query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
list
label_sequence
list
Except block handles 'BaseException'
nfscan/ocr-process-service/validation/cnpj.py
[ { "content": " @staticmethod\n def calculate_last_digits(cnpj):\n \"\"\"\n Method to calculate the last two cnpj's digits to make it a valid cnpj\n :param cnpj: a base cnpj without the last two digits containing 12 characters\n :return:\n \"\"\"\n\n # verifying the length of the cnpj\n if len(cnpj) != 12:\n raise Exception('It should have 12 characters')\n\n # defining some variables\n lista_validacao_um = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]\n lista_validacao_dois = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]\n\n\n # calculating the first digit\n soma = 0\n id = 0\n for numero in cnpj:\n\n # to do not raise indexerrors\n try:\n lista_validacao_um[id]\n except:\n break\n\n soma += int(numero) * int(lista_validacao_um[id])\n id += 1\n\n soma %= 11\n if soma < 2:\n digito_um = 0\n else:\n digito_um = 11 - soma\n\n digito_um = str(digito_um) # converting to string, for later comparison\n\n # calculating the second digit\n # suming the two lists\n soma = 0\n id = 0\n cnpj += digito_um\n\n # suming the two lists\n for numero in cnpj:\n\n # to do not raise indexerrors\n try:\n lista_validacao_dois[id]\n except:\n break\n\n soma += int(numero) * int(lista_validacao_dois[id])\n id += 1\n\n # defining the digit\n soma = soma % 11\n if soma < 2:\n digito_dois = 0\n else:\n digito_dois = 11 - soma\n\n digito_dois = str(digito_dois)\n\n return [digito_um, digito_dois]", "metadata": "root.Cnpj.calculate_last_digits", "header": "['class', 'Cnpj', ':', '___EOS___']", "index": 46 } ]
[ { "span": "except:", "start_line": 71, "start_column": 12, "end_line": 71, "end_column": 19 }, { "span": "except:", "start_line": 97, "start_column": 12, "end_line": 97, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Cn", "pj_", ":_", "\\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_", "calcul", "ate", "\\u", "last", "\\u", "digits_", "(_", "cn", "pj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "to", " ", "calcul", "ate", " ", "the", " ", "last", " ", "two", " ", "cn", "pj", "'", "s", " ", "digit", "s", " ", "to", " ", "make", " ", "it", " ", "a", " ", "valid", " ", "cn", "pj", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cn", "pj", ":", " ", "a", " ", "base", " ", "cn", "pj", " ", "with", "out", " ", "the", " ", "last", " ", "two", " ", "digit", "s", " ", "contain", "ing", " ", "1", "2", " ", "character", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", "ing", " ", "the", " ", "length", " ", "of", " ", "the", " ", "cn", "pj_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "cn", "pj_", ")_", "!=_", "12_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "It", " ", "shou", "ld", " ", "have", " ", "1", "2", " ", "character", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defini", "ng", " ", "some", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lista", "\\u", "valida", "ca", "o", "\\u", "um_", "=_", "[_", "5_", ",_", "4_", ",_", "3_", ",_", "2_", ",_", "9_", ",_", "8_", ",_", "7_", ",_", "6_", ",_", "5_", ",_", "4_", ",_", "3_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista", "\\u", "valida", "ca", "o", "\\u", "doi", "s_", "=_", "[_", "6_", ",_", "5_", ",_", "4_", ",_", "3_", ",_", "2_", ",_", "9_", ",_", "8_", ",_", "7_", ",_", "6_", ",_", "5_", ",_", "4_", ",_", "3_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calculati", "ng", " ", "the", " ", "first", " ", "digit_", "\\u\\u\\uNL\\u\\u\\u_", "soma", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "numero_", "in_", "cn", "pj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "do", " ", "not", " ", "raise", " ", "indexer", "ror", "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 ", " _", "lista", "\\u", "valida", "ca", "o", "\\u", "um_", "[_", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "soma", "_", "+=_", "int_", "(_", "numero_", ")_", "*_", "int_", "(_", "lista", "\\u", "valida", "ca", "o", "\\u", "um_", "[_", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "soma", "_", "%=_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "soma", "_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "digit", "o", "\\u", "um_", "=_", "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 ", " _", "digit", "o", "\\u", "um_", "=_", "11_", "-_", "soma", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "digit", "o", "\\u", "um_", "=_", "str_", "(_", "digit", "o", "\\u", "um_", ")_", "#", " ", "convert", "ing", " ", "to", " ", "string", ",", " ", "for", " ", "late", "r", " ", "comparison_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calculati", "ng", " ", "the", " ", "second", " ", "digit_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", "ing", " ", "the", " ", "two", " ", "lists_", "\\u\\u\\uNL\\u\\u\\u_", "soma", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cn", "pj_", "+=_", "digit", "o", "\\u", "um_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", "ing", " ", "the", " ", "two", " ", "lists_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "numero_", "in_", "cn", "pj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "do", " ", "not", " ", "raise", " ", "indexer", "ror", "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 ", " _", "lista", "\\u", "valida", "ca", "o", "\\u", "doi", "s_", "[_", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "soma", "_", "+=_", "int_", "(_", "numero_", ")_", "*_", "int_", "(_", "lista", "\\u", "valida", "ca", "o", "\\u", "doi", "s_", "[_", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defini", "ng", " ", "the", " ", "digit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "soma", "_", "=_", "soma", "_", "%_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "soma", "_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "digit", "o", "\\u", "doi", "s_", "=_", "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 ", " _", "digit", "o", "\\u", "doi", "s_", "=_", "11_", "-_", "soma", "_", "\\u\\u\\uNEWLINE\\u\\u\\u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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
HIPS/Kayak/kayak/matrix_ops.py
[ { "content": "# Authors: Harvard Intelligent Probabilistic Systems (HIPS) Group\n# http://hips.seas.harvard.edu\n# Ryan Adams, David Duvenaud, Scott Linderman,\n# Dougal Maclaurin, Jasper Snoek, and others\n# Copyright 2014, The President and Fellows of Harvard University\n# Distributed under an MIT license. See license.txt file.\n\nimport numpy as np\nimport scipy.linalg as spla\nfrom . import Differentiable\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 MatMult(Differentiable):\n __slots__ = ['A', 'B']\n\n", "metadata": "root.MatMult", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self, A, B, *args):\n # Recurse to handle lists of arguments.\n if len(args) > 0:\n B = MatMult(B, *args)\n super(MatMult, self).__init__((A, B))\n self.A = A\n self.B = B", "metadata": "root.MatMult.__init__", "header": "['class', 'MatMult', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 13 }, { "content": " def _compute_value(self):\n A_val, B_val = self.A.value, self.B.value\n if A_val.ndim > 2 or B_val.ndim > 2:\n raise Exception(\"Inputs of shape %s and %s are not matrices or vectors\" % (self.A.shape))\n if A_val.shape[-1] != B_val.shape[0]:\n raise Exception(\"Cannot multiply %s by %s matrices.\" % (self.A.shape, self.B.shape))\n\n return np.dot(self.A.value, self.B.value)", "metadata": "root.MatMult._compute_value", "header": "['class', 'MatMult', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 21 }, { "content": " def _local_grad(self, parent, d_out_d_self):\n if parent == 0:\n B_val = self.B.value\n if B_val.ndim == 2:\n return np.dot(d_out_d_self, B_val.T)\n else:\n return np.outer(d_out_d_self, B_val)\n elif parent == 1:\n A_val = self.A.value\n if A_val.ndim ==2:\n return np.dot(A_val.T, d_out_d_self)\n else:\n return np.outer(A_val, d_out_d_self)\n else:\n raise Exception(\"Not a parent of me\")", "metadata": "root.MatMult._local_grad", "header": "['class', 'MatMult', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 30 }, { "content": "class MatSum(Differentiable):\n __slots__ = ['A', 'axis', 'keepdims']\n\n", "metadata": "root.MatSum", "header": "['module', '___EOS___']", "index": 46 }, { "content": " def __init__(self, A, axis=None, keepdims=True):\n super(MatSum, self).__init__((A,))\n if axis is not None and type(axis) != int:\n raise Exception(\"Can only sum over one axis at a time.\")\n self.A = A\n self.axis = axis\n self.keepdims = keepdims", "metadata": "root.MatSum.__init__", "header": "['class', 'MatSum', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 48 }, { "content": " def _compute_value(self):\n return np.sum(self.A.value, axis=self.axis, keepdims=self.keepdims)", "metadata": "root.MatSum._compute_value", "header": "['class', 'MatSum', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 56 }, { "content": " def _local_grad(self, parent, d_out_d_self):\n # If self.keepdims == False then we need to\n # broadcast d_out_d_self along the summation axis\n if not self.keepdims and self.axis is not None:\n expanded_d_out_d_self = np.expand_dims(d_out_d_self, self.axis)\n return expanded_d_out_d_self * np.ones(self.A.shape)\n else:\n return d_out_d_self * np.ones(self.A.shape)", "metadata": "root.MatSum._local_grad", "header": "['class', 'MatSum', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 59 }, { "content": "class MatMean(Differentiable):\n __slots__ = ['A', 'axis', 'keepdims']\n\n", "metadata": "root.MatMean", "header": "['module', '___EOS___']", "index": 68 }, { "content": " def __init__(self, A, axis=None, keepdims=True):\n super(MatMean, self).__init__((A,))\n if axis is not None and type(axis) != int:\n raise Exception(\"Can only take the mean over one axis at a time.\")\n self.A = A\n self.axis = axis\n self.keepdims = keepdims", "metadata": "root.MatMean.__init__", "header": "['class', 'MatMean', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 70 }, { "content": " def _compute_value(self):\n return np.mean(self.A.value, axis=self.axis, keepdims=self.keepdims)", "metadata": "root.MatMean._compute_value", "header": "['class', 'MatMean', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 78 }, { "content": " def _local_grad(self, parent, d_out_d_self):\n # If self.keepdims == False then we need to\n # broadcast d_out_d_self along the summation axis\n N = float(self.A.value.size) if self.axis is None else float(self.A.shape[self.axis])\n if not self.keepdims and self.axis is not None:\n expanded_d_out_d_self = np.expand_dims(d_out_d_self, self.axis)\n return expanded_d_out_d_self * 1.0/N * np.ones(self.A.shape)\n else:\n return d_out_d_self * 1.0/N * np.ones(self.A.shape)", "metadata": "root.MatMean._local_grad", "header": "['class', 'MatMean', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 81 }, { "content": "class MatAdd(Differentiable):\n __slots__ = []\n\n", "metadata": "root.MatAdd", "header": "['module', '___EOS___']", "index": 91 }, { "content": " def __init__(self, *args):\n super(MatAdd, self).__init__(args)", "metadata": "root.MatAdd.__init__", "header": "['class', 'MatAdd', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 93 }, { "content": " def _compute_value(self):\n return sum([p.value for p in self._parents])", "metadata": "root.MatAdd._compute_value", "header": "['class', 'MatAdd', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 96 }, { "content": " def _local_grad(self, parent, d_out_d_self):\n parent_shape = self._parents[parent].shape\n num_singletons = len(d_out_d_self.shape) - len(parent_shape)\n if num_singletons > 0:\n extra_singletons = tuple(range(num_singletons))\n result = np.sum(d_out_d_self, axis=extra_singletons, keepdims=False)\n else:\n result = d_out_d_self\n\n assert len(result.shape) == len(parent_shape)\n original_singletons = tuple(np.where(np.array(parent_shape) == 1)[0])\n return np.sum(result, axis=original_singletons, keepdims=True)", "metadata": "root.MatAdd._local_grad", "header": "['class', 'MatAdd', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 99 }, { "content": "class MatElemMult(Differentiable):\n \"\"\"\n Elementwise multiplication of two arrays of the same size.\n Note: This does not support broadcasting yet. Look at MatAdd for ideas.\n \"\"\"\n __slots__ = ['A', 'B']\n\n", "metadata": "root.MatElemMult", "header": "['module', '___EOS___']", "index": 112 }, { "content": " def __init__(self, A, B, *args):\n # Recurse to handle lists of arguments.\n if len(args) > 0:\n B = MatElemMult(B, *args)\n\n super(MatElemMult, self).__init__((A,B))\n\n self.A = A\n self.B = B", "metadata": "root.MatElemMult.__init__", "header": "['class', 'MatElemMult', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 118 }, { "content": " def _compute_value(self):\n return self.A.value * self.B.value", "metadata": "root.MatElemMult._compute_value", "header": "['class', 'MatElemMult', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 128 }, { "content": " def _local_grad(self, parent, d_out_d_self):\n \"\"\"\n For element-wise multiplication d(A*B)/dA = d_out_d_self * B.\n However, to support broadcasting, we need to sum over the broadcast dimensions.\n For example, d(A*x)/dx, where A is a matrix and x is a scalar, is\n given by \\sum_{d1} \\ldots \\sum_{dD} (d_out_d_self * A)[d1,...,dD]\n \"\"\"\n parent_shape = self._parents[parent].shape\n other_parent = 1 if parent == 0 else 0\n other_parent_value = self._parents[other_parent].value\n\n # Compute how many dimensions was parent broadcast along\n num_singletons = len(d_out_d_self.shape) - len(parent_shape)\n if num_singletons > 0:\n extra_singletons = tuple(range(num_singletons))\n # Sum out the broadcast dimensions\n result = np.sum(d_out_d_self*other_parent_value, axis=extra_singletons, keepdims=False)\n else:\n result = d_out_d_self*other_parent_value\n\n # In mutliplying, we may have broadcast the parent.\n # Sum out those dimensions as well.\n assert len(result.shape) == len(parent_shape)\n original_singletons = tuple(np.where(np.array(parent_shape) == 1)[0])\n return np.sum(result, axis=original_singletons, keepdims=True)", "metadata": "root.MatElemMult._local_grad", "header": "['class', 'MatElemMult', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 131 }, { "content": "class MatDet(Differentiable):\n __slots__ = ['A']\n\n", "metadata": "root.MatDet", "header": "['module', '___EOS___']", "index": 157 }, { "content": " def __init__(self, A, axis=None, keepdims=True):\n super(MatDet, self).__init__((A,))\n self.A = A", "metadata": "root.MatDet.__init__", "header": "['class', 'MatDet', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 159 }, { "content": " def _compute_value(self):\n return np.linalg.det(self.A.value)", "metadata": "root.MatDet._compute_value", "header": "['class', 'MatDet', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 163 }, { "content": " def _local_grad(self, parent, d_out_d_self):\n det = self._compute_value()\n return d_out_d_self * det * np.linalg.inv(self.A.value).T", "metadata": "root.MatDet._local_grad", "header": "['class', 'MatDet', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 166 }, { "content": "class MatLogDet(Differentiable):\n pass", "metadata": "root.MatLogDet", "header": "['module', '___EOS___']", "index": 170 }, { "content": "class MatTrace(Differentiable):\n pass", "metadata": "root.MatTrace", "header": "['module', '___EOS___']", "index": 173 }, { "content": "class Transpose(Differentiable):\n __slots__ = ['A', 'axes']\n\n", "metadata": "root.Transpose", "header": "['module', '___EOS___']", "index": 176 }, { "content": " def __init__(self, A, axes=None):\n super(Transpose, self).__init__((A,))\n self.A = A\n self.axes = axes", "metadata": "root.Transpose.__init__", "header": "['class', 'Transpose', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 178 }, { "content": " def _compute_value(self):\n return np.transpose(self.A.value, axes=self.axes)", "metadata": "root.Transpose._compute_value", "header": "['class', 'Transpose', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 183 }, { "content": " def _local_grad(self, parent, d_out_d_self):\n if self.axes is None:\n return np.transpose(d_out_d_self)\n else:\n return np.transpose(d_out_d_self, axes=np.argsort(self.axes))", "metadata": "root.Transpose._local_grad", "header": "['class', 'Transpose', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 186 }, { "content": "class Reshape(Differentiable):\n __slots__ = ['A', 'new_shape']\n\n\n", "metadata": "root.Reshape", "header": "['module', '___EOS___']", "index": 192 }, { "content": " def __init__(self, A, new_shape):\n super(Reshape, self).__init__((A,))\n self.A = A\n self.new_shape = new_shape", "metadata": "root.Reshape.__init__", "header": "['class', 'Reshape', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 195 }, { "content": " def _compute_value(self):\n return np.reshape(self.A.value, self.new_shape)", "metadata": "root.Reshape._compute_value", "header": "['class', 'Reshape', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 200 }, { "content": " def _local_grad(self, parent, d_out_d_self):\n return np.reshape(d_out_d_self, self.A.shape)", "metadata": "root.Reshape._local_grad", "header": "['class', 'Reshape', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 203 }, { "content": "class Concatenate(Differentiable):\n __slots__ = ['axis']\n\n", "metadata": "root.Concatenate", "header": "['module', '___EOS___']", "index": 206 }, { "content": " def __init__(self, axis, *args):\n super(Concatenate, self).__init__(args)\n self.axis = axis", "metadata": "root.Concatenate.__init__", "header": "['class', 'Concatenate', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 208 }, { "content": " def _compute_value(self):\n return np.concatenate([p.value for p in self._parents], axis=self.axis)", "metadata": "root.Concatenate._compute_value", "header": "['class', 'Concatenate', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 212 }, { "content": " def _local_grad(self, parent_ix, d_out_d_self):\n # Return the gradient only w.r.t. the matrix indexed by parent.\n start_ix = sum([p.shape[self.axis] for p in self._parents[0:parent_ix]])\n end_ix = start_ix + self._parents[parent_ix].shape[self.axis]\n return index_along_axis(d_out_d_self, self.axis, start_ix, end_ix)", "metadata": "root.Concatenate._local_grad", "header": "['class', 'Concatenate', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 215 }, { "content": "class ListToArray(Differentiable):\n \"\"\"Build an array out of a list of arrays by prepending a dimensions\n and concatenating.\"\"\"\n __slots__ = []\n\n", "metadata": "root.ListToArray", "header": "['module', '___EOS___']", "index": 221 }, { "content": " def __init__(self, *args):\n super(ListToArray, self).__init__(args)", "metadata": "root.ListToArray.__init__", "header": "['class', 'ListToArray', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 225 }, { "content": " def _compute_value(self):\n return np.concatenate([p.value[None, :] for p in self._parents], axis=0)", "metadata": "root.ListToArray._compute_value", "header": "['class', 'ListToArray', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 228 }, { "content": " def _local_grad(self, parent_ix, d_out_d_self):\n return d_out_d_self[parent_ix, :]", "metadata": "root.ListToArray._local_grad", "header": "['class', 'ListToArray', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 231 }, { "content": "def index_along_axis(array, axis, start, end):\n \"\"\"Return everything up to but not including end.\n\n For example:\n >>> index_along_axis(np.randn(10,20), 0, 10, 12).shape\n (2, 20)\n \"\"\"\n full_slice = [slice(None),] * array.ndim\n full_slice[axis] = slice(start,end)\n return array[full_slice]", "metadata": "root.index_along_axis", "header": "['module', '___EOS___']", "index": 234 }, { "content": "class TensorMult(Differentiable):\n __slots__ = ['axes']\n\n", "metadata": "root.TensorMult", "header": "['module', '___EOS___']", "index": 245 }, { "content": " def __init__(self, A, B, axes):\n super(TensorMult, self).__init__((A, B))\n self.axes = axes", "metadata": "root.TensorMult.__init__", "header": "['class', 'TensorMult', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 247 }, { "content": " def _compute_value(self):\n A = self._parents[0].value\n B = self._parents[1].value\n return np.tensordot(A, B, self.axes)", "metadata": "root.TensorMult._compute_value", "header": "['class', 'TensorMult', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 251 }, { "content": " def _local_grad(self, parent, d_out_d_self):\n diff = lambda A, B : [a for a in A if a not in B]\n rank = lambda L : list(np.argsort(np.argsort(L)))\n val = [p.value for p in self._parents]\n axes = self.axes\n n_axes = len(axes[0])\n ignore_dims = [diff(range(val[i].ndim), axes[i]) for i in (0, 1)]\n ignore_ndims = [len(x) for x in ignore_dims]\n output_dims = (range(ignore_ndims[0]),\n range(ignore_ndims[0], ignore_ndims[0] + ignore_ndims[1]))\n X, Y = parent, 1 - parent\n wrong_order = np.tensordot(val[Y], d_out_d_self, (ignore_dims[Y], output_dims[Y]))\n permutation = [None] * val[X].ndim\n for final, cur in zip(list(axes[X]) + ignore_dims[X],\n rank(axes[Y]) + range(n_axes, val[X].ndim)):\n permutation[final] = cur\n\n return np.transpose(wrong_order, permutation)", "metadata": "root.TensorMult._local_grad", "header": "['class', 'TensorMult', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 256 }, { "content": "class Identity(Differentiable):\n __slots__ = []\n\n", "metadata": "root.Identity", "header": "['module', '___EOS___']", "index": 275 }, { "content": " def __init__(self, A):\n super(Identity, self).__init__((A,))", "metadata": "root.Identity.__init__", "header": "['class', 'Identity', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 277 }, { "content": " def _compute_value(self):\n return self._parents[0].value", "metadata": "root.Identity._compute_value", "header": "['class', 'Identity', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 280 }, { "content": " def _local_grad(self, parent_ix, d_out_d_self):\n return d_out_d_self", "metadata": "root.Identity._local_grad", "header": "['class', 'Identity', '(', 'Differentiable', ')', ':', '___EOS___']", "index": 283 } ]
[ { "span": "import scipy.linalg as spla", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "Har", "vard", " ", "Intel", "lig", "ent", " ", "Probabili", "stic", " ", "System", "s", " ", "(", "HI", "PS", ")", " ", "Group_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "hip", "s", ".", "sea", "s", ".", "har", "vard", ".", "edu", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Ry", "an", " ", "Adam", "s", ",", " ", "Dav", "id", " ", "Du", "ven", "aud", ",", " ", "Scot", "t", " ", "Lin", "der", "man", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Dou", "gal", " ", "Mac", "lau", "rin", ",", " ", "Ja", "sper", " ", "Sn", "oe", "k", ",", " ", "and", " ", "others_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", ",", " ", "The", " ", "Pres", "ident", " ", "and", " ", "Fel", "lows", " ", "of", " ", "Har", "vard", " ", "Univers", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Distribut", "ed", " ", "under", " ", "an", " ", "MIT", " ", "license", ".", " ", "See", " ", "license", ".", "txt", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "linalg_", "as_", "spla", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "Different", "iable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Mat", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "'", "A", "'_", ",_", "'", "B", "'_", "]_", "\\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_", "Mat", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "A_", ",_", "B_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Recurs", "e", " ", "to", " ", "handle", " ", "lists", " ", "of", " ", "argu", "ment", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "B_", "=_", "Mat", "Mult", "_", "(_", "B_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Mat", "Mult", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "(_", "A_", ",_", "B_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "A_", "=_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "B_", "=_", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A", "\\u", "val_", ",_", "B", "\\u", "val_", "=_", "self_", "._", "A_", "._", "value_", ",_", "self_", "._", "B_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "A", "\\u", "val_", "._", "ndim_", ">_", "2_", "or_", "B", "\\u", "val_", "._", "ndim_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Inp", "uts", " ", "of", " ", "shape", " ", "%", "s", " ", "and", " ", "%", "s", " ", "are", " ", "not", " ", "matric", "es", " ", "or", " ", "vector", "s", "\"_", "%_", "(_", "self_", "._", "A_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "A", "\\u", "val_", "._", "shape_", "[_", "-_", "1_", "]_", "!=_", "B", "\\u", "val_", "._", "shape_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Cann", "ot", " ", "multipl", "y", " ", "%", "s", " ", "by", " ", "%", "s", " ", "matric", "es", ".\"_", "%_", "(_", "self_", "._", "A_", "._", "shape_", ",_", "self_", "._", "B_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "dot_", "(_", "self_", "._", "A_", "._", "value_", ",_", "self_", "._", "B_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "parent_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "B", "\\u", "val_", "=_", "self_", "._", "B_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "B", "\\u", "val_", "._", "ndim_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "dot_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", ",_", "B", "\\u", "val_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "outer_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", ",_", "B", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "parent_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A", "\\u", "val_", "=_", "self_", "._", "A_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "A", "\\u", "val_", "._", "ndim_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "dot_", "(_", "A", "\\u", "val_", "._", "T_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "outer_", "(_", "A", "\\u", "val_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Not", " ", "a", " ", "parent", " ", "of", " ", "me", "\"_", ")_", "\\u\\u\\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_", "Mat", "Sum_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "'", "A", "'_", ",_", "'", "axis", "'_", ",_", "'", "keep", "dims", "'_", "]_", "\\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_", "Mat", "Sum_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "A_", ",_", "axis_", "=_", "None_", ",_", "keepdims_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Mat", "Sum_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "(_", "A_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "axis_", "is_", "not_", "None_", "and_", "type_", "(_", "axis_", ")_", "!=_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Can", " ", "only", " ", "sum", " ", "over", " ", "one", " ", "axis", " ", "at", " ", "a", " ", "time", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "A_", "=_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "axis_", "=_", "axis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "keepdims_", "=_", "keepdims_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Sum_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "sum_", "(_", "self_", "._", "A_", "._", "value_", ",_", "axis_", "=_", "self_", "._", "axis_", ",_", "keepdims_", "=_", "self_", "._", "keepdims_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Sum_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "self", ".", "keep", "dims", " ", "==", " ", "Fal", "se", " ", "then", " ", "we", " ", "need", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "broadcast", " ", "d\\u", "out", "\\u", "d\\u", "self", " ", "along", " ", "the", " ", "summa", "tion", " ", "axis_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "keepdims_", "and_", "self_", "._", "axis_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expand", "ed", "\\u", "d\\u", "out", "\\u", "d\\u", "self_", "=_", "np_", "._", "expand", "\\u", "dims_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", ",_", "self_", "._", "axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "expand", "ed", "\\u", "d\\u", "out", "\\u", "d\\u", "self_", "*_", "np_", "._", "ones_", "(_", "self_", "._", "A_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d\\u", "out", "\\u", "d\\u", "self_", "*_", "np_", "._", "ones_", "(_", "self_", "._", "A_", "._", "shape_", ")_", "\\u\\u\\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_", "Mat", "Mean_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "'", "A", "'_", ",_", "'", "axis", "'_", ",_", "'", "keep", "dims", "'_", "]_", "\\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_", "Mat", "Mean_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "A_", ",_", "axis_", "=_", "None_", ",_", "keepdims_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Mat", "Mean_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "(_", "A_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "axis_", "is_", "not_", "None_", "and_", "type_", "(_", "axis_", ")_", "!=_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Can", " ", "only", " ", "take", " ", "the", " ", "mean", " ", "over", " ", "one", " ", "axis", " ", "at", " ", "a", " ", "time", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "A_", "=_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "axis_", "=_", "axis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "keepdims_", "=_", "keepdims_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Mean_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "mean_", "(_", "self_", "._", "A_", "._", "value_", ",_", "axis_", "=_", "self_", "._", "axis_", ",_", "keepdims_", "=_", "self_", "._", "keepdims_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Mean_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "self", ".", "keep", "dims", " ", "==", " ", "Fal", "se", " ", "then", " ", "we", " ", "need", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "broadcast", " ", "d\\u", "out", "\\u", "d\\u", "self", " ", "along", " ", "the", " ", "summa", "tion", " ", "axis_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "float_", "(_", "self_", "._", "A_", "._", "value_", "._", "size_", ")_", "if_", "self_", "._", "axis_", "is_", "None_", "else_", "float_", "(_", "self_", "._", "A_", "._", "shape_", "[_", "self_", "._", "axis_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "keepdims_", "and_", "self_", "._", "axis_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expand", "ed", "\\u", "d\\u", "out", "\\u", "d\\u", "self_", "=_", "np_", "._", "expand", "\\u", "dims_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", ",_", "self_", "._", "axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "expand", "ed", "\\u", "d\\u", "out", "\\u", "d\\u", "self_", "*_", "1.0_", "/_", "N_", "*_", "np_", "._", "ones_", "(_", "self_", "._", "A_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d\\u", "out", "\\u", "d\\u", "self_", "*_", "1.0_", "/_", "N_", "*_", "np_", "._", "ones_", "(_", "self_", "._", "A_", "._", "shape_", ")_", "\\u\\u\\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_", "Mat", "Add_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Add_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Mat", "Add_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Add_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sum_", "(_", "[_", "p_", "._", "value_", "for_", "p_", "in_", "self_", "._", "\\u", "parents_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Add_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "shape_", "=_", "self_", "._", "\\u", "parents_", "[_", "parent_", "]_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "singleton", "s_", "=_", "len_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", "._", "shape_", ")_", "-_", "len_", "(_", "parent", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "\\u", "singleton", "s_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "\\u", "singleton", "s_", "=_", "tuple_", "(_", "range_", "(_", "num", "\\u", "singleton", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "np_", "._", "sum_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", ",_", "axis_", "=_", "extra", "\\u", "singleton", "s_", ",_", "keepdims_", "=_", "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 ", " _", "result_", "=_", "d\\u", "out", "\\u", "d\\u", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "result_", "._", "shape_", ")_", "==_", "len_", "(_", "parent", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "singleton", "s_", "=_", "tuple_", "(_", "np_", "._", "where_", "(_", "np_", "._", "array_", "(_", "parent", "\\u", "shape_", ")_", "==_", "1_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "np_", "._", "sum_", "(_", "result_", ",_", "axis_", "=_", "original", "\\u", "singleton", "s_", ",_", "keepdims_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mat", "Ele", "m", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Element", "wis", "e", " ", "multiplication", " ", "of", " ", "two", " ", "arrays", " ", "of", " ", "the", " ", "same", " ", "size", ".", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "Thi", "s", " ", "doe", "s", " ", "not", " ", "support", " ", "broadcast", "ing", " ", "ye", "t", ".", " ", "Look", " ", "at", " ", "Mat", "Add", " ", "for", " ", "idea", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "slots\\u\\u_", "=_", "[_", "'", "A", "'_", ",_", "'", "B", "'_", "]_", "\\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_", "Mat", "Ele", "m", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "A_", ",_", "B_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Recurs", "e", " ", "to", " ", "handle", " ", "lists", " ", "of", " ", "argu", "ment", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "B_", "=_", "Mat", "Ele", "m", "Mult", "_", "(_", "B_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Mat", "Ele", "m", "Mult", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "(_", "A_", ",_", "B_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "A_", "=_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "B_", "=_", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Ele", "m", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "A_", "._", "value_", "*_", "self_", "._", "B_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Ele", "m", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "element", "-", "wis", "e", " ", "multiplication", " ", "d", "(", "A", "*", "B", ")/", "d", "A", " ", "=", " ", "d\\u", "out", "\\u", "d\\u", "self", " ", "*", " ", "B", ".", "\\", "10", ";", " ", " ", " ", " ", "Ho", "we", "ver", ",", " ", "to", " ", "support", " ", " ", "broadcast", "ing", ",", " ", "we", " ", "need", " ", "to", " ", "sum", " ", "over", " ", "the", " ", "broadcast", " ", "dimension", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", " ", "example", ",", " ", "d", "(", "A", "*", "x", ")/", "dx", ",", " ", "where", " ", "A", " ", "is", " ", "a", " ", "matrix", " ", "and", " ", "x", " ", "is", " ", "a", " ", "scala", "r", ",", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "by", " ", "\\\\", "sum", "\\u{", "d1", "}", " ", "\\\\", "ld", "ots", " ", "\\\\", "sum", "\\u{", "d", "D", "}", " ", "(", "d\\u", "out", "\\u", "d\\u", "self", " ", "*", " ", "A", ")[", "d1", ",...", ",", "d", "D", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "shape_", "=_", "self_", "._", "\\u", "parents_", "[_", "parent_", "]_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "parent_", "=_", "1_", "if_", "parent_", "==_", "0_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "parent", "\\u", "value_", "=_", "self_", "._", "\\u", "parents_", "[_", "other", "\\u", "parent_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "how", " ", "many", " ", "dimension", "s", " ", "was", " ", "parent", " ", "broadcast", " ", "along", "_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "singleton", "s_", "=_", "len_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", "._", "shape_", ")_", "-_", "len_", "(_", "parent", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "\\u", "singleton", "s_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "\\u", "singleton", "s_", "=_", "tuple_", "(_", "range_", "(_", "num", "\\u", "singleton", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sum", " ", "out", " ", "the", " ", "broadcast", " ", "dimensions_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "np_", "._", "sum_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", "*_", "other", "\\u", "parent", "\\u", "value_", ",_", "axis_", "=_", "extra", "\\u", "singleton", "s_", ",_", "keepdims_", "=_", "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 ", " _", "result_", "=_", "d\\u", "out", "\\u", "d\\u", "self_", "*_", "other", "\\u", "parent", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "mut", "lip", "ly", "ing", ",", " ", "we", " ", "may", " ", "have", " ", "broadcast", " ", "the", " ", "parent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sum", " ", "out", " ", "tho", "se", " ", "dimension", "s", " ", "as", " ", "well", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "result_", "._", "shape_", ")_", "==_", "len_", "(_", "parent", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "singleton", "s_", "=_", "tuple_", "(_", "np_", "._", "where_", "(_", "np_", "._", "array_", "(_", "parent", "\\u", "shape_", ")_", "==_", "1_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "np_", "._", "sum_", "(_", "result_", ",_", "axis_", "=_", "original", "\\u", "singleton", "s_", ",_", "keepdims_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mat", "Det", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "'", "A", "'_", "]_", "\\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_", "Mat", "Det", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "A_", ",_", "axis_", "=_", "None_", ",_", "keepdims_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Mat", "Det", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "(_", "A_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "A_", "=_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Det", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "linalg_", "._", "det_", "(_", "self_", "._", "A_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "Det", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "det_", "=_", "self_", "._", "\\u", "compute", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d\\u", "out", "\\u", "d\\u", "self_", "*_", "det_", "*_", "np_", "._", "linalg_", "._", "inv_", "(_", "self_", "._", "A_", "._", "value_", ")_", "._", "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_", "Mat", "Log", "Det", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mat", "Trace_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Transpose", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "'", "A", "'_", ",_", "'", "axes", "'_", "]_", "\\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_", "Transpose", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "A_", ",_", "axes_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Transpose", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "(_", "A_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "A_", "=_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "axes_", "=_", "axes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Transpose", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "transpose_", "(_", "self_", "._", "A_", "._", "value_", ",_", "axes_", "=_", "self_", "._", "axes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Transpose", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "axes_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "transpose_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "transpose_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", ",_", "axes_", "=_", "np_", "._", "argsort_", "(_", "self_", "._", "axes_", ")_", ")_", "\\u\\u\\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_", "Res", "hape_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "'", "A", "'_", ",_", "'", "new", "\\u", "shape", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Res", "hape_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "A_", ",_", "new", "\\u", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Res", "hape_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "(_", "A_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "A_", "=_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "new", "\\u", "shape_", "=_", "new", "\\u", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Res", "hape_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "reshape_", "(_", "self_", "._", "A_", "._", "value_", ",_", "self_", "._", "new", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Res", "hape_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "reshape_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", ",_", "self_", "._", "A_", "._", "shape_", ")_", "\\u\\u\\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_", "Concat", "enat", "e_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "'", "axis", "'_", "]_", "\\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_", "Concat", "enat", "e_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "axis_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Concat", "enat", "e_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "axis_", "=_", "axis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Concat", "enat", "e_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "concatenate_", "(_", "[_", "p_", "._", "value_", "for_", "p_", "in_", "self_", "._", "\\u", "parents_", "]_", ",_", "axis_", "=_", "self_", "._", "axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Concat", "enat", "e_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent", "\\u", "ix_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Return", " ", "the", " ", "gradi", "ent", " ", "only", " ", "w", ".", "r", ".", "t", ".", " ", "the", " ", "matrix", " ", "indexe", "d", " ", "by", " ", "parent", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "ix_", "=_", "sum_", "(_", "[_", "p_", "._", "shape_", "[_", "self_", "._", "axis_", "]_", "for_", "p_", "in_", "self_", "._", "\\u", "parents_", "[_", "0_", ":_", "parent", "\\u", "ix_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "ix_", "=_", "start", "\\u", "ix_", "+_", "self_", "._", "\\u", "parents_", "[_", "parent", "\\u", "ix_", "]_", "._", "shape_", "[_", "self_", "._", "axis_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "index", "\\u", "along", "\\u", "axis_", "(_", "d\\u", "out", "\\u", "d\\u", "self_", ",_", "self_", "._", "axis_", ",_", "start", "\\u", "ix_", ",_", "end", "\\u", "ix_", ")_", "\\u\\u\\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_", "List", "To", "Array_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Build", " ", "an", " ", "array", " ", "out", " ", "of", " ", "a", " ", "list", " ", "of", " ", "arrays", " ", "by", " ", "prepend", "ing", " ", "a", " ", "dimension", "s", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "concate", "nati", "ng", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "slots\\u\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "List", "To", "Array_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "List", "To", "Array_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "List", "To", "Array_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "concatenate_", "(_", "[_", "p_", "._", "value_", "[_", "None_", ",_", ":_", "]_", "for_", "p_", "in_", "self_", "._", "\\u", "parents_", "]_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "List", "To", "Array_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent", "\\u", "ix_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d\\u", "out", "\\u", "d\\u", "self_", "[_", "parent", "\\u", "ix_", ",_", ":_", "]_", "\\u\\u\\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_", "index", "\\u", "along", "\\u", "axis_", "(_", "array_", ",_", "axis_", ",_", "start_", ",_", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "every", "thing", " ", "up", " ", "to", " ", "but", " ", "not", " ", "inclu", "ding", " ", "end", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ":", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "index", "\\u", "along", "\\u", "axis", "(", "np", ".", "rand", "n", "(", "10", ",", "20", "),", " ", "0", ",", " ", "10", ",", " ", "1", "2", ").", "shape", "\\", "10", ";", " ", " ", " ", " ", "(", "2", ",", " ", "20", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "slice_", "=_", "[_", "slice_", "(_", "None_", ")_", ",_", "]_", "*_", "array_", "._", "ndim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "slice_", "[_", "axis_", "]_", "=_", "slice_", "(_", "start_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "array_", "[_", "full", "\\u", "slice_", "]_", "\\u\\u\\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_", "Tensor", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "'", "axes", "'_", "]_", "\\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_", "Tensor", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "A_", ",_", "B_", ",_", "axes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Tensor", "Mult", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "(_", "A_", ",_", "B_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "axes_", "=_", "axes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tensor", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "=_", "self_", "._", "\\u", "parents_", "[_", "0_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B_", "=_", "self_", "._", "\\u", "parents_", "[_", "1_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "np_", "._", "tensor", "dot_", "(_", "A_", ",_", "B_", ",_", "self_", "._", "axes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tensor", "Mult", "_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diff_", "=_", "lambda_", "A_", ",_", "B_", ":_", "[_", "a_", "for_", "a_", "in_", "A_", "if_", "a_", "not_", "in_", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rank_", "=_", "lambda_", "L_", ":_", "list_", "(_", "np_", "._", "argsort_", "(_", "np_", "._", "argsort_", "(_", "L_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "[_", "p_", "._", "value_", "for_", "p_", "in_", "self_", "._", "\\u", "parents_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "self_", "._", "axes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "axes_", "=_", "len_", "(_", "axes_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "dims_", "=_", "[_", "diff_", "(_", "range_", "(_", "val_", "[_", "i_", "]_", "._", "ndim_", ")_", ",_", "axes_", "[_", "i_", "]_", ")_", "for_", "i_", "in_", "(_", "0_", ",_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "ndims_", "=_", "[_", "len_", "(_", "x_", ")_", "for_", "x_", "in_", "ignore", "\\u", "dims_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "dims_", "=_", "(_", "range_", "(_", "ignore", "\\u", "ndims_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "range_", "(_", "ignore", "\\u", "ndims_", "[_", "0_", "]_", ",_", "ignore", "\\u", "ndims_", "[_", "0_", "]_", "+_", "ignore", "\\u", "ndims_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", ",_", "Y_", "=_", "parent_", ",_", "1_", "-_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrong", "\\u", "order_", "=_", "np_", "._", "tensor", "dot_", "(_", "val_", "[_", "Y_", "]_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ",_", "(_", "ignore", "\\u", "dims_", "[_", "Y_", "]_", ",_", "output", "\\u", "dims_", "[_", "Y_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permutation_", "=_", "[_", "None_", "]_", "*_", "val_", "[_", "X_", "]_", "._", "ndim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "final_", ",_", "cur_", "in_", "zip_", "(_", "list_", "(_", "axes_", "[_", "X_", "]_", ")_", "+_", "ignore", "\\u", "dims_", "[_", "X_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rank_", "(_", "axes_", "[_", "Y_", "]_", ")_", "+_", "range_", "(_", "n", "\\u", "axes_", ",_", "val_", "[_", "X_", "]_", "._", "ndim_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "permutation_", "[_", "final_", "]_", "=_", "cur_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "transpose_", "(_", "wrong", "\\u", "order_", ",_", "permutation_", ")_", "\\u\\u\\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_", "Identity_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Identity_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "A_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Identity_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "(_", "A_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Identity_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "parents_", "[_", "0_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Identity_", "(_", "Different", "iable", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "local", "\\u", "grad_", "(_", "self_", ",_", "parent", "\\u", "ix_", ",_", "d\\u", "out", "\\u", "d\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d\\u", "out", "\\u", "d\\u", "self_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
cloudaice/simple-data/misc/virtenv/share/doc/pycurl/examples/retriever-multi.py
[ { "content": "#! /usr/bin/env python\n# -*- coding: iso-8859-1 -*-\n# vi:ts=4:et\n# $Id$\n\n#\n# Usage: python retriever-multi.py <file with URLs to fetch> [<# of\n# concurrent connections>]\n#\n\nimport sys\nimport pycurl\n\n# We should ignore SIGPIPE when using pycurl.NOSIGNAL - see\n# the libcurl tutorial for more info.\ntry:\n import signal\n from signal import SIGPIPE, SIG_IGN\n signal.signal(signal.SIGPIPE, signal.SIG_IGN)\nexcept ImportError:\n pass\n\n\n# Get args\nnum_conn = 10\ntry:\n if sys.argv[1] == \"-\":\n urls = sys.stdin.readlines()\n else:\n urls = open(sys.argv[1]).readlines()\n if len(sys.argv) >= 3:\n num_conn = int(sys.argv[2])\nexcept:\n print(\"Usage: %s <file with URLs to fetch> [<# of concurrent connections>]\" % sys.argv[0])\n raise SystemExit\n\n\n# Make a queue with (url, filename) tuples\nqueue = []\nfor url in urls:\n url = url.strip()\n if not url or url[0] == \"#\":\n continue\n filename = \"doc_%03d.dat\" % (len(queue) + 1)\n queue.append((url, filename))\n\n\n# Check args\nassert queue, \"no URLs given\"\nnum_urls = len(queue)\nnum_conn = min(num_conn, num_urls)\nassert 1 <= num_conn <= 10000, \"invalid number of concurrent connections\"\nprint(\"PycURL %s (compiled against 0x%x)\" % (pycurl.version, pycurl.COMPILE_LIBCURL_VERSION_NUM))\nprint(\"----- Getting\", num_urls, \"URLs using\", num_conn, \"connections -----\")\n\n\n# Pre-allocate a list of curl objects\nm = pycurl.CurlMulti()\nm.handles = []\nfor i in range(num_conn):\n c = pycurl.Curl()\n c.fp = None\n c.setopt(pycurl.FOLLOWLOCATION, 1)\n c.setopt(pycurl.MAXREDIRS, 5)\n c.setopt(pycurl.CONNECTTIMEOUT, 30)\n c.setopt(pycurl.TIMEOUT, 300)\n c.setopt(pycurl.NOSIGNAL, 1)\n m.handles.append(c)\n\n\n# Main loop\nfreelist = m.handles[:]\nnum_processed = 0\nwhile num_processed < num_urls:\n # If there is an url to process and a free curl object, add to multi stack\n while queue and freelist:\n url, filename = queue.pop(0)\n c = freelist.pop()\n c.fp = open(filename, \"wb\")\n c.setopt(pycurl.URL, url)\n c.setopt(pycurl.WRITEDATA, c.fp)\n m.add_handle(c)\n # store some info\n c.filename = filename\n c.url = url\n # Run the internal curl state machine for the multi stack\n while 1:\n ret, num_handles = m.perform()\n if ret != pycurl.E_CALL_MULTI_PERFORM:\n break\n # Check for curl objects which have terminated, and add them to the freelist\n while 1:\n num_q, ok_list, err_list = m.info_read()\n for c in ok_list:\n c.fp.close()\n c.fp = None\n m.remove_handle(c)\n print(\"Success:\", c.filename, c.url, c.getinfo(pycurl.EFFECTIVE_URL))\n freelist.append(c)\n for c, errno, errmsg in err_list:\n c.fp.close()\n c.fp = None\n m.remove_handle(c)\n print(\"Failed: \", c.filename, c.url, errno, errmsg)\n freelist.append(c)\n num_processed = num_processed + len(ok_list) + len(err_list)\n if num_q == 0:\n break\n # Currently no more I/O is pending, could do something in the meantime\n # (display a progress bar, etc.).\n # We just call select() to sleep until some more data is available.\n m.select(1.0)\n\n\n# Cleanup\nfor c in m.handles:\n if c.fp is not None:\n c.fp.close()\n c.fp = None\n c.close()\nm.close()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from signal import SIGPIPE, SIG_IGN", "start_line": 17, "start_column": 4, "end_line": 17, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", " ", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "iso", "-", "8859", "-1", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vi", ":", "ts", "=", "4", ":", "et_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", "Id", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "age", ":", " ", "python", " ", "retrieve", "r", "-", "multi", ".", "py", " ", "<", "file", " ", "with", " ", "URL", "s", " ", "to", " ", "fetch", ">", " ", "[", "<", "#", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "concurrent", " ", "connections", ">]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pycurl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "ignore", " ", "SIG", "PIPE", " ", "whe", "n", " ", "usi", "ng", " ", "pyc", "url", ".", "NOS", "IGN", "AL", " ", "-", " ", "see", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "libc", "url", " ", "tutorial", " ", "for", " ", "more", " ", "info", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "signal_", "import_", "SIG", "PIPE_", ",_", "SIG", "\\u", "IGN", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "._", "signal_", "(_", "signal_", "._", "SIG", "PIPE_", ",_", "signal_", "._", "SIG", "\\u", "IGN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "conn_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "argv_", "[_", "1_", "]_", "==_", "\"-\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "sys_", "._", "stdin_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls_", "=_", "open_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ")_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "conn_", "=_", "int_", "(_", "sys_", "._", "argv_", "[_", "2_", "]_", ")_", "\\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 ", " _", "print_", "(_", "\"", "Us", "age", ":", " ", "%", "s", " ", "<", "file", " ", "with", " ", "URL", "s", " ", "to", " ", "fetch", ">", " ", "[", "<", "#", " ", "of", " ", "concurrent", " ", "connections", ">]", "\"_", "%_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "System", "Exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "queue", " ", "with", " ", "(", "url", ",", " ", "filename", ")", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "queue_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "url_", "in_", "urls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "url_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "url_", "or_", "url_", "[_", "0_", "]_", "==_", "\"#\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filename_", "=_", "\"", "doc", "\\u", "%", "03", "d", ".", "dat", "\"_", "%_", "(_", "len_", "(_", "queue_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue_", "._", "append_", "(_", "(_", "url_", ",_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "queue_", ",_", "\"", "no", " ", "URL", "s", " ", "give", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "urls_", "=_", "len_", "(_", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "conn_", "=_", "min_", "(_", "num", "\\u", "conn_", ",_", "num", "\\u", "urls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "1_", "<=_", "num", "\\u", "conn_", "<=_", "10000_", ",_", "\"", "invalid", " ", "number", " ", "of", " ", "concurrent", " ", "connections", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Py", "c", "URL", " ", "%", "s", " ", "(", "compile", "d", " ", "against", " ", "0", "x", "%", "x", ")\"_", "%_", "(_", "pycurl_", "._", "version_", ",_", "pycurl_", "._", "COMPIL", "E", "\\u", "LIB", "CUR", "L", "\\u", "VERSI", "ON", "\\u", "NUM_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"----", "-", " ", "Get", "ting", "\"_", ",_", "num", "\\u", "urls_", ",_", "\"", "URL", "s", " ", "usi", "ng", "\"_", ",_", "num", "\\u", "conn_", ",_", "\"", "connections", " ", "-----", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pre", "-", "allocate", " ", "a", " ", "list", " ", "of", " ", "curl", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "pycurl_", "._", "Curl", "Multi", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "handles_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "\\u", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "pycurl_", "._", "Curl", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "fp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "setopt_", "(_", "pycurl_", "._", "FOL", "LOW", "LOCATION_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "setopt_", "(_", "pycurl_", "._", "MAX", "RED", "IR", "S_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "setopt_", "(_", "pycurl_", "._", "CONNECT", "TIMEOUT_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "setopt_", "(_", "pycurl_", "._", "TIMEOUT_", ",_", "300_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "setopt_", "(_", "pycurl_", "._", "NOS", "IGN", "AL_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "handles_", "._", "append_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Main", " ", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "free", "list_", "=_", "m_", "._", "handles_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "processed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "num", "\\u", "processed_", "<_", "num", "\\u", "urls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "is", " ", "an", " ", "url", " ", "to", " ", "process", " ", "and", " ", "a", " ", "free", " ", "curl", " ", "object", ",", " ", "add", " ", "to", " ", "multi", " ", "stack_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "queue_", "and_", "free", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", ",_", "filename_", "=_", "queue_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "free", "list_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "fp_", "=_", "open_", "(_", "filename_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "setopt_", "(_", "pycurl_", "._", "URL_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "setopt_", "(_", "pycurl_", "._", "WRITE", "DATA_", ",_", "c_", "._", "fp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "add", "\\u", "handle_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "some", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "filename_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "url_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Run", " ", "the", " ", "internal", " ", "curl", " ", "state", " ", "machine", " ", "for", " ", "the", " ", "multi", " ", "stack_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", ",_", "num", "\\u", "handles_", "=_", "m_", "._", "perform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "!=_", "pycurl_", "._", "E", "\\u", "CALL", "\\u", "MULTI", "\\u", "PERF", "ORM", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "curl", " ", "object", "s", " ", "whi", "ch", " ", "have", " ", "terminate", "d", ",", " ", "and", " ", "add", " ", "them", " ", "to", " ", "the", " ", "free", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "q_", ",_", "ok", "\\u", "list_", ",_", "err", "\\u", "list_", "=_", "m_", "._", "info", "\\u", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "ok", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "fp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "remove", "\\u", "handle_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Success", ":\"_", ",_", "c_", "._", "filename_", ",_", "c_", "._", "url_", ",_", "c_", "._", "getin", "fo_", "(_", "pycurl_", "._", "EFFECT", "IV", "E", "\\u", "URL_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "free", "list_", "._", "append_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "c_", ",_", "errno_", ",_", "errmsg_", "in_", "err", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "fp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "remove", "\\u", "handle_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fail", "ed", ":", " ", "\"_", ",_", "c_", "._", "filename_", ",_", "c_", "._", "url_", ",_", "errno_", ",_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "free", "list_", "._", "append_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "processed_", "=_", "num", "\\u", "processed_", "+_", "len_", "(_", "ok", "\\u", "list_", ")_", "+_", "len_", "(_", "err", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "\\u", "q_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Curr", "ent", "ly", " ", "no", " ", "more", " ", "I", "/", "O", " ", "is", " ", "pend", "ing", ",", " ", "coul", "d", " ", "do", " ", "somet", "hing", " ", "in", " ", "the", " ", "mean", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "display", " ", "a", " ", "progress", " ", "bar", ",", " ", "etc", ".)", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "just", " ", "call", " ", "select", "()", " ", "to", " ", "sleep", " ", "unti", "l", " ", "some", " ", "more", " ", "data", " ", "is", " ", "avail", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "._", "select_", "(_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cleanup_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "c_", "in_", "m_", "._", "handles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "c_", "._", "fp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "fp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "._", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
sshwsfc/xadmin/xadmin/views/dashboard.py
[ { "content": "from django import forms\nfrom django.apps import apps\nfrom django.core.exceptions import PermissionDenied\nfrom django.core.urlresolvers import reverse, NoReverseMatch\nfrom django.db import models\nfrom django.db.models.base import ModelBase\nfrom django.forms.forms import DeclarativeFieldsMetaclass\nfrom django.forms.utils import flatatt\nfrom django.template import loader\nfrom django.http import Http404\nfrom django.template.context import RequestContext\nfrom django.test.client import RequestFactory\nfrom django.utils.encoding import force_unicode, smart_unicode\nfrom django.utils.html import escape\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import ugettext as _\nfrom django.utils.http import urlencode, urlquote\nfrom django.views.decorators.cache import never_cache\nfrom xadmin import widgets as exwidgets\nfrom xadmin.layout import FormHelper\nfrom xadmin.models import UserSettings, UserWidget\nfrom xadmin.sites import site\nfrom xadmin.views.base import CommAdminView, ModelAdminView, filter_hook, csrf_protect_m\nfrom xadmin.views.edit import CreateAdminView\nfrom xadmin.views.list import ListAdminView\nfrom xadmin.util import unquote\nimport copy\n\n\n\n\n\n\nsite.register(UserWidget, UserWidgetAdmin)\n\n\n\nwidget_manager = WidgetManager()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class WidgetTypeSelect(forms.Widget):\n\n\n\n", "metadata": "root.WidgetTypeSelect", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def __init__(self, widgets, attrs=None):\n super(WidgetTypeSelect, self).__init__(attrs)\n self._widgets = widgets", "metadata": "root.WidgetTypeSelect.__init__", "header": "['class', 'WidgetTypeSelect', '(', 'forms', '.', 'Widget', ')', ':', '___EOS___']", "index": 31 }, { "content": " def render(self, name, value, attrs=None):\n if value is None:\n value = ''\n final_attrs = self.build_attrs(attrs, name=name)\n final_attrs['class'] = 'nav nav-pills nav-stacked'\n output = [u'<ul%s>' % flatatt(final_attrs)]\n options = self.render_options(force_unicode(value), final_attrs['id'])\n if options:\n output.append(options)\n output.append(u'</ul>')\n output.append('<input type=\"hidden\" id=\"%s_input\" name=\"%s\" value=\"%s\"/>' %\n (final_attrs['id'], name, force_unicode(value)))\n return mark_safe(u'\\n'.join(output))", "metadata": "root.WidgetTypeSelect.render", "header": "['class', 'WidgetTypeSelect', '(', 'forms', '.', 'Widget', ')', ':', '___EOS___']", "index": 35 }, { "content": " def render_option(self, selected_choice, widget, id):\n if widget.widget_type == selected_choice:\n selected_html = u' class=\"active\"'\n else:\n selected_html = ''\n return (u'<li%s><a onclick=\"' +\n 'javascript:$(this).parent().parent().find(\\'>li\\').removeClass(\\'active\\');$(this).parent().addClass(\\'active\\');' +\n '$(\\'#%s_input\\').attr(\\'value\\', \\'%s\\')' % (id, widget.widget_type) +\n '\"><h4><i class=\"%s\"></i> %s</h4><p>%s</p></a></li>') % (\n selected_html,\n widget.widget_icon,\n widget.widget_title or widget.widget_type,\n widget.description)", "metadata": "root.WidgetTypeSelect.render_option", "header": "['class', 'WidgetTypeSelect', '(', 'forms', '.', 'Widget', ')', ':', '___EOS___']", "index": 49 }, { "content": " def render_options(self, selected_choice, id):\n # Normalize to strings.\n output = []\n for widget in self._widgets:\n output.append(self.render_option(selected_choice, widget, id))\n return u'\\n'.join(output)", "metadata": "root.WidgetTypeSelect.render_options", "header": "['class', 'WidgetTypeSelect', '(', 'forms', '.', 'Widget', ')', ':', '___EOS___']", "index": 63 }, { "content": "class UserWidgetAdmin(object):\n\n model_icon = 'fa fa-dashboard'\n list_display = ('widget_type', 'page_id', 'user')\n list_filter = ['user', 'widget_type', 'page_id']\n list_display_links = ('widget_type',)\n user_fields = ['user']\n hidden_menu = True\n\n wizard_form_list = (\n (_(u\"Widget Type\"), ('page_id', 'widget_type')),\n (_(u\"Widget Params\"), {'callback':\n \"get_widget_params_form\", 'convert': \"convert_widget_params\"})\n )\n\n\n\n\n\n\n\n", "metadata": "root.UserWidgetAdmin", "header": "['module', '___EOS___']", "index": 71 }, { "content": " def formfield_for_dbfield(self, db_field, **kwargs):\n if db_field.name == 'widget_type':\n widgets = widget_manager.get_widgets(self.request.GET.get('page_id', ''))\n form_widget = WidgetTypeSelect(widgets)\n return forms.ChoiceField(choices=[(w.widget_type, w.description) for w in widgets],\n widget=form_widget, label=_('Widget Type'))\n if 'page_id' in self.request.GET and db_field.name == 'page_id':\n kwargs['widget'] = forms.HiddenInput\n field = super(\n UserWidgetAdmin, self).formfield_for_dbfield(db_field, **kwargs)\n return field", "metadata": "root.UserWidgetAdmin.formfield_for_dbfield", "header": "['class', 'UserWidgetAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 86 }, { "content": " def get_widget_params_form(self, wizard):\n data = wizard.get_cleaned_data_for_step(wizard.steps.first)\n widget_type = data['widget_type']\n widget = widget_manager.get(widget_type)\n fields = copy.deepcopy(widget.base_fields)\n if 'id' in fields:\n del fields['id']\n return DeclarativeFieldsMetaclass(\"WidgetParamsForm\", (forms.Form,), fields)", "metadata": "root.UserWidgetAdmin.get_widget_params_form", "header": "['class', 'UserWidgetAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 98 }, { "content": " def convert_widget_params(self, wizard, cleaned_data, form):\n widget = UserWidget()\n value = dict([(f.name, f.value()) for f in form])\n widget.set_value(value)\n cleaned_data['value'] = widget.value\n cleaned_data['user'] = self.user", "metadata": "root.UserWidgetAdmin.convert_widget_params", "header": "['class', 'UserWidgetAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 107 }, { "content": " def get_list_display(self):\n list_display = super(UserWidgetAdmin, self).get_list_display()\n if not self.user.is_superuser:\n list_display.remove('user')\n return list_display", "metadata": "root.UserWidgetAdmin.get_list_display", "header": "['class', 'UserWidgetAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 114 }, { "content": " def queryset(self):\n if self.user.is_superuser:\n return super(UserWidgetAdmin, self).queryset()\n return UserWidget.objects.filter(user=self.user)", "metadata": "root.UserWidgetAdmin.queryset", "header": "['class', 'UserWidgetAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 120 }, { "content": " def update_dashboard(self, obj):\n try:\n portal_pos = UserSettings.objects.get(\n user=obj.user, key=\"dashboard:%s:pos\" % obj.page_id)\n except UserSettings.DoesNotExist:\n return\n pos = [[w for w in col.split(',') if w != str(\n obj.id)] for col in portal_pos.value.split('|')]\n portal_pos.value = '|'.join([','.join(col) for col in pos])\n portal_pos.save()", "metadata": "root.UserWidgetAdmin.update_dashboard", "header": "['class', 'UserWidgetAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 125 }, { "content": " def delete_model(self):\n self.update_dashboard(self.obj)\n super(UserWidgetAdmin, self).delete_model()", "metadata": "root.UserWidgetAdmin.delete_model", "header": "['class', 'UserWidgetAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 136 }, { "content": " def delete_models(self, queryset):\n for obj in queryset:\n self.update_dashboard(obj)\n super(UserWidgetAdmin, self).delete_models(queryset)", "metadata": "root.UserWidgetAdmin.delete_models", "header": "['class', 'UserWidgetAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 140 }, { "content": "class WidgetManager(object):\n _widgets = None\n\n\n\n", "metadata": "root.WidgetManager", "header": "['module', '___EOS___']", "index": 149 }, { "content": " def __init__(self):\n self._widgets = {}", "metadata": "root.WidgetManager.__init__", "header": "['class', 'WidgetManager', '(', 'object', ')', ':', '___EOS___']", "index": 152 }, { "content": " def register(self, widget_class):\n self._widgets[widget_class.widget_type] = widget_class\n return widget_class", "metadata": "root.WidgetManager.register", "header": "['class', 'WidgetManager', '(', 'object', ')', ':', '___EOS___']", "index": 155 }, { "content": " def get(self, name):\n return self._widgets[name]", "metadata": "root.WidgetManager.get", "header": "['class', 'WidgetManager', '(', 'object', ')', ':', '___EOS___']", "index": 159 }, { "content": " def get_widgets(self, page_id):\n return self._widgets.values()", "metadata": "root.WidgetManager.get_widgets", "header": "['class', 'WidgetManager', '(', 'object', ')', ':', '___EOS___']", "index": 162 }, { "content": "class WidgetDataError(Exception):\n", "metadata": "root.WidgetDataError", "header": "['module', '___EOS___']", "index": 168 }, { "content": " def __init__(self, widget, errors):\n super(WidgetDataError, self).__init__(str(errors))\n self.widget = widget\n self.errors = errors", "metadata": "root.WidgetDataError.__init__", "header": "['class', 'WidgetDataError', '(', 'Exception', ')', ':', '___EOS___']", "index": 170 }, { "content": "class BaseWidget(forms.Form):\n\n template = 'xadmin/widgets/base.html'\n description = 'Base Widget, don\\'t use it.'\n widget_title = None\n widget_icon = 'fa fa-plus-square'\n widget_type = 'base'\n base_title = None\n\n id = forms.IntegerField(label=_('Widget ID'), widget=forms.HiddenInput)\n title = forms.CharField(label=_('Widget Title'), required=False, widget=exwidgets.AdminTextInputWidget)\n\n\n\n\n\n\n\n\n\n", "metadata": "root.BaseWidget", "header": "['module', '___EOS___']", "index": 176 }, { "content": " def __init__(self, dashboard, data):\n self.dashboard = dashboard\n self.admin_site = dashboard.admin_site\n self.request = dashboard.request\n self.user = dashboard.request.user\n self.convert(data)\n super(BaseWidget, self).__init__(data)\n\n if not self.is_valid():\n raise WidgetDataError(self, self.errors.as_text())\n\n self.setup()", "metadata": "root.BaseWidget.__init__", "header": "['class', 'BaseWidget', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 188 }, { "content": " def setup(self):\n helper = FormHelper()\n helper.form_tag = False\n self.helper = helper\n\n self.id = self.cleaned_data['id']\n self.title = self.cleaned_data['title'] or self.base_title\n\n if not (self.user.is_superuser or self.has_perm()):\n raise PermissionDenied", "metadata": "root.BaseWidget.setup", "header": "['class', 'BaseWidget', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 201 }, { "content": " @property\n def widget(self):\n context = {'widget_id': self.id, 'widget_title': self.title, 'widget_icon': self.widget_icon,\n 'widget_type': self.widget_type, 'form': self, 'widget': self}\n self.context(context)\n return loader.render_to_string(self.template, context, context_instance=RequestContext(self.request))", "metadata": "root.BaseWidget.widget", "header": "['class', 'BaseWidget', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 212 }, { "content": " def context(self, context):\n pass", "metadata": "root.BaseWidget.context", "header": "['class', 'BaseWidget', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 219 }, { "content": " def convert(self, data):\n pass", "metadata": "root.BaseWidget.convert", "header": "['class', 'BaseWidget', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 222 }, { "content": " def has_perm(self):\n return False", "metadata": "root.BaseWidget.has_perm", "header": "['class', 'BaseWidget', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 225 }, { "content": " def save(self):\n value = dict([(f.name, f.value()) for f in self])\n user_widget = UserWidget.objects.get(id=self.id)\n user_widget.set_value(value)\n user_widget.save()", "metadata": "root.BaseWidget.save", "header": "['class', 'BaseWidget', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 228 }, { "content": " def static(self, path):\n return self.dashboard.static(path)", "metadata": "root.BaseWidget.static", "header": "['class', 'BaseWidget', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 234 }, { "content": " def vendor(self, *tags):\n return self.dashboard.vendor(*tags)", "metadata": "root.BaseWidget.vendor", "header": "['class', 'BaseWidget', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 237 }, { "content": " def media(self):\n return forms.Media()", "metadata": "root.BaseWidget.media", "header": "['class', 'BaseWidget', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 240 }, { "content": "@widget_manager.register\nclass HtmlWidget(BaseWidget):\n widget_type = 'html'\n widget_icon = 'fa fa-file-o'\n description = _(\n u'Html Content Widget, can write any html content in widget.')\n\n content = forms.CharField(label=_(\n 'Html Content'), widget=exwidgets.AdminTextareaWidget, required=False)\n\n", "metadata": "root.HtmlWidget", "header": "['module', '___EOS___']", "index": 244 }, { "content": " def has_perm(self):\n return True", "metadata": "root.HtmlWidget.has_perm", "header": "['class', 'HtmlWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 254 }, { "content": " def context(self, context):\n context['content'] = self.cleaned_data['content']", "metadata": "root.HtmlWidget.context", "header": "['class', 'HtmlWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 257 }, { "content": "class ModelChoiceIterator(object):\n", "metadata": "root.ModelChoiceIterator", "header": "['module', '___EOS___']", "index": 261 }, { "content": " def __init__(self, field):\n self.field = field", "metadata": "root.ModelChoiceIterator.__init__", "header": "['class', 'ModelChoiceIterator', '(', 'object', ')', ':', '___EOS___']", "index": 262 }, { "content": " def __iter__(self):\n from xadmin import site as g_admin_site\n for m, ma in g_admin_site._registry.items():\n yield ('%s.%s' % (m._meta.app_label, m._meta.model_name),\n m._meta.verbose_name)", "metadata": "root.ModelChoiceIterator.__iter__", "header": "['class', 'ModelChoiceIterator', '(', 'object', ')', ':', '___EOS___']", "index": 265 }, { "content": "class ModelChoiceField(forms.ChoiceField):\n\n\n\n\n choices = property(_get_choices, forms.ChoiceField._set_choices)\n\n\n", "metadata": "root.ModelChoiceField", "header": "['module', '___EOS___']", "index": 272 }, { "content": " def __init__(self, required=True, widget=None, label=None, initial=None,\n help_text=None, *args, **kwargs):\n # Call Field instead of ChoiceField __init__() because we don't need\n # ChoiceField.__init__().\n forms.Field.__init__(self, required, widget, label, initial, help_text,\n *args, **kwargs)\n self.widget.choices = self.choices", "metadata": "root.ModelChoiceField.__init__", "header": "['class', 'ModelChoiceField', '(', 'forms', '.', 'ChoiceField', ')', ':', '___EOS___']", "index": 274 }, { "content": " def __deepcopy__(self, memo):\n result = forms.Field.__deepcopy__(self, memo)\n return result", "metadata": "root.ModelChoiceField.__deepcopy__", "header": "['class', 'ModelChoiceField', '(', 'forms', '.', 'ChoiceField', ')', ':', '___EOS___']", "index": 282 }, { "content": " def _get_choices(self):\n return ModelChoiceIterator(self)", "metadata": "root.ModelChoiceField._get_choices", "header": "['class', 'ModelChoiceField', '(', 'forms', '.', 'ChoiceField', ')', ':', '___EOS___']", "index": 286 }, { "content": " def to_python(self, value):\n if isinstance(value, ModelBase):\n return value\n app_label, model_name = value.lower().split('.')\n return apps.get_model(app_label, model_name)", "metadata": "root.ModelChoiceField.to_python", "header": "['class', 'ModelChoiceField', '(', 'forms', '.', 'ChoiceField', ')', ':', '___EOS___']", "index": 291 }, { "content": " def prepare_value(self, value):\n if isinstance(value, ModelBase):\n value = '%s.%s' % (value._meta.app_label, value._meta.model_name)\n return value", "metadata": "root.ModelChoiceField.prepare_value", "header": "['class', 'ModelChoiceField', '(', 'forms', '.', 'ChoiceField', ')', ':', '___EOS___']", "index": 297 }, { "content": " def valid_value(self, value):\n value = self.prepare_value(value)\n for k, v in self.choices:\n if value == smart_unicode(k):\n return True\n return False", "metadata": "root.ModelChoiceField.valid_value", "header": "['class', 'ModelChoiceField', '(', 'forms', '.', 'ChoiceField', ')', ':', '___EOS___']", "index": 302 }, { "content": "class ModelBaseWidget(BaseWidget):\n\n app_label = None\n model_name = None\n model_perm = 'change'\n model = ModelChoiceField(label=_(u'Target Model'), widget=exwidgets.AdminSelectWidget)\n\n\n\n\n", "metadata": "root.ModelBaseWidget", "header": "['module', '___EOS___']", "index": 310 }, { "content": " def __init__(self, dashboard, data):\n self.dashboard = dashboard\n super(ModelBaseWidget, self).__init__(dashboard, data)", "metadata": "root.ModelBaseWidget.__init__", "header": "['class', 'ModelBaseWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 317 }, { "content": " def setup(self):\n self.model = self.cleaned_data['model']\n self.app_label = self.model._meta.app_label\n self.model_name = self.model._meta.model_name\n\n super(ModelBaseWidget, self).setup()", "metadata": "root.ModelBaseWidget.setup", "header": "['class', 'ModelBaseWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 321 }, { "content": " def has_perm(self):\n return self.dashboard.has_model_perm(self.model, self.model_perm)", "metadata": "root.ModelBaseWidget.has_perm", "header": "['class', 'ModelBaseWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 328 }, { "content": " def filte_choices_model(self, model, modeladmin):\n return self.dashboard.has_model_perm(model, self.model_perm)", "metadata": "root.ModelBaseWidget.filte_choices_model", "header": "['class', 'ModelBaseWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 331 }, { "content": " def model_admin_url(self, name, *args, **kwargs):\n return reverse(\n \"%s:%s_%s_%s\" % (self.admin_site.app_name, self.app_label,\n self.model_name, name), args=args, kwargs=kwargs)", "metadata": "root.ModelBaseWidget.model_admin_url", "header": "['class', 'ModelBaseWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 334 }, { "content": "class PartialBaseWidget(BaseWidget):\n\n\n\n\n", "metadata": "root.PartialBaseWidget", "header": "['module', '___EOS___']", "index": 340 }, { "content": " def get_view_class(self, view_class, model=None, **opts):\n admin_class = self.admin_site._registry.get(model) if model else None\n return self.admin_site.get_view_class(view_class, admin_class, **opts)", "metadata": "root.PartialBaseWidget.get_view_class", "header": "['class', 'PartialBaseWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 342 }, { "content": " def get_factory(self):\n return RequestFactory()", "metadata": "root.PartialBaseWidget.get_factory", "header": "['class', 'PartialBaseWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 346 }, { "content": " def setup_request(self, request):\n request.user = self.user\n request.session = self.request.session\n return request", "metadata": "root.PartialBaseWidget.setup_request", "header": "['class', 'PartialBaseWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 349 }, { "content": " def make_get_request(self, path, data={}, **extra):\n req = self.get_factory().get(path, data, **extra)\n return self.setup_request(req)", "metadata": "root.PartialBaseWidget.make_get_request", "header": "['class', 'PartialBaseWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 354 }, { "content": " def make_post_request(self, path, data={}, **extra):\n req = self.get_factory().post(path, data, **extra)\n return self.setup_request(req)", "metadata": "root.PartialBaseWidget.make_post_request", "header": "['class', 'PartialBaseWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 358 }, { "content": "@widget_manager.register\nclass QuickBtnWidget(BaseWidget):\n widget_type = 'qbutton'\n description = _(u'Quick button Widget, quickly open any page.')\n template = \"xadmin/widgets/qbutton.html\"\n base_title = _(u\"Quick Buttons\")\n widget_icon = 'fa fa-caret-square-o-right'\n\n\n\n", "metadata": "root.QuickBtnWidget", "header": "['module', '___EOS___']", "index": 363 }, { "content": " def convert(self, data):\n self.q_btns = data.pop('btns', [])", "metadata": "root.QuickBtnWidget.convert", "header": "['class', 'QuickBtnWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 371 }, { "content": " def get_model(self, model_or_label):\n if isinstance(model_or_label, ModelBase):\n return model_or_label\n else:\n return apps.get_model(*model_or_label.lower().split('.'))", "metadata": "root.QuickBtnWidget.get_model", "header": "['class', 'QuickBtnWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 374 }, { "content": " def context(self, context):\n btns = []\n for b in self.q_btns:\n btn = {}\n if 'model' in b:\n model = self.get_model(b['model'])\n if not self.user.has_perm(\"%s.view_%s\" % (model._meta.app_label, model._meta.model_name)):\n continue\n btn['url'] = reverse(\"%s:%s_%s_%s\" % (self.admin_site.app_name, model._meta.app_label,\n model._meta.model_name, b.get('view', 'changelist')))\n btn['title'] = model._meta.verbose_name\n btn['icon'] = self.dashboard.get_model_icon(model)\n else:\n try:\n btn['url'] = reverse(b['url'])\n except NoReverseMatch:\n btn['url'] = b['url']\n\n if 'title' in b:\n btn['title'] = b['title']\n if 'icon' in b:\n btn['icon'] = b['icon']\n btns.append(btn)\n\n context.update({'btns': btns})", "metadata": "root.QuickBtnWidget.context", "header": "['class', 'QuickBtnWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 380 }, { "content": " def has_perm(self):\n return True", "metadata": "root.QuickBtnWidget.has_perm", "header": "['class', 'QuickBtnWidget', '(', 'BaseWidget', ')', ':', '___EOS___']", "index": 406 }, { "content": "@widget_manager.register\nclass ListWidget(ModelBaseWidget, PartialBaseWidget):\n widget_type = 'list'\n description = _(u'Any Objects list Widget.')\n template = \"xadmin/widgets/list.html\"\n model_perm = 'view'\n widget_icon = 'fa fa-align-justify'\n\n\n", "metadata": "root.ListWidget", "header": "['module', '___EOS___']", "index": 410 }, { "content": " def convert(self, data):\n self.list_params = data.pop('params', {})\n self.list_count = data.pop('count', 10)", "metadata": "root.ListWidget.convert", "header": "['class', 'ListWidget', '(', 'ModelBaseWidget', ',', 'PartialBaseWidget', ')', ':', '___EOS___']", "index": 418 }, { "content": " def setup(self):\n super(ListWidget, self).setup()\n\n if not self.title:\n self.title = self.model._meta.verbose_name_plural\n\n req = self.make_get_request(\"\", self.list_params)\n self.list_view = self.get_view_class(ListAdminView, self.model)(req)\n if self.list_count:\n self.list_view.list_per_page = self.list_count", "metadata": "root.ListWidget.setup", "header": "['class', 'ListWidget', '(', 'ModelBaseWidget', ',', 'PartialBaseWidget', ')', ':', '___EOS___']", "index": 422 }, { "content": " def context(self, context):\n list_view = self.list_view\n list_view.make_result_list()\n\n base_fields = list_view.base_list_display\n if len(base_fields) > 5:\n base_fields = base_fields[0:5]\n\n context['result_headers'] = [c for c in list_view.result_headers(\n ).cells if c.field_name in base_fields]\n context['results'] = [[o for i, o in\n enumerate(filter(lambda c:c.field_name in base_fields, r.cells))]\n for r in list_view.results()]\n context['result_count'] = list_view.result_count\n context['page_url'] = self.model_admin_url('changelist') + \"?\" + urlencode(self.list_params)", "metadata": "root.ListWidget.context", "header": "['class', 'ListWidget', '(', 'ModelBaseWidget', ',', 'PartialBaseWidget', ')', ':', '___EOS___']", "index": 433 }, { "content": "@widget_manager.register\nclass AddFormWidget(ModelBaseWidget, PartialBaseWidget):\n widget_type = 'addform'\n description = _(u'Add any model object Widget.')\n template = \"xadmin/widgets/addform.html\"\n model_perm = 'add'\n widget_icon = 'fa fa-plus'\n\n\n", "metadata": "root.AddFormWidget", "header": "['module', '___EOS___']", "index": 450 }, { "content": " def setup(self):\n super(AddFormWidget, self).setup()\n\n if self.title is None:\n self.title = _('Add %s') % self.model._meta.verbose_name\n\n req = self.make_get_request(\"\")\n self.add_view = self.get_view_class(\n CreateAdminView, self.model, list_per_page=10)(req)\n self.add_view.instance_forms()", "metadata": "root.AddFormWidget.setup", "header": "['class', 'AddFormWidget', '(', 'ModelBaseWidget', ',', 'PartialBaseWidget', ')', ':', '___EOS___']", "index": 458 }, { "content": " def context(self, context):\n helper = FormHelper()\n helper.form_tag = False\n\n context.update({\n 'addform': self.add_view.form_obj,\n 'addhelper': helper,\n 'addurl': self.add_view.model_admin_url('add'),\n 'model': self.model\n })", "metadata": "root.AddFormWidget.context", "header": "['class', 'AddFormWidget', '(', 'ModelBaseWidget', ',', 'PartialBaseWidget', ')', ':', '___EOS___']", "index": 469 }, { "content": " def media(self):\n return self.add_view.media + self.add_view.form_obj.media + self.vendor('xadmin.plugin.quick-form.js')", "metadata": "root.AddFormWidget.media", "header": "['class', 'AddFormWidget', '(', 'ModelBaseWidget', ',', 'PartialBaseWidget', ')', ':', '___EOS___']", "index": 480 }, { "content": "class Dashboard(CommAdminView):\n\n widget_customiz = True\n widgets = []\n title = _(u\"Dashboard\")\n icon = None\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Dashboard", "header": "['module', '___EOS___']", "index": 484 }, { "content": " def get_page_id(self):\n return self.request.path", "metadata": "root.Dashboard.get_page_id", "header": "['class', 'Dashboard', '(', 'CommAdminView', ')', ':', '___EOS___']", "index": 491 }, { "content": " def get_portal_key(self):\n return \"dashboard:%s:pos\" % self.get_page_id()", "metadata": "root.Dashboard.get_portal_key", "header": "['class', 'Dashboard', '(', 'CommAdminView', ')', ':', '___EOS___']", "index": 494 }, { "content": " @filter_hook\n def get_widget(self, widget_or_id, data=None):\n try:\n if isinstance(widget_or_id, UserWidget):\n widget = widget_or_id\n else:\n widget = UserWidget.objects.get(user=self.user, page_id=self.get_page_id(), id=widget_or_id)\n wid = widget_manager.get(widget.widget_type)\n\n class widget_with_perm(wid):\n def context(self, context):\n super(widget_with_perm, self).context(context)\n context.update({'has_change_permission': self.request.user.has_perm('xadmin.change_userwidget')})\n wid_instance = widget_with_perm(self, data or widget.get_value())\n return wid_instance\n except UserWidget.DoesNotExist:\n return None", "metadata": "root.Dashboard.get_widget", "header": "['class', 'Dashboard', '(', 'CommAdminView', ')', ':', '___EOS___']", "index": 497 }, { "content": " @filter_hook\n def get_init_widget(self):\n portal = []\n widgets = self.widgets\n for col in widgets:\n portal_col = []\n for opts in col:\n try:\n widget = UserWidget(user=self.user, page_id=self.get_page_id(), widget_type=opts['type'])\n widget.set_value(opts)\n widget.save()\n portal_col.append(self.get_widget(widget))\n except (PermissionDenied, WidgetDataError):\n widget.delete()\n continue\n portal.append(portal_col)\n\n UserSettings(\n user=self.user, key=\"dashboard:%s:pos\" % self.get_page_id(),\n value='|'.join([','.join([str(w.id) for w in col]) for col in portal])).save()\n\n return portal", "metadata": "root.Dashboard.get_init_widget", "header": "['class', 'Dashboard', '(', 'CommAdminView', ')', ':', '___EOS___']", "index": 515 }, { "content": " @filter_hook\n def get_widgets(self):\n\n if self.widget_customiz:\n portal_pos = UserSettings.objects.filter(\n user=self.user, key=self.get_portal_key())\n if len(portal_pos):\n portal_pos = portal_pos[0].value\n widgets = []\n\n if portal_pos:\n user_widgets = dict([(uw.id, uw) for uw in UserWidget.objects.filter(user=self.user, page_id=self.get_page_id())])\n for col in portal_pos.split('|'):\n ws = []\n for wid in col.split(','):\n try:\n widget = user_widgets.get(int(wid))\n if widget:\n ws.append(self.get_widget(widget))\n except Exception, e:\n import logging\n logging.error(e, exc_info=True)\n widgets.append(ws)\n\n return widgets\n\n return self.get_init_widget()", "metadata": "root.Dashboard.get_widgets", "header": "['class', 'Dashboard', '(', 'CommAdminView', ')', ':', '___EOS___']", "index": 538 }, { "content": " @filter_hook\n def get_title(self):\n return self.title", "metadata": "root.Dashboard.get_title", "header": "['class', 'Dashboard', '(', 'CommAdminView', ')', ':', '___EOS___']", "index": 566 }, { "content": " @filter_hook\n def get_context(self):\n new_context = {\n 'title': self.get_title(),\n 'icon': self.icon,\n 'portal_key': self.get_portal_key(),\n 'columns': [('col-sm-%d' % int(12 / len(self.widgets)), ws) for ws in self.widgets],\n 'has_add_widget_permission': self.has_model_perm(UserWidget, 'add') and self.widget_customiz,\n 'add_widget_url': self.get_admin_url('%s_%s_add' % (UserWidget._meta.app_label, UserWidget._meta.model_name)) +\n \"?user=%s&page_id=%s&_redirect=%s\" % (self.user.id, self.get_page_id(), urlquote(self.request.get_full_path()))\n }\n context = super(Dashboard, self).get_context()\n context.update(new_context)\n return context", "metadata": "root.Dashboard.get_context", "header": "['class', 'Dashboard', '(', 'CommAdminView', ')', ':', '___EOS___']", "index": 570 }, { "content": " @never_cache\n def get(self, request, *args, **kwargs):\n self.widgets = self.get_widgets()\n return self.template_response('xadmin/views/dashboard.html', self.get_context())", "metadata": "root.Dashboard.get", "header": "['class', 'Dashboard', '(', 'CommAdminView', ')', ':', '___EOS___']", "index": 585 }, { "content": " @csrf_protect_m\n def post(self, request, *args, **kwargs):\n if 'id' in request.POST:\n widget_id = request.POST['id']\n if request.POST.get('_delete', None) != 'on':\n widget = self.get_widget(widget_id, request.POST.copy())\n widget.save()\n else:\n try:\n widget = UserWidget.objects.get(\n user=self.user, page_id=self.get_page_id(), id=widget_id)\n widget.delete()\n try:\n portal_pos = UserSettings.objects.get(user=self.user, key=\"dashboard:%s:pos\" % self.get_page_id())\n pos = [[w for w in col.split(',') if w != str(\n widget_id)] for col in portal_pos.value.split('|')]\n portal_pos.value = '|'.join([','.join(col) for col in pos])\n portal_pos.save()\n except Exception:\n pass\n except UserWidget.DoesNotExist:\n pass\n\n return self.get(request)", "metadata": "root.Dashboard.post", "header": "['class', 'Dashboard', '(', 'CommAdminView', ')', ':', '___EOS___']", "index": 590 }, { "content": " @filter_hook\n def get_media(self):\n media = super(Dashboard, self).get_media() + \\\n self.vendor('xadmin.page.dashboard.js', 'xadmin.page.dashboard.css')\n if self.widget_customiz:\n media = media + self.vendor('xadmin.plugin.portal.js')\n for ws in self.widgets:\n for widget in ws:\n media = media + widget.media()\n return media", "metadata": "root.Dashboard.get_media", "header": "['class', 'Dashboard', '(', 'CommAdminView', ')', ':', '___EOS___']", "index": 615 }, { "content": "class ModelDashboard(Dashboard, ModelAdminView):\n\n title = _(u\"%s Dashboard\")\n\n\n\n\n", "metadata": "root.ModelDashboard", "header": "['module', '___EOS___']", "index": 627 }, { "content": " def get_page_id(self):\n return 'model:%s/%s' % self.model_info", "metadata": "root.ModelDashboard.get_page_id", "header": "['class', 'ModelDashboard', '(', 'Dashboard', ',', 'ModelAdminView', ')', ':', '___EOS___']", "index": 631 }, { "content": " @filter_hook\n def get_title(self):\n return self.title % force_unicode(self.obj)", "metadata": "root.ModelDashboard.get_title", "header": "['class', 'ModelDashboard', '(', 'Dashboard', ',', 'ModelAdminView', ')', ':', '___EOS___']", "index": 634 }, { "content": " def init_request(self, object_id, *args, **kwargs):\n self.obj = self.get_object(unquote(object_id))\n\n if not self.has_view_permission(self.obj):\n raise PermissionDenied\n\n if self.obj is None:\n raise Http404(_('%(name)s object with primary key %(key)r does not exist.') %\n {'name': force_unicode(self.opts.verbose_name), 'key': escape(object_id)})", "metadata": "root.ModelDashboard.init_request", "header": "['class', 'ModelDashboard', '(', 'Dashboard', ',', 'ModelAdminView', ')', ':', '___EOS___']", "index": 638 }, { "content": " @filter_hook\n def get_context(self):\n new_context = {\n 'has_change_permission': self.has_change_permission(self.obj),\n 'object': self.obj,\n }\n context = Dashboard.get_context(self)\n context.update(ModelAdminView.get_context(self))\n context.update(new_context)\n return context", "metadata": "root.ModelDashboard.get_context", "header": "['class', 'ModelDashboard', '(', 'Dashboard', ',', 'ModelAdminView', ')', ':', '___EOS___']", "index": 648 }, { "content": " @never_cache\n def get(self, request, *args, **kwargs):\n self.widgets = self.get_widgets()\n return self.template_response(self.get_template_list('views/model_dashboard.html'), self.get_context())", "metadata": "root.ModelDashboard.get", "header": "['class', 'ModelDashboard', '(', 'Dashboard', ',', 'ModelAdminView', ')', ':', '___EOS___']", "index": 659 } ]
[ { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "apps_", "import_", "apps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", ",_", "No", "Revers", "e", "Match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "base_", "import_", "Model", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "forms_", "import_", "Declarati", "ve", "Field", "s", "Meta", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "utils_", "import_", "flat", "att_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "context_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "client_", "import_", "Request", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "force", "\\u", "unicode_", ",_", "smart", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "html_", "import_", "escape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "safe", "string_", "import_", "mark", "\\u", "safe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "http_", "import_", "urlencode_", ",_", "url", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "decorators_", "._", "cache_", "import_", "neve", "r", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xad", "min_", "import_", "widgets_", "as_", "ex", "widgets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xad", "min_", "._", "layout_", "import_", "Form", "Helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xad", "min_", "._", "models_", "import_", "User", "Settings_", ",_", "User", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xad", "min_", "._", "sites_", "import_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xad", "min_", "._", "views_", "._", "base_", "import_", "Comm", "Admi", "n", "View_", ",_", "Model", "Admi", "n", "View_", ",_", "filter", "\\u", "hook_", ",_", "csr", "f", "\\u", "protect", "\\u", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xad", "min_", "._", "views_", "._", "edit_", "import_", "Creat", "e", "Admi", "n", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xad", "min_", "._", "views_", "._", "list_", "import_", "List", "Admi", "n", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xad", "min_", "._", "util_", "import_", "unquote_", "\\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\\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_", "site_", "._", "register_", "(_", "User", "Widget_", ",_", "User", "Wid", "get", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "widget", "\\u", "manager_", "=_", "Wid", "get", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Wid", "get", "Type", "Select_", "(_", "forms_", "._", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Wid", "get", "Type", "Select_", "(_", "forms_", "._", "Widget_", ")_", ":_", "\\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_", ",_", "widgets_", ",_", "attrs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Wid", "get", "Type", "Select_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "widgets_", "=_", "widgets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wid", "get", "Type", "Select_", "(_", "forms_", "._", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "attrs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "final", "\\u", "attrs_", "=_", "self_", "._", "build", "\\u", "attrs_", "(_", "attrs_", ",_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "attrs_", "[_", "'", "class", "'_", "]_", "=_", "'", "nav", " ", "nav", "-", "pill", "s", " ", "nav", "-", "stacked", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "[_", "u", "'<", "ul", "%", "s", ">'_", "%_", "flat", "att_", "(_", "final", "\\u", "attrs_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "self_", "._", "render", "\\u", "options_", "(_", "force", "\\u", "unicode_", "(_", "value_", ")_", ",_", "final", "\\u", "attrs_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "append_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "._", "append_", "(_", "u", "'<", "/", "ul", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "append_", "(_", "'<", "input", " ", "type", "=\"", "hidden", "\"", " ", "id", "=\"", "%", "s", "\\u", "input", "\"", " ", "name", "=\"", "%", "s", "\"", " ", "value", "=\"", "%", "s", "\"/>'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "final", "\\u", "attrs_", "[_", "'", "id", "'_", "]_", ",_", "name_", ",_", "force", "\\u", "unicode_", "(_", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mark", "\\u", "safe_", "(_", "u", "'\\\\", "n", "'_", "._", "join_", "(_", "output_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wid", "get", "Type", "Select_", "(_", "forms_", "._", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "option_", "(_", "self_", ",_", "selecte", "d\\u", "choice_", ",_", "widget_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "widget_", "._", "widget", "\\u", "type_", "==_", "selecte", "d\\u", "choice_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selecte", "d\\u", "html_", "=_", "u", "'", " ", "class", "=\"", "active", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selecte", "d\\u", "html_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "u", "'<", "li", "%", "s", "><", "a", " ", "onc", "lick", "=\"'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "javascript", ":$", "(", "this", ").", "parent", "()", ".", "parent", "()", ".", "find", "(\\\\'", ">", "li", "\\\\')", ".", "remove", "Class", "(\\\\'", "active", "\\\\')", ";", "$(", "this", ").", "parent", "()", ".", "add", "Class", "(\\\\'", "active", "\\\\')", ";'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\\\\'", "#", "%", "s", "\\u", "input", "\\\\')", ".", "attr", "(\\\\'", "value", "\\\\'", ",", " ", "\\\\'", "%", "s", "\\\\')", "'_", "%_", "(_", "id_", ",_", "widget_", "._", "widget", "\\u", "type_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\">", "<", "h", "4", "><", "i", " ", "class", "=\"", "%", "s", "\">", "</", "i", ">", " ", "%", "s", "</", "h", "4", "><", "p", ">", "%", "s", "</", "p", "><", "/", "a", "><", "/", "li", ">'_", ")_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "selecte", "d\\u", "html_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "._", "widget", "\\u", "icon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "._", "widget", "\\u", "title_", "or_", "widget_", "._", "widget", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wid", "get", "Type", "Select_", "(_", "forms_", "._", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "options_", "(_", "self_", ",_", "selecte", "d\\u", "choice_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Normalize", " ", "to", " ", "string", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "widget_", "in_", "self_", "._", "\\u", "widgets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "append_", "(_", "self_", "._", "render", "\\u", "option_", "(_", "selecte", "d\\u", "choice_", ",_", "widget_", ",_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "u", "'\\\\", "n", "'_", "._", "join_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User", "Wid", "get", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "\\u", "icon_", "=_", "'", "fa", " ", "fa", "-", "dash", "board", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "widget", "\\u", "type", "'_", ",_", "'", "page", "\\u", "id", "'_", ",_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "filter_", "=_", "[_", "'", "user", "'_", ",_", "'", "widget", "\\u", "type", "'_", ",_", "'", "page", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "widget", "\\u", "type", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "fields_", "=_", "[_", "'", "user", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "\\u", "menu_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wiz", "ard", "\\u", "form", "\\u", "list_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u_", "(_", "u", "\"", "Wid", "get", " ", "Type", "\"_", ")_", ",_", "(_", "'", "page", "\\u", "id", "'_", ",_", "'", "widget", "\\u", "type", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u_", "(_", "u", "\"", "Wid", "get", " ", "Param", "s", "\"_", ")_", ",_", "{_", "'", "callback", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "get", "\\u", "widget", "\\u", "params", "\\u", "form", "\"_", ",_", "'", "convert", "'_", ":_", "\"", "convert", "\\u", "widget", "\\u", "params", "\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "User", "Wid", "get", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "dbf", "ield_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "widget", "\\u", "type", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widgets_", "=_", "widget", "\\u", "manager_", "._", "get", "\\u", "widgets_", "(_", "self_", "._", "request_", "._", "GET_", "._", "get_", "(_", "'", "page", "\\u", "id", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "widget_", "=_", "Wid", "get", "Type", "Select_", "(_", "widgets_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "forms_", "._", "Choi", "ce", "Field_", "(_", "choices_", "=_", "[_", "(_", "w_", "._", "widget", "\\u", "type_", ",_", "w_", "._", "description_", ")_", "for_", "w_", "in_", "widgets_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "form", "\\u", "widget_", ",_", "label_", "=_", "\\u_", "(_", "'", "Wid", "get", " ", "Type", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "page", "\\u", "id", "'_", "in_", "self_", "._", "request_", "._", "GET_", "and_", "db", "\\u", "field_", "._", "name_", "==_", "'", "page", "\\u", "id", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Hi", "dde", "n", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "super_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "User", "Wid", "get", "Admin_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "dbf", "ield_", "(_", "db", "\\u", "field_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Wid", "get", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "widget", "\\u", "params", "\\u", "form_", "(_", "self_", ",_", "wizard_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "wizard_", "._", "get", "\\u", "clean", "ed", "\\u", "data\\u", "for", "\\u", "step_", "(_", "wizard_", "._", "steps_", "._", "first_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget", "\\u", "type_", "=_", "data_", "[_", "'", "widget", "\\u", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "=_", "widget", "\\u", "manager_", "._", "get_", "(_", "widget", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "copy_", "._", "deepcopy_", "(_", "widget_", "._", "base", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "id", "'_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "fields_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Declarati", "ve", "Field", "s", "Meta", "class_", "(_", "\"", "Wid", "get", "Param", "s", "Form", "\"_", ",_", "(_", "forms_", "._", "Form_", ",_", ")_", ",_", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Wid", "get", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "convert", "\\u", "widget", "\\u", "params_", "(_", "self_", ",_", "wizard_", ",_", "clean", "ed", "\\u", "data_", ",_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "User", "Widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "dict_", "(_", "[_", "(_", "f_", "._", "name_", ",_", "f_", "._", "value_", "(_", ")_", ")_", "for_", "f_", "in_", "form_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "._", "set\\u", "value_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "ed", "\\u", "data_", "[_", "'", "value", "'_", "]_", "=_", "widget_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "ed", "\\u", "data_", "[_", "'", "user", "'_", "]_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Wid", "get", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "list", "\\u", "display_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "super_", "(_", "User", "Wid", "get", "Admin_", ",_", "self_", ")_", "._", "get", "\\u", "list", "\\u", "display_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "user_", "._", "is", "\\u", "superuser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "._", "remove_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "list", "\\u", "display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Wid", "get", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "user_", "._", "is", "\\u", "superuser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "User", "Wid", "get", "Admin_", ",_", "self_", ")_", "._", "queryset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "User", "Widget_", "._", "objects_", "._", "filter_", "(_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Wid", "get", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "dashboard_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\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 ", " _", "portal", "\\u", "pos_", "=_", "User", "Settings_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "obj_", "._", "user_", ",_", "key_", "=_", "\"", "dash", "board", ":", "%", "s", ":", "pos", "\"_", "%_", "obj_", "._", "page", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "User", "Settings_", "._", "Do", "es", "Not", "Exist_", ":_", "\\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_", "pos_", "=_", "[_", "[_", "w_", "for_", "w_", "in_", "col_", "._", "split_", "(_", "','_", ")_", "if_", "w_", "!=_", "str_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "id_", ")_", "]_", "for_", "col_", "in_", "portal", "\\u", "pos_", "._", "value_", "._", "split_", "(_", "'|'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "pos_", "._", "value_", "=_", "'|'_", "._", "join_", "(_", "[_", "','_", "._", "join_", "(_", "col_", ")_", "for_", "col_", "in_", "pos_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "pos_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Wid", "get", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "model_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "\\u", "dashboard_", "(_", "self_", "._", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "User", "Wid", "get", "Admin_", ",_", "self_", ")_", "._", "delete", "\\u", "model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Wid", "get", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "models_", "(_", "self_", ",_", "queryset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "obj_", "in_", "queryset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "\\u", "dashboard_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "User", "Wid", "get", "Admin_", ",_", "self_", ")_", "._", "delete", "\\u", "models_", "(_", "queryset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Wid", "get", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "widgets_", "=_", "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_", "[SEP]_", "class_", "Wid", "get", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "widgets_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wid", "get", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "register_", "(_", "self_", ",_", "widget", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "widgets_", "[_", "widget", "\\u", "class_", "._", "widget", "\\u", "type_", "]_", "=_", "widget", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "widget", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wid", "get", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "widgets_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wid", "get", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "widgets_", "(_", "self_", ",_", "page", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "widgets_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Wid", "get", "Data", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Wid", "get", "Data", "Error_", "(_", "Exception_", ")_", ":_", "\\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_", ",_", "widget_", ",_", "errors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Wid", "get", "Data", "Error_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "str_", "(_", "errors_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "=_", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "errors_", "=_", "errors_", "\\u\\u\\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", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "'", "xad", "min", "/", "widget", "s", "/", "base", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "'", "Base", " ", "Wid", "get", ",", " ", "don", "\\\\'", "t", " ", "use", " ", "it", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget", "\\u", "title_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget", "\\u", "icon_", "=_", "'", "fa", " ", "fa", "-", "plus", "-", "square", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget", "\\u", "type_", "=_", "'", "base", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "title_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "forms_", "._", "Integer", "Field_", "(_", "label_", "=_", "\\u_", "(_", "'", "Wid", "get", " ", "ID", "'_", ")_", ",_", "widget_", "=_", "forms_", "._", "Hi", "dde", "n", "Input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "forms_", "._", "Char", "Field_", "(_", "label_", "=_", "\\u_", "(_", "'", "Wid", "get", " ", "Tit", "le", "'_", ")_", ",_", "required_", "=_", "False_", ",_", "widget_", "=_", "ex", "widgets_", "._", "Admi", "n", "Text", "Inp", "ut", "Widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "dashboard_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dashboard_", "=_", "dashboard_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "admin", "\\u", "site_", "=_", "dashboard_", "._", "admin", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request_", "=_", "dashboard_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "=_", "dashboard_", "._", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "convert_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Base", "Widget_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Wid", "get", "Data", "Error_", "(_", "self_", ",_", "self_", "._", "errors_", "._", "as", "\\u", "text_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "helper_", "=_", "Form", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "helper_", "._", "form", "\\u", "tag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "=_", "helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "id_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "title_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "title", "'_", "]_", "or_", "self_", "._", "base", "\\u", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "self_", "._", "user_", "._", "is", "\\u", "superuser_", "or_", "self_", "._", "has", "\\u", "perm_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "widget_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "{_", "'", "widget", "\\u", "id", "'_", ":_", "self_", "._", "id_", ",_", "'", "widget", "\\u", "title", "'_", ":_", "self_", "._", "title_", ",_", "'", "widget", "\\u", "icon", "'_", ":_", "self_", "._", "widget", "\\u", "icon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "widget", "\\u", "type", "'_", ":_", "self_", "._", "widget", "\\u", "type_", ",_", "'", "form", "'_", ":_", "self_", ",_", "'", "widget", "'_", ":_", "self_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "loader_", "._", "render", "\\u", "to", "\\u", "string_", "(_", "self_", "._", "template_", ",_", "context_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "self_", "._", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "context_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "convert_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "perm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "dict_", "(_", "[_", "(_", "f_", "._", "name_", ",_", "f_", "._", "value_", "(_", ")_", ")_", "for_", "f_", "in_", "self_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "widget_", "=_", "User", "Widget_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "widget_", "._", "set\\u", "value_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "widget_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "static_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dashboard_", "._", "static_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "vendor_", "(_", "self_", ",_", "*_", "tags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dashboard_", "._", "vendor_", "(_", "*_", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Widget_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "media_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "forms_", "._", "Media_", "(_", ")_", "\\u\\u\\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_", "@_", "widget", "\\u", "manager_", "._", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Ht", "ml", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget", "\\u", "type_", "=_", "'", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget", "\\u", "icon_", "=_", "'", "fa", " ", "fa", "-", "file", "-", "o", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Ht", "ml", " ", "Conten", "t", " ", "Wid", "get", ",", " ", "can", " ", "write", " ", "any", " ", "html", " ", "content", " ", "in", " ", "widget", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "forms_", "._", "Char", "Field_", "(_", "label_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ht", "ml", " ", "Conten", "t", "'_", ")_", ",_", "widget_", "=_", "ex", "widgets_", "._", "Admi", "n", "Text", "area", "Widget_", ",_", "required_", "=_", "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_", "[SEP]_", "class_", "Ht", "ml", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "has", "\\u", "perm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ht", "ml", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "context_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "'", "content", "'_", "]_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "content", "'_", "]_", "\\u\\u\\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_", "Model", "Choi", "ce", "Iterator_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Model", "Choi", "ce", "Iterator_", "(_", "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_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "field_", "=_", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Choi", "ce", "Iterator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "xad", "min_", "import_", "site_", "as_", "g", "\\u", "admin", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", ",_", "ma_", "in_", "g", "\\u", "admin", "\\u", "site_", "._", "\\u", "registry_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "m_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "m_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "\\u", "meta_", "._", "verbo", "se", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Model", "Choi", "ce", "Field_", "(_", "forms_", "._", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "choices_", "=_", "property_", "(_", "\\u", "get", "\\u", "choices_", ",_", "forms_", "._", "Choi", "ce", "Field_", "._", "\\u", "set\\u", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Model", "Choi", "ce", "Field_", "(_", "forms_", "._", "Choi", "ce", "Field_", ")_", ":_", "\\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_", ",_", "required_", "=_", "True_", ",_", "widget_", "=_", "None_", ",_", "label_", "=_", "None_", ",_", "initial_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Call", " ", "Field", " ", "inst", "ead", " ", "of", " ", "Choi", "ce", "Field", " ", "\\u\\u", "init", "\\u\\u()", " ", "bec", "aus", "e", " ", "we", " ", "don", "'", "t", " ", "need", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Choi", "ce", "Field", ".\\u", "\\u", "init", "\\u\\u()", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forms_", "._", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "required_", ",_", "widget_", ",_", "label_", ",_", "initial_", ",_", "help", "\\u", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "choices_", "=_", "self_", "._", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Choi", "ce", "Field_", "(_", "forms_", "._", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "self_", ",_", "memo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "forms_", "._", "Field_", "._", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "self_", ",_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Choi", "ce", "Field_", "(_", "forms_", "._", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "choices_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Model", "Choi", "ce", "Iterator_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Choi", "ce", "Field_", "(_", "forms_", "._", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "Model", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "label_", ",_", "model", "\\u", "name_", "=_", "value_", "._", "lower_", "(_", ")_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "apps_", "._", "get", "\\u", "model_", "(_", "app", "\\u", "label_", ",_", "model", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Choi", "ce", "Field_", "(_", "forms_", "._", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepar", "e\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "Model", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "value_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "value_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Choi", "ce", "Field_", "(_", "forms_", "._", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "valid", "\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "prepar", "e\\u", "value_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "choices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "==_", "smart", "\\u", "unicode_", "(_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "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_", "Model", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "perm_", "=_", "'", "change", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Model", "Choi", "ce", "Field_", "(_", "label_", "=_", "\\u_", "(_", "u", "'", "Target", " ", "Model", "'_", ")_", ",_", "widget_", "=_", "ex", "widgets_", "._", "Admi", "n", "Select", "Widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Model", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "dashboard_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dashboard_", "=_", "dashboard_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Model", "Base", "Widget_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "dashboard_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "model", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "label_", "=_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model", "\\u", "name_", "=_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Model", "Base", "Widget_", ",_", "self_", ")_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "perm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dashboard_", "._", "has", "\\u", "model", "\\u", "perm_", "(_", "self_", "._", "model_", ",_", "self_", "._", "model", "\\u", "perm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "filt", "e\\u", "choice", "s", "\\u", "model_", "(_", "self_", ",_", "model_", ",_", "model", "admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dashboard_", "._", "has", "\\u", "model", "\\u", "perm_", "(_", "model_", ",_", "self_", "._", "model", "\\u", "perm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "model", "\\u", "admin", "\\u", "url_", "(_", "self_", ",_", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reverse_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", ":", "%", "s", "\\u", "%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "self_", "._", "admin", "\\u", "site_", "._", "app", "\\u", "name_", ",_", "self_", "._", "app", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "model", "\\u", "name_", ",_", "name_", ")_", ",_", "args_", "=_", "args_", ",_", "kwargs_", "=_", "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_", "Parti", "al", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Parti", "al", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "view", "\\u", "class_", "(_", "self_", ",_", "view", "\\u", "class_", ",_", "model_", "=_", "None_", ",_", "**_", "opts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin", "\\u", "class_", "=_", "self_", "._", "admin", "\\u", "site_", "._", "\\u", "registry_", "._", "get_", "(_", "model_", ")_", "if_", "model_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "admin", "\\u", "site_", "._", "get", "\\u", "view", "\\u", "class_", "(_", "view", "\\u", "class_", ",_", "admin", "\\u", "class_", ",_", "**_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parti", "al", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "factory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Request", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parti", "al", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "request_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "=_", "self_", "._", "request_", "._", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parti", "al", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "get", "\\u", "request_", "(_", "self_", ",_", "path_", ",_", "data_", "=_", "{_", "}_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "self_", "._", "get", "\\u", "factory_", "(_", ")_", "._", "get_", "(_", "path_", ",_", "data_", ",_", "**_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "setup", "\\u", "request_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parti", "al", "Base", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "post", "\\u", "request_", "(_", "self_", ",_", "path_", ",_", "data_", "=_", "{_", "}_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "self_", "._", "get", "\\u", "factory_", "(_", ")_", "._", "post_", "(_", "path_", ",_", "data_", ",_", "**_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "setup", "\\u", "request_", "(_", "req_", ")_", "\\u\\u\\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_", "@_", "widget", "\\u", "manager_", "._", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Qui", "ck", "Bt", "n", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget", "\\u", "type_", "=_", "'", "qb", "utt", "on", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "\\u_", "(_", "u", "'", "Qui", "ck", " ", "button", " ", "Wid", "get", ",", " ", "quickl", "y", " ", "open", " ", "any", " ", "page", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "\"", "xad", "min", "/", "widget", "s", "/", "qb", "utt", "on", ".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "title_", "=_", "\\u_", "(_", "u", "\"", "Qui", "ck", " ", "Butt", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget", "\\u", "icon_", "=_", "'", "fa", " ", "fa", "-", "caret", "-", "square", "-", "o", "-", "right", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Qui", "ck", "Bt", "n", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "convert_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "q", "\\u", "btn", "s_", "=_", "data_", "._", "pop_", "(_", "'", "btn", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qui", "ck", "Bt", "n", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "model_", "(_", "self_", ",_", "model", "\\u", "or", "\\u", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "model", "\\u", "or", "\\u", "label_", ",_", "Model", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "model", "\\u", "or", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "apps_", "._", "get", "\\u", "model_", "(_", "*_", "model", "\\u", "or", "\\u", "label_", "._", "lower_", "(_", ")_", "._", "split_", "(_", "'.'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qui", "ck", "Bt", "n", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "context_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "btn", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "b_", "in_", "self_", "._", "q", "\\u", "btn", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "btn_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "model", "'_", "in_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "self_", "._", "get", "\\u", "model_", "(_", "b_", "[_", "'", "model", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "user_", "._", "has", "\\u", "perm_", "(_", "\"%", "s", ".", "view", "\\u", "%", "s", "\"_", "%_", "(_", "model_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "model_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ")_", ")_", ":_", "\\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_", "btn_", "[_", "'", "url", "'_", "]_", "=_", "reverse_", "(_", "\"%", "s", ":", "%", "s", "\\u", "%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "self_", "._", "admin", "\\u", "site_", "._", "app", "\\u", "name_", ",_", "model_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ",_", "b_", "._", "get_", "(_", "'", "view", "'_", ",_", "'", "changeli", "st", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "btn_", "[_", "'", "title", "'_", "]_", "=_", "model_", "._", "\\u", "meta_", "._", "verbo", "se", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "btn_", "[_", "'", "icon", "'_", "]_", "=_", "self_", "._", "dashboard_", "._", "get", "\\u", "model", "\\u", "icon_", "(_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "btn_", "[_", "'", "url", "'_", "]_", "=_", "reverse_", "(_", "b_", "[_", "'", "url", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Revers", "e", "Match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "btn_", "[_", "'", "url", "'_", "]_", "=_", "b_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "title", "'_", "in_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "btn_", "[_", "'", "title", "'_", "]_", "=_", "b_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "icon", "'_", "in_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "btn_", "[_", "'", "icon", "'_", "]_", "=_", "b_", "[_", "'", "icon", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "btn", "s_", "._", "append_", "(_", "btn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "._", "update_", "(_", "{_", "'", "btn", "s", "'_", ":_", "btn", "s_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qui", "ck", "Bt", "n", "Widget_", "(_", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "perm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "widget", "\\u", "manager_", "._", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "List", "Widget_", "(_", "Model", "Base", "Widget_", ",_", "Parti", "al", "Base", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget", "\\u", "type_", "=_", "'", "list", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "\\u_", "(_", "u", "'", "Any", " ", "Object", "s", " ", "list", " ", "Wid", "get", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "\"", "xad", "min", "/", "widget", "s", "/", "list", ".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "perm_", "=_", "'", "view", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget", "\\u", "icon_", "=_", "'", "fa", " ", "fa", "-", "align", "-", "justif", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Widget_", "(_", "Model", "Base", "Widget_", ",_", "Parti", "al", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "convert_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "list", "\\u", "params_", "=_", "data_", "._", "pop_", "(_", "'", "params", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list", "\\u", "count_", "=_", "data_", "._", "pop_", "(_", "'", "count", "'_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "List", "Widget_", "(_", "Model", "Base", "Widget_", ",_", "Parti", "al", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "List", "Widget_", ",_", "self_", ")_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "title_", "=_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "verbo", "se", "\\u", "name", "\\u", "plural_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req_", "=_", "self_", "._", "make", "\\u", "get", "\\u", "request_", "(_", "\"\"_", ",_", "self_", "._", "list", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list", "\\u", "view_", "=_", "self_", "._", "get", "\\u", "view", "\\u", "class_", "(_", "List", "Admi", "n", "View_", ",_", "self_", "._", "model_", ")_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "list", "\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "list", "\\u", "view_", "._", "list", "\\u", "per", "\\u", "page_", "=_", "self_", "._", "list", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "List", "Widget_", "(_", "Model", "Base", "Widget_", ",_", "Parti", "al", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "context_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "view_", "=_", "self_", "._", "list", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "view_", "._", "make", "\\u", "result", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "fields_", "=_", "list", "\\u", "view_", "._", "base", "\\u", "list", "\\u", "display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "base", "\\u", "fields_", ")_", ">_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "fields_", "=_", "base", "\\u", "fields_", "[_", "0_", ":_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "'", "result", "\\u", "header", "s", "'_", "]_", "=_", "[_", "c_", "for_", "c_", "in_", "list", "\\u", "view_", "._", "result", "\\u", "headers_", "(_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "cells_", "if_", "c_", "._", "field", "\\u", "name_", "in_", "base", "\\u", "fields_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "results", "'_", "]_", "=_", "[_", "[_", "o_", "for_", "i_", ",_", "o_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "enumerate_", "(_", "filter_", "(_", "lambda_", "c_", ":_", "c_", "._", "field", "\\u", "name_", "in_", "base", "\\u", "fields_", ",_", "r_", "._", "cells_", ")_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "r_", "in_", "list", "\\u", "view_", "._", "results_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "result", "\\u", "count", "'_", "]_", "=_", "list", "\\u", "view_", "._", "result", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "page", "\\u", "url", "'_", "]_", "=_", "self_", "._", "model", "\\u", "admin", "\\u", "url_", "(_", "'", "changeli", "st", "'_", ")_", "+_", "\"?\"_", "+_", "urlencode_", "(_", "self_", "._", "list", "\\u", "params_", ")_", "\\u\\u\\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_", "@_", "widget", "\\u", "manager_", "._", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Add", "Form", "Widget_", "(_", "Model", "Base", "Widget_", ",_", "Parti", "al", "Base", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget", "\\u", "type_", "=_", "'", "add", "form", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "\\u_", "(_", "u", "'", "Add", " ", "any", " ", "model", " ", "object", " ", "Wid", "get", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "\"", "xad", "min", "/", "widget", "s", "/", "add", "form", ".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "perm_", "=_", "'", "add", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget", "\\u", "icon_", "=_", "'", "fa", " ", "fa", "-", "plus", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Add", "Form", "Widget_", "(_", "Model", "Base", "Widget_", ",_", "Parti", "al", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Add", "Form", "Widget_", ",_", "self_", ")_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "title_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "title_", "=_", "\\u_", "(_", "'", "Add", " ", "%", "s", "'_", ")_", "%_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "verbo", "se", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req_", "=_", "self_", "._", "make", "\\u", "get", "\\u", "request_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "view_", "=_", "self_", "._", "get", "\\u", "view", "\\u", "class_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Creat", "e", "Admi", "n", "View_", ",_", "self_", "._", "model_", ",_", "list", "\\u", "per", "\\u", "page_", "=_", "10_", ")_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "view_", "._", "instance", "\\u", "forms_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Form", "Widget_", "(_", "Model", "Base", "Widget_", ",_", "Parti", "al", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "context_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "helper_", "=_", "Form", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "helper_", "._", "form", "\\u", "tag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "form", "'_", ":_", "self_", "._", "add", "\\u", "view_", "._", "form", "\\u", "obj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "help", "er", "'_", ":_", "helper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "url", "'_", ":_", "self_", "._", "add", "\\u", "view_", "._", "model", "\\u", "admin", "\\u", "url_", "(_", "'", "add", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "self_", "._", "model_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Form", "Widget_", "(_", "Model", "Base", "Widget_", ",_", "Parti", "al", "Base", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "media_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "add", "\\u", "view_", "._", "media_", "+_", "self_", "._", "add", "\\u", "view_", "._", "form", "\\u", "obj_", "._", "media_", "+_", "self_", "._", "vendor_", "(_", "'", "xad", "min", ".", "plugin", ".", "quick", "-", "form", ".", "js", "'_", ")_", "\\u\\u\\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_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget", "\\u", "customi", "z_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "\\u_", "(_", "u", "\"", "Dash", "board", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icon_", "=_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "page", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "request_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "portal", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "dash", "board", ":", "%", "s", ":", "pos", "\"_", "%_", "self_", "._", "get", "\\u", "page", "\\u", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "filter", "\\u", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "widget_", "(_", "self_", ",_", "widget", "\\u", "or", "\\u", "id_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "widget", "\\u", "or", "\\u", "id_", ",_", "User", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "widget", "\\u", "or", "\\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 ", " _", "widget_", "=_", "User", "Widget_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "self_", "._", "user_", ",_", "page", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "page", "\\u", "id_", "(_", ")_", ",_", "id_", "=_", "widget", "\\u", "or", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wid_", "=_", "widget", "\\u", "manager_", "._", "get_", "(_", "widget_", "._", "widget", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "widget", "\\u", "with", "\\u", "perm_", "(_", "wid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "context_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "super_", "(_", "widget", "\\u", "with", "\\u", "perm_", ",_", "self_", ")_", "._", "context_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "update_", "(_", "{_", "'", "has", "\\u", "change", "\\u", "permissi", "on", "'_", ":_", "self_", "._", "request_", "._", "user_", "._", "has", "\\u", "perm_", "(_", "'", "xad", "min", ".", "change", "\\u", "user", "widget", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wid", "\\u", "instance_", "=_", "widget", "\\u", "with", "\\u", "perm_", "(_", "self_", ",_", "data_", "or_", "widget_", "._", "get", "\\u", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "wid", "\\u", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "User", "Widget_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "filter", "\\u", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "init", "\\u", "widget_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "self_", "._", "widgets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col_", "in_", "widgets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal", "\\u", "col_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opts_", "in_", "col_", ":_", "\\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 ", " ", "_", "widget_", "=_", "User", "Widget_", "(_", "user_", "=_", "self_", "._", "user_", ",_", "page", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "page", "\\u", "id_", "(_", ")_", ",_", "widget", "\\u", "type_", "=_", "opts_", "[_", "'", "type", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "._", "set\\u", "value_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "col_", "._", "append_", "(_", "self_", "._", "get", "\\u", "widget_", "(_", "widget_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Permi", "ssion", "Denied_", ",_", "Wid", "get", "Data", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "widget_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "portal_", "._", "append_", "(_", "portal", "\\u", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "User", "Settings_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "user_", ",_", "key_", "=_", "\"", "dash", "board", ":", "%", "s", ":", "pos", "\"_", "%_", "self_", "._", "get", "\\u", "page", "\\u", "id_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "'|'_", "._", "join_", "(_", "[_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "w_", "._", "id_", ")_", "for_", "w_", "in_", "col_", "]_", ")_", "for_", "col_", "in_", "portal_", "]_", ")_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "portal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "filter", "\\u", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "widgets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "widget", "\\u", "customi", "z_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal", "\\u", "pos_", "=_", "User", "Settings_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "user_", ",_", "key_", "=_", "self_", "._", "get", "\\u", "portal", "\\u", "key_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "portal", "\\u", "pos_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal", "\\u", "pos_", "=_", "portal", "\\u", "pos_", "[_", "0_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "portal", "\\u", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "user", "\\u", "widgets_", "=_", "dict_", "(_", "[_", "(_", "uw", "_", "._", "id_", ",_", "uw", "_", ")_", "for_", "uw", "_", "in_", "User", "Widget_", "._", "objects_", "._", "filter_", "(_", "user_", "=_", "self_", "._", "user_", ",_", "page", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "page", "\\u", "id_", "(_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col_", "in_", "portal", "\\u", "pos_", "._", "split_", "(_", "'|'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ws_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "wid_", "in_", "col_", "._", "split_", "(_", "','_", ")_", ":_", "\\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 ", " ", " _", "widget_", "=_", "user", "\\u", "widgets_", "._", "get_", "(_", "int_", "(_", "wid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "widget_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ws_", "._", "append_", "(_", "self_", "._", "get", "\\u", "widget_", "(_", "widget_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "error_", "(_", "e_", ",_", "exc", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "widgets_", "._", "append_", "(_", "ws_", ")_", "\\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_", "widgets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "get", "\\u", "init", "\\u", "widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "filter", "\\u", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "title_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "filter", "\\u", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "self_", "._", "get", "\\u", "title_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "icon", "'_", ":_", "self_", "._", "icon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "portal", "\\u", "key", "'_", ":_", "self_", "._", "get", "\\u", "portal", "\\u", "key_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "(_", "'", "col", "-", "sm", "-%", "d", "'_", "%_", "int_", "(_", "12_", "/_", "len_", "(_", "self_", "._", "widgets_", ")_", ")_", ",_", "ws_", ")_", "for_", "ws_", "in_", "self_", "._", "widgets_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "add", "\\u", "widget", "\\u", "permissi", "on", "'_", ":_", "self_", "._", "has", "\\u", "model", "\\u", "perm_", "(_", "User", "Widget_", ",_", "'", "add", "'_", ")_", "and_", "self_", "._", "widget", "\\u", "customi", "z_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "\\u", "widget", "\\u", "url", "'_", ":_", "self_", "._", "get", "\\u", "admin", "\\u", "url_", "(_", "'%", "s", "\\u", "%", "s", "\\u", "add", "'_", "%_", "(_", "User", "Widget_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "User", "Widget_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ")_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"?", "user", "=", "%", "s", "&", "page", "\\u", "id", "=", "%", "s", "&\\u", "redirec", "t", "=", "%", "s", "\"_", "%_", "(_", "self_", "._", "user_", "._", "id_", ",_", "self_", "._", "get", "\\u", "page", "\\u", "id_", "(_", ")_", ",_", "url", "quote_", "(_", "self_", "._", "request_", "._", "get", "\\u", "full", "\\u", "path_", "(_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "super_", "(_", "Dash", "board_", ",_", "self_", ")_", "._", "get", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "update_", "(_", "new", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "neve", "r", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widgets_", "=_", "self_", "._", "get", "\\u", "widgets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "template", "\\u", "response_", "(_", "'", "xad", "min", "/", "views", "/", "dash", "board", ".", "html", "'_", ",_", "self_", "._", "get", "\\u", "context_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "csr", "f", "\\u", "protect", "\\u", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "id", "'_", "in_", "request_", "._", "POST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget", "\\u", "id_", "=_", "request_", "._", "POST_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "POST_", "._", "get_", "(_", "'\\u", "delete", "'_", ",_", "None_", ")_", "!=_", "'", "on", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "self_", "._", "get", "\\u", "widget_", "(_", "widget", "\\u", "id_", ",_", "request_", "._", "POST_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "widget_", "=_", "User", "Widget_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "user_", ",_", "page", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "page", "\\u", "id_", "(_", ")_", ",_", "id_", "=_", "widget", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "portal", "\\u", "pos_", "=_", "User", "Settings_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "self_", "._", "user_", ",_", "key_", "=_", "\"", "dash", "board", ":", "%", "s", ":", "pos", "\"_", "%_", "self_", "._", "get", "\\u", "page", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "[_", "[_", "w_", "for_", "w_", "in_", "col_", "._", "split_", "(_", "','_", ")_", "if_", "w_", "!=_", "str_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "widget", "\\u", "id_", ")_", "]_", "for_", "col_", "in_", "portal", "\\u", "pos_", "._", "value_", "._", "split_", "(_", "'|'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "pos_", "._", "value_", "=_", "'|'_", "._", "join_", "(_", "[_", "','_", "._", "join_", "(_", "col_", ")_", "for_", "col_", "in_", "pos_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "pos_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "User", "Widget_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "get_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board_", "(_", "Comm", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "filter", "\\u", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "media_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "media_", "=_", "super_", "(_", "Dash", "board_", ",_", "self_", ")_", "._", "get", "\\u", "media_", "(_", ")_", "+_", "self_", "._", "vendor_", "(_", "'", "xad", "min", ".", "page", ".", "dash", "board", ".", "js", "'_", ",_", "'", "xad", "min", ".", "page", ".", "dash", "board", ".", "css", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "widget", "\\u", "customi", "z_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "media_", "=_", "media_", "+_", "self_", "._", "vendor_", "(_", "'", "xad", "min", ".", "plugin", ".", "portal", ".", "js", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ws_", "in_", "self_", "._", "widgets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "widget_", "in_", "ws_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "media_", "=_", "media_", "+_", "widget_", "._", "media_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "media_", "\\u\\u\\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_", "Model", "Dash", "board_", "(_", "Dash", "board_", ",_", "Model", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "\\u_", "(_", "u", "\"%", "s", " ", "Dash", "board", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Model", "Dash", "board_", "(_", "Dash", "board_", ",_", "Model", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "page", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "model", ":", "%", "s", "/", "%", "s", "'_", "%_", "self_", "._", "model", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dash", "board_", "(_", "Dash", "board_", ",_", "Model", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "filter", "\\u", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "title_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "title_", "%_", "force", "\\u", "unicode_", "(_", "self_", "._", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dash", "board_", "(_", "Dash", "board_", ",_", "Model", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "request_", "(_", "self_", ",_", "object\\u", "id_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "obj_", "=_", "self_", "._", "get", "\\u", "object_", "(_", "unquote_", "(_", "object\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "view", "\\u", "permission_", "(_", "self_", "._", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "(_", "\\u_", "(_", "'%", "(", "name", ")", "s", " ", "object", " ", "with", " ", "primary", " ", "key", " ", "%", "(", "key", ")", "r", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "name", "'_", ":_", "force", "\\u", "unicode_", "(_", "self_", "._", "opts_", "._", "verbo", "se", "\\u", "name_", ")_", ",_", "'", "key", "'_", ":_", "escape_", "(_", "object\\u", "id_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dash", "board_", "(_", "Dash", "board_", ",_", "Model", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "filter", "\\u", "hook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "change", "\\u", "permissi", "on", "'_", ":_", "self_", "._", "has", "\\u", "change", "\\u", "permission_", "(_", "self_", "._", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "'_", ":_", "self_", "._", "obj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "Dash", "board_", "._", "get", "\\u", "context_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "update_", "(_", "Model", "Admi", "n", "View_", "._", "get", "\\u", "context_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "update_", "(_", "new", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Dash", "board_", "(_", "Dash", "board_", ",_", "Model", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "neve", "r", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widgets_", "=_", "self_", "._", "get", "\\u", "widgets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "template", "\\u", "response_", "(_", "self_", "._", "get", "\\u", "template", "\\u", "list_", "(_", "'", "views", "/", "model", "\\u", "dash", "board", ".", "html", "'_", ")_", ",_", "self_", "._", "get", "\\u", "context_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
anandology/pyjamas/examples/kitchensink/Text.py
[ { "content": "from Sink import Sink, SinkInfo\nfrom pyjamas.ui.Button import Button\nfrom pyjamas.ui.HorizontalPanel import HorizontalPanel\nfrom pyjamas.ui.HTML import HTML\nfrom pyjamas.ui.PasswordTextBox import PasswordTextBox\nfrom pyjamas.ui.TextArea import TextArea\nfrom pyjamas.ui.TextBox import TextBox\nfrom pyjamas.ui.TextBoxBase import TextBoxBase\nfrom pyjamas.ui.VerticalPanel import VerticalPanel\nfrom pyjamas.ui.Widget import Widget\n\n\n\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Text(Sink):\n\n \n\n", "metadata": "root.Text", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self):\n Sink.__init__(self)\n self.fPasswordText = PasswordTextBox()\n self.fTextArea = TextArea()\n self.fTextBox = TextBox()\n\n panel = VerticalPanel()\n panel.setSpacing(8)\n panel.add(HTML(\"Normal text box:\"))\n panel.add(self.createTextThing(self.fTextBox))\n panel.add(HTML(\"Password text box:\"))\n panel.add(self.createTextThing(self.fPasswordText))\n panel.add(HTML(\"Text area:\"))\n panel.add(self.createTextThing(self.fTextArea))\n \n panel.add(HTML(\"\"\"Textarea below demos oninput event. oninput allows\nto detect when the content of an element has changed. This is different\nfrom examples above, where changes are detected only if they are made with\nkeyboard. oninput occurs when the content is changed through any user\ninterface(keyboard, mouse, etc.). For example, at first type few chars, but\nthen paste some text to the text areas above and below by selecting 'Paste'\ncommand from context menu or by dragging&dropping and see the difference.\noninput is similar to onchange event, but onchange event fires only when a\ntext-entry widget loses focus.\"\"\"))\n vp = VerticalPanel()\n self.echo = HTML()\n textArea = TextArea()\n vp.add(textArea)\n vp.add(self.echo)\n textArea.addInputListener(self)\n panel.add(vp)\n \n self.initWidget(panel)", "metadata": "root.Text.__init__", "header": "['class', 'Text', '(', 'Sink', ')', ':', '___EOS___']", "index": 12 }, { "content": " def onShow(self):\n pass", "metadata": "root.Text.onShow", "header": "['class', 'Text', '(', 'Sink', ')', ':', '___EOS___']", "index": 46 }, { "content": " def onInput(self, sender):\n self.echo.setText(sender.getText())", "metadata": "root.Text.onInput", "header": "['class', 'Text', '(', 'Sink', ')', ':', '___EOS___']", "index": 49 }, { "content": " def createTextThing(self, textBox):\n p = HorizontalPanel()\n p.setSpacing(4)\n\n p.add(textBox)\n\n echo = HTML()\n select_all = Button(\"select all\")\n p.add(select_all)\n p.add(echo)\n \n listener=TextBoxListener(self, textBox, echo, select_all)\n select_all.addClickListener(listener)\n textBox.addKeyboardListener(listener)\n textBox.addClickListener(listener)\n\n return p", "metadata": "root.Text.createTextThing", "header": "['class', 'Text', '(', 'Sink', ')', ':', '___EOS___']", "index": 52 }, { "content": " def updateText(self, text, echo):\n echo.setHTML(\"Text: \" + text.getText() + \"<br>\" + \"Selection: %d\" % text.getCursorPos() + \", %d\" % text.getSelectionLength())", "metadata": "root.Text.updateText", "header": "['class', 'Text', '(', 'Sink', ')', ':', '___EOS___']", "index": 70 }, { "content": "class TextBoxListener:\n \n\n\n ", "metadata": "root.TextBoxListener", "header": "['module', '___EOS___']", "index": 74 }, { "content": " def __init__(self, parent, textBox, echo, select_all):\n self.textBox=textBox\n self.echo=echo\n self.parent=parent\n self.select_all=select_all", "metadata": "root.TextBoxListener.__init__", "header": "['class', 'TextBoxListener', ':', '___EOS___']", "index": 75 }, { "content": " def onClick(self, sender):\n if sender == self.select_all:\n self.textBox.selectAll()\n self.textBox.setFocus(True)\n\n self.parent.updateText(self.textBox, self.echo)", "metadata": "root.TextBoxListener.onClick", "header": "['class', 'TextBoxListener', ':', '___EOS___']", "index": 81 }, { "content": " def onKeyUp(self, sender, keyCode, modifiers):\n self.parent.updateText(self.textBox, self.echo)", "metadata": "root.TextBoxListener.onKeyUp", "header": "['class', 'TextBoxListener', ':', '___EOS___']", "index": 88 }, { "content": " def onKeyDown(self, sender, keyCode, modifiers):\n pass", "metadata": "root.TextBoxListener.onKeyDown", "header": "['class', 'TextBoxListener', ':', '___EOS___']", "index": 91 }, { "content": " def onKeyPress(self, sender, keyCode, modifiers):\n pass", "metadata": "root.TextBoxListener.onKeyPress", "header": "['class', 'TextBoxListener', ':', '___EOS___']", "index": 94 }, { "content": "def init():\n text=\"GWT includes the standard complement of text-entry widgets, each of which \"\n text+=\"supports keyboard and selection events you can use to control text entry. \"\n text+=\"In particular, notice that the selection range for each widget is \"\n text+=\"updated whenever you press a key. \"\n text+=\"This can be a bit tricky on some browsers, but the GWT class library \"\n text+=\"takes care of the plumbing for you automatically.\"\n return SinkInfo(\"Text\", text, Text)", "metadata": "root.init", "header": "['module', '___EOS___']", "index": 98 } ]
[ { "span": "from pyjamas.ui.TextBoxBase import TextBoxBase", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 46 }, { "span": "from pyjamas.ui.Widget import Widget", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 36 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "Sink_", "import_", "Sink_", ",_", "Sin", "k", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Button_", "import_", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Horiz", "onta", "l", "Panel_", "import_", "Horiz", "onta", "l", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "HTML_", "import_", "HTML_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Passw", "ord", "Text", "Box_", "import_", "Passw", "ord", "Text", "Box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Text", "Area_", "import_", "Text", "Area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Text", "Box_", "import_", "Text", "Box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Text", "Box", "Base_", "import_", "Text", "Box", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Vertica", "l", "Panel_", "import_", "Vertica", "l", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Widget_", "import_", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Text_", "(_", "Sink_", ")_", ":_", "\\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_", "Text_", "(_", "Sink_", ")_", ":_", "\\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 ", " _", "Sink_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "f", "Passw", "ord", "Text_", "=_", "Passw", "ord", "Text", "Box_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "f", "Text", "Area_", "=_", "Text", "Area_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "f", "Text", "Box_", "=_", "Text", "Box_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "panel_", "=_", "Vertica", "l", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "set", "Spacing_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "add_", "(_", "HTML_", "(_", "\"", "Normal", " ", "text", " ", "box", ":\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "add_", "(_", "self_", "._", "create", "Text", "Thing_", "(_", "self_", "._", "f", "Text", "Box_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "add_", "(_", "HTML_", "(_", "\"", "Passw", "ord", " ", "text", " ", "box", ":\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "add_", "(_", "self_", "._", "create", "Text", "Thing_", "(_", "self_", "._", "f", "Passw", "ord", "Text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "add_", "(_", "HTML_", "(_", "\"", "Text", " ", "area", ":\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "add_", "(_", "self_", "._", "create", "Text", "Thing_", "(_", "self_", "._", "f", "Text", "Area_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "panel_", "._", "add_", "(_", "HTML_", "(_", "\"\"\"", "Text", "area", " ", "belo", "w", " ", "demo", "s", " ", "oni", "nput", " ", "event", ".", " ", "oni", "nput", " ", "allow", "s", "\\", "10", ";", "to", " ", "detect", " ", "whe", "n", " ", "the", " ", "content", " ", "of", " ", "an", " ", "element", " ", "has", " ", "change", "d", ".", " ", "Thi", "s", " ", "is", " ", "different", "\\", "10", ";", "from", " ", "example", "s", " ", "above", ",", " ", "where", " ", "change", "s", " ", "are", " ", "detect", "ed", " ", "only", " ", "if", " ", "the", "y", " ", "are", " ", "made", " ", "with", "\\", "10", ";", "keyb", "oard", ".", " ", "oni", "nput", " ", "occur", "s", " ", "whe", "n", " ", "the", " ", "content", " ", "is", " ", "change", "d", " ", "through", " ", "any", " ", "user", "\\", "10", ";", "interface", "(", "keyb", "oard", ",", " ", "mouse", ",", " ", "etc", ".)", ".", " ", "For", " ", "example", ",", " ", "at", " ", "first", " ", "type", " ", "few", " ", "char", "s", ",", " ", "but", "\\", "10", ";", "then", " ", "paste", " ", "some", " ", "text", " ", "to", " ", "the", " ", "text", " ", "area", "s", " ", "above", " ", "and", " ", "belo", "w", " ", "by", " ", "selecti", "ng", " ", "'", "Past", "e", "'", "\\", "10", ";", "command", " ", "from", " ", "context", " ", "menu", " ", "or", " ", "by", " ", "dragg", "ing", "&", "drop", "ping", " ", "and", " ", "see", " ", "the", " ", "difference", ".", "\\", "10", ";", "oni", "nput", " ", "is", " ", "similar", " ", "to", " ", "onchange", " ", "event", ",", " ", "but", " ", "onchange", " ", "event", " ", "fires", " ", "only", " ", "whe", "n", " ", "a", "\\", "10", ";", "text", "-", "entry", " ", "widget", " ", "lose", "s", " ", "foc", "us", ".\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vp_", "=_", "Vertica", "l", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "echo_", "=_", "HTML_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "Area_", "=_", "Text", "Area_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vp_", "._", "add_", "(_", "text", "Area_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vp_", "._", "add_", "(_", "self_", "._", "echo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "Area_", "._", "add", "Inp", "ut", "Listener_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "add_", "(_", "vp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "init", "Widget_", "(_", "panel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text_", "(_", "Sink_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Show_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text_", "(_", "Sink_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Input_", "(_", "self_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "echo_", "._", "set", "Text_", "(_", "sender_", "._", "get", "Text_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text_", "(_", "Sink_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Text", "Thing_", "(_", "self_", ",_", "text", "Box_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Horiz", "onta", "l", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "set", "Spacing_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "add_", "(_", "text", "Box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "echo_", "=_", "HTML_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "select", "\\u", "all_", "=_", "Button_", "(_", "\"", "select", " ", "all", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "add_", "(_", "select", "\\u", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "add_", "(_", "echo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "listener_", "=_", "Text", "Box", "Listener_", "(_", "self_", ",_", "text", "Box_", ",_", "echo_", ",_", "select", "\\u", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "select", "\\u", "all_", "._", "add", "Click", "Listener_", "(_", "listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "Box_", "._", "add", "Key", "board", "Listener_", "(_", "listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "Box_", "._", "add", "Click", "Listener_", "(_", "listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text_", "(_", "Sink_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Text_", "(_", "self_", ",_", "text_", ",_", "echo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "echo_", "._", "set", "HTML_", "(_", "\"", "Text", ":", " ", "\"_", "+_", "text_", "._", "get", "Text_", "(_", ")_", "+_", "\"<", "br", ">\"_", "+_", "\"", "Selecti", "on", ":", " ", "%", "d", "\"_", "%_", "text_", "._", "get", "Curs", "or", "Pos_", "(_", ")_", "+_", "\",", " ", "%", "d", "\"_", "%_", "text_", "._", "get", "Selecti", "on", "Length_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Text", "Box", "Listener_", ":_", "\\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_", "Text", "Box", "Listener_", ":_", "\\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_", ",_", "parent_", ",_", "text", "Box_", ",_", "echo_", ",_", "select", "\\u", "all_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "text", "Box_", "=_", "text", "Box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "echo_", "=_", "echo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "select", "\\u", "all_", "=_", "select", "\\u", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text", "Box", "Listener_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Click_", "(_", "self_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sender_", "==_", "self_", "._", "select", "\\u", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "text", "Box_", "._", "select", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "text", "Box_", "._", "set", "Focus_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "parent_", "._", "update", "Text_", "(_", "self_", "._", "text", "Box_", ",_", "self_", "._", "echo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text", "Box", "Listener_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Key", "Up_", "(_", "self_", ",_", "sender_", ",_", "key", "Code_", ",_", "modifiers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "update", "Text_", "(_", "self_", "._", "text", "Box_", ",_", "self_", "._", "echo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text", "Box", "Listener_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Key", "Down_", "(_", "self_", ",_", "sender_", ",_", "key", "Code_", ",_", "modifiers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text", "Box", "Listener_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Key", "Press_", "(_", "self_", ",_", "sender_", ",_", "key", "Code_", ",_", "modifiers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "\"", "GW", "T", " ", "include", "s", " ", "the", " ", "standard", " ", "complement", " ", "of", " ", "text", "-", "entry", " ", "widget", "s", ",", " ", "each", " ", "of", " ", "whi", "ch", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "\"", "support", "s", " ", "keyb", "oard", " ", "and", " ", "selection", " ", "events", " ", "you", " ", "can", " ", "use", " ", "to", " ", "control", " ", "text", " ", "entry", ".", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "\"", "In", " ", "partic", "ular", ",", " ", "notice", " ", "tha", "t", " ", "the", " ", "selection", " ", "range", " ", "for", " ", "each", " ", "widget", " ", "is", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "\"", "update", "d", " ", "whe", "neve", "r", " ", "you", " ", "press", " ", "a", " ", "key", ".", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "\"", "Thi", "s", " ", "can", " ", "be", " ", "a", " ", "bit", " ", "trick", "y", " ", "on", " ", "some", " ", "browsers", ",", " ", "but", " ", "the", " ", "GW", "T", " ", "class", " ", "librar", "y", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "\"", "take", "s", " ", "care", " ", "of", " ", "the", " ", "plum", "bing", " ", "for", " ", "you", " ", "automati", "call", "y", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Sin", "k", "Info_", "(_", "\"", "Text", "\"_", ",_", "text_", ",_", "Text_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 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2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 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 ]
Unused import
weecology/retriever/scripts/npn.py
[ { "content": "#retriever\n\"\"\"Retriever script for National Phenology Network data\n\"\"\"\n\nimport os\nimport urllib\nimport zipfile\nfrom decimal import Decimal\nfrom retriever.lib.templates import Script\nfrom retriever.lib.models import Table, Cleanup, no_cleanup, correct_invalid_value\n\nVERSION = '0.5'\n\n\n\n\nSCRIPT = main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class main(Script):", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __init__(self, **kwargs):\n Script.__init__(self, **kwargs)\n self.name = \"USA National Phenology Network\"\n self.shortname = \"NPN\"\n self.ref = \"http://www.usanpn.org/results/data\"\n self.tags = [\"Data Type > Phenology\", \"Spatial Scale > Continental\"]\n self.description = \"The data set was collected via Nature's Notebook phenology observation program (2009-present), and (2) Lilac and honeysuckle data (1955-present)\"\n self.citation = \"Schwartz, M. D., Ault, T. R., & J. L. Betancourt, 2012: Spring Onset Variations and Trends in the Continental USA: Past and Regional Assessment Using Temperature-Based Indices. International Journal of Climatology (published online, DOI: 10.1002/joc.3625).\"", "metadata": "root.main.__init__", "header": "['class', 'main', '(', 'Script', ')', ':', '___EOS___']", "index": 15 }, { "content": " def download(self, engine=None, debug=False):\n Script.download(self, engine, debug)\n\n engine = self.engine\n\n taxa = ('Plant', 'Animal')\n\n for tax in taxa:\n table = Table(tax.lower() + 's', delimiter=',', header_rows = 3, pk='record_id', contains_pk=True)\n\n columns = [(\"record_id\" , (\"pk-int\",) ),\n (\"station_id\" , (\"int\",) ),\n (\"obs_date\" , (\"char\",) ),\n (\"ind_id\" , (\"int\",) ),\n (\"sci_name\" , (\"char\",) ),\n (\"com_name\" , (\"char\",) ),\n (\"kingdom\" , (\"char\",) ),\n (\"pheno_cat\" , (\"char\",) ),\n (\"pheno_name\" , (\"char\",) ),\n (\"pheno_status\" , (\"char\",) ),\n (\"lat\" , (\"double\",) ),\n (\"lon\" , (\"double\",) ),\n (\"elevation\" , (\"int\",) ),\n (\"network_name\" , (\"char\",) )]\n table.columns = columns\n\n engine.table = table\n engine.create_table()\n\n base_url = 'http://www.usanpn.org/getObs/observations/'\n years = range(2009, 2013)\n\n for year in years:\n if year == 2009 and tax == 'Animal': continue\n\n url = base_url + 'get%s%sDataNoDefinitions' % (year, tax)\n\n filename = '%s_%s.csv' % (tax, year)\n engine.download_file(url, filename)\n\n engine.insert_data_from_file(engine.find_file(filename))\n\n return engine", "metadata": "root.main.download", "header": "['class', 'main', '(', 'Script', ')', ':', '___EOS___']", "index": 23 } ]
[ { "span": "import os", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 9 }, { "span": "import urllib", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 13 }, { "span": "import zipfile", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 14 }, { "span": "from decimal import Decimal", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 27 }, { "span": "from retriever.lib.models import Table, Cleanup, no_cleanup, correct_invalid_value", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 82 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "retrieve", "r_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Retrieve", "r", " ", "script", " ", "for", " ", "Nat", "ional", " ", "Phen", "olog", "y", " ", "Network", " ", "data", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "decimal_", "import_", "Decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "retrieve", "r_", "._", "lib_", "._", "templates_", "import_", "Script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "retrieve", "r_", "._", "lib_", "._", "models_", "import_", "Table_", ",_", "Cleanup_", ",_", "no", "\\u", "cleanup_", ",_", "correct", "\\u", "invalid", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VERSION_", "=_", "'", "0.", "5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "SCRIPT_", "=_", "main_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "main_", "(_", "Script_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "main_", "(_", "Script_", ")_", ":_", "\\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_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Script_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "\"", "USA", " ", "Nat", "ional", " ", "Phen", "olog", "y", " ", "Network", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shortname_", "=_", "\"", "NP", "N", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ref_", "=_", "\"", "http", "://", "www", ".", "usa", "np", "n", ".", "org", "/", "results", "/", "data", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tags_", "=_", "[_", "\"", "Data", " ", "Type", " ", ">", " ", "Phen", "olog", "y", "\"_", ",_", "\"", "Spa", "tial", " ", "Scale", " ", ">", " ", "Conti", "nent", "al", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description_", "=_", "\"", "The", " ", "data", " ", "set", " ", "was", " ", "collected", " ", "via", " ", "Nat", "ure", "'", "s", " ", "Notebook", " ", "pheno", "log", "y", " ", "observa", "tion", " ", "program", " ", "(", "200", "9", "-", "presen", "t", "),", " ", "and", " ", "(", "2", ")", " ", "Lil", "ac", " ", "and", " ", "honey", "suc", "kle", " ", "data", " ", "(", "195", "5", "-", "presen", "t", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "citation_", "=_", "\"", "Sch", "war", "tz", ",", " ", "M", ".", " ", "D", ".,", " ", "Au", "lt", ",", " ", "T", ".", " ", "R", ".,", " ", "&", " ", "J", ".", " ", "L", ".", " ", "Beta", "nco", "ur", "t", ",", " ", "2012", ":", " ", "Sprin", "g", " ", "On", "set", " ", "Variation", "s", " ", "and", " ", "Tren", "ds", " ", "in", " ", "the", " ", "Conti", "nent", "al", " ", "USA", ":", " ", "Past", " ", "and", " ", "Region", "al", " ", "Asse", "ssm", "ent", " ", "Us", "ing", " ", "Tempe", "ratur", "e-", "Base", "d", " ", "Indic", "es", ".", " ", "Intern", "ation", "al", " ", "Journ", "al", " ", "of", " ", "Clim", "atol", "og", "y", " ", "(", "publi", "shed", " ", "onli", "ne", ",", " ", "DOI", ":", " ", "10.1", "002", "/", "jo", "c", ".3", "625", ").\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "main_", "(_", "Script_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download_", "(_", "self_", ",_", "engine_", "=_", "None_", ",_", "debug_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Script_", "._", "download_", "(_", "self_", ",_", "engine_", ",_", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "engine_", "=_", "self_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "taxa", "_", "=_", "(_", "'", "Plant", "'_", ",_", "'", "Anima", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "tax_", "in_", "taxa", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "Table_", "(_", "tax_", "._", "lower_", "(_", ")_", "+_", "'", "s", "'_", ",_", "delimiter_", "=_", "','_", ",_", "header", "\\u", "rows_", "=_", "3_", ",_", "pk_", "=_", "'", "record", "\\u", "id", "'_", ",_", "contain", "s", "\\u", "pk_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "[_", "(_", "\"", "record", "\\u", "id", "\"_", ",_", "(_", "\"", "pk", "-", "int", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "station", "\\u", "id", "\"_", ",_", "(_", "\"", "int", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "obs", "\\u", "date", "\"_", ",_", "(_", "\"", "char", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ind", "\\u", "id", "\"_", ",_", "(_", "\"", "int", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "sci", "\\u", "name", "\"_", ",_", "(_", "\"", "char", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "com", "\\u", "name", "\"_", ",_", "(_", "\"", "char", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "kingdom", "\"_", ",_", "(_", "\"", "char", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "pheno", "\\u", "cat", "\"_", ",_", "(_", "\"", "char", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "pheno", "\\u", "name", "\"_", ",_", "(_", "\"", "char", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "pheno", "\\u", "status", "\"_", ",_", "(_", "\"", "char", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "lat", "\"_", ",_", "(_", "\"", "double", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "lon", "\"_", ",_", "(_", "\"", "double", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "elevat", "ion", "\"_", ",_", "(_", "\"", "int", "\"_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "network", "\\u", "name", "\"_", ",_", "(_", "\"", "char", "\"_", ",_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "columns_", "=_", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "engine_", "._", "table_", "=_", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "._", "create", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "url_", "=_", "'", "http", "://", "www", ".", "usa", "np", "n", ".", "org", "/", "get", "Obs", "/", "observa", "tion", "s", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "years_", "=_", "range_", "(_", "2009_", ",_", "2013_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "year_", "in_", "years_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "year_", "==_", "2009_", "and_", "tax_", "==_", "'", "Anima", "l", "'_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "base", "\\u", "url_", "+_", "'", "get", "%", "s", "%", "s", "Data", "No", "Definit", "ion", "s", "'_", "%_", "(_", "year_", ",_", "tax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "'%", "s", "\\u", "%", "s", ".", "csv", "'_", "%_", "(_", "tax_", ",_", "year_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "._", "download", "\\u", "file_", "(_", "url_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "engine_", "._", "insert", "\\u", "data\\u", "from", "\\u", "file_", "(_", "engine_", "._", "find", "\\u", "file_", "(_", "filename_", ")_", ")_", "\\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_", "engine_", "\\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, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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 ]
Except block handles 'BaseException'
adieu/python-openid/examples/server.py
[ { "content": " def do_GET(self):\n try:\n self.parsed_uri = urlparse(self.path)\n self.query = {}\n for k, v in cgi.parse_qsl(self.parsed_uri[4]):\n self.query[k] = v\n\n self.setUser()\n\n path = self.parsed_uri[2].lower()\n\n if path == '/':\n self.showMainPage()\n elif path == '/openidserver':\n self.serverEndPoint(self.query)\n\n elif path == '/login':\n self.showLoginPage('/', '/')\n elif path == '/loginsubmit':\n self.doLogin()\n elif path.startswith('/id/'):\n self.showIdPage(path)\n elif path.startswith('/yadis/'):\n self.showYadis(path[7:])\n elif path == '/serveryadis':\n self.showServerYadis()\n else:\n self.send_response(404)\n self.end_headers()\n\n except (KeyboardInterrupt, SystemExit):\n raise\n except:\n self.send_response(500)\n self.send_header('Content-type', 'text/html')\n self.end_headers()\n self.wfile.write(cgitb.html(sys.exc_info(), context=10))", "metadata": "root.ServerHandler.do_GET", "header": "['class', 'ServerHandler', '(', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']", "index": 63 }, { "content": " def do_POST(self):\n try:\n self.parsed_uri = urlparse(self.path)\n\n self.setUser()\n content_length = int(self.headers['Content-Length'])\n post_data = self.rfile.read(content_length)\n\n self.query = {}\n for k, v in cgi.parse_qsl(post_data):\n self.query[k] = v\n\n path = self.parsed_uri[2]\n if path == '/openidserver':\n self.serverEndPoint(self.query)\n\n elif path == '/allow':\n self.handleAllow(self.query)\n else:\n self.send_response(404)\n self.end_headers()\n\n except (KeyboardInterrupt, SystemExit):\n raise\n except:\n self.send_response(500)\n self.send_header('Content-type', 'text/html')\n self.end_headers()\n self.wfile.write(cgitb.html(sys.exc_info(), context=10))", "metadata": "root.ServerHandler.do_POST", "header": "['class', 'ServerHandler', '(', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']", "index": 101 } ]
[ { "span": "except:", "start_line": 95, "start_column": 8, "end_line": 95, "end_column": 15 }, { "span": "except:", "start_line": 125, "start_column": 8, "end_line": 125, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Server", "Handler_", "(_", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "GET_", "(_", "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_", "._", "parsed", "\\u", "uri_", "=_", "urlparse_", "(_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "query_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "cgi_", "._", "parse", "\\u", "qs", "l_", "(_", "self_", "._", "parsed", "\\u", "uri_", "[_", "4_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "query_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set", "User_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "self_", "._", "parsed", "\\u", "uri_", "[_", "2_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "path_", "==_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Main", "Page_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "path_", "==_", "'/", "openid", "server", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "server", "End", "Point_", "(_", "self_", "._", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "path_", "==_", "'/", "login", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Logi", "n", "Page_", "(_", "'/'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "path_", "==_", "'/", "login", "submit", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "do", "Login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "path_", "._", "startswith_", "(_", "'/", "id", "/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Id", "Page_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "path_", "._", "startswith_", "(_", "'/", "ya", "dis", "/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Ya", "dis_", "(_", "path_", "[_", "7_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "path_", "==_", "'/", "server", "ya", "dis", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Server", "Ya", "dis_", "(_", ")_", "\\u\\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_", "._", "send", "\\u", "response_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "board", "Interrupt_", ",_", "System", "Exit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "'", "Conten", "t", "-", "type", "'_", ",_", "'", "text", "/", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wfile_", "._", "write_", "(_", "cgi", "tb_", "._", "html_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ",_", "context_", "=_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "Handler_", "(_", "Base", "HTTP", "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_", "do", "\\u", "POST_", "(_", "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_", "._", "parsed", "\\u", "uri_", "=_", "urlparse_", "(_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set", "User_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "length_", "=_", "int_", "(_", "self_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Length", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "data_", "=_", "self_", "._", "rfile_", "._", "read_", "(_", "content", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "query_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "cgi_", "._", "parse", "\\u", "qs", "l_", "(_", "post", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "query_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "self_", "._", "parsed", "\\u", "uri_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", "==_", "'/", "openid", "server", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "server", "End", "Point_", "(_", "self_", "._", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "path_", "==_", "'/", "allow", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handle", "All", "ow_", "(_", "self_", "._", "query_", ")_", "\\u\\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_", "._", "send", "\\u", "response_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "board", "Interrupt_", ",_", "System", "Exit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "'", "Conten", "t", "-", "type", "'_", ",_", "'", "text", "/", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wfile_", "._", "write_", "(_", "cgi", "tb_", "._", "html_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ",_", "context_", "=_", "10_", ")_", ")_", "\\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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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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
deanhiller/databus/webapp/play1.3.x/python/Lib/site-packages/win32/scripts/ce/pysynch.py
[ { "content": "def CopyFileToCe(src_name, dest_name, progress = None):\n sh = win32file.CreateFile(src_name, win32con.GENERIC_READ, 0, None, win32con.OPEN_EXISTING, 0, None)\n bytes=0\n try:\n dh = wincerapi.CeCreateFile(dest_name, win32con.GENERIC_WRITE, 0, None, win32con.OPEN_ALWAYS, 0, None)\n try:\n while 1:\n hr, data = win32file.ReadFile(sh, 2048)\n if not data:\n break\n wincerapi.CeWriteFile(dh, data)\n bytes = bytes + len(data)\n if progress is not None: progress(bytes)\n finally:\n pass\n dh.Close()\n finally:\n sh.Close()\n return bytes", "metadata": "root.CopyFileToCe", "header": "['module', '___EOS___']", "index": 33 } ]
[ { "span": "pass", "start_line": 47, "start_column": 12, "end_line": 47, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Copy", "File", "To", "Ce", "_", "(_", "src", "\\u", "name_", ",_", "dest", "\\u", "name_", ",_", "progress_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sh_", "=_", "win32", "file_", "._", "Creat", "e", "File_", "(_", "src", "\\u", "name_", ",_", "win32con_", "._", "GENERIC", "\\u", "READ_", ",_", "0_", ",_", "None_", ",_", "win32con_", "._", "OPEN", "\\u", "EXIST", "ING_", ",_", "0_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dh_", "=_", "win", "cer", "api_", "._", "Ce", "Creat", "e", "File_", "(_", "dest", "\\u", "name_", ",_", "win32con_", "._", "GENERIC", "\\u", "WRITE_", ",_", "0_", ",_", "None_", ",_", "win32con_", "._", "OPEN", "\\u", "ALWAYS", "_", ",_", "0_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hr_", ",_", "data_", "=_", "win32", "file_", "._", "Read", "File_", "(_", "sh_", ",_", "2048_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "win", "cer", "api_", "._", "Ce", "Write", "File_", "(_", "dh_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes_", "=_", "bytes_", "+_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "progress_", "is_", "not_", "None_", ":_", "progress_", "(_", "bytes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dh_", "._", "Close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sh_", "._", "Close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bytes_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
Esri/solutions-geoprocessing-toolbox/visibility/toolboxes/scripts/spa.py
[ { "content": "#------------------------------------------------------------------------------\n# Copyright 2014 Esri\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#------------------------------------------------------------------------------\n# spa.py\n# Description: Sun Position and Hillshade\n# Requirements: ArcGIS Desktop Standard\n#------------------------------------------------------------------------------\n\n\n# IMPORTS ==========================================\nimport os, sys, math, traceback, types, datetime, time\nimport arcpy\nfrom arcpy import env\nfrom arcpy import sa\nfrom arcpy.sa import *\nfrom time import mktime, gmtime, strftime\n\ntimezone = {\n '(UTC-12:00) International Date Line West': -12,\n '(UTC-11:00) Midway Island, Samoa': -11,\n '(UTC-10:00) Hawaii': -10,\n '(UTC-9:00) Alaska': -9,\n '(UTC-8:00) Pacific Time (US & Canada), Baja California': -8,\n '(UTC-7:00) Mountain Time (US & Canada), Chihuahua, La Paz, Mazatlan': -7,\n '(UTC-6:00) Central Time (US & Canada), Central America, Guadalajara,'\\\n ' Mexico City': -6,\n '(UTC-5:00) Eastern Time (US & Canada), Bogota, Lima, Quito': -5,\n '(UTC-4:00) Atlantic Time (Canada), Santiago, La Paz, San Juan': -4,\n '(UTC-3:30) Newfoundland (Canada)': -3.5,\n '(UTC-3:00) Brasilia, Buenos Aires, Cayenne, Greenland, Montevideo': -3,\n '(UTC-2:00) Mid-Atlantic': -2,\n '(UTC-1:00) Cape Verde Islands, Azores': -1,\n '(UTC) Casablanca, Dublin, Edinburgh, London, Monrovia': 0,\n '(UTC+1:00) West Central Africa, Amsterdam, Berlin, Rome, Sarajevo,'\\\n ' Stockholm': 1,\n '(UTC+2:00) Amman, Athens, Beirut, Cairo, Harare, Helsinki, Istanbul,'\\\n ' Pretoria': 2,\n '(UTC+3:00) Kuwait, Baghdad, Moscow, Nairobi, Riyadh': 3,\n '(UTC+3:30) Tehran': 3.5,\n '(UTC+4:00) Abu Dhabi, Baku, Muscat, Tbilisi, Yerevan': 4,\n '(UTC+4:30) Afghanistan': 4.5,\n '(UTC+5:00) Ekaterinburg. Islamabad, Karachi, Tashkent': 5,\n '(UTC+5:30) Chennai, Kolkata, Mumbai, New Delhi': 5.5,\n '(UTC+6:00) Astana, Dhaka, Novosibirsk': 6,\n '(UTC+7:00) Bangkok, Hanoi, Jakarta': 7,\n '(UTC+8:00) Beijing, Hong Kong, Kuala Lampur, Singapore, Taipei,'\\\n ' Ulaanbaatar': 8,\n '(UTC+9:00) Osaka, Seoul, Tokyo, Yakutsk': 9,\n '(UTC+9:30) Adelaide, Darwin': 9.5,\n '(UTC+10:00) Brisbane, Melbourne, Guam, Bladivostok': 10,\n '(UTC+11:00) Magadan, Solomon Islands': 11,\n '(UTC+12:00) Fiji, Marshall Islands': 12\n }\n\n# Represents the position of the sun on a given date at a given observer point\n\n# Given a featureclass, determines the centerpoint\n\n#Returns the Julian day number of a date.\n\n# Given a datetime and a observation point, determine the position of the sun\n\n# Check out any necessary licenses\narcpy.CheckOutExtension(\"Spatial\")\n\n# Globals\ndeleteme = []\ndebug = False\n\n# WGS84 Spatial Reference\nsr = arcpy.SpatialReference()\nsr.factoryCode = 4326\nsr.create()\nGCS_WGS_1984 = sr\n\n## Web Mercator\n#sr = arcpy.SpatialReference()\n#sr.factoryCode = 3857\n#sr.create()\n#webMercator = sr\n\n# Local variables:\n\n# Script arguments\ninputAOI = arcpy.GetParameterAsText(0)\nif inputAOI == '#' or not inputAOI:\n raise MissingParameterError(\"inputAOI\")\n\ninputElevation = arcpy.GetParameterAsText(1)\nif inputElevation == '#' or not inputElevation:\n raise MissingParameterError(\"inputElevation\")\n\ninputDatetime = arcpy.GetParameterAsText(2)\nif inputDatetime == '#' or not inputDatetime:\n raise MissingParameterError(\"inputDatetime\")\n\ninputTimezone = arcpy.GetParameterAsText(3)\nif inputTimezone == '#' or not inputTimezone:\n raise MissingParameterError(\"inputTimezone\")\n\noutputHillshade = arcpy.GetParameterAsText(4)\nif outputHillshade == '#' or not outputHillshade:\n raise MissingParameterError(\"outputHillshade\")\n\n# Configure the Environment\nenv.cellSize = inputElevation\nenv.extent = inputAOI\nenv.mask = inputAOI\nenv.snapRaster = inputElevation\nenv.overwriteOutput = True\nenv.resample = \"CUBIC\"\nenv.compression = \"LZ77\"\nenv.rasterStatistics = 'STATISTICS'\n\ntry:\n\n # Datetime comes in looking like this: 11/1/2013 3:26:37 PM\n # Convert the string to a datetime object\n timeStruct = time.strptime(inputDatetime, \"%m/%d/%Y %I:%M:%S %p\")\n utcoffset = time.timezone\n if time.daylight > 0:\n utcoffset = time.altzone\n\n # Adjust to UTC time to run the calculations\n dt = datetime.datetime.fromtimestamp(mktime(timeStruct))\n if debug == True:\n arcpy.AddMessage(\"Initially provided date time (\" + inputTimezone + \"): \" + str(dt))\n dt = dt - datetime.timedelta(seconds=(timezone[inputTimezone]*60*60))\n if debug == True:\n arcpy.AddMessage(\"UTC-adjusted date time: \" + str(dt))\n\n # Get the centerpoint of the input AOI to use as the observer position\n if debug == True:\n arcpy.AddMessage(\"Generating observer centerpoint...\")\n\n centerPoint = CenterPoint(inputAOI)\n\n if debug == True:\n arcpy.AddMessage(\"Determining Sun Position\")\n\n sunPosition = CalculateSunPosition(dt,centerPoint)\n\n # From the observer position, and the provided date time, determine the sun angle and altitude\n\n if sunPosition.altitude < 0:\n if debug == True:\n arcpy.AddMessage(\"Generating constant raster...\")\n outConstRaster = CreateConstantRaster(0, \"INTEGER\")\n outConstRaster.save(outputHillshade)\n else:\n if debug == True:\n arcpy.AddMessage(\"Generating hillshade...\")\n tempHillshade = arcpy.sa.Hillshade(inputElevation, sunPosition.azimuth, sunPosition.altitude, \"NO_SHADOWS\")\n tempHillshade.save(outputHillshade)\n\n if debug == True:\n arcpy.AddMessage(\"Calculating hillshade statistics...\")\n\n arcpy.CalculateStatistics_management(outputHillshade)\n\nexcept arcpy.ExecuteError:\n if debug == True:\n arcpy.AddMessage(\"CRASH: \" + str(time.strftime(\"%m/%d/%Y %H:%M:%S\", time.localtime())))\n # Get the traceback object\n tb = sys.exc_info()[2]\n tbinfo = traceback.format_tb(tb)[0]\n arcpy.AddError(\"Traceback: \" + tbinfo)\n # Get the tool error messages\n msgs = arcpy.GetMessages()\n arcpy.AddError(msgs)\n #print msgs #UPDATE\n print(msgs)\nexcept MissingParameterError as e:\n if debug == True:\n arcpy.AddMessage(\"CRASH: \" + str(time.strftime(\"%m/%d/%Y %H:%M:%S\", time.localtime())))\n # Get the traceback object\n tb = sys.exc_info()[2]\n tbinfo = traceback.format_tb(tb)[0]\n arcpy.AddError(\"Traceback: \" + tbinfo)\n # Get the tool error messages\n msg = e.value + \" parameter is missing.\"\n arcpy.AddError(msg)\n #print msg #UPDATE\n print (msg)\nexcept:\n if debug == True:\n arcpy.AddMessage(\"CRASH: \" + str(time.strftime(\"%m/%d/%Y %H:%M:%S\", time.localtime())))\n # Get the traceback object\n tb = sys.exc_info()[2]\n tbinfo = traceback.format_tb(tb)[0]\n\n # Concatenate information together concerning the error into a message string\n pymsg = \"PYTHON ERRORS:\\nTraceback info:\\n\" + tbinfo + \"\\nError Info:\\n\" + str(sys.exc_info()[1])\n msgs = \"ArcPy ERRORS:\\n\" + arcpy.GetMessages() + \"\\n\"\n\n # Return python error messages for use in script tool or Python Window\n arcpy.AddError(pymsg)\n arcpy.AddError(msgs)\n\n # Print Python error messages for use in Python / Python Window\n #print pymsg + \"\\n\" #UPDATE\n #print msgs #UPDATE\n print ((pymsg + \"\\n\"))\n print (msgs)\nfinally:\n\n arcpy.CheckInExtension(\"Spatial\")\n # cleanup intermediate datasets\n if debug == True: arcpy.AddMessage(\"Removing intermediate datasets...\")\n for i in deleteme:\n if debug == True: arcpy.AddMessage(\"Removing: \" + str(i))\n if arcpy.Exists(i):\n arcpy.Delete_management(i)\n pass\n if debug == True: arcpy.AddMessage(\"Done\")", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 353, "start_column": 0, "end_line": 353, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Es", "ri_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "spa", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Descripti", "on", ":", " ", "Sun", " ", "Position", " ", "and", " ", "Hill", "shade", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Requirements", ":", " ", "Arc", "GI", "S", " ", "Des", "kto", "p", " ", "Standard", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPORT", "S", " ", "==============", "==============", "==============", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "math_", ",_", "traceback_", ",_", "types_", ",_", "datetime_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "arcpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "arcpy_", "import_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "arcpy_", "import_", "sa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "arcpy_", "._", "sa_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "mktime_", ",_", "gmtime_", ",_", "strftime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "timezone_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-1", "2", ":", "00", ")", " ", "Intern", "ation", "al", " ", "Date", " ", "Line", " ", "West", "'_", ":_", "-_", "12_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-1", "1", ":", "00", ")", " ", "Mid", "way", " ", "Isl", "and", ",", " ", "Sam", "oa", "'_", ":_", "-_", "11_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-1", "0", ":", "00", ")", " ", "Ha", "wai", "i", "'_", ":_", "-_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-", "9", ":", "00", ")", " ", "Ala", "ska", "'_", ":_", "-_", "9_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-", "8", ":", "00", ")", " ", "Pac", "ifi", "c", " ", "Time", " ", "(", "US", " ", "&", " ", "Cana", "da", "),", " ", "Ba", "ja", " ", "Cali", "for", "nia", "'_", ":_", "-_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-", "7", ":", "00", ")", " ", "Mount", "ain", " ", "Time", " ", "(", "US", " ", "&", " ", "Cana", "da", "),", " ", "Chi", "hua", "hua", ",", " ", "La", " ", "Pa", "z", ",", " ", "Ma", "zat", "lan", "'_", ":_", "-_", "7_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-", "6", ":", "00", ")", " ", "Cent", "ral", " ", "Time", " ", "(", "US", " ", "&", " ", "Cana", "da", "),", " ", "Cent", "ral", " ", "Ame", "rica", ",", " ", "Gua", "dal", "aja", "ra", ",'_", "'", " ", "Me", "xic", "o", " ", "Cit", "y", "'_", ":_", "-_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-", "5", ":", "00", ")", " ", "Eas", "tern", " ", "Time", " ", "(", "US", " ", "&", " ", "Cana", "da", "),", " ", "Bo", "got", "a", ",", " ", "Lim", "a", ",", " ", "Qui", "to", "'_", ":_", "-_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-", "4", ":", "00", ")", " ", "Atlanti", "c", " ", "Time", " ", "(", "Cana", "da", "),", " ", "San", "tia", "go", ",", " ", "La", " ", "Pa", "z", ",", " ", "San", " ", "Ju", "an", "'_", ":_", "-_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-", "3", ":", "30", ")", " ", "New", "found", "land", " ", "(", "Cana", "da", ")'_", ":_", "-_", "3.5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-", "3", ":", "00", ")", " ", "Bra", "sil", "ia", ",", " ", "Bu", "eno", "s", " ", "Air", "es", ",", " ", "Ca", "yen", "ne", ",", " ", "Green", "land", ",", " ", "Monte", "video", "'_", ":_", "-_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-", "2", ":", "00", ")", " ", "Mid", "-", "Atlanti", "c", "'_", ":_", "-_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "-1", ":", "00", ")", " ", "Cap", "e", " ", "Verd", "e", " ", "Isl", "ands", ",", " ", "Az", "ore", "s", "'_", ":_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", ")", " ", "Cas", "abl", "anc", "a", ",", " ", "Du", "blin", ",", " ", "Ed", "inb", "urg", "h", ",", " ", "Lon", "don", ",", " ", "Mon", "rov", "ia", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "1", ":", "00", ")", " ", "West", " ", "Cent", "ral", " ", "Af", "rica", ",", " ", "Am", "ster", "dam", ",", " ", "Ber", "lin", ",", " ", "Rom", "e", ",", " ", "Sar", "aj", "evo", ",'_", "'", " ", "Stock", "hol", "m", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "2", ":", "00", ")", " ", "Am", "man", ",", " ", "Ath", "ens", ",", " ", "Bei", "rut", ",", " ", "Cai", "ro", ",", " ", "Har", "are", ",", " ", "Hel", "sink", "i", ",", " ", "Is", "tan", "bul", ",'_", "'", " ", "Pret", "oria", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "3", ":", "00", ")", " ", "Ku", "wait", ",", " ", "Bag", "hda", "d", ",", " ", "Mos", "cow", ",", " ", "Nai", "robi", ",", " ", "Ri", "ya", "dh", "'_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "3", ":", "30", ")", " ", "Te", "hra", "n", "'_", ":_", "3.5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "4", ":", "00", ")", " ", "Abu", " ", "Dh", "abi", ",", " ", "Bak", "u", ",", " ", "Mus", "cat", ",", " ", "Tb", "ilis", "i", ",", " ", "Ye", "rev", "an", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "4", ":", "30", ")", " ", "Af", "gha", "nist", "an", "'_", ":_", "4.5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "5", ":", "00", ")", " ", "Ek", "ater", "inb", "urg", ".", " ", "Isl", "ama", "bad", ",", " ", "Kar", "achi", ",", " ", "Ta", "sh", "ken", "t", "'_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "5", ":", "30", ")", " ", "Chen", "nai", ",", " ", "Ko", "lk", "ata", ",", " ", "Mu", "mba", "i", ",", " ", "New", " ", "Del", "hi", "'_", ":_", "5.5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "6", ":", "00", ")", " ", "Ast", "ana", ",", " ", "Dh", "aka", ",", " ", "Nov", "osi", "bir", "sk", "'_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "7", ":", "00", ")", " ", "Ban", "gk", "ok", ",", " ", "Han", "oi", ",", " ", "Ja", "kart", "a", "'_", ":_", "7_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "8", ":", "00", ")", " ", "Bei", "jin", "g", ",", " ", "Hon", "g", " ", "Kon", "g", ",", " ", "Ku", "ala", " ", "Lam", "pur", ",", " ", "Sing", "apo", "re", ",", " ", "Tai", "pe", "i", ",'_", "'", " ", "Ul", "aan", "baa", "tar", "'_", ":_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "9", ":", "00", ")", " ", "Os", "aka", ",", " ", "Se", "oul", ",", " ", "Tok", "yo", ",", " ", "Ya", "ku", "tsk", "'_", ":_", "9_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "9", ":", "30", ")", " ", "Ade", "lai", "de", ",", " ", "Dar", "win", "'_", ":_", "9.5", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "10", ":", "00", ")", " ", "Bri", "sba", "ne", ",", " ", "Mel", "bour", "ne", ",", " ", "Gua", "m", ",", " ", "Bla", "div", "ost", "ok", "'_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "11", ":", "00", ")", " ", "Mag", "ada", "n", ",", " ", "Sol", "omo", "n", " ", "Isl", "ands", "'_", ":_", "11_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "UT", "C", "+", "1", "2", ":", "00", ")", " ", "Fi", "ji", ",", " ", "Marshall", " ", "Isl", "ands", "'_", ":_", "12_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Represent", "s", " ", "the", " ", "position", " ", "of", " ", "the", " ", "sun", " ", "on", " ", "a", " ", "give", "n", " ", "date", " ", "at", " ", "a", " ", "give", "n", " ", "observer", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", "n", " ", "a", " ", "feature", "class", ",", " ", "dete", "rmin", "es", " ", "the", " ", "center", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Return", "s", " ", "the", " ", "Juli", "an", " ", "day", " ", "number", " ", "of", " ", "a", " ", "date", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", "n", " ", "a", " ", "datetime", " ", "and", " ", "a", " ", "observa", "tion", " ", "point", ",", " ", "dete", "rmin", "e", " ", "the", " ", "position", " ", "of", " ", "the", " ", "sun_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "out", " ", "any", " ", "necessar", "y", " ", "license", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Check", "Out", "Extension_", "(_", "\"", "Spa", "tial", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Globals_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "me_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WG", "S", "84", " ", "Spa", "tial", " ", "Reference_", "\\u\\u\\uNL\\u\\u\\u_", "sr_", "=_", "arcpy_", "._", "Spa", "tial", "Reference_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sr_", "._", "factor", "y", "Code_", "=_", "432", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sr_", "._", "create_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GC", "S", "\\u", "WG", "S", "\\u", "1984", "_", "=_", "sr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Web", " ", "Merc", "ator_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sr", " ", "=", " ", "arc", "py", ".", "Spa", "tial", "Reference", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sr", ".", "factor", "y", "Code", " ", "=", " ", "3857", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sr", ".", "create", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "web", "Merc", "ator", " ", "=", " ", "sr_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "variab", "les", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Script", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "input", "AO", "I_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "AO", "I_", "==_", "'#'_", "or_", "not_", "input", "AO", "I_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Missing", "Parameter", "Error_", "(_", "\"", "input", "AO", "I", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "Elevat", "ion_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "Elevat", "ion_", "==_", "'#'_", "or_", "not_", "input", "Elevat", "ion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Missing", "Parameter", "Error_", "(_", "\"", "input", "Elevat", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "Datetime_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "Datetime_", "==_", "'#'_", "or_", "not_", "input", "Datetime_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Missing", "Parameter", "Error_", "(_", "\"", "input", "Date", "time", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "Timezone", "_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "Timezone", "_", "==_", "'#'_", "or_", "not_", "input", "Timezone", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Missing", "Parameter", "Error_", "(_", "\"", "input", "Timezone", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "Hill", "shade", "_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output", "Hill", "shade", "_", "==_", "'#'_", "or_", "not_", "output", "Hill", "shade", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Missing", "Parameter", "Error_", "(_", "\"", "output", "Hill", "shade", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "the", " ", "Environment_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "._", "cell", "Size_", "=_", "input", "Elevat", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "extent_", "=_", "input", "AO", "I_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "mask_", "=_", "input", "AO", "I_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "snap", "Raster_", "=_", "input", "Elevat", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "overwrit", "e", "Output_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "resample_", "=_", "\"", "CUB", "IC", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "compression_", "=_", "\"", "LZ", "7", "7", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "rast", "er", "Statistics_", "=_", "'", "STATI", "STIC", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Date", "time", " ", "come", "s", " ", "in", " ", "look", "ing", " ", "like", " ", "this", ":", " ", "11", "/", "1", "/", "2013", " ", "3", ":", "2", "6", ":", "3", "7", " ", "PM", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "the", " ", "string", " ", "to", " ", "a", " ", "datetime", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "Struct_", "=_", "time_", "._", "strptime_", "(_", "input", "Datetime_", ",_", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", "%", "I", ":", "%", "M", ":", "%", "S", " ", "%", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utc", "offset_", "=_", "time_", "._", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "time_", "._", "day", "light_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utc", "offset_", "=_", "time_", "._", "alt", "zone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Adjust", " ", "to", " ", "UT", "C", " ", "time", " ", "to", " ", "run", " ", "the", " ", "calculati", "ons_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dt_", "=_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "mktime_", "(_", "time", "Struct_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Initial", "ly", " ", "provided", " ", "date", " ", "time", " ", "(\"_", "+_", "input", "Timezone", "_", "+_", "\"):", " ", "\"_", "+_", "str_", "(_", "dt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dt_", "=_", "dt_", "-_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "(_", "timezone_", "[_", "input", "Timezone", "_", "]_", "*_", "60_", "*_", "60_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "UT", "C", "-", "adjusted", " ", "date", " ", "time", ":", " ", "\"_", "+_", "str_", "(_", "dt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "center", "point", " ", "of", " ", "the", " ", "input", " ", "AO", "I", " ", "to", " ", "use", " ", "as", " ", "the", " ", "observer", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "debug_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Generat", "ing", " ", "observer", " ", "center", "point", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "center", "Point_", "=_", "Center", "Point_", "(_", "input", "AO", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "debug_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Determini", "ng", " ", "Sun", " ", "Position", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sun", "Position_", "=_", "Calculat", "e", "Sun", "Position_", "(_", "dt_", ",_", "center", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fro", "m", " ", "the", " ", "observer", " ", "position", ",", " ", "and", " ", "the", " ", "provided", " ", "date", " ", "time", ",", " ", "dete", "rmin", "e", " ", "the", " ", "sun", " ", "angle", " ", "and", " ", "altitude_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sun", "Position_", "._", "altitude_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "debug_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Generat", "ing", " ", "constant", " ", "rast", "er", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "Const", "Raster_", "=_", "Creat", "e", "Const", "ant", "Raster_", "(_", "0_", ",_", "\"", "INTEG", "ER", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Const", "Raster_", "._", "save_", "(_", "output", "Hill", "shade", "_", ")_", "\\u\\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_", "debug_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Generat", "ing", " ", "hill", "shade", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "Hill", "shade", "_", "=_", "arcpy_", "._", "sa_", "._", "Hill", "shade", "_", "(_", "input", "Elevat", "ion_", ",_", "sun", "Position_", "._", "azimuth", "_", ",_", "sun", "Position_", "._", "altitude_", ",_", "\"", "NO", "\\u", "SHA", "DO", "WS", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "Hill", "shade", "_", "._", "save_", "(_", "output", "Hill", "shade", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "debug_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Calculating", " ", "hill", "shade", " ", "statistic", "s", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Calculat", "e", "Statistic", "s", "\\u", "management_", "(_", "output", "Hill", "shade", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "arcpy_", "._", "Execut", "e", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "debug_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "CRA", "SH", ":", " ", "\"_", "+_", "str_", "(_", "time_", "._", "strftime_", "(_", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "localtime_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "traceback", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "info_", "=_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "\"", "Trace", "back", ":", " ", "\"_", "+_", "tb", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "tool", " ", "error", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "msgs_", "=_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "msgs", " ", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Missing", "Parameter", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "debug_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "CRA", "SH", ":", " ", "\"_", "+_", "str_", "(_", "time_", "._", "strftime_", "(_", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "localtime_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "traceback", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "info_", "=_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "\"", "Trace", "back", ":", " ", "\"_", "+_", "tb", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "tool", " ", "error", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "e_", "._", "value_", "+_", "\"", " ", "parameter", " ", "is", " ", "missi", "ng", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "msg", " ", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "debug_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "CRA", "SH", ":", " ", "\"_", "+_", "str_", "(_", "time_", "._", "strftime_", "(_", "\"%", "m", "/", "%", "d", "/", "%", "Y", " ", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "localtime_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "traceback", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "info_", "=_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Concat", "enat", "e", " ", "informati", "on", " ", "tog", "ether", " ", "concern", "ing", " ", "the", " ", "error", " ", "int", "o", " ", "a", " ", "message", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "pym", "sg_", "=_", "\"", "PYTHON", " ", "ERRORS", ":\\\\", "n", "Trace", "back", " ", "info", ":\\\\", "n", "\"_", "+_", "tb", "info_", "+_", "\"\\\\", "n", "Error", " ", "Info", ":\\\\", "n", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs_", "=_", "\"", "Arc", "Py", " ", "ERRORS", ":\\\\", "n", "\"_", "+_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "python", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "script", " ", "tool", " ", "or", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "pym", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "Pyth", "on", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "Pyth", "on", " ", "/", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "pym", "sg", " ", "+", " ", "\"\\\\", "n", "\"", " ", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "msgs", " ", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "(_", "pym", "sg_", "+_", "\"\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Check", "In", "Extension_", "(_", "\"", "Spa", "tial", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "clean", "up", " ", "intermediate", " ", "datasets_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "debug_", "==_", "True_", ":_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Remo", "ving", " ", "intermediate", " ", "dataset", "s", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "delete", "me_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "debug_", "==_", "True_", ":_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Remo", "ving", ":", " ", "\"_", "+_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arcpy_", "._", "Exists_", "(_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Delete", "\\u", "management_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "debug_", "==_", "True_", ":_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Don", "e", "\"_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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 ]
First parameter of a method is not named 'self'
aerospike/aerospike-client-python/test/old_tests/test_udf_list.py
[ { "content": " def setup_class(cls):\n \"\"\"\n Setup class\n \"\"\"\n hostlist, user, password = TestBaseClass.get_hosts()\n config = {'hosts': hostlist}\n\n if user is None and password is None:\n TestUdfList.client = aerospike.client(config).connect()\n else:\n TestUdfList.client = aerospike.client(config).connect(user,\n password)\n\n TestUdfList.client.udf_put('example.lua', 0, {})", "metadata": "root.TestUdfList.setup_class", "header": "['class', 'TestUdfList', '(', 'TestBaseClass', ')', ':', '___EOS___']", "index": 18 }, { "content": " def teardown_class(cls):\n \"\"\"\n Teardown class\n \"\"\"\n TestUdfList.client.udf_remove(\"example.lua\")\n\n TestUdfList.client.close()", "metadata": "root.TestUdfList.teardown_class", "header": "['class', 'TestUdfList', '(', 'TestBaseClass', ')', ':', '___EOS___']", "index": 33 } ]
[ { "span": "def setup_class(cls):", "start_line": 18, "start_column": 4, "end_line": 18, "end_column": 25 }, { "span": "def teardown_class(cls):", "start_line": 33, "start_column": 4, "end_line": 33, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Test", "Ud", "f", "List_", "(_", "Test", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setup", "\\u", "class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "up", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "list_", ",_", "user_", ",_", "password_", "=_", "Test", "Base", "Class_", "._", "get", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "{_", "'", "host", "s", "'_", ":_", "host", "list_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", "is_", "None_", "and_", "password_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Test", "Ud", "f", "List_", "._", "client_", "=_", "aeros", "pike", "_", "._", "client_", "(_", "config_", ")_", "._", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Test", "Ud", "f", "List_", "._", "client_", "=_", "aeros", "pike", "_", "._", "client_", "(_", "config_", ")_", "._", "connect_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Test", "Ud", "f", "List_", "._", "client_", "._", "udf", "\\u", "put_", "(_", "'", "example", ".", "lua", "'_", ",_", "0_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ud", "f", "List_", "(_", "Test", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "down", "\\u", "class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tea", "rdo", "wn", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Test", "Ud", "f", "List_", "._", "client_", "._", "udf", "\\u", "remove_", "(_", "\"", "example", ".", "lua", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Ud", "f", "List_", "._", "client_", "._", "close_", "(_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary delete statement in function
daler/metaseq/metaseq/filetype_adapters.py
[ { "content": " def __getitem__(self, key):\n bt = self.fileobj.tabix_intervals(\n '%s:%s-%s' % (key.chrom, key.start, key.stop))\n for i in bt:\n yield i\n del bt", "metadata": "root.BedAdapter.__getitem__", "header": "['class', 'BedAdapter', '(', 'BaseAdapter', ')', ':', '___EOS___']", "index": 89 } ]
[ { "span": "del bt", "start_line": 94, "start_column": 8, "end_line": 94, "end_column": 14 } ]
[ { "span": "def __getitem__(self, key):", "start_line": 89, "start_column": 4, "end_line": 89, "end_column": 31 } ]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "delete_", "statement_", "in_", "function_", "[SEP]_", "class_", "Bed", "Adapter_", "(_", "Base", "Adapter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bt_", "=_", "self_", "._", "fileobj_", "._", "tabi", "x", "\\u", "intervals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ":", "%", "s", "-%", "s", "'_", "%_", "(_", "key_", "._", "chrom_", ",_", "key_", "._", "start_", ",_", "key_", "._", "stop_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "bt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "bt_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2 ]
Testing equality to None
bitxbay/BitXBay/electru/build/lib/electrum/pyqrnative.py
[ { "content": " def makeImpl(self, test, maskPattern):\n\n self.moduleCount = self.typeNumber * 4 + 17\n self.modules = [None for x in range(self.moduleCount)]\n\n for row in range(self.moduleCount):\n\n self.modules[row] = [None for x in range(self.moduleCount)]\n\n for col in range(self.moduleCount):\n self.modules[row][col] = None #//(col + row) % 3;\n\n self.setupPositionProbePattern(0, 0)\n self.setupPositionProbePattern(self.moduleCount - 7, 0)\n self.setupPositionProbePattern(0, self.moduleCount - 7)\n self.setupPositionAdjustPattern()\n self.setupTimingPattern()\n self.setupTypeInfo(test, maskPattern)\n\n if (self.typeNumber >= 7):\n self.setupTypeNumber(test)\n\n if (self.dataCache == None):\n self.dataCache = QRCode.createData(self.typeNumber, self.errorCorrectLevel, self.dataList)\n self.mapData(self.dataCache, maskPattern)", "metadata": "root.QRCode.makeImpl", "header": "['class', 'QRCode', ':', '___EOS___']", "index": 59 }, { "content": " def mapData(self, data, maskPattern):\n\n inc = -1\n row = self.moduleCount - 1\n bitIndex = 7\n byteIndex = 0\n\n for col in range(self.moduleCount - 1, 0, -2):\n\n if (col == 6): col-=1\n\n while (True):\n\n for c in range(2):\n\n if (self.modules[row][col - c] == None):\n\n dark = False\n\n if (byteIndex < len(data)):\n dark = ( ( (data[byteIndex] >> bitIndex) & 1) == 1)\n\n mask = QRUtil.getMask(maskPattern, row, col - c)\n\n if (mask):\n dark = not dark\n\n self.modules[row][col - c] = dark\n bitIndex-=1\n\n if (bitIndex == -1):\n byteIndex+=1\n bitIndex = 7\n\n row += inc\n\n if (row < 0 or self.moduleCount <= row):\n row -= inc\n inc = -inc\n break", "metadata": "root.QRCode.mapData", "header": "['class', 'QRCode', ':', '___EOS___']", "index": 199 }, { "content": " @staticmethod\n def getRSBlocks(typeNumber, errorCorrectLevel):\n rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);\n if rsBlock == None:\n raise Exception(\"bad rs block @ typeNumber:\" + typeNumber + \"/errorCorrectLevel:\" + errorCorrectLevel)\n\n length = len(rsBlock) / 3\n\n list = []\n\n for i in range(length):\n\n count = rsBlock[i * 3 + 0]\n totalCount = rsBlock[i * 3 + 1]\n dataCount = rsBlock[i * 3 + 2]\n\n for j in range(count):\n list.append(QRRSBlock(totalCount, dataCount))\n\n return list;", "metadata": "root.QRRSBlock.getRSBlocks", "header": "['class', 'QRRSBlock', ':', '___EOS___']", "index": 905 } ]
[ { "span": "self.dataCache == None)", "start_line": 81, "start_column": 12, "end_line": 81, "end_column": 34 }, { "span": "self.modules[row][col - c] == None)", "start_line": 214, "start_column": 24, "end_line": 214, "end_column": 58 }, { "span": "rsBlock == None:", "start_line": 908, "start_column": 11, "end_line": 908, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "QR", "Code_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Impl_", "(_", "self_", ",_", "test_", ",_", "mask", "Pattern_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "module", "Count_", "=_", "self_", "._", "type", "Number_", "*_", "4_", "+_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "modules_", "=_", "[_", "None_", "for_", "x_", "in_", "range_", "(_", "self_", "._", "module", "Count_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "row_", "in_", "range_", "(_", "self_", "._", "module", "Count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "modules_", "[_", "row_", "]_", "=_", "[_", "None_", "for_", "x_", "in_", "range_", "(_", "self_", "._", "module", "Count_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "col_", "in_", "range_", "(_", "self_", "._", "module", "Count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "modules_", "[_", "row_", "]_", "[_", "col_", "]_", "=_", "None_", "#", "//", "(", "col", " ", "+", " ", "row", ")", " ", "%", " ", "3", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "setup", "Position", "Probe", "Pattern_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "Position", "Probe", "Pattern_", "(_", "self_", "._", "module", "Count_", "-_", "7_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "Position", "Probe", "Pattern_", "(_", "0_", ",_", "self_", "._", "module", "Count_", "-_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "Position", "Adjust", "Pattern_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "Tim", "ing", "Pattern_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "Type", "Info_", "(_", "test_", ",_", "mask", "Pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "type", "Number_", ">=_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "setup", "Type", "Number_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "data", "Cache_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data", "Cache_", "=_", "QR", "Code_", "._", "create", "Data_", "(_", "self_", "._", "type", "Number_", ",_", "self_", "._", "error", "Correct", "Level_", ",_", "self_", "._", "data", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "map", "Data_", "(_", "self_", "._", "data", "Cache_", ",_", "mask", "Pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QR", "Code_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "map", "Data_", "(_", "self_", ",_", "data_", ",_", "mask", "Pattern_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inc_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "self_", "._", "module", "Count_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bit", "Index_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "byte", "Index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "col_", "in_", "range_", "(_", "self_", "._", "module", "Count_", "-_", "1_", ",_", "0_", ",_", "-_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "col_", "==_", "6_", ")_", ":_", "col_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "c_", "in_", "range_", "(_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "self_", "._", "modules_", "[_", "row_", "]_", "[_", "col_", "-_", "c_", "]_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dark", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "byte", "Index_", "<_", "len_", "(_", "data_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dark", "_", "=_", "(_", "(_", "(_", "data_", "[_", "byte", "Index_", "]_", ">>_", "bit", "Index_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask_", "=_", "QR", "Util_", "._", "get", "Mask_", "(_", "mask", "Pattern_", ",_", "row_", ",_", "col_", "-_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "mask_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dark", "_", "=_", "not_", "dark", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "modules_", "[_", "row_", "]_", "[_", "col_", "-_", "c_", "]_", "=_", "dark", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bit", "Index_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "bit", "Index_", "==_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "byte", "Index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bit", "Index_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "+=_", "inc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "row_", "<_", "0_", "or_", "self_", "._", "module", "Count_", "<=_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "row_", "-=_", "inc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inc_", "=_", "-_", "inc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QR", "RS", "Block_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "RS", "Blocks_", "(_", "type", "Number_", ",_", "error", "Correct", "Level_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "Block_", "=_", "QR", "RS", "Block_", "._", "get", "Rs", "Block", "Table_", "(_", "type", "Number_", ",_", "error", "Correct", "Level_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rs", "Block_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "bad", " ", "rs", " ", "block", " ", "@", " ", "type", "Number", ":\"_", "+_", "type", "Number_", "+_", "\"/", "error", "Correct", "Leve", "l", ":\"_", "+_", "error", "Correct", "Level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "length_", "=_", "len_", "(_", "rs", "Block_", ")_", "/_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "rs", "Block_", "[_", "i_", "*_", "3_", "+_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "Count_", "=_", "rs", "Block_", "[_", "i_", "*_", "3_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Count_", "=_", "rs", "Block_", "[_", "i_", "*_", "3_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "._", "append_", "(_", "QR", "RS", "Block_", "(_", "total", "Count_", ",_", "data", "Count_", ")_", ")_", "\\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_", "list_", ";_", "\\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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
ustream/openduty/notification/notifier/twilio_call.py
[ { "content": " def notify(self, notification):\n client = TwilioRestClient(self.__config['SID'], self.__config['token'])\n try:\n client.calls.create(\n url=settings.BASE_URL + \"/twilio/%s/%s\" % (notification.id, notification.user_to_notify.id),\n method=\"GET\",\n to=notification.user_to_notify.profile.phone_number,\n from_=self.__config['phone_number'])\n print 'successfully sent the call'\n except :\n print 'failed to send the call'", "metadata": "root.TwilioCallNotifier.notify", "header": "['class', 'TwilioCallNotifier', ':', '___EOS___']", "index": 11 } ]
[ { "span": "except :", "start_line": 20, "start_column": 8, "end_line": 20, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Twi", "lio", "Call", "Notifier_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "notify_", "(_", "self_", ",_", "notification_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "Twi", "lio", "Rest", "Client_", "(_", "self_", "._", "\\u\\u", "config_", "[_", "'", "SID", "'_", "]_", ",_", "self_", "._", "\\u\\u", "config_", "[_", "'", "token", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "._", "calls_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "settings_", "._", "BASE", "\\u", "URL_", "+_", "\"/", "twilio", "/", "%", "s", "/", "%", "s", "\"_", "%_", "(_", "notification_", "._", "id_", ",_", "notification_", "._", "user", "\\u", "to", "\\u", "notify_", "._", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "\"", "GET", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "to_", "=_", "notification_", "._", "user", "\\u", "to", "\\u", "notify_", "._", "profile_", "._", "phone", "\\u", "number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from\\u_", "=_", "self_", "._", "\\u\\u", "config_", "[_", "'", "phone", "\\u", "number", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "success", "full", "y", " ", "sent", " ", "the", " ", "call", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "fail", "ed", " ", "to", " ", "send", " ", "the", " ", "call", "'_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
bernardopires/django-tenant-schemas/version.py
[ { "content": "def call_git_describe():\n try:\n p = Popen(['git', 'describe', '--tags', '--always'],\n stdout=PIPE, stderr=PIPE)\n p.stderr.close()\n line = p.stdout.readlines()[0]\n return line.strip().decode('utf-8')\n\n except:\n return None", "metadata": "root.call_git_describe", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def read_release_version():\n try:\n f = open(\"VERSION\", \"r\")\n\n try:\n version = f.readlines()[0]\n return version.strip()\n\n finally:\n f.close()\n\n except:\n return None", "metadata": "root.read_release_version", "header": "['module', '___EOS___']", "index": 50 } ]
[ { "span": "except:", "start_line": 46, "start_column": 4, "end_line": 46, "end_column": 11 }, { "span": "except:", "start_line": 61, "start_column": 4, "end_line": 61, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "call", "\\u", "git", "\\u", "describe_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Popen_", "(_", "[_", "'", "git", "'_", ",_", "'", "descri", "be", "'_", ",_", "'--", "tags", "'_", ",_", "'--", "alw", "ay", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "PIPE_", ",_", "stderr_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "stderr_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "p_", "._", "stdout_", "._", "readlines_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "line_", "._", "strip_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "release", "\\u", "version_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "\"", "VERSI", "ON", "\"_", ",_", "\"", "r", "\"_", ")_", "\\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 ", " _", "version_", "=_", "f_", "._", "readlines_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "version_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused local variable
rlpy/rlpy/rlpy/Domains/PacmanPackage/qlearningAgents.py
[ { "content": " def getAction(self, state):\n \"\"\"\n Compute the action to take in the current state. With\n probability self.epsilon, we should take a random action and\n take the best policy action otherwise. Note that if there are\n no legal actions, which is the case at the terminal state, you\n should choose None as the action.\n\n HINT: You might want to use util.flipCoin(prob)\n HINT: To pick randomly from a list, use random.choice(list)\n \"\"\"\n # Pick Action\n legalActions = self.getLegalActions(state)\n action = None\n \"*** YOUR CODE HERE ***\"\n util.raiseNotDefined()\n\n return action", "metadata": "root.QLearningAgent.getAction", "header": "['class', 'QLearningAgent', '(', 'ReinforcementAgent', ')', ':', '___EOS___']", "index": 75 } ]
[ { "span": "legalActions ", "start_line": 87, "start_column": 8, "end_line": 87, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "QL", "earn", "ing", "Agent_", "(_", "Rein", "force", "ment", "Agent_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Action_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Compute", " ", "the", " ", "action", " ", "to", " ", "take", " ", "in", " ", "the", " ", "current", " ", "state", ".", " ", " ", "With", "\\", "10", ";", " ", " ", "probabilit", "y", " ", "self", ".", "eps", "ilon", ",", " ", "we", " ", "shou", "ld", " ", "take", " ", "a", " ", "random", " ", "action", " ", "and", "\\", "10", ";", " ", " ", "take", " ", "the", " ", "best", " ", "policy", " ", "action", " ", "other", "wis", "e", ".", " ", " ", "Not", "e", " ", "tha", "t", " ", "if", " ", "there", " ", "are", "\\", "10", ";", " ", " ", "no", " ", "lega", "l", " ", "action", "s", ",", " ", "whi", "ch", " ", "is", " ", "the", " ", "case", " ", "at", " ", "the", " ", "termina", "l", " ", "state", ",", " ", "you", "\\", "10", ";", " ", " ", "shou", "ld", " ", "choose", " ", "Non", "e", " ", "as", " ", "the", " ", "action", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "HINT", ":", " ", "You", " ", "mig", "ht", " ", "want", " ", "to", " ", "use", " ", "util", ".", "flip", "Coin", "(", "prob", ")", "\\", "10", ";", " ", " ", "HINT", ":", " ", "To", " ", "pick", " ", "random", "ly", " ", "from", " ", "a", " ", "list", ",", " ", "use", " ", "random", ".", "choice", "(", "list", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pick", " ", "Action_", "\\u\\u\\uNL\\u\\u\\u_", "lega", "l", "Actions_", "=_", "self_", "._", "get", "Legal", "Actions_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"**", "*", " ", "YOU", "R", " ", "CODE", " ", "HER", "E", " ", "***\"", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "raise", "Not", "Define", "d_", "(_", ")_", "\\u\\u\\uNEWLIN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load(graph, source):\n try:\n return graph.load(source, **kwargs)\n except:\n pass\n try:\n return graph.load(source, format='n3', **kwargs)\n except:\n pass\n try:\n return graph.load(source, format='nt', **kwargs)\n except:\n raise Exception(\n \"Could not load %s as either RDF/XML, N3 or NTriples\" % (\n source))\n\n if not rdflib.plugins.sparql.SPARQL_LOAD_GRAPHS:\n # we are not loading - if we already know the graph\n # being \"loaded\", just add it to the default-graph\n if default:\n self.graph += self.dataset.get_context(source)\n else:\n\n if default:\n _load(self.graph, source)\n else:\n _load(self.dataset, source)", "metadata": "root.QueryContext.load", "header": "['class', 'QueryContext', '(', 'object', ')', ':', '___EOS___']", "index": 251 } ]
[ { "span": "except:", "start_line": 256, "start_column": 12, "end_line": 256, "end_column": 19 }, { "span": "except:", "start_line": 260, "start_column": 12, "end_line": 260, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Query", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "load_", "(_", "self_", ",_", "source_", ",_", "default_", "=_", "False_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "load_", "(_", "graph_", ",_", "source_", ")_", ":_", "\\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_", "graph_", "._", "load_", "(_", "source_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "graph_", "._", "load_", "(_", "source_", ",_", "format_", "=_", "'", "n", "3", "'_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "graph_", "._", "load_", "(_", "source_", ",_", "format_", "=_", "'", "nt", "'_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cou", "ld", " ", "not", " ", "load", " ", "%", "s", " ", "as", " ", "eit", "her", " ", "RDF", "/", "XML", ",", " ", "N3", " ", "or", " ", "NT", "rip", "les", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "rdflib_", "._", "plugins_", "._", "sparql", "_", "._", "SPAR", "QL", "\\u", "LOAD", "\\u", "GRAPH", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "are", " ", "not", " ", "load", "ing", " ", "-", " ", "if", " ", "we", " ", "alr", "ead", "y", " ", "know", " ", "the", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bei", "ng", " ", "\"", "load", "ed", "\",", " ", "just", " ", "add", " ", "it", " ", "to", " ", "the", " ", "default", "-", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "graph_", "+=_", "self_", "._", "dataset_", "._", "get", "\\u", "context_", "(_", "source_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "load_", "(_", "self_", "._", "graph_", ",_", "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 ", " _", "\\u", "load_", "(_", "self_", "._", "dataset_", ",_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
mozilla/addons-server/src/olympia/amo/tests/test_celery.py
[ { "content": "import datetime\nimport unittest\nfrom datetime import timedelta\n\nimport mock\n\nfrom olympia.amo.celery import task\nfrom olympia.amo.utils import utc_millesecs_from_epoch\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import datetime", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "oly", "mpi", "a_", "._", "amo", "_", "._", "celery_", "import_", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oly", "mpi", "a_", "._", "amo", "_", "._", "utils_", "import_", "utc", "\\u", "mill", "ese", "cs", "\\u", "from", "\\u", "epoch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
mmp2/megaman/examples/example.py
[ { "content": "import sys\nimport numpy as np\nimport scipy as sp\nimport scipy.sparse as sparse\nfrom megaman.geometry import Geometry\nfrom sklearn import datasets\nfrom megaman.embedding import (Isomap, LocallyLinearEmbedding,\n LTSA, SpectralEmbedding)\n\n# Generate an example data set\nN = 10\nX, color = datasets.samples_generator.make_s_curve(N, random_state=0)\n\n# Geometry is the main class that will Cache things like distance, affinity, and laplacian.\n# you instantiate the Geometry class with the parameters & methods for the three main components:\n# Adjacency: an NxN (sparse) pairwise matrix indicating neighborhood regions\n# Affinity an NxN (sparse) pairwise matrix insicated similarity between points \n# Laplacian an NxN (sparse) pairwsie matrix containing geometric manifold information\n\nradius = 5\nadjacency_method = 'cyflann'\nadjacency_kwds = {'radius':radius} # ignore distances above this radius\naffinity_method = 'gaussian'\naffinity_kwds = {'radius':radius} # A = exp(-||x - y||/radius^2) \nlaplacian_method = 'geometric'\nlaplacian_kwds = {'scaling_epps':radius} # scaling ensures convergence to Laplace-Beltrami operator\n\ngeom = Geometry(adjacency_method=adjacency_method, adjacency_kwds=adjacency_kwds,\n\t\t\t\t affinity_method=affinity_method, affinity_kwds=affinity_kwds,\n\t\t\t\t laplacian_method=laplacian_method, laplacian_kwds=laplacian_kwds)\n\n# You can/should also use the set_data_matrix, set_adjacency_matrix, set_affinity_matrix\n# to send your data set (in whichever form it takes) this way.\ngeom.set_data_matrix(X)\n\n# You can get the distance, affinity etc with e.g: Geometry.get_distance_matrix()\n\t# you can update the keyword arguments passed inially using these functions\nadjacency_matrix = geom.compute_adjacency_matrix()\n# by defualt this is pass-by-reference. Use copy=True to get a copied version.\n\n# If you don't want to pre-compute a Geometry you can pass a dictionary or geometry\n# arguments to one of the embedding classes.\ngeom = {'adjacency_method':adjacency_method, 'adjacency_kwds':adjacency_kwds,\n\t\t 'affinity_method':affinity_method, 'affinity_kwds':affinity_kwds,\n\t\t 'laplacian_method':laplacian_method, 'laplacian_kwds':laplacian_kwds}\n\t\n\n# an example follows for creating each embedding into 2 dimensions.\nn_components = 2\n\n# LTSA\nltsa =LTSA(n_components=n_components, eigen_solver='arpack',\n\t\t\tgeom=geom)\nembed_ltsa = ltsa.fit_transform(X)\n\n# LLE\nlle = LocallyLinearEmbedding(n_components=n_components, eigen_solver='arpack',\n\t\t\t\t\t\t\t geom=geom)\nembed_lle = lle.fit_transform(X)\n\n# Isomap\nisomap = Isomap(n_components=n_components, eigen_solver='arpack',\n\t\t\t\tgeom=geom)\nembed_isomap = isomap.fit_transform(X)\n\n# Spectral Embedding \nspectral = SpectralEmbedding(n_components=n_components, eigen_solver='arpack',\n\t\t\t\t\t\t\t geom=geom)\nembed_spectral = spectral.fit_transform(X)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 10 }, { "span": "import numpy as np", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 18 }, { "span": "import scipy as sp", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 18 }, { "span": "import scipy.sparse as sparse", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "as_", "sp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "sparse_", "as_", "sparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mega", "man_", "._", "geometry_", "import_", "Geometry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "import_", "datasets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mega", "man_", "._", "embedding_", "import_", "(_", "Iso", "map_", ",_", "Local", "ly", "Linea", "r", "Embedding", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "LT", "SA", "_", ",_", "Spectra", "l", "Embedding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "an", " ", "example", " ", "data", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "N_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", ",_", "color_", "=_", "datasets_", "._", "samples", "\\u", "generator_", "._", "make", "\\u", "s", "\\u", "curve_", "(_", "N_", ",_", "random", "\\u", "state_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Geometr", "y", " ", "is", " ", "the", " ", "main", " ", "class", " ", "tha", "t", " ", "will", " ", "Cache", " ", "thing", "s", " ", "like", " ", "distance", ",", " ", "affinity", ",", " ", "and", " ", "laplac", "ian", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "instantiate", " ", "the", " ", "Geometr", "y", " ", "class", " ", "with", " ", "the", " ", "parameter", "s", " ", "&", " ", "method", "s", " ", "for", " ", "the", " ", "three", " ", "main", " ", "component", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Adj", "acen", "cy", ":", " ", "an", " ", "Nx", "N", " ", "(", "spars", "e", ")", " ", "pairwise", " ", "matrix", " ", "indicati", "ng", " ", "neighborhood", " ", "regions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Affi", "nit", "y", " ", "an", " ", "Nx", "N", " ", "(", "spars", "e", ")", " ", "pairwise", " ", "matrix", " ", "insi", "cated", " ", "similar", "it", "y", " ", "bet", "ween", " ", "points", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lap", "lac", "ian", " ", "an", " ", "Nx", "N", " ", "(", "spars", "e", ")", " ", "pair", "ws", "ie", " ", "matrix", " ", "contain", "ing", " ", "geometric", " ", "mani", "fold", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "radius_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adjacency", "\\u", "method_", "=_", "'", "cy", "flan", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adjacency", "\\u", "kwds_", "=_", "{_", "'", "radi", "us", "'_", ":_", "radius_", "}_", "#", " ", "ignore", " ", "distance", "s", " ", "above", " ", "this", " ", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "affinity", "\\u", "method_", "=_", "'", "gauss", "ian", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "affinity", "\\u", "kwds_", "=_", "{_", "'", "radi", "us", "'_", ":_", "radius_", "}_", "#", " ", "A", " ", "=", " ", "exp", "(-", "||", "x", " ", "-", " ", "y", "||", "/", "radi", "us", "^", "2", ")", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "laplac", "ian", "\\u", "method_", "=_", "'", "geometric", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "laplac", "ian", "\\u", "kwds_", "=_", "{_", "'", "scal", "ing", "\\u", "ep", "ps", "'_", ":_", "radius_", "}_", "#", " ", "scal", "ing", " ", "ensure", "s", " ", "convergence", " ", "to", " ", "Lap", "lace", "-", "Bel", "tram", "i", " ", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "geom_", "=_", "Geometry_", "(_", "adjacency", "\\u", "method_", "=_", "adjacency", "\\u", "method_", ",_", "adjacency", "\\u", "kwds_", "=_", "adjacency", "\\u", "kwds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "affinity", "\\u", "method_", "=_", "affinity", "\\u", "method_", ",_", "affinity", "\\u", "kwds_", "=_", "affinity", "\\u", "kwds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "laplac", "ian", "\\u", "method_", "=_", "laplac", "ian", "\\u", "method_", ",_", "laplac", "ian", "\\u", "kwds_", "=_", "laplac", "ian", "\\u", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "can", "/", "shou", "ld", " ", "als", "o", " ", "use", " ", "the", " ", "set\\u", "data\\u", "matrix", ",", " ", "set\\u", "adjacency", "\\u", "matrix", ",", " ", "set\\u", "affinity", "\\u", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "send", " ", "your", " ", "data", " ", "set", " ", "(", "in", " ", "whi", "che", "ver", " ", "form", " ", "it", " ", "take", "s", ")", " ", "this", " ", "way", "._", "\\u\\u\\uNL\\u\\u\\u_", "geom_", "._", "set\\u", "data\\u", "matrix_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "can", " ", "get", " ", "the", " ", "distance", ",", " ", "affinity", " ", "etc", " ", "with", " ", "e", ".", "g", ":", " ", "Geometr", "y", ".", "get", "\\u", "distance", "\\u", "matrix", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "can", " ", "update", " ", "the", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "pass", "ed", " ", "ini", "ally", " ", "usi", "ng", " ", "these", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "adjacency", "\\u", "matrix_", "=_", "geom_", "._", "compute", "\\u", "adjacency", "\\u", "matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "by", " ", "defu", "alt", " ", "this", " ", "is", " ", "pass", "-", "by", "-", "reference", ".", " ", "Us", "e", " ", "copy", "=", "Tru", "e", " ", "to", " ", "get", " ", "a", " ", "copie", "d", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "don", "'", "t", " ", "want", " ", "to", " ", "pre", "-", "compute", " ", "a", " ", "Geometr", "y", " ", "you", " ", "can", " ", "pass", " ", "a", " ", "dictionar", "y", " ", "or", " ", "geometry_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", "s", " ", "to", " ", "one", " ", "of", " ", "the", " ", "embed", "ding", " ", "classe", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "geom_", "=_", "{_", "'", "adjacency", "\\u", "method", "'_", ":_", "adjacency", "\\u", "method_", ",_", "'", "adjacency", "\\u", "kwd", "s", "'_", ":_", "adjacency", "\\u", "kwds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "affinity", "\\u", "method", "'_", ":_", "affinity", "\\u", "method_", ",_", "'", "affinity", "\\u", "kwd", "s", "'_", ":_", "affinity", "\\u", "kwds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "laplac", "ian", "\\u", "method", "'_", ":_", "laplac", "ian", "\\u", "method_", ",_", "'", "laplac", "ian", "\\u", "kwd", "s", "'_", ":_", "laplac", "ian", "\\u", "kwds_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "an", " ", "example", " ", "follow", "s", " ", "for", " ", "creati", "ng", " ", "each", " ", "embed", "ding", " ", "int", "o", " ", "2", " ", "dimension", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "components_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LT", "SA", "_", "\\u\\u\\uNL\\u\\u\\u_", "lts", "a_", "=_", "LT", "SA", "_", "(_", "n", "\\u", "components_", "=_", "n", "\\u", "components_", ",_", "eigen", "\\u", "solver_", "=_", "'", "arp", "ack", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "geom_", "=_", "geom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "embed", "\\u", "lts", "a_", "=_", "lts", "a_", "._", "fit", "\\u", "transform_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LLE", "_", "\\u\\u\\uNL\\u\\u\\u_", "lle", "_", "=_", "Local", "ly", "Linea", "r", "Embedding", "_", "(_", "n", "\\u", "components_", "=_", "n", "\\u", "components_", ",_", "eigen", "\\u", "solver_", "=_", "'", "arp", "ack", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "geom_", "=_", "geom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "embed", "\\u", "lle", "_", "=_", "lle", "_", "._", "fit", "\\u", "transform_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iso", "map_", "\\u\\u\\uNL\\u\\u\\u_", "isom", "ap_", "=_", "Iso", "map_", "(_", "n", "\\u", "components_", "=_", "n", "\\u", "components_", ",_", "eigen", "\\u", "solver_", "=_", "'", "arp", "ack", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "geom_", "=_", "geom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "embed", "\\u", "isom", "ap_", "=_", "isom", "ap_", "._", "fit", "\\u", "transform_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Spectra", "l", " ", "Embedding", " _", "\\u\\u\\uNL\\u\\u\\u_", "spectral", "_", "=_", "Spectra", "l", "Embedding", "_", "(_", "n", "\\u", "components_", "=_", "n", "\\u", "components_", ",_", "eigen", "\\u", "solver_", "=_", "'", "arp", "ack", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "geom_", "=_", "geom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "embed", "\\u", "spectral", "_", "=_", "spectral", "_", "._", "fit", "\\u", "transform_", "(_", "X_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
saltstack/salt/tests/unit/modules/k8s_test.py
[ { "content": " def test_get_resource_quotas(self):\n name = self.name\n namespace = self.name\n create_namespace = Popen([\"kubectl\", \"create\", \"namespace\", namespace], stdout=PIPE)\n create_namespace = Popen([\"kubectl\", \"create\", \"namespace\", namespace], stdout=PIPE)\n request = \"\"\"\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n name: {0}\nspec:\n hard:\n cpu: \"20\"\n memory: 1Gi\n persistentvolumeclaims: \"10\"\n pods: \"10\"\n replicationcontrollers: \"20\"\n resourcequotas: \"1\"\n secrets: \"10\"\n services: \"5\"\n\"\"\".format(name)\n filename = \"/tmp/{0}.yaml\".format(name)\n with open(filename, 'w') as f:\n f.write(request)\n\n create = Popen([\"kubectl\", \"--namespace={0}\".format(namespace), \"create\", \"-f\", filename], stdout=PIPE)\n # wee need to give kubernetes time save data in etcd\n time.sleep(0.2)\n res = k8s.get_resource_quotas(namespace, apiserver_url=\"http://127.0.0.1:8080\")\n a = len(res.get(\"items\", []))\n proc = Popen([\"kubectl\", \"--namespace={0}\".format(namespace), \"get\", \"quota\", \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n b = len(kubectl_out.get(\"items\", []))\n self.assertEqual(a, b)", "metadata": "root.TestK8SResourceQuotas.test_get_resource_quotas", "header": "['class', 'TestK8SResourceQuotas', '(', 'TestCase', ')', ':', '___EOS___']", "index": 180 } ]
[ { "span": "create_namespace ", "start_line": 183, "start_column": 8, "end_line": 183, "end_column": 24 } ]
[ { "span": "create_namespace ", "start_line": 184, "start_column": 8, "end_line": 184, "end_column": 24 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "K", "8", "SR", "esource", "Quota", "s_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "resource", "\\u", "quotas_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "namespace_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "namespace_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"", "create", "\"_", ",_", "\"", "namespace", "\"_", ",_", "namespace_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "namespace_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"", "create", "\"_", ",_", "\"", "namespace", "\"_", ",_", "namespace_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "\"\"\"", "\\", "10", ";", "api", "Version", ":", " ", "v1", "\\", "10", ";", "kind", ":", " ", "Reso", "urc", "e", "Quota", "\\", "10", ";", "metadata", ":", "\\", "10", ";", " ", " ", "name", ":", " ", "{", "0", "}", "\\", "10", ";", "spec", ":", "\\", "10", ";", " ", " ", "hard", ":", "\\", "10", ";", " ", " ", " ", " ", "cpu", ":", " ", "\"", "20", "\"", "\\", "10", ";", " ", " ", " ", " ", "memory", ":", " ", "1", "Gi", "\\", "10", ";", " ", " ", " ", " ", "persiste", "nt", "volume", "claim", "s", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "pods", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "replication", "controlle", "rs", ":", " ", "\"", "20", "\"", "\\", "10", ";", " ", " ", " ", " ", "resource", "quotas", ":", " ", "\"", "1", "\"", "\\", "10", ";", " ", " ", " ", " ", "secret", "s", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "service", "s", ":", " ", "\"", "5", "\"", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/{", "0", "}.", "yaml", "\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "={", "0", "}\"_", "._", "format_", "(_", "namespace_", ")_", ",_", "\"", "create", "\"_", ",_", "\"-", "f", "\"_", ",_", "filename_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wee", " ", "need", " ", "to", " ", "give", " ", "kubernetes", " ", "time", " ", "save", " ", "data", " ", "in", " ", "etcd", "_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "get", "\\u", "resource", "\\u", "quotas_", "(_", "namespace_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "len_", "(_", "res_", "._", "get_", "(_", "\"", "items", "\"_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "={", "0", "}\"_", "._", "format_", "(_", "namespace_", ")_", ",_", "\"", "get", "\"_", ",_", "\"", "quot", "a", "\"_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "len_", "(_", "kubec", "tl", "\\u", "out_", "._", "get_", "(_", "\"", "items", "\"_", ",_", "[_", "]_", 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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 ]
Unused import
mertyildiran/Cerebrum/cerebrum/vision/developmentExamples/opencv-optical-flow.py
[ { "content": "# USAGE\n# python opencv-optical-flow.py\n# python opencv-optical-flow.py --video PATH/example_01.mp4\n\nimport numpy\nimport cv2\nimport argparse\nimport time\nimport random\nimport math\nimport imutils\nfrom collections import Counter\n\nTRACKER_POINTS = 500 # How many points will be used to track the optical flow\nCRAZY_LINE_DISTANCE = 50 # Distance value to detect crazy lines\nCRAZY_LINE_LIMIT = 100 * TRACKER_POINTS / 1000 # Amount of crazy lines are indication of different shots\nABSDIFF_ANGLE = 20 # To determine the inconsistency between tangent values in degrees\nLINE_THICKNESS = 3 # Lines thickness that we will use for mask delta\nCONTOUR_LIMIT = 10 # Contour limit for detecting ZOOM, ZOOM + PAN, ZOOM + TILT, ZOOM + ROLL (Not just PAN, TILT, ROLL)\nTARGET_HEIGHT = 360 # Number of horizontal lines for target video and processing. Like 720p, 360p etc.\nDELTA_LIMIT_DIVISOR = 3 # Divisor for detecting too much motion. Like: ( height * width / X )\n\n# Construct the argument parser and parse the arguments\nap = argparse.ArgumentParser()\nap.add_argument(\"-v\", \"--video\", help=\"path to the video file\")\nap.add_argument(\"-a\", \"--min-area\", type=int, default=500, help=\"minimum area size\")\nargs = vars(ap.parse_args())\n\nif args.get(\"video\", None) is None: # If the video argument is None, then we are reading from webcam\n\tcap = cv2.VideoCapture(0)\n\ttime.sleep(0.25)\nelse: # Otherwise, we are reading from a video file\n\tcap = cv2.VideoCapture(args[\"video\"])\n\n# Parameters for Lucas Kanade Optical Flow\nlk_params = dict( winSize = (15,15),\n\t\t\t\t maxLevel = 2,\n\t\t\t\t criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03))\n\nwhile True: # On this level it gets only one frame\n\n\tcolor = numpy.random.randint(0,255,(TRACKER_POINTS,3)) # Create some random colors\n\n\tret, old_frame = cap.read() # Take first frame\n\told_frame = imutils.resize(old_frame, height=TARGET_HEIGHT) # Resize frame to 360p. Alternative resizing method:\n\told_gray = cv2.cvtColor(old_frame, cv2.COLOR_BGR2GRAY) # Convert previous frame to grayscale\n\n\theight, width = old_frame.shape[:2] # Get video height and width (size)\n\n\t# Create random points on frame\n\tp1 = numpy.random.randint(width, size=(TRACKER_POINTS, 1, 2))\n\tfor y in p1: # Get y values one by one\n\t\t if y[0][1] > height: # If there is a y value that greater than max height\n\t\t\t y[0][1] = numpy.random.random_integers(height) # Random again this time with max height value\n\tp1 = p1.astype(numpy.float32) # Change numpy array's data type to float32\n\n\tmask = numpy.zeros_like(old_frame) # Create a mask image for drawing purposes (original frame)\n\tmask_delta = numpy.zeros_like(old_frame) # Create a mask image for drawing purposes (delta frame)\n\tmask_white = numpy.ones_like(old_frame) # Create a white mask image for cloning original frame\n\twhite_color = numpy.array([255,255,255]) # Define color white\n\n\ttotal_crazy_lines = 0 # Crazy line counter\n\n\tmost_common_angle = None # Most common angle in general optical flow in shot\n\n\twhile True: # Loop over the frames of the video\n\n\t\tmask_biggest_contour = numpy.zeros_like(old_frame) # Create a mask image for drawing purposes (biggest contour frame)\n\n\t\tret,frame = cap.read() # Take a new frame\n\t\tframe = imutils.resize(frame, height=TARGET_HEIGHT) # Resize frame to 360p. Alternative resizing method:\n\t\tframe_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # Convert it to grayscale\n\n\t\tdelta_value = 0 # Delta Value for storing max continuous contour area for current frame\n\n\t\tp2, st, err = cv2.calcOpticalFlowPyrLK(old_gray, frame_gray, p1, None, **lk_params) # Calculate optical flow (Lucas Kanade Optical Flow function of OpenCV)\n\n\t\tif p2 is None: # If there are not any points that coming from Lucas Kanade Optical Flow function of OpenCV\n\t\t\tbreak # Break the loop to reconstruct the optical flow\n\n\t\t# Select good points\n\t\tgood_points2 = p2[st==1]\n\t\tgood_points1 = p1[st==1]\n\n\t\tangles_array = [] # Angle list of all newly created tiny lines\n\n\t\tfor i,(good_point2,good_point1) in enumerate(zip(good_points2,good_points1)): # Get point pairs one by one\n\n\t\t\t# Get coordinates of points\n\t\t\tx2,y2 = good_point2.ravel() # New point\n\t\t\tx1,y1 = good_point1.ravel() # Previous point\n\n\t\t\tdistance = math.hypot(x2 - x1, y2 - y1) # Length of the tiny line between these two points.\n\n\t\t\tif distance >= CRAZY_LINE_DISTANCE: # If the line is not that \"tiny\" it's CRAZY! xD\n\t\t\t\ttotal_crazy_lines += 1 # Then increase total crazy line counter's value\n\n\t\t\tangle = math.atan2(y2-y1, x2-x1) # Calculate tangent value of the line (returns Radian)\n\t\t\tangle = math.degrees(angle) # Radian to Degree\n\t\t\tangle = round(angle) # Round up the degree\n\t\t\tangles_array.append(angle) # Append the degree to Angle List\n\n\t\t\tif most_common_angle != None: # If there is a most common angle value\n\t\t\t\tif abs(most_common_angle - angle) > ABSDIFF_ANGLE: # If Absolute Difference between most common angle and the current line's angle greater than ABDSDIFF_ANGLE value, this line is inconsistent to current general optical flow\n\t\t\t\t\tcv2.line(mask_delta, (x2,y2),(x1,y1), white_color, LINE_THICKNESS) # Then draw a white line to mask_delta\n\n\t\t\tcv2.line(mask, (x2,y2),(x1,y1), color[i].tolist(), 1) # In every frame draw the colored lines to original frame for better understanding (optional)\n\n\t\tif angles_array: # If angles_array is not empty\n\t\t\tmost_common_angle = Counter(angles_array).most_common()[0][0] # Find most common angle value in Angle List\n\n\t\tmask_delta_gray = cv2.cvtColor(mask_delta, cv2.COLOR_BGR2GRAY) # Convert mask_delta to grayscale\n\t\tthresh = cv2.threshold(mask_delta_gray, 12, 255, cv2.THRESH_BINARY)[1] # Apply OpenCV's threshold function to get binary frame\n\t\tthresh = cv2.dilate(thresh, None, iterations=1) # Dlation to increase white region for surrounding pixels\n\n\t\t# Find contours on thresholded image\n\t\t(cnts, _) = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n\n\t\tcontour_area_stack = [] # List of contour areas's values\n\t\tcontour_dictionary = {} # Dictionary of contours key = 'contour area' & value = 'contour coordinates (x,y,w,h)'\n\t\tbiggest_contour_coordinates = None # Biggest contour coordinate\n\n\t\tframe_final_form = cv2.add(frame,mask_white)\n\n\t\t# Loop over the contours\n\t\tif cnts:\n\t\t\tfor c in cnts: # Contour in Contours\n\t\t\t\tcontour_area_stack.append(cv2.contourArea(c)) # Calculate contour area and append to contour stack\n\t\t\t\tif cv2.contourArea(c) > args[\"min_area\"]: # If contour area greater than min area\n\t\t\t\t\t(x, y, w, h) = cv2.boundingRect(c) # Compute the bounding box for this contour\n\t\t\t\t\tcv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2) # Draw it on the frame\n\t\t\t\t\tcontour_dictionary[cv2.contourArea(c)] = (x, y, w, h) # Add a key - value pair to contour dictionary\n\t\t\tdelta_value = max(contour_area_stack) # Assign max contour area to delta value\n\n\t\t\tif contour_dictionary: # If contour dictionary is not empty\n\t\t\t\tbiggest_contour_coordinates = contour_dictionary[delta_value] # Get coordinates of biggest contour\n\n\t\t\tif biggest_contour_coordinates: # If we have the coordinates it means there is a contour in the frame at the same time\n\t\t\t\t# Parse the coordinates\n\t\t\t\tx = biggest_contour_coordinates[0]\n\t\t\t\ty = biggest_contour_coordinates[1]\n\t\t\t\tw = biggest_contour_coordinates[2]\n\t\t\t\th = biggest_contour_coordinates[3]\n\t\t\t\tcv2.rectangle(mask_biggest_contour, (x, y), (x + w, y + h), (255, 255, 255), -1) # Draw only one white rectange\n\n\t\tif delta_value > (height * width / DELTA_LIMIT_DIVISOR): # If delta value is too much\n\t\t\tbreak # Then break\n\n\t\tif len(contour_dictionary) > CONTOUR_LIMIT: # PROBABLY!!! There is a ZOOM, ZOOM + PAN, ZOOM + TILT, ZOOM + ROLL situation (Not just PAN, TILT, ROLL)\n\t\t\t# Then restart angle calculation. This time divide frame to quarters\n\n\t\t\ttotal_crazy_lines = 0 # Crazy line counter\n\t\t\tmost_common_angle1 = None # Most common angle in general optical flow in shot\n\t\t\tangles_array1 = [] # Angle list of all newly created tiny lines\n\t\t\tmost_common_angle2 = None # Most common angle in general optical flow in shot\n\t\t\tangles_array2 = [] # Angle list of all newly created tiny lines\n\t\t\tmost_common_angle3 = None # Most common angle in general optical flow in shot\n\t\t\tangles_array3 = [] # Angle list of all newly created tiny lines\n\t\t\tmost_common_angle4 = None # Most common angle in general optical flow in shot\n\t\t\tangles_array4 = [] # Angle list of all newly created tiny lines\n\t\t\tmask_delta = numpy.zeros_like(old_frame) # Create a mask image for drawing purposes (delta frame)\n\n\t\t\tfor i,(good_point2,good_point1) in enumerate(zip(good_points2,good_points1)): # Get point pairs one by one\n\n\t\t\t\t# Get coordinates of points\n\t\t\t\tx2,y2 = good_point2.ravel() # New point\n\t\t\t\tx1,y1 = good_point1.ravel() # Previous point\n\n\t\t\t\tdistance = math.hypot(x2 - x1, y2 - y1) # Length of the tiny line between these two points.\n\n\t\t\t\tif distance >= CRAZY_LINE_DISTANCE: # If the line is not that \"tiny\" it's CRAZY! xD\n\t\t\t\t\ttotal_crazy_lines += 1 # Then increase total crazy line counter's value\n\n\t\t\t\tangle = math.atan2(y2-y1, x2-x1) # Calculate tangent value of the line (returns Radian)\n\t\t\t\tangle = math.degrees(angle) # Radian to Degree\n\t\t\t\tangle = round(angle) # Round up the degree\n\n\t\t\t\tif (x1 <= (width / 2)) and (y1 <= (height / 2)):\n\t\t\t\t\tangles_array1.append(angle) # Append the degree to Angle List\n\t\t\t\t\tif most_common_angle1 != None: # If there is a most common angle value\n\t\t\t\t\t\tif abs(most_common_angle1 - angle) > ABSDIFF_ANGLE: # If Absolute Difference between most common angle and the current line's angle greater than ABDSDIFF_ANGLE value, this line is inconsistent to current general optical flow\n\t\t\t\t\t\t\tcv2.line(mask_delta, (x2,y2),(x1,y1), white_color, LINE_THICKNESS) # Then draw a white line to mask_delta\n\t\t\t\tif (x1 >= (width / 2)) and (y1 <= (height / 2)):\n\t\t\t\t\tangles_array2.append(angle) # Append the degree to Angle List\n\t\t\t\t\tif most_common_angle2 != None: # If there is a most common angle value\n\t\t\t\t\t\tif abs(most_common_angle2 - angle) > ABSDIFF_ANGLE: # If Absolute Difference between most common angle and the current line's angle greater than ABDSDIFF_ANGLE value, this line is inconsistent to current general optical flow\n\t\t\t\t\t\t\tcv2.line(mask_delta, (x2,y2),(x1,y1), white_color, LINE_THICKNESS) # Then draw a white line to mask_delta\n\t\t\t\tif (x1 <= (width / 2)) and (y1 >= (height / 2)):\n\t\t\t\t\tangles_array3.append(angle) # Append the degree to Angle List\n\t\t\t\t\tif most_common_angle3 != None: # If there is a most common angle value\n\t\t\t\t\t\tif abs(most_common_angle3 - angle) > ABSDIFF_ANGLE: # If Absolute Difference between most common angle and the current line's angle greater than ABDSDIFF_ANGLE value, this line is inconsistent to current general optical flow\n\t\t\t\t\t\t\tcv2.line(mask_delta, (x2,y2),(x1,y1), white_color, LINE_THICKNESS) # Then draw a white line to mask_delta\n\t\t\t\tif (x1 >= (width / 2)) and (y1 >= (height / 2)):\n\t\t\t\t\tangles_array4.append(angle) # Append the degree to Angle List\n\t\t\t\t\tif most_common_angle3 != None: # If there is a most common angle value\n\t\t\t\t\t\tif abs(most_common_angle3 - angle) > ABSDIFF_ANGLE: # If Absolute Difference between most common angle and the current line's angle greater than ABDSDIFF_ANGLE value, this line is inconsistent to current general optical flow\n\t\t\t\t\t\t\tcv2.line(mask_delta, (x2,y2),(x1,y1), white_color, LINE_THICKNESS) # Then draw a white line to mask_delta\n\n\t\t\t\tcv2.line(mask, (x2,y2),(x1,y1), color[i].tolist(), 1) # In every frame draw the colored lines to original frame for better understanding (optional)\n\n\t\t\tif angles_array1: # If angles_array is not empty\n\t\t\t\tmost_common_angle1 = Counter(angles_array1).most_common()[0][0] # Find most common angle value in Angle List\n\t\t\tif angles_array2: # If angles_array is not empty\n\t\t\t\tmost_common_angle2 = Counter(angles_array2).most_common()[0][0] # Find most common angle value in Angle List\n\t\t\tif angles_array3: # If angles_array is not empty\n\t\t\t\tmost_common_angle3 = Counter(angles_array3).most_common()[0][0] # Find most common angle value in Angle List\n\t\t\tif angles_array4: # If angles_array is not empty\n\t\t\t\tmost_common_angle4 = Counter(angles_array4).most_common()[0][0] # Find most common angle value in Angle List\n\n\n\t\t\tmask_delta_gray = cv2.cvtColor(mask_delta, cv2.COLOR_BGR2GRAY) # Convert mask_delta to grayscale\n\t\t\tthresh = cv2.threshold(mask_delta_gray, 12, 255, cv2.THRESH_BINARY)[1] # Apply OpenCV's threshold function to get binary frame\n\t\t\tthresh = cv2.dilate(thresh, None, iterations=1) # Dlation to increase white region for surrounding pixels\n\n\t\t\t# Find contours on thresholded image\n\t\t\t(cnts, _) = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n\n\t\t\tcontour_area_stack = [] # List of contour areas's values\n\t\t\tcontour_dictionary = {} # Dictionary of contours key = 'contour area' & value = 'contour coordinates (x,y,w,h)'\n\t\t\tbiggest_contour_coordinates = None # Biggest contour coordinate\n\n\t\t\tframe_final_form = cv2.add(frame,mask_white)\n\n\t\t\t# Loop over the contours\n\t\t\tif cnts:\n\t\t\t\tfor c in cnts: # Contour in Contours\n\t\t\t\t\tcontour_area_stack.append(cv2.contourArea(c)) # Calculate contour area and append to contour stack\n\t\t\t\t\tif cv2.contourArea(c) > args[\"min_area\"]: # If contour area greater than min area\n\t\t\t\t\t\t(x, y, w, h) = cv2.boundingRect(c) # Compute the bounding box for this contour\n\t\t\t\t\t\tcv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2) # Draw it on the frame\n\t\t\t\t\t\tcontour_dictionary[cv2.contourArea(c)] = (x, y, w, h) # Add a key - value pair to contour dictionary\n\t\t\t\tdelta_value = max(contour_area_stack) # Assign max contour area to delta value\n\n\t\t\t\tif contour_dictionary: # If contour dictionary is not empty\n\t\t\t\t\tbiggest_contour_coordinates = contour_dictionary[delta_value] # Get coordinates of biggest contour\n\n\t\t\t\tif biggest_contour_coordinates: # If we have the coordinates it means there is a contour in the frame at the same time\n\t\t\t\t\t# Parse the coordinates\n\t\t\t\t\tx = biggest_contour_coordinates[0]\n\t\t\t\t\ty = biggest_contour_coordinates[1]\n\t\t\t\t\tw = biggest_contour_coordinates[2]\n\t\t\t\t\th = biggest_contour_coordinates[3]\n\t\t\t\t\tcv2.rectangle(mask_biggest_contour, (x, y), (x + w, y + h), (255, 255, 255), -1) # Draw only one white rectange\n\n\t\t\tif delta_value > (height * width / DELTA_LIMIT_DIVISOR): # If delta value is too much\n\t\t\t\tbreak # Then break\n\n\t\telse: # There is just a PAN, TILT, ROLL situation. Don't touch anything.\n\t\t\tpass\n\n\t\tmask_biggest_contour_gray = cv2.cvtColor(mask_biggest_contour, cv2.COLOR_BGR2GRAY) # Convert mask_biggest_contour to grayscale\n\t\tthresh_biggest_contour = cv2.threshold(mask_biggest_contour_gray, 12, 255, cv2.THRESH_BINARY)[1] # Apply OpenCV's threshold function to get binary frame\n\n\t\tthresh_final_form = cv2.bitwise_and(thresh,thresh, mask= thresh_biggest_contour) # Bitwise and - biggest contour and tresh lines\n\t\tthresh_final_form = cv2.dilate(thresh_final_form, None, iterations=1) # Dlation to increase white region for surrounding pixels\n\n\t\tframeDelta = cv2.bitwise_and(frame_final_form,frame_final_form, mask= thresh_final_form) # Bitwise and - to get delta frame\n\n\t\tif total_crazy_lines >= CRAZY_LINE_LIMIT: # If amout of total crazy lines is greater than CRAZY_LINE_LIMIT\n\t\t\tbreak # Break the loop to reconstruct the optical flow\n\n\t\tframe_with_mask = cv2.add(frame,mask) # Add mask layer over frame\n\t\tcv2.imshow('Original Frame',frame_with_mask) # Show Original Frame\n\t\tcv2.imshow('Mask Delta',mask_delta) # Show Mask Delta Frame\n\t\tcv2.imshow('Mask Biggest Contour',mask_biggest_contour) # Show Mask Delta Frame\n\t\tcv2.imshow('Frame Delta',frameDelta) # Show Frame Delta\n\n\t\tk = cv2.waitKey(30) & 0xff # DEVELOPMENT\n\t\tif k == 27: # DEVELOPMENT PRESS ESC\n\t\t\tbreak # DEVELOPMENT BREAK\n\n\t\told_gray = frame_gray.copy() # Update the previous frame\n\t\tp1 = good_points2.reshape(-1,1,2) # Update previous points\n\n\ncv2.destroyAllWindows() # Close any open windows\ncap.release() # Release the capture device\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import random", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "USAGE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "opencv", "-", "optic", "al", "-", "flow", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "opencv", "-", "optic", "al", "-", "flow", ".", "py", " ", "--", "video", " ", "PATH", "/", "example", "\\u", "01", ".", "mp", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cv2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imu", "tils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TRACK", "ER", "\\u", "POINTS_", "=_", "500_", "#", " ", "Ho", "w", " ", "many", " ", "points", " ", "will", " ", "be", " ", "used", " ", "to", " ", "track", " ", "the", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CRA", "ZY", "\\u", "LINE", "\\u", "DISTANCE", "_", "=_", "50_", "#", " ", "Distan", "ce", " ", "value", " ", "to", " ", "detect", " ", "cra", "zy", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CRA", "ZY", "\\u", "LINE", "\\u", "LIMIT_", "=_", "100_", "*_", "TRACK", "ER", "\\u", "POINTS_", "/_", "1000_", "#", " ", "Amo", "unt", " ", "of", " ", "cra", "zy", " ", "lines", " ", "are", " ", "indicati", "on", " ", "of", " ", "different", " ", "shots", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ABS", "DIFF", "\\u", "ANGLE", "_", "=_", "20_", "#", " ", "To", " ", "dete", "rmin", "e", " ", "the", " ", "incon", "siste", "nc", "y", " ", "bet", "ween", " ", "tangent", " ", "values", " ", "in", " ", "degrees_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LINE", "\\u", "THI", "CK", "NESS", "_", "=_", "3_", "#", " ", "Line", "s", " ", "thick", "ness", " ", "tha", "t", " ", "we", " ", "will", " ", "use", " ", "for", " ", "mask", " ", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONT", "OUR", "\\u", "LIMIT_", "=_", "10_", "#", " ", "Contour", " ", "limit", " ", "for", " ", "detect", "ing", " ", "ZOO", "M", ",", " ", "ZOO", "M", " ", "+", " ", "PAN", ",", " ", "ZOO", "M", " ", "+", " ", "TI", "LT", ",", " ", "ZOO", "M", " ", "+", " ", "ROLL", " ", "(", "Not", " ", "just", " ", "PAN", ",", " ", "TI", "LT", ",", " ", "ROLL", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TARGET", "\\u", "HEIGHT_", "=_", "360_", "#", " ", "Number", " ", "of", " ", "horizon", "tal", " ", "lines", " ", "for", " ", "target", " ", "video", " ", "and", " ", "process", "ing", ".", " ", "Lik", "e", " ", "720", "p", ",", " ", "360", "p", " ", "etc", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DELTA", "\\u", "LIMIT", "\\u", "DIVI", "SOR", "_", "=_", "3_", "#", " ", "Divis", "or", " ", "for", " ", "detect", "ing", " ", "too", " ", "muc", "h", " ", "moti", "on", ".", " ", "Lik", "e", ":", " ", "(", " ", "height", " ", "*", " ", "widt", "h", " ", "/", " ", "X", " ", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Construct", " ", "the", " ", "argu", "ment", " ", "parser", " ", "and", " ", "parse", " ", "the", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "ap_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ap_", "._", "add", "\\u", "argument_", "(_", "\"-", "v", "\"_", ",_", "\"--", "video", "\"_", ",_", "help_", "=_", "\"", "path", " ", "to", " ", "the", " ", "video", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ap_", "._", "add", "\\u", "argument_", "(_", "\"-", "a", "\"_", ",_", "\"--", "min", "-", "area", "\"_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "500_", ",_", "help_", "=_", "\"", "minim", "um", " ", "area", " ", "size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "vars_", "(_", "ap_", "._", "parse", "\\u", "args_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "get_", "(_", "\"", "video", "\"_", ",_", "None_", ")_", "is_", "None_", ":_", "#", " ", "If", " ", "the", " ", "video", " ", "argu", "ment", " ", "is", " ", "Non", "e", ",", " ", "then", " ", "we", " ", "are", " ", "readi", "ng", " ", "from", " ", "webca", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "cap_", "=_", "cv2_", "._", "Vid", "eo", "Capture_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "we", " ", "are", " ", "readi", "ng", " ", "from", " ", "a", " ", "video", " ", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "cap_", "=_", "cv2_", "._", "Vid", "eo", "Capture_", "(_", "args_", "[_", "\"", "video", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Parameter", "s", " ", "for", " ", "Luc", "as", " ", "Kan", "ade", " ", "Optic", "al", " ", "Flow_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lk", "\\u", "params_", "=_", "dict_", "(_", "win", "Size_", "=_", "(_", "15_", ",_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Level_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "criteria_", "=_", "(_", "cv2_", "._", "TERM", "\\u", "CRIT", "ERI", "A", "\\u", "EPS", "_", "|_", "cv2_", "._", "TERM", "\\u", "CRIT", "ERI", "A", "\\u", "COUNT_", ",_", "10_", ",_", "0.03_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "#", " ", "On", " ", "this", " ", "level", " ", "it", " ", "gets", " ", "only", " ", "one", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "color_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "0_", ",_", "255_", ",_", "(_", "TRACK", "ER", "\\u", "POINTS_", ",_", "3_", ")_", ")_", "#", " ", "Creat", "e", " ", "some", " ", "random", " ", "colors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", ",_", "old", "\\u", "frame_", "=_", "cap_", "._", "read_", "(_", ")_", "#", " ", "Tak", "e", " ", "first", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "frame_", "=_", "imu", "tils_", "._", "resize_", "(_", "old", "\\u", "frame_", ",_", "height_", "=_", "TARGET", "\\u", "HEIGHT_", ")_", "#", " ", "Resize", " ", "frame", " ", "to", " ", "360", "p", ".", " ", "Alternative", " ", "resiz", "ing", " ", "method", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "gray_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "old", "\\u", "frame_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "GRAY_", ")_", "#", " ", "Convert", " ", "previ", "ous", " ", "frame", " ", "to", " ", "grayscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "height_", ",_", "width_", "=_", "old", "\\u", "frame_", "._", "shape_", "[_", ":_", "2_", "]_", "#", " ", "Get", " ", "video", " ", "height", " ", "and", " ", "widt", "h", " ", "(", "size", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "random", " ", "points", " ", "on", " ", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "width_", ",_", "size_", "=_", "(_", "TRACK", "ER", "\\u", "POINTS_", ",_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "y_", "in_", "p1_", ":_", "#", " ", "Get", " ", "y", " ", "values", " ", "one", " ", "by", " ", "one_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t", " _", "if_", "y_", "[_", "0_", "]_", "[_", "1_", "]_", ">_", "height_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "y", " ", "value", " ", "tha", "t", " ", "great", "er", " ", "than", " ", "max", " ", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t", "\t", " _", "y_", "[_", "0_", "]_", "[_", "1_", "]_", "=_", "numpy_", "._", "random_", "._", "random", "\\u", "integers_", "(_", "height_", ")_", "#", " ", "Random", " ", "again", " ", "this", " ", "time", " ", "with", " ", "max", " ", "height", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p1_", "=_", "p1_", "._", "astype_", "(_", "numpy_", "._", "float32_", ")_", "#", " ", "Change", " ", "nump", "y", " ", "array", "'", "s", " ", "data", " ", "type", " ", "to", " ", "float32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mask_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "old", "\\u", "frame_", ")_", "#", " ", "Creat", "e", " ", "a", " ", "mask", " ", "image", " ", "for", " ", "drawing", " ", "purpose", "s", " ", "(", "original", " ", "frame", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "delta_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "old", "\\u", "frame_", ")_", "#", " ", "Creat", "e", " ", "a", " ", "mask", " ", "image", " ", "for", " ", "drawing", " ", "purpose", "s", " ", "(", "delta", " ", "frame", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "white_", "=_", "numpy_", "._", "ones", "\\u", "like_", "(_", "old", "\\u", "frame_", ")_", "#", " ", "Creat", "e", " ", "a", " ", "white", " ", "mask", " ", "image", " ", "for", " ", "clo", "ning", " ", "original", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "white", "\\u", "color_", "=_", "numpy_", "._", "array_", "(_", "[_", "255_", ",_", "255_", ",_", "255_", "]_", ")_", "#", " ", "Define", " ", "color", " ", "white_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "total", "\\u", "cra", "zy", "\\u", "lines_", "=_", "0_", "#", " ", "Cra", "zy", " ", "line", " ", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "most", "\\u", "common", "\\u", "angle_", "=_", "None_", "#", " ", "Mos", "t", " ", "common", " ", "angle", " ", "in", " ", "genera", "l", " ", "optic", "al", " ", "flow", " ", "in", " ", "shot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "#", " ", "Loop", " ", "over", " ", "the", " ", "frames", " ", "of", " ", "the", " ", "video_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mask", "\\u", "bigge", "st", "\\u", "contour_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "old", "\\u", "frame_", ")_", "#", " ", "Creat", "e", " ", "a", " ", "mask", " ", "image", " ", "for", " ", "drawing", " ", "purpose", "s", " ", "(", "bigge", "st", " ", "conto", "ur", " ", "frame", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", ",_", "frame_", "=_", "cap_", "._", "read_", "(_", ")_", "#", " ", "Tak", "e", " ", "a", " ", "new", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame_", "=_", "imu", "tils_", "._", "resize_", "(_", "frame_", ",_", "height_", "=_", "TARGET", "\\u", "HEIGHT_", ")_", "#", " ", "Resize", " ", "frame", " ", "to", " ", "360", "p", ".", " ", "Alternative", " ", "resiz", "ing", " ", "method", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "\\u", "gray_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "frame_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "GRAY_", ")_", "#", " ", "Convert", " ", "it", " ", "to", " ", "grayscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delta", "\\u", "value_", "=_", "0_", "#", " ", "Del", "ta", " ", "Value", " ", "for", " ", "stor", "ing", " ", "max", " ", "continuous", " ", "conto", "ur", " ", "area", " ", "for", " ", "current", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p2_", ",_", "st_", ",_", "err_", "=_", "cv2_", "._", "calc", "Optic", "al", "Flow", "Pyr", "LK", "_", "(_", "old", "\\u", "gray_", ",_", "frame", "\\u", "gray_", ",_", "p1_", ",_", "None_", ",_", "**_", "lk", "\\u", "params_", ")_", "#", " ", "Calculat", "e", " ", "optic", "al", " ", "flow", " ", "(", "Luc", "as", " ", "Kan", "ade", " ", "Optic", "al", " ", "Flow", " ", "function", " ", "of", " ", "Open", "CV", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "p2_", "is_", "None_", ":_", "#", " ", "If", " ", "there", " ", "are", " ", "not", " ", "any", " ", "points", " ", "tha", "t", " ", "comi", "ng", " ", "from", " ", "Luc", "as", " ", "Kan", "ade", " ", "Optic", "al", " ", "Flow", " ", "function", " ", "of", " ", "Open", "CV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "break_", "#", " ", "Break", " ", "the", " ", "loop", " ", "to", " ", "reconstruct", " ", "the", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "good", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "good", "\\u", "points", "2_", "=_", "p2_", "[_", "st_", "==_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "points", "1_", "=_", "p1_", "[_", "st_", "==_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "angle", "s", "\\u", "array_", "=_", "[_", "]_", "#", " ", "Ang", "le", " ", "list", " ", "of", " ", "all", " ", "newl", "y", " ", "created", " ", "tiny", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "(_", "good", "\\u", "point2_", ",_", "good", "\\u", "point1_", ")_", "in_", "enumerate_", "(_", "zip_", "(_", "good", "\\u", "points", "2_", ",_", "good", "\\u", "points", "1_", ")_", ")_", ":_", "#", " ", "Get", " ", "point", " ", "pair", "s", " ", "one", " ", "by", " ", "one_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "coordinate", "s", " ", "of", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x2_", ",_", "y2_", "=_", "good", "\\u", "point2_", "._", "ravel_", "(_", ")_", "#", " ", "New", " ", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x1_", ",_", "y1_", "=_", "good", "\\u", "point1_", "._", "ravel_", "(_", ")_", "#", " ", "Prev", "ious", " ", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "math_", "._", "hypot", "_", "(_", "x2_", "-_", "x1_", ",_", "y2_", "-_", "y1_", ")_", "#", " ", "Length", " ", "of", " ", "the", " ", "tiny", " ", "line", " ", "bet", "ween", " ", "these", " ", "two", " ", "points", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "distance_", ">=_", "CRA", "ZY", "\\u", "LINE", "\\u", "DISTANCE", "_", ":_", "#", " ", "If", " ", "the", " ", "line", " ", "is", " ", "not", " ", "tha", "t", " ", "\"", "tiny", "\"", " ", "it", "'", "s", " ", "CRA", "ZY", "!", " ", "x", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "total", "\\u", "cra", "zy", "\\u", "lines_", "+=_", "1_", "#", " ", "The", "n", " ", "increase", " ", "total", " ", "cra", "zy", " ", "line", " ", "counter", "'", "s", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "angle_", "=_", "math_", "._", "atan2_", "(_", "y2_", "-_", "y1_", ",_", "x2_", "-_", "x1_", ")_", "#", " ", "Calculat", "e", " ", "tangent", " ", "value", " ", "of", " ", "the", " ", "line", " ", "(", "return", "s", " ", "Radia", "n", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "math_", "._", "degrees_", "(_", "angle_", ")_", "#", " ", "Radia", "n", " ", "to", " ", "Deg", "ree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "round_", "(_", "angle_", ")_", "#", " ", "Round", " ", "up", " ", "the", " ", "degree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "s", "\\u", "array_", "._", "append_", "(_", "angle_", ")_", "#", " ", "Append", " ", "the", " ", "degr", "ee", " ", "to", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "most", "\\u", "common", "\\u", "angle_", "!=_", "None_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "most", " ", "common", " ", "angle", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "abs_", "(_", "most", "\\u", "common", "\\u", "angle_", "-_", "angle_", ")_", ">_", "ABS", "DIFF", "\\u", "ANGLE", "_", ":_", "#", " ", "If", " ", "Abs", "olute", " ", "Difference", " ", "bet", "ween", " ", "most", " ", "common", " ", "angle", " ", "and", " ", "the", " ", "current", " ", "line", "'", "s", " ", "angle", " ", "great", "er", " ", "than", " ", "AB", "DS", "DIFF", "\\u", "ANGLE", " ", "value", ",", " ", "this", " ", "line", " ", "is", " ", "inconsistent", " ", "to", " ", "current", " ", "genera", "l", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cv2_", "._", "line_", "(_", "mask", "\\u", "delta_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "white", "\\u", "color_", ",_", "LINE", "\\u", "THI", "CK", "NESS", "_", ")_", "#", " ", "The", "n", " ", "draw", " ", "a", " ", "white", " ", "line", " ", "to", " ", "mask", "\\u", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cv2_", "._", "line_", "(_", "mask_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "color_", "[_", "i_", "]_", "._", "tolist_", "(_", ")_", ",_", "1_", ")_", "#", " ", "In", " ", "every", " ", "frame", " ", "draw", " ", "the", " ", "colore", "d", " ", "lines", " ", "to", " ", "original", " ", "frame", " ", "for", " ", "bett", "er", " ", "underst", "and", "ing", " ", "(", "option", "al", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "angle", "s", "\\u", "array_", ":_", "#", " ", "If", " ", "angle", "s", "\\u", "array", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "most", "\\u", "common", "\\u", "angle_", "=_", "Counter_", "(_", "angle", "s", "\\u", "array_", ")_", "._", "most", "\\u", "common_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "#", " ", "Fin", "d", " ", "most", " ", "common", " ", "angle", " ", "value", " ", "in", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "delta", "\\u", "gray_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "mask", "\\u", "delta_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "GRAY_", ")_", "#", " ", "Convert", " ", "mask", "\\u", "delta", " ", "to", " ", "grayscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh_", "=_", "cv2_", "._", "threshold_", "(_", "mask", "\\u", "delta", "\\u", "gray_", ",_", "12_", ",_", "255_", ",_", "cv2_", "._", "THRESH", "\\u", "BINARY_", ")_", "[_", "1_", "]_", "#", " ", "Apply", " ", "Open", "CV", "'", "s", " ", "threshol", "d", " ", "function", " ", "to", " ", "get", " ", "binar", "y", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh_", "=_", "cv2_", "._", "dilate", "_", "(_", "thresh_", ",_", "None_", ",_", "iterations_", "=_", "1_", ")_", "#", " ", "Dl", "ation", " ", "to", " ", "increase", " ", "white", " ", "region", " ", "for", " ", "surround", "ing", " ", "pixels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "contours", " ", "on", " ", "threshol", "ded", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cnt", "s_", ",_", "\\u_", ")_", "=_", "cv2_", "._", "find", "Contours", "_", "(_", "thresh_", "._", "copy_", "(_", ")_", ",_", "cv2_", "._", "RET", "R", "\\u", "EXTERNAL", "_", ",_", "cv2_", "._", "CHAIN", "\\u", "APPRO", "X", "\\u", "SIMPLE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conto", "ur\\u", "area", "\\u", "stack_", "=_", "[_", "]_", "#", " ", "List", " ", "of", " ", "conto", "ur", " ", "area", "s", "'", "s", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conto", "ur\\u", "dictionary_", "=_", "{_", "}_", "#", " ", "Dict", "ionar", "y", " ", "of", " ", "contours", " ", "key", " ", "=", " ", "'", "conto", "ur", " ", "area", "'", " ", "&", " ", "value", " ", "=", " ", "'", "conto", "ur", " ", "coordinate", "s", " ", "(", "x", ",", "y", ",", "w", ",", "h", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "=_", "None_", "#", " ", "Big", "gest", " ", "conto", "ur", " ", "coordinate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "\\u", "final", "\\u", "form_", "=_", "cv2_", "._", "add_", "(_", "frame_", ",_", "mask", "\\u", "white_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "the", " ", "contours_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cnt", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "c_", "in_", "cnt", "s_", ":_", "#", " ", "Contour", " ", "in", " ", "Contours", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "conto", "ur\\u", "area", "\\u", "stack_", "._", "append_", "(_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", ")_", "#", " ", "Calculat", "e", " ", "conto", "ur", " ", "area", " ", "and", " ", "append", " ", "to", " ", "conto", "ur", " ", "stack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", ">_", "args_", "[_", "\"", "min", "\\u", "area", "\"_", "]_", ":_", "#", " ", "If", " ", "conto", "ur", " ", "area", " ", "great", "er", " ", "than", " ", "min", " ", "area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "=_", "cv2_", "._", "bound", "ing", "Rect_", "(_", "c_", ")_", "#", " ", "Compute", " ", "the", " ", "bound", "ing", " ", "box", " ", "for", " ", "this", " ", "contour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "rectangle_", "(_", "frame_", ",_", "(_", "x_", ",_", "y_", ")_", ",_", "(_", "x_", "+_", "w_", ",_", "y_", "+_", "h_", ")_", ",_", "(_", "0_", ",_", "255_", ",_", "0_", ")_", ",_", "2_", ")_", "#", " ", "Draw", " ", "it", " ", "on", " ", "the", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conto", "ur\\u", "dictionary_", "[_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", "]_", "=_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "#", " ", "Add", " ", "a", " ", "key", " ", "-", " ", "value", " ", "pair", " ", "to", " ", "conto", "ur", " ", "dictionary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delta", "\\u", "value_", "=_", "max_", "(_", "conto", "ur\\u", "area", "\\u", "stack_", ")_", "#", " ", "Assign", " ", "max", " ", "conto", "ur", " ", "area", " ", "to", " ", "delta", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "conto", "ur\\u", "dictionary_", ":_", "#", " ", "If", " ", "conto", "ur", " ", "dictionar", "y", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "=_", "conto", "ur\\u", "dictionary_", "[_", "delta", "\\u", "value_", "]_", "#", " ", "Get", " ", "coordinate", "s", " ", "of", " ", "bigge", "st", " ", "contour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", ":_", "#", " ", "If", " ", "we", " ", "have", " ", "the", " ", "coordinate", "s", " ", "it", " ", "means", " ", "there", " ", "is", " ", "a", " ", "conto", "ur", " ", "in", " ", "the", " ", "frame", " ", "at", " ", "the", " ", "same", " ", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pars", "e", " ", "the", " ", "coordinates_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "x_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "rectangle_", "(_", "mask", "\\u", "bigge", "st", "\\u", "contour_", ",_", "(_", "x_", ",_", "y_", ")_", ",_", "(_", "x_", "+_", "w_", ",_", "y_", "+_", "h_", ")_", ",_", "(_", "255_", ",_", "255_", ",_", "255_", ")_", ",_", "-_", "1_", ")_", "#", " ", "Draw", " ", "only", " ", "one", " ", "white", " ", "rect", "ange_", "\\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_", "delta", "\\u", "value_", ">_", "(_", "height_", "*_", "width_", "/_", "DELTA", "\\u", "LIMIT", "\\u", "DIVI", "SOR", "_", ")_", ":_", "#", " ", "If", " ", "delta", " ", "value", " ", "is", " ", "too", " ", "muc", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "break_", "#", " ", "The", "n", " ", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "conto", "ur\\u", "dictionary_", ")_", ">_", "CONT", "OUR", "\\u", "LIMIT_", ":_", "#", " ", "PROB", "AB", "LY", "!!!", " ", "There", " ", "is", " ", "a", " ", "ZOO", "M", ",", " ", "ZOO", "M", " ", "+", " ", "PAN", ",", " ", "ZOO", "M", " ", "+", " ", "TI", "LT", ",", " ", "ZOO", "M", " ", "+", " ", "ROLL", " ", "situation", " ", "(", "Not", " ", "just", " ", "PAN", ",", " ", "TI", "LT", ",", " ", "ROLL", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "n", " ", "restart", " ", "angle", " ", "calculati", "on", ".", " ", "Thi", "s", " ", "time", " ", "divide", " ", "frame", " ", "to", " ", "quarter", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "total", "\\u", "cra", "zy", "\\u", "lines_", "=_", "0_", "#", " ", "Cra", "zy", " ", "line", " ", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "most", "\\u", "common", "\\u", "angle", "1_", "=_", "None_", "#", " ", "Mos", "t", " ", "common", " ", "angle", " ", "in", " ", "genera", "l", " ", "optic", "al", " ", "flow", " ", "in", " ", "shot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "s", "\\u", "array", "1_", "=_", "[_", "]_", "#", " ", "Ang", "le", " ", "list", " ", "of", " ", "all", " ", "newl", "y", " ", "created", " ", "tiny", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "most", "\\u", "common", "\\u", "angle", "2_", "=_", "None_", "#", " ", "Mos", "t", " ", "common", " ", "angle", " ", "in", " ", "genera", "l", " ", "optic", "al", " ", "flow", " ", "in", " ", "shot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "s", "\\u", "array", "2_", "=_", "[_", "]_", "#", " ", "Ang", "le", " ", "list", " ", "of", " ", "all", " ", "newl", "y", " ", "created", " ", "tiny", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "most", "\\u", "common", "\\u", "angle", "3_", "=_", "None_", "#", " ", "Mos", "t", " ", "common", " ", "angle", " ", "in", " ", "genera", "l", " ", "optic", "al", " ", "flow", " ", "in", " ", "shot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "s", "\\u", "array", "3_", "=_", "[_", "]_", "#", " ", "Ang", "le", " ", "list", " ", "of", " ", "all", " ", "newl", "y", " ", "created", " ", "tiny", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "most", "\\u", "common", "\\u", "angle", "4_", "=_", "None_", "#", " ", "Mos", "t", " ", "common", " ", "angle", " ", "in", " ", "genera", "l", " ", "optic", "al", " ", "flow", " ", "in", " ", "shot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "s", "\\u", "array", "4_", "=_", "[_", "]_", "#", " ", "Ang", "le", " ", "list", " ", "of", " ", "all", " ", "newl", "y", " ", "created", " ", "tiny", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "delta_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "old", "\\u", "frame_", ")_", "#", " ", "Creat", "e", " ", "a", " ", "mask", " ", "image", " ", "for", " ", "drawing", " ", "purpose", "s", " ", "(", "delta", " ", "frame", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "(_", "good", "\\u", "point2_", ",_", "good", "\\u", "point1_", ")_", "in_", "enumerate_", "(_", "zip_", "(_", "good", "\\u", "points", "2_", ",_", "good", "\\u", "points", "1_", ")_", ")_", ":_", "#", " ", "Get", " ", "point", " ", "pair", "s", " ", "one", " ", "by", " ", "one_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "coordinate", "s", " ", "of", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "x2_", ",_", "y2_", "=_", "good", "\\u", "point2_", "._", "ravel_", "(_", ")_", "#", " ", "New", " ", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x1_", ",_", "y1_", "=_", "good", "\\u", "point1_", "._", "ravel_", "(_", ")_", "#", " ", "Prev", "ious", " ", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "math_", "._", "hypot", "_", "(_", "x2_", "-_", "x1_", ",_", "y2_", "-_", "y1_", ")_", "#", " ", "Length", " ", "of", " ", "the", " ", "tiny", " ", "line", " ", "bet", "ween", " ", "these", " ", "two", " ", "points", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "distance_", ">=_", "CRA", "ZY", "\\u", "LINE", "\\u", "DISTANCE", "_", ":_", "#", " ", "If", " ", "the", " ", "line", " ", "is", " ", "not", " ", "tha", "t", " ", "\"", "tiny", "\"", " ", "it", "'", "s", " ", "CRA", "ZY", "!", " ", "x", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "total", "\\u", "cra", "zy", "\\u", "lines_", "+=_", "1_", "#", " ", "The", "n", " ", "increase", " ", "total", " ", "cra", "zy", " ", "line", " ", "counter", "'", "s", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "angle_", "=_", "math_", "._", "atan2_", "(_", "y2_", "-_", "y1_", ",_", "x2_", "-_", "x1_", ")_", "#", " ", "Calculat", "e", " ", "tangent", " ", "value", " ", "of", " ", "the", " ", "line", " ", "(", "return", "s", " ", "Radia", "n", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "math_", "._", "degrees_", "(_", "angle_", ")_", "#", " ", "Radia", "n", " ", "to", " ", "Deg", "ree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "round_", "(_", "angle_", ")_", "#", " ", "Round", " ", "up", " ", "the", " ", "degree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "x1_", "<=_", "(_", "width_", "/_", "2_", ")_", ")_", "and_", "(_", "y1_", "<=_", "(_", "height_", "/_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "angle", "s", "\\u", "array", "1_", "._", "append_", "(_", "angle_", ")_", "#", " ", "Append", " ", "the", " ", "degr", "ee", " ", "to", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "most", "\\u", "common", "\\u", "angle", "1_", "!=_", "None_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "most", " ", "common", " ", "angle", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "abs_", "(_", "most", "\\u", "common", "\\u", "angle", "1_", "-_", "angle_", ")_", ">_", "ABS", "DIFF", "\\u", "ANGLE", "_", ":_", "#", " ", "If", " ", "Abs", "olute", " ", "Difference", " ", "bet", "ween", " ", "most", " ", "common", " ", "angle", " ", "and", " ", "the", " ", "current", " ", "line", "'", "s", " ", "angle", " ", "great", "er", " ", "than", " ", "AB", "DS", "DIFF", "\\u", "ANGLE", " ", "value", ",", " ", "this", " ", "line", " ", "is", " ", "inconsistent", " ", "to", " ", "current", " ", "genera", "l", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "cv2_", "._", "line_", "(_", "mask", "\\u", "delta_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "white", "\\u", "color_", ",_", "LINE", "\\u", "THI", "CK", "NESS", "_", ")_", "#", " ", "The", "n", " ", "draw", " ", "a", " ", "white", " ", "line", " ", "to", " ", "mask", "\\u", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "x1_", ">=_", "(_", "width_", "/_", "2_", ")_", ")_", "and_", "(_", "y1_", "<=_", "(_", "height_", "/_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "angle", "s", "\\u", "array", "2_", "._", "append_", "(_", "angle_", ")_", "#", " ", "Append", " ", "the", " ", "degr", "ee", " ", "to", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "most", "\\u", "common", "\\u", "angle", "2_", "!=_", "None_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "most", " ", "common", " ", "angle", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "abs_", "(_", "most", "\\u", "common", "\\u", "angle", "2_", "-_", "angle_", ")_", ">_", "ABS", "DIFF", "\\u", "ANGLE", "_", ":_", "#", " ", "If", " ", "Abs", "olute", " ", "Difference", " ", "bet", "ween", " ", "most", " ", "common", " ", "angle", " ", "and", " ", "the", " ", "current", " ", "line", "'", "s", " ", "angle", " ", "great", "er", " ", "than", " ", "AB", "DS", "DIFF", "\\u", "ANGLE", " ", "value", ",", " ", "this", " ", "line", " ", "is", " ", "inconsistent", " ", "to", " ", "current", " ", "genera", "l", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "cv2_", "._", "line_", "(_", "mask", "\\u", "delta_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "white", "\\u", "color_", ",_", "LINE", "\\u", "THI", "CK", "NESS", "_", ")_", "#", " ", "The", "n", " ", "draw", " ", "a", " ", "white", " ", "line", " ", "to", " ", "mask", "\\u", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "x1_", "<=_", "(_", "width_", "/_", "2_", ")_", ")_", "and_", "(_", "y1_", ">=_", "(_", "height_", "/_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "angle", "s", "\\u", "array", "3_", "._", "append_", "(_", "angle_", ")_", "#", " ", "Append", " ", "the", " ", "degr", "ee", " ", "to", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "most", "\\u", "common", "\\u", "angle", "3_", "!=_", "None_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "most", " ", "common", " ", "angle", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "abs_", "(_", "most", "\\u", "common", "\\u", "angle", "3_", "-_", "angle_", ")_", ">_", "ABS", "DIFF", "\\u", "ANGLE", "_", ":_", "#", " ", "If", " ", "Abs", "olute", " ", "Difference", " ", "bet", "ween", " ", "most", " ", "common", " ", "angle", " ", "and", " ", "the", " ", "current", " ", "line", "'", "s", " ", "angle", " ", "great", "er", " ", "than", " ", "AB", "DS", "DIFF", "\\u", "ANGLE", " ", "value", ",", " ", "this", " ", "line", " ", "is", " ", "inconsistent", " ", "to", " ", "current", " ", "genera", "l", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "cv2_", "._", "line_", "(_", "mask", "\\u", "delta_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "white", "\\u", "color_", ",_", "LINE", "\\u", "THI", "CK", "NESS", "_", ")_", "#", " ", "The", "n", " ", "draw", " ", "a", " ", "white", " ", "line", " ", "to", " ", "mask", "\\u", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "x1_", ">=_", "(_", "width_", "/_", "2_", ")_", ")_", "and_", "(_", "y1_", ">=_", "(_", "height_", "/_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "angle", "s", "\\u", "array", "4_", "._", "append_", "(_", "angle_", ")_", "#", " ", "Append", " ", "the", " ", "degr", "ee", " ", "to", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "most", "\\u", "common", "\\u", "angle", "3_", "!=_", "None_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "most", " ", "common", " ", "angle", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "abs_", "(_", "most", "\\u", "common", "\\u", "angle", "3_", "-_", "angle_", ")_", ">_", "ABS", "DIFF", "\\u", "ANGLE", "_", ":_", "#", " ", "If", " ", "Abs", "olute", " ", "Difference", " ", "bet", "ween", " ", "most", " ", "common", " ", "angle", " ", "and", " ", "the", " ", "current", " ", "line", "'", "s", " ", "angle", " ", "great", "er", " ", "than", " ", "AB", "DS", "DIFF", "\\u", "ANGLE", " ", "value", ",", " ", "this", " ", "line", " ", "is", " ", "inconsistent", " ", "to", " ", "current", " ", "genera", "l", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "cv2_", "._", "line_", "(_", "mask", "\\u", "delta_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "white", "\\u", "color_", ",_", "LINE", "\\u", "THI", "CK", "NESS", "_", ")_", "#", " ", "The", "n", " ", "draw", " ", "a", " ", "white", " ", "line", " ", "to", " ", "mask", "\\u", "delta_", "\\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_", "cv2_", "._", "line_", "(_", "mask_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "color_", "[_", "i_", "]_", "._", "tolist_", "(_", ")_", ",_", "1_", ")_", "#", " ", "In", " ", "every", " ", "frame", " ", "draw", " ", "the", " ", "colore", "d", " ", "lines", " ", "to", " ", "original", " ", "frame", " ", "for", " ", "bett", "er", " ", "underst", "and", "ing", " ", "(", "option", "al", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "angle", "s", "\\u", "array", "1_", ":_", "#", " ", "If", " ", "angle", "s", "\\u", "array", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "most", "\\u", "common", "\\u", "angle", "1_", "=_", "Counter_", "(_", "angle", "s", "\\u", "array", "1_", ")_", "._", "most", "\\u", "common_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "#", " ", "Fin", "d", " ", "most", " ", "common", " ", "angle", " ", "value", " ", "in", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "angle", "s", "\\u", "array", "2_", ":_", "#", " ", "If", " ", "angle", "s", "\\u", "array", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "most", "\\u", "common", "\\u", "angle", "2_", "=_", "Counter_", "(_", "angle", "s", "\\u", "array", "2_", ")_", "._", "most", "\\u", "common_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "#", " ", "Fin", "d", " ", "most", " ", "common", " ", "angle", " ", "value", " ", "in", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "angle", "s", "\\u", "array", "3_", ":_", "#", " ", "If", " ", "angle", "s", "\\u", "array", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "most", "\\u", "common", "\\u", "angle", "3_", "=_", "Counter_", "(_", "angle", "s", "\\u", "array", "3_", ")_", "._", "most", "\\u", "common_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "#", " ", "Fin", "d", " ", "most", " ", "common", " ", "angle", " ", "value", " ", "in", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "angle", "s", "\\u", "array", "4_", ":_", "#", " ", "If", " ", "angle", "s", "\\u", "array", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "most", "\\u", "common", "\\u", "angle", "4_", "=_", "Counter_", "(_", "angle", "s", "\\u", "array", "4_", ")_", "._", "most", "\\u", "common_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "#", " ", "Fin", "d", " ", "most", " ", "common", " ", "angle", " ", "value", " ", "in", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "delta", "\\u", "gray_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "mask", "\\u", "delta_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "GRAY_", ")_", "#", " ", "Convert", " ", "mask", "\\u", "delta", " ", "to", " ", "grayscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh_", "=_", "cv2_", "._", "threshold_", "(_", "mask", "\\u", "delta", "\\u", "gray_", ",_", "12_", ",_", "255_", ",_", "cv2_", "._", "THRESH", "\\u", "BINARY_", ")_", "[_", "1_", "]_", "#", " ", "Apply", " ", "Open", "CV", "'", "s", " ", "threshol", "d", " ", "function", " ", "to", " ", "get", " ", "binar", "y", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh_", "=_", "cv2_", "._", "dilate", "_", "(_", "thresh_", ",_", "None_", ",_", "iterations_", "=_", "1_", ")_", "#", " ", "Dl", "ation", " ", "to", " ", "increase", " ", "white", " ", "region", " ", "for", " ", "surround", "ing", " ", "pixels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "contours", " ", "on", " ", "threshol", "ded", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cnt", "s_", ",_", "\\u_", ")_", "=_", "cv2_", "._", "find", "Contours", "_", "(_", "thresh_", "._", "copy_", "(_", ")_", ",_", "cv2_", "._", "RET", "R", "\\u", "EXTERNAL", "_", ",_", "cv2_", "._", "CHAIN", "\\u", "APPRO", "X", "\\u", "SIMPLE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conto", "ur\\u", "area", "\\u", "stack_", "=_", "[_", "]_", "#", " ", "List", " ", "of", " ", "conto", "ur", " ", "area", "s", "'", "s", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conto", "ur\\u", "dictionary_", "=_", "{_", "}_", "#", " ", "Dict", "ionar", "y", " ", "of", " ", "contours", " ", "key", " ", "=", " ", "'", "conto", "ur", " ", "area", "'", " ", "&", " ", "value", " ", "=", " ", "'", "conto", "ur", " ", "coordinate", "s", " ", "(", "x", ",", "y", ",", "w", ",", "h", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "=_", "None_", "#", " ", "Big", "gest", " ", "conto", "ur", " ", "coordinate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "\\u", "final", "\\u", "form_", "=_", "cv2_", "._", "add_", "(_", "frame_", ",_", "mask", "\\u", "white_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "the", " ", "contours_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cnt", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "for_", "c_", "in_", "cnt", "s_", ":_", "#", " ", "Contour", " ", "in", " ", "Contours", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "conto", "ur\\u", "area", "\\u", "stack_", "._", "append_", "(_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", ")_", "#", " ", "Calculat", "e", " ", "conto", "ur", " ", "area", " ", "and", " ", "append", " ", "to", " ", "conto", "ur", " ", "stack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", ">_", "args_", "[_", "\"", "min", "\\u", "area", "\"_", "]_", ":_", "#", " ", "If", " ", "conto", "ur", " ", "area", " ", "great", "er", " ", "than", " ", "min", " ", "area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "=_", "cv2_", "._", "bound", "ing", "Rect_", "(_", "c_", ")_", "#", " ", "Compute", " ", "the", " ", "bound", "ing", " ", "box", " ", "for", " ", "this", " ", "contour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "rectangle_", "(_", "frame_", ",_", "(_", "x_", ",_", "y_", ")_", ",_", "(_", "x_", "+_", "w_", ",_", "y_", "+_", "h_", ")_", ",_", "(_", "0_", ",_", "255_", ",_", "0_", ")_", ",_", "2_", ")_", "#", " ", "Draw", " ", "it", " ", "on", " ", "the", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conto", "ur\\u", "dictionary_", "[_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", "]_", "=_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "#", " ", "Add", " ", "a", " ", "key", " ", "-", " ", "value", " ", "pair", " ", "to", " ", "conto", "ur", " ", "dictionary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delta", "\\u", "value_", "=_", "max_", "(_", "conto", "ur\\u", "area", "\\u", "stack_", ")_", "#", " ", "Assign", " ", "max", " ", "conto", "ur", " ", "area", " ", "to", " ", "delta", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "conto", "ur\\u", "dictionary_", ":_", "#", " ", "If", " ", "conto", "ur", " ", "dictionar", "y", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "=_", "conto", "ur\\u", "dictionary_", "[_", "delta", "\\u", "value_", "]_", "#", " ", "Get", " ", "coordinate", "s", " ", "of", " ", "bigge", "st", " ", "contour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", ":_", "#", " ", "If", " ", "we", " ", "have", " ", "the", " ", "coordinate", "s", " ", "it", " ", "means", " ", "there", " ", "is", " ", "a", " ", "conto", "ur", " ", "in", " ", "the", " ", "frame", " ", "at", " ", "the", " ", "same", " ", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pars", "e", " ", "the", " ", "coordinates_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "x_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "rectangle_", "(_", "mask", "\\u", "bigge", "st", "\\u", "contour_", ",_", "(_", "x_", ",_", "y_", ")_", ",_", "(_", "x_", "+_", "w_", ",_", "y_", "+_", "h_", ")_", ",_", "(_", "255_", ",_", "255_", ",_", "255_", ")_", ",_", "-_", "1_", ")_", "#", " ", "Draw", " ", "only", " ", "one", " ", "white", " ", "rect", "ange_", "\\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_", "delta", "\\u", "value_", ">_", "(_", "height_", "*_", "width_", "/_", "DELTA", "\\u", "LIMIT", "\\u", "DIVI", "SOR", "_", ")_", ":_", "#", " ", "If", " ", "delta", " ", "value", " ", "is", " ", "too", " ", "muc", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "break_", "#", " ", "The", "n", " ", "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_", "else_", ":_", "#", " ", "There", " ", "is", " ", "just", " ", "a", " ", "PAN", ",", " ", "TI", "LT", ",", " ", "ROLL", " ", "situation", ".", " ", "Don", "'", "t", " ", "touch", " ", "anyt", "hing", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "bigge", "st", "\\u", "conto", "ur\\u", "gray_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "mask", "\\u", "bigge", "st", "\\u", "contour_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "GRAY_", ")_", "#", " ", "Convert", " ", "mask", "\\u", "bigge", "st", "\\u", "conto", "ur", " ", "to", " ", "grayscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh", "\\u", "bigge", "st", "\\u", "contour_", "=_", "cv2_", "._", "threshold_", "(_", "mask", "\\u", "bigge", "st", "\\u", "conto", "ur\\u", "gray_", ",_", "12_", ",_", "255_", ",_", "cv2_", "._", "THRESH", "\\u", "BINARY_", ")_", "[_", "1_", "]_", "#", " ", "Apply", " ", "Open", "CV", "'", "s", " ", "threshol", "d", " ", "function", " ", "to", " ", "get", " ", "binar", "y", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thresh", "\\u", "final", "\\u", "form_", "=_", "cv2_", "._", "bitwise", "\\u", "and_", "(_", "thresh_", ",_", "thresh_", ",_", "mask_", "=_", "thresh", "\\u", "bigge", "st", "\\u", "contour_", ")_", "#", " ", "Bit", "wis", "e", " ", "and", " ", "-", " ", "bigge", "st", " ", "conto", "ur", " ", "and", " ", "tres", "h", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh", "\\u", "final", "\\u", "form_", "=_", "cv2_", "._", "dilate", "_", "(_", "thresh", "\\u", "final", "\\u", "form_", ",_", "None_", ",_", "iterations_", "=_", "1_", ")_", "#", " ", "Dl", "ation", " ", "to", " ", "increase", " ", "white", " ", "region", " ", "for", " ", "surround", "ing", " ", "pixels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "Delta_", "=_", "cv2_", "._", "bitwise", "\\u", "and_", "(_", "frame", "\\u", "final", "\\u", "form_", ",_", "frame", "\\u", "final", "\\u", "form_", ",_", "mask_", "=_", "thresh", "\\u", "final", "\\u", "form_", ")_", "#", " ", "Bit", "wis", "e", " ", "and", " ", "-", " ", "to", " ", "get", " ", "delta", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "total", "\\u", "cra", "zy", "\\u", "lines_", ">=_", "CRA", "ZY", "\\u", "LINE", "\\u", "LIMIT_", ":_", "#", " ", "If", " ", "amo", "ut", " ", "of", " ", "total", " ", "cra", "zy", " ", "lines", " ", "is", " ", "great", "er", " ", "than", " ", "CRA", "ZY", "\\u", "LINE", "\\u", "LIMIT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "break_", "#", " ", "Break", " ", "the", " ", "loop", " ", "to", " ", "reconstruct", " ", "the", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frame", "\\u", "with", "\\u", "mask_", "=_", "cv2_", "._", "add_", "(_", "frame_", ",_", "mask_", ")_", "#", " ", "Add", " ", "mask", " ", "layer", " ", "over", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "imshow_", "(_", "'", "Origina", "l", " ", "Frame", "'_", ",_", "frame", "\\u", "with", "\\u", "mask_", ")_", "#", " ", "Show", " ", "Origina", "l", " ", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "imshow_", "(_", "'", "Mask", " ", "Del", "ta", "'_", ",_", "mask", "\\u", "delta_", ")_", "#", " ", "Show", " ", "Mask", " ", "Del", "ta", " ", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "imshow_", "(_", "'", "Mask", " ", "Big", "gest", " ", "Contour", "'_", ",_", "mask", "\\u", "bigge", "st", "\\u", "contour_", ")_", "#", " ", "Show", " ", "Mask", " ", "Del", "ta", " ", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "imshow_", "(_", "'", "Frame", " ", "Del", "ta", "'_", ",_", "frame", "Delta_", ")_", "#", " ", "Show", " ", "Frame", " ", "Delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "cv2_", "._", "wait", "Key_", "(_", "30_", ")_", "&_", "0xff_", "#", " ", "DEVELO", "PM", "ENT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", "==_", "27_", ":_", "#", " ", "DEVELO", "PM", "ENT", " ", "PRESS", " ", "ESC", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "break_", "#", " ", "DEVELO", "PM", "ENT", " ", "BREAK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "gray_", "=_", "frame", "\\u", "gray_", "._", "copy_", "(_", ")_", "#", " ", "Update", " ", "the", " ", "previ", "ous", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "good", "\\u", "points", "2_", "._", "reshape_", "(_", "-_", "1_", ",_", "1_", ",_", "2_", ")_", "#", " ", "Update", " ", "previ", "ous", " ", "points_", "\\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_", "cv2_", "._", "destroy", "All", "Windows_", "(_", ")_", "#", " ", "Clos", "e", " ", "any", " ", "open", " ", "windows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cap_", "._", "release_", "(_", ")_", "#", " ", "Release", " ", "the", " ", "captur", "e", " ", "device_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Imprecise assert
jpaugh/agithub/agithub/agithub_test.py
[ { "content": " def test_user_pw(self):\n gh = GitHub('korfuri', '1234')\n self.assertTrue(gh is not None)\n\n gh = GitHub(username='korfuri', password='1234')\n self.assertTrue(gh is not None)", "metadata": "root.TestGitHubObjectCreation.test_user_pw", "header": "['class', 'TestGitHubObjectCreation', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 9 }, { "content": " def test_token(self):\n gh = GitHub(username='korfuri', token='deadbeef')\n self.assertTrue(gh is not None)\n\n gh = GitHub(token='deadbeef')\n self.assertTrue(gh is not None)", "metadata": "root.TestGitHubObjectCreation.test_token", "header": "['class', 'TestGitHubObjectCreation', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 16 } ]
[ { "span": "self.assertTrue(gh is not None)", "start_line": 11, "start_column": 8, "end_line": 11, "end_column": 39 }, { "span": "self.assertTrue(gh is not None)", "start_line": 14, "start_column": 8, "end_line": 14, "end_column": 39 }, { "span": "self.assertTrue(gh is not None)", "start_line": 18, "start_column": 8, "end_line": 18, "end_column": 39 }, { "span": "self.assertTrue(gh is not None)", "start_line": 21, "start_column": 8, "end_line": 21, "end_column": 39 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Git", "Hub", "Object", "Creat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "user", "\\u", "pw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gh_", "=_", "Git", "Hub", "_", "(_", "'", "kor", "fur", "i", "'_", ",_", "'", "1234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gh_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gh_", "=_", "Git", "Hub", "_", "(_", "username_", "=_", "'", "kor", "fur", "i", "'_", ",_", "password_", "=_", "'", "1234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gh_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Git", "Hub", "Object", "Creat", "ion_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "token_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gh_", "=_", "Git", "Hub", "_", "(_", "username_", "=_", "'", "kor", "fur", "i", "'_", ",_", "token_", "=_", "'", "dead", "beef", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gh_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gh_", "=_", "Git", "Hub", "_", "(_", "token_", "=_", "'", "dead", "beef", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gh_", "is_", "not_", "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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
Esri/solutions-geoprocessing-toolbox/suitability/toolboxes/scripts/MultidimensionSupplementalTools/MultidimensionSupplementalTools/Scripts/mds/tools/multidimensional_zonal_statistics_as_table.py
[ { "content": " def updateParameters(self, parameters):\n \"\"\"Modifies the values and properties of parameters before internal\n validation is performed. This method is called whenever a parameter\n has been changed.\"\"\"\n\n zone_parameter = parameters[0]\n input_parameter = parameters[1]\n variable_parameter = parameters[2]\n output_parameter = parameters[3]\n type_parameter = parameters[4]\n ignore_parameter = parameters[5]\n zonefield_parameter = parameters[6]\n\n # Populate the output netCDF file parameter with a reasonable default\n # (i.e. the name of the variable with 'zonal_' appended to it.)\n if (variable_parameter.value is not None) and (not output_parameter.altered):\n out_file_name = variable_parameter.valueAsText + '_zonal'\n # Generate a unique name\n i = 1\n temp_name = out_file_name + '.dbf'\n while arcpy.Exists(temp_name):\n temp_name = out_file_name + str(i) + '.dbf'\n i += 1\n out_file_name = temp_name\n workspace = arcpy.env.workspace\n output_parameter.value = os.path.join(workspace, out_file_name)\n\n # Set zone parameter default\n if (zone_parameter.value is not None) and (not zonefield_parameter.altered):\n valid_raster_types = [\"RasterLayer\", \"RasterDataset\"]\n valid_feature_types = [\"ShapeFile\",\"FeatureLayer\", \"FeatureDataset\"]\n desc = arcpy.Describe(zone_parameter.value)\n if desc.dataType in valid_raster_types:\n zonefield_parameter.value = \"Value\"\n else:\n zonefield_parameter.value = \"FID\"\n\n return", "metadata": "root.MultidimensionalZonalStatisticsAsTable.updateParameters", "header": "['class', 'MultidimensionalZonalStatisticsAsTable', '(', 'object', ')', ':', '___EOS___']", "index": 251 }, { "content": " def updateMessages(self, parameters):\n \"\"\"Modifies the messages created by internal validation for each tool\n parameter. This method is called after internal validation.\"\"\"\n\n zone_parameter = parameters[0]\n input_parameter = parameters[1]\n variable_parameter = parameters[2]\n output_parameter = parameters[3]\n type_parameter = parameters[4]\n ignore_parameter = parameters[5]\n zonefield_parameter = parameters[6]\n dataset = None\n\n if zone_parameter.value is not None:\n valid_raster_types = [\"RasterLayer\", \"RasterDataset\"]\n valid_feature_types = [\"ShapeFile\",\"FeatureLayer\", \"FeatureDataset\"]\n desc = arcpy.Describe(zone_parameter.value)\n if desc.dataType in valid_raster_types:\n # Check that raster is of an integer data type\n if not hasattr(desc, 'isInteger') or not desc.isInteger:\n zone_parameter.setErrorMessage(\n mds.messages.ZONE_RASTER_NOT_INTEGER.format(\n zone_parameter.valueAsText))\n else:\n # Fill zone field parameter for raster\n if hasattr(desc, 'fields'):\n zonefield_parameter.filter.type = \"ValueList\"\n validtypes = ['Integer','SmallInteger','String']\n zonefield_parameter.filter.list = [zonefield.name for \\\n zonefield in desc.fields if zonefield.type in validtypes]\n else:\n zonefield_parameter.filter.type = \"ValueList\"\n zonefield_parameter.filter.list = ['Value']\n elif desc.dataType in valid_feature_types:\n # Fill zone field parameter for feature class\n zonefield_parameter.filter.type = \"ValueList\"\n validtypes = ['OID','Integer','SmallInteger','String']\n zonefield_parameter.filter.list = [zonefield.name for \\\n zonefield in desc.fields if zonefield.type in validtypes]\n else:\n zonefield_parameter.filter.type = \"ValueList\"\n zonefield_parameter.filter.list = []\n else:\n # Clear zone field list if no zone dataset specified\n zonefield_parameter.filter.type = \"ValueList\"\n zonefield_parameter.filter.list = []\n\n # Open netCDF dataset\n if input_parameter.value is not None:\n try:\n dataset = mds.netcdf.Dataset(input_parameter.valueAsText, '')\n except RuntimeError, exception:\n if \"No such file or directory\" in str(exception) or \\\n \"Invalid argument\" in str(exception):\n input_parameter.setErrorMessage(\n mds.messages.INPUT_FILE_DOES_NOT_EXIST.format(\n input_parameter.valueAsText))\n elif \"Malformed or inaccessible DAP DDS\" in str(exception):\n input_parameter.setErrorMessage(\n mds.messages.INPUT_DATASET_URL_MALFORMED.format(\n input_parameter.valueAsText))\n else:\n input_parameter.setErrorMessage(\n mds.messages.INPUT_DATASET_GENERIC_ERROR.format(\n input_parameter.valueAsText, str(exception)))\n except Exception, exception:\n input_parameter.setErrorMessage(\n mds.messages.INPUT_DATASET_GENERIC_ERROR.format(\n input_parameter.valueAsText, str(exception)))\n if dataset is not None:\n # Try to fill variable list with spatial variables\n var_list = list(dataset.spatial_data_variable_names())\n if var_list != []:\n # If successful, we likely have a gridded dataset. We\n # will check regular gridding on execution.\n variable_parameter.filter.type = \"ValueList\"\n variable_parameter.filter.list = var_list\n else:\n # If unsuccessful, try to fill variable list assuming\n # dataset is of a discrete geometry type.\n var_list = list(dataset.data_variable_names())\n var_filter = []\n for var_item in var_list:\n var_stat, var_x, var_y = self.get_dependent_variables(\n dataset, var_item)\n if (var_stat is not None) and (var_x is not None) and (\n var_y is not None):\n var_filter = self.get_variables_by_dimension(\n dataset, var_stat)\n break\n variable_parameter.filter.type = \"ValueList\"\n variable_parameter.filter.list = var_filter\n else:\n # Clear variable list if no input dataset specified\n variable_parameter.filter.type = \"ValueList\"\n variable_parameter.filter.list = []\n variable_parameter.value = \"\"\n\n # Modify statistic choices so that, if any variable is not of integer\n # type, categorical statistics are not offered.\n if variable_parameter.value is not None:\n if (dataset is not None) and (variable_parameter.value in \\\n dataset.variable_names()):\n var = dataset.variable(variable_parameter.value)\n ispacked = hasattr(var,'scale_factor') or hasattr(var, 'add_offset')\n flag = ('int' in str(var.dtype)) and not ispacked\n type_parameter.filter.list = sorted([key for stat in \\\n self.statistics if flag or not stat[2] for key in \\\n stat[1].keys()])\n else:\n # When variable parameter is cleared, make all statistics available\n type_parameter.filter.list = sorted([key for stat in \\\n self.statistics for key in stat[1].keys()])\n\n # Ensure output table has a .dbf extension\n if output_parameter.value is not None:\n output_filename = output_parameter.valueAsText\n if os.path.splitext(output_filename)[1] != \".dbf\":\n output_parameter.setErrorMessage(\n mds.messages.OUTPUT_FILE_EXTENSION_MUST_BE_DBF)\n\n return", "metadata": "root.MultidimensionalZonalStatisticsAsTable.updateMessages", "header": "['class', 'MultidimensionalZonalStatisticsAsTable', '(', 'object', ')', ':', '___EOS___']", "index": 290 }, { "content": " def execute(self, parameters, messages):\n \"\"\"The source code of the tool.\"\"\"\n\n zone_parameter = parameters[0]\n input_parameter = parameters[1]\n variable_parameter = parameters[2]\n output_parameter = parameters[3]\n type_parameter = parameters[4]\n ignore_parameter = parameters[5]\n zonefield_parameter = parameters[6]\n\n # Grab the parameter values\n dataset_name = input_parameter.valueAsText # input netCDF filename\n output_filename = output_parameter.valueAsText # output filename\n var_name = variable_parameter.valueAsText # netCDF variable name\n\n # Try to open the netCDF dataset\n try:\n dataset = mds.netcdf.Dataset(dataset_name,'')\n except RuntimeError, exception:\n messages.addErrorMessage(str(exception))\n raise arcpy.ExecuteError\n\n # Based on same criteria used to populate variable_parameter in\n # updateMessages(), check if input dataset is gridded or contains\n # discrete geometries and branch code appropriately.\n if list(dataset.spatial_data_variable_names()) != []:\n self.zonal_statistics_as_table_for_grid(parameters, messages, dataset)\n else:\n self.zonal_statistics_as_table_for_discrete(parameters, messages, dataset)\n\n return", "metadata": "root.MultidimensionalZonalStatisticsAsTable.execute", "header": "['class', 'MultidimensionalZonalStatisticsAsTable', '(', 'object', ')', ':', '___EOS___']", "index": 414 }, { "content": " def zonal_statistics_as_table_for_grid(self, parameters, messages, dataset):\n \"\"\"Performs zonal statistics as table assuming dataset contains\n regularly gridded variables.\"\"\"\n\n zone_parameter = parameters[0]\n input_parameter = parameters[1]\n variable_parameter = parameters[2]\n output_parameter = parameters[3]\n type_parameter = parameters[4]\n ignore_parameter = parameters[5]\n zonefield_parameter = parameters[6]\n\n # Grab the parameter values\n dataset_name = input_parameter.valueAsText # input netCDF filename\n output_filename = output_parameter.valueAsText # output filename\n var_name = variable_parameter.valueAsText # netCDF variable name\n\n # Extract variable from netCDF dataset\n arr_var = dataset.variable(var_name)\n\n # Check that spatial dimensions of input netCDF variable are regularly\n # gridded and obtain cell size\n cell_size_x = None\n cell_size_y = None\n spat_list = list(dataset.space_dimension_names(var_name))\n assert len(spat_list) >= 2\n spat_var = dataset.variable(spat_list[0])\n blfirst = True\n if spat_var.size > 1:\n for i in range(spat_var.size - 1):\n cell_size_x = spat_var[i+1] - spat_var[i]\n if (not blfirst) and (cell_size_x != last_cell_size):\n messages.addErrorMessage(\n mds.messages.VARIABLE_NOT_REGULARLY_GRIDDED.format(\n var_name, spat_list[0]))\n raise arcpy.ExecuteError\n break\n last_cell_size = cell_size_x\n blfirst = False\n cell_size_x = float(cell_size_x)\n spat_var = dataset.variable(spat_list[1])\n blfirst = True\n if spat_var.size > 1:\n for i in range(spat_var.size - 1):\n cell_size_y = spat_var[i+1] - spat_var[i]\n if (not blfirst) and (cell_size_y != last_cell_size):\n messages.addErrorMessage(\n mds.messages.VARIABLE_NOT_REGULARLY_GRIDDED.format(\n var_name, spat_list[1]))\n raise arcpy.ExecuteError\n break\n last_cell_size = cell_size_y\n blfirst = False\n cell_size_y = float(cell_size_y)\n # If both x and y cell sizes are None, the dataset is a scalar.\n if (cell_size_x is None) and (cell_size_y is None):\n messages.addErrorMessage(\n mds.messages.VARIABLE_CONTAINS_INSUFFICIENT_VALUES.format(\n var_name))\n raise arcpy.ExecuteError\n # If one of x and y is None, the dataset is a line, so we will assume\n # the singleton dimension shares the other's cell size.\n if cell_size_x is None:\n cell_size_x = cell_size_y\n messages.addWarningMessage(\n (\"Assuming variable dimension {} shares a cell size of {} \" + \\\n \"with {}\").format(spat_list[0], cell_size_y, spat_list[1]))\n if cell_size_y is None:\n cell_size_y = cell_size_x\n messages.addWarningMessage(\n (\"Assuming variable dimension {} shares a cell size of {} \" + \\\n \"with {}\").format(spat_list[1], cell_size_x, spat_list[0]))\n\n # Figure out which spatial variable is x and which is y\n # and then get corresponding number of columns and rows\n if dataset.convention.is_x_dimension_variable(dataset.variable(spat_list[0])):\n ncol = len(dataset.variable(spat_list[0]))\n nrow = len(dataset.variable(spat_list[1]))\n bltranspose = True\n else:\n ncol = len(dataset.variable(spat_list[1]))\n nrow = len(dataset.variable(spat_list[0]))\n cell_size_x, cell_size_y = cell_size_y, cell_size_x\n bltranspose = False\n\n # Grab extent from netCDF dataset\n # i.e. [x_min, y_min, x_max, y_max]\n var_extent = dataset.extent(var_name)\n # Lower left hand corner of netCDF variable spatial slice\n xl = float(var_extent[0])\n yl = float(var_extent[1])\n\n # Determine whether to flip the zone data over a given axis and\n # transpose it to align with the netCDF data\n blflipx = False\n blflipy = False\n if cell_size_y > 0:\n blflipx = True\n if cell_size_x < 0:\n blflipy = True\n\n # Use absolute cell sizes\n cell_size_x = abs(cell_size_x)\n cell_size_y = abs(cell_size_y)\n\n # Convert extent to extent object for use later\n var_extent = arcpy.Extent(var_extent[0], var_extent[1], \\\n var_extent[2], var_extent[3])\n\n # Was a temporary raster created?\n bltempRaster = False\n\n # Describe zone data\n desc = arcpy.Describe(zone_parameter.value)\n\n # Environments\n arcpy.env.outputCoordinateSystem = desc.spatialReference\n temp_snap = arcpy.NumPyArrayToRaster(numpy.zeros((1,1)), \\\n arcpy.Point(xl,yl), cell_size_x, cell_size_y)\n arcpy.env.snapRaster = temp_snap\n\n # Process input zone data\n valid_raster_types = [\"RasterLayer\", \"RasterDataset\"]\n valid_feature_types = [\"ShapeFile\",\"FeatureLayer\", \"FeatureDataset\"]\n if desc.dataType in valid_feature_types:\n # Limitation of Feature to Raster\n if cell_size_x != cell_size_y:\n messages.addErrorMessage(\n \"The variable %s must use the same gridding \" + \\\n \"for both its spatial dimensions when feature zone \" + \\\n \"data is used.\" % var_name)\n raise arcpy.ExecuteError\n # Convert features\n temp_raster = 'in_memory\\\\temp'\n arcpy.FeatureToRaster_conversion(zone_parameter.value, \\\n zonefield_parameter.value, temp_raster, cell_size_x)\n bltempRaster = True\n # NoData value\n noDataValue = arcpy.Describe(temp_raster).noDataValue\n elif desc.dataType in valid_raster_types:\n # Map non-Value field to Value if necessary and grab NoData value\n if zonefield_parameter.value != 'Value':\n in_raster = arcpy.sa.Lookup(zone_parameter.value, \\\n zonefield_parameter.value)\n # Raster created with Lookup will have default noDataValue\n # used for given .pixelType, but not assigned to .noDataValue\n if '8' in in_raster.pixelType:\n noDataValue = -128 # S8\n else:\n noDataValue = -2147483647 # S32\n else:\n in_raster = zone_parameter.valueAsText\n noDataValue = desc.noDataValue\n # Resample if necessary\n if (desc.meanCellHeight != cell_size_y) or \\\n (desc.meanCellWidth != cell_size_x):\n temp_raster = 'in_memory\\\\temp'\n arcpy.Resample_management(in_raster, temp_raster, \\\n \"%f %f\" % (cell_size_x, cell_size_y))\n bltempRaster = True\n else:\n temp_raster = in_raster\n else:\n messages.addErrorMessage(\"Not a valid zone dataset.\")\n raise arcpy.ExecuteError\n\n # Make raster object from zone data if not already\n if not isinstance(temp_raster, arcpy.Raster):\n temp_raster = arcpy.Raster(temp_raster)\n\n # Limit to lon [-180, 180] and lat [-90, 90]\n def convert_coord(num, islon = True):\n lim = 180 if islon else 90\n if num > lim:\n out = num % -lim\n elif num < -lim:\n out = num % lim\n else:\n out = num\n if not islon:\n mult = -1.0 if num < 0 else 1.0\n out = mult * abs(out)\n return out\n\n # Determine whether input zone data has a PCS or GCS\n if (temp_raster.spatialReference.exporttostring() == \\\n temp_raster.spatialReference.GCS.exporttostring()):\n # Test for overlap between zone and netCDF data\n if temp_raster.extent.disjoint(var_extent):\n # Try with coordinates in lon[-180,180] and lat[-90,90] ranges\n var_extent_temp = arcpy.Extent(\n convert_coord(var_extent.XMin, True),\n convert_coord(var_extent.YMin, True),\n convert_coord(var_extent.XMax, False),\n convert_coord(var_extent.YMax, False))\n xl = var_extent_temp.XMin\n yl = var_extent_temp.YMin\n # Check again and throw warning on failure\n if temp_raster.extent.disjoint(var_extent_temp):\n messages.addWarningMessage(\"Data extents don't overlap.\")\n else:\n if (not temp_raster.extent.overlaps(var_extent)) and (\n not temp_raster.extent.equals(var_extent)):\n messages.addWarningMessage(\"Data extents don't overlap.\")\n\n # Extract zone data from raster\n arr_zone = arcpy.RasterToNumPyArray(temp_raster, arcpy.Point(xl,yl), \\\n ncol, nrow)\n # Flip zone raster to accord with how data is stored\n if blflipx:\n arr_zone = numpy.flipud(arr_zone)\n if blflipy:\n arr_zone = numpy.fliplr(arr_zone)\n if bltranspose:\n arr_zone = numpy.transpose(arr_zone)\n # Delete temporary raster if it exists\n if bltempRaster:\n arcpy.Delete_management(temp_raster)\n\n # Check if variable is packed\n ispacked = hasattr(arr_var,'scale_factor') or hasattr(arr_var, 'add_offset')\n # Determine whether given statistic is categorical or not\n new_var_dtype = False\n for stat in self.statistics:\n if type_parameter.valueAsText in stat[1].keys():\n new_var_dtype = stat[2]\n break\n type_changed = False\n if ('int' in str(arr_var.dtype)) and (not new_var_dtype) and (\n not ispacked):\n type_changed = True\n\n # Slice generator\n # Adapted from: http://code.activestate.com/recipes/\n # 502194-a-generator-for-an-arbitrary-number-of-for-loops/\n # Originally written by Steven Bethard\n def multi_for(iterables):\n if not iterables:\n yield ()\n else:\n if isinstance(iterables[0], collections.Iterable):\n for item in iterables[0]:\n for rest_tuple in multi_for(iterables[1:]):\n yield (item,) + rest_tuple\n else:\n for rest_tuple in multi_for(iterables[1:]):\n yield (iterables[0],) + rest_tuple\n\n # Generate slice list\n dim_shape = arr_var.shape\n dim_name = arr_var.dimensions\n dim_slices = []\n dim_dims = []\n dim_prod = 1\n for dim_index, dim_item in enumerate(dim_name):\n if not dim_item in spat_list:\n dim_prod *= dim_shape[dim_index]\n dim_slices.append(xrange(dim_shape[dim_index]))\n dim_dims.append((str(dim_item), numpy.int))\n else:\n dim_slices.append(Ellipsis)\n\n blstructcreated = False\n\n def hstack_struct(arr1, arr2):\n # Will only work correctly if arr1 and arr2 only have one record\n dt = numpy.lib.recfunctions.zip_descr((arr1, arr2), flatten=True)\n return numpy.array(arr1.tolist() + arr2.tolist(), dtype = dt)\n\n # Get zone values\n if noDataValue is not None:\n zones = numpy.setdiff1d(numpy.unique(arr_zone), [noDataValue])\n else:\n zones = numpy.unique(arr_zone)\n\n # Progress bar\n dim_prod *= zones.size\n arcpy.ResetProgressor()\n arcpy.SetProgressor('step', 'Calculating...', 0, dim_prod, 1)\n\n # Loop through slices\n index = 0\n valid_indices = []\n for varslice in multi_for(dim_slices):\n\n # Take slice from data\n if type_changed:\n arr_slice = arr_var[varslice].astype('f8')\n else:\n arr_slice = arr_var[varslice]\n\n # Create masked array\n if hasattr(arr_slice, 'mask'):\n arr_mask = arr_slice.mask.copy()\n else:\n arr_mask = numpy.ma.make_mask_none(arr_slice.shape)\n arr_slice = numpy.ma.asarray(arr_slice)\n\n # Loop over zones\n for z in zones:\n # Perform for zone when NoData is ignored\n # or when there is no NoData within zone\n if ignore_parameter.value or \\\n (not numpy.any((arr_zone==z) & arr_mask)):\n # Set mask to netCDF NoData mask\n arr_slice.mask = arr_mask\n # Apply zone mask\n arr_slice[arr_zone!=z] = numpy.ma.masked\n # Apply operator to zone masked slice\n result = self.calculate_statistic(arr_slice[:], \\\n type_parameter.valueAsText)\n\n # Structure results into row\n struct_data = [dataset.variable(dim_name[it_ind])[it] for \\\n it_ind, it in enumerate(list(varslice)) if \\\n it != Ellipsis]\n struct_data.append(z)\n struct_data.append(numpy.ma.count(arr_slice))\n if numpy.isscalar(result):\n # Single-valued result\n struct_data.append(result)\n else:\n # Multivalued result\n struct_data += [it2 for it in result.tolist() for \\\n it2 in it]\n\n # Create table when necessary\n if not blstructcreated:\n struct_dtype = dim_dims[:]\n struct_dtype.append((str(zonefield_parameter.value), \\\n numpy.int))\n struct_dtype.append(('COUNT', numpy.int))\n if type_parameter.valueAsText in \\\n self.statistics_multiple_values:\n struct_dtype += [(it, numpy.float) for it in list(\n result.dtype.names)]\n else:\n struct_dtype.append((str(\n type_parameter.valueAsText), numpy.float))\n struct = numpy.zeros((dim_prod,), numpy.dtype(struct_dtype))\n blstructcreated = True\n\n # Insert row\n struct[index] = numpy.array(tuple(struct_data), \\\n numpy.dtype(struct_dtype))\n\n valid_indices.append(index)\n #else:\n # # Passing drops zones with NoData in them from table\n # pass\n index += 1\n arcpy.SetProgressorPosition()\n\n arcpy.ResetProgressor()\n\n if 'time' in dim_name:\n # Output zonal statistics to temporary table\n temp_table = os.path.join(tempfile.gettempdir(), 'temp_table.dbf')\n if arcpy.Exists(temp_table):\n arcpy.Delete_management(temp_table)\n arcpy.da.NumPyArrayToTable(struct[valid_indices], temp_table)\n # Create table view of the time dimension from netCDF file\n temp_mdtable = r\"md_table\"\n arcpy.MakeNetCDFTableView_md(dataset_name, 'time', temp_mdtable, 'time')\n # Get time field from table view\n desc_fields = arcpy.ListFields(temp_mdtable)\n time_field = desc_fields[[field.name for field in \\\n desc_fields].index('time')]\n # Create a table in the output location\n arcpy.CreateTable_management(*os.path.split(output_filename))\n # Add fields from temporary table except for time field, which\n # we add from the MakeNetCDFTableView\n desc_fields = arcpy.ListFields(temp_table)\n for index, field in enumerate(desc_fields):\n if field.type != 'OID':\n if field.name == 'time':\n arcpy.AddField_management(output_filename, time_field.name, \\\n time_field.type, time_field.precision, time_field.scale, \\\n time_field.length, time_field.aliasName, \\\n time_field.isNullable, time_field.required, \\\n time_field.domain)\n else:\n arcpy.AddField_management(output_filename, field.name, \\\n field.type, field.precision, field.scale, field.length, \\\n field.aliasName, field.isNullable, field.required,\n field.domain)\n arcpy.DeleteField_management(output_filename,\"Field1\")\n # Create list of datetime objects from table view\n time_arc = []\n with arcpy.da.SearchCursor(temp_mdtable, 'time') as cursor:\n for row in cursor:\n time_arc.append(row[0])\n del cursor\n # Get time variable from netCDF dataset\n time_var = dataset.variable('time')[:].tolist()\n # Loop through entries from temporary table\n with arcpy.da.InsertCursor(output_filename, '*') as ins_cursor:\n new_time_ind = ins_cursor.fields.index('time')\n with arcpy.da.SearchCursor(temp_table, '*') as cursor:\n time_ind = cursor.fields.index('time')\n for row in cursor:\n new_row = list(row)\n new_row[new_time_ind] = \\\n time_arc[time_var.index(row[time_ind])]\n ins_cursor.insertRow(tuple(new_row))\n del ins_cursor\n del cursor\n else:\n # Write table\n if arcpy.env.overwriteOutput:\n arcpy.Delete_management(output_filename)\n arcpy.da.NumPyArrayToTable(struct[valid_indices], output_filename)\n\n return", "metadata": "root.MultidimensionalZonalStatisticsAsTable.zonal_statistics_as_table_for_grid", "header": "['class', 'MultidimensionalZonalStatisticsAsTable', '(', 'object', ')', ':', '___EOS___']", "index": 447 }, { "content": " def zonal_statistics_as_table_for_discrete(self, parameters, messages, dataset):\n \"\"\"Performs zonal statistics as table assuming dataset is a CF 1.6\n compliant discrete sampling geometry dataset of 'point', 'timeseries',\n or 'profile' feature type using an orthogonal or incomplete\n multidimensional array data representation.\"\"\"\n\n zone_parameter = parameters[0]\n input_parameter = parameters[1]\n variable_parameter = parameters[2]\n output_parameter = parameters[3]\n type_parameter = parameters[4]\n ignore_parameter = parameters[5]\n zonefield_parameter = parameters[6]\n\n # Grab the parameter values\n dataset_name = input_parameter.valueAsText # input netCDF filename\n output_filename = output_parameter.valueAsText # output filename\n var_name = variable_parameter.valueAsText # netCDF variable name\n\n # Get associated station, x, and y variables\n (stat_variable, x_variable, y_variable) = self.get_dependent_variables(\n dataset, var_name)\n if (stat_variable is None) or (x_variable is None) or (y_variable is None):\n messages.addErrorMessage('%s is not a station variable.' % var_name)\n raise arcpy.ExecuteError\n\n # Extract variable from netCDF dataset\n arr_var = dataset.variable(var_name)\n\n # Extract coordinates attribute\n dim_names = []\n if 'coordinates' in arr_var.ncattrs():\n dim_names = str(arr_var.getncattr('coordinates')).split()\n\n # Get coordinate arrays\n X = dataset.variable(x_variable)\n Y = dataset.variable(y_variable)\n\n # Make array of station indices\n if stat_variable in dataset.variable_names():\n arr_stat = dataset.variable(stat_variable)[:]\n else:\n arr_stat = numpy.arange(len(dataset.dimension(stat_variable)))\n\n # Empty dictionary to hold stations falling within each zone\n zone_stations = {}\n # where the keys are values of the zone field and the key values\n # are each a list of station indices contained within that zone\n\n # Process input zone data\n desc = arcpy.Describe(zone_parameter.value)\n\n # Was a temporary feature class created?\n bltemppoly = False\n\n # Convert raster to polygon if necessary\n valid_raster_types = [\"RasterLayer\", \"RasterDataset\"]\n valid_feature_types = [\"ShapeFile\",\"FeatureLayer\", \"FeatureDataset\"]\n if desc.dataType in valid_raster_types:\n temp_poly = \"in_memory\\\\temp\"\n arcpy.RasterToPolygon_conversion(in_raster, temp_poly, \\\n \"NO_SIMPLIFY\", zonefield_parameter.value)\n temp_field = \"GRIDCODE\"\n bltemppoly = True\n elif desc.dataType in valid_feature_types:\n temp_poly = zone_parameter.value\n temp_field = zonefield_parameter.value\n else:\n messages.addErrorMessage(\"Not a valid zone dataset.\")\n raise arcpy.ExecuteError\n\n num_recs = int(arcpy.GetCount_management(temp_poly).getOutput(0))\n num_recs *= numpy.prod(arr_stat.shape)\n\n arcpy.SetProgressor(\"step\", \"Building zone feature look-up...\", 0, num_recs, 1)\n\n # Find zones associated with each feature\n desc = arcpy.Describe(temp_poly)\n rows = arcpy.SearchCursor(temp_poly)\n for row in rows:\n feat = row.getValue(desc.ShapeFieldName)\n zone = row.getValue(temp_field)\n for station in arr_stat:\n if feat.contains(arcpy.Point(float(X[station]),float(Y[station]))):\n if not zone in zone_stations.keys():\n zone_stations[zone] = []\n zone_stations[zone].append(station)\n arcpy.SetProgressorPosition()\n del rows, row\n arcpy.ResetProgressor()\n\n # Delete temporary feature class if it exists\n if bltemppoly:\n arcpy.Delete_management(temp_poly)\n\n # Check if variable is packed\n ispacked = hasattr(arr_var,'scale_factor') or hasattr(arr_var, 'add_offset')\n # Determine whether given statistic is categorical or not\n new_var_dtype = False\n for stat in self.statistics:\n if type_parameter.valueAsText in stat[1].keys():\n new_var_dtype = stat[2]\n break\n type_changed = False\n if ('int' in str(arr_var.dtype)) and (not new_var_dtype) and (\n not ispacked):\n type_changed = True\n\n # Slice generator\n # Adapted from: http://code.activestate.com/recipes/\n # 502194-a-generator-for-an-arbitrary-number-of-for-loops/\n # Originally written by Steven Bethard\n def multi_for(iterables):\n if not iterables:\n yield ()\n else:\n if isinstance(iterables[0], collections.Iterable):\n for item in iterables[0]:\n for rest_tuple in multi_for(iterables[1:]):\n yield (item,) + rest_tuple\n else:\n for rest_tuple in multi_for(iterables[1:]):\n yield (iterables[0],) + rest_tuple\n\n # Generate slice list\n dim_shape = arr_var.shape\n dim_name = arr_var.dimensions\n dim_slices = []\n dim_dims = []\n dim_prod = 1\n for dim_index, dim_item in enumerate(dim_name):\n if dim_item != stat_variable:\n dim_prod *= dim_shape[dim_index]\n dim_slices.append(xrange(dim_shape[dim_index]))\n dim_dims.append((str(dim_item), numpy.int))\n\n # Get position of statistic\n stat_position = dim_name.index(stat_variable)\n\n blstructcreated = False\n\n def hstack_struct(arr1, arr2):\n # Will only work correctly if arr1 and arr2 only have one record\n dt = numpy.lib.recfunctions.zip_descr((arr1, arr2), flatten=True)\n return numpy.array(arr1.tolist() + arr2.tolist(), dtype = dt)\n\n # Progress bar\n dim_prod *= len(zone_stations)\n arcpy.ResetProgressor()\n arcpy.SetProgressor('step', 'Calculating...', 0, dim_prod, 1)\n\n # Loop through zones\n index = 0\n valid_indices = []\n for zone in zone_stations:\n\n # Grab station indices associated with zone\n zone_indices = zone_stations[zone]\n\n # Loop through slices\n for varslice in multi_for(dim_slices):\n\n # Insert station indices into slice\n varslice = list(varslice)\n varslice.insert(stat_position, zone_indices)\n\n # Take slice from data\n if type_changed:\n arr_slice = arr_var[varslice].astype('f8')\n else:\n arr_slice = arr_var[varslice]\n\n # Create masked array\n if hasattr(arr_slice, 'mask'):\n arr_mask = arr_slice.mask.copy()\n else:\n arr_mask = numpy.ma.make_mask_none(arr_slice.shape)\n arr_slice = numpy.ma.asarray(arr_slice)\n\n # Perform for zone when NoData is ignored\n # or when there is no NoData within zone\n if ignore_parameter.value or (not numpy.any(arr_mask)):\n\n # Apply mask\n arr_slice.mask = arr_mask\n\n # Apply operator to zone masked slice\n result = self.calculate_statistic(arr_slice[:], \\\n type_parameter.valueAsText)\n\n # Structure results into row\n struct_data = []\n for it_ind, it in enumerate(list(varslice)):\n if it_ind != stat_position:\n if dim_name[it_ind] in dataset.variable_names():\n # Dimension with variable\n struct_data.append(dataset.variable(dim_name[it_ind])[it])\n else:\n # Dimension without variable\n struct_data.append(it)\n struct_data.append(zone)\n struct_data.append(numpy.ma.count(arr_slice))\n if numpy.isscalar(result):\n # Single-valued result\n struct_data.append(result)\n else:\n # Multivalued result\n struct_data += [it2 for it in result.tolist() for it2 in it]\n\n # Create table when necessary\n if not blstructcreated:\n struct_dtype = dim_dims[:]\n struct_dtype.append((str(zonefield_parameter.value),numpy.int))\n struct_dtype.append(('COUNT', numpy.int))\n if numpy.isscalar(result):\n # Single-valued result\n struct_dtype.append((str(type_parameter.valueAsText), \\\n numpy.float))\n else:\n # Multivalued result\n struct_dtype += [(it, numpy.float) for it in list(\n result.dtype.names)]\n struct = numpy.zeros((dim_prod,), numpy.dtype(struct_dtype))\n blstructcreated = True\n\n # Insert row\n struct[index] = numpy.array(tuple(struct_data), \\\n numpy.dtype(struct_dtype))\n valid_indices.append(index)\n #else:\n # # Passing drops zones with NoData in them from table\n # pass\n index += 1\n arcpy.SetProgressorPosition()\n\n arcpy.ResetProgressor()\n\n if 'time' in dim_name:\n # Output zonal statistics to temporary table\n temp_table = os.path.join(tempfile.gettempdir(), 'temp_table.dbf')\n if arcpy.Exists(temp_table):\n arcpy.Delete_management(temp_table)\n arcpy.da.NumPyArrayToTable(struct[valid_indices], temp_table)\n # Create table view of the time dimension from netCDF file\n temp_mdtable = r\"md_table\"\n arcpy.MakeNetCDFTableView_md(dataset_name, 'time', temp_mdtable, 'time')\n # Get time field from table view\n desc_fields = arcpy.ListFields(temp_mdtable)\n time_field = desc_fields[[field.name for field in \\\n desc_fields].index('time')]\n # Create a table in the output location\n arcpy.CreateTable_management(*os.path.split(output_filename))\n # Add fields from temporary table except for time field, which\n # we add from the MakeNetCDFTableView\n desc_fields = arcpy.ListFields(temp_table)\n for index, field in enumerate(desc_fields):\n if field.type != 'OID':\n if field.name == 'time':\n arcpy.AddField_management(output_filename, time_field.name, \\\n time_field.type, time_field.precision, time_field.scale, \\\n time_field.length, time_field.aliasName, \\\n time_field.isNullable, time_field.required, \\\n time_field.domain)\n else:\n arcpy.AddField_management(output_filename, field.name, \\\n field.type, field.precision, field.scale, field.length, \\\n field.aliasName, field.isNullable, field.required,\n field.domain)\n arcpy.DeleteField_management(output_filename,\"Field1\")\n # Create list of datetime objects from table view\n time_arc = []\n with arcpy.da.SearchCursor(temp_mdtable, 'time') as cursor:\n for row in cursor:\n time_arc.append(row[0])\n del cursor\n # Get time variable from netCDF dataset\n time_var = dataset.variable('time')[:].tolist()\n # Loop through entries from temporary table\n with arcpy.da.InsertCursor(output_filename, '*') as ins_cursor:\n new_time_ind = ins_cursor.fields.index('time')\n with arcpy.da.SearchCursor(temp_table, '*') as cursor:\n time_ind = cursor.fields.index('time')\n for row in cursor:\n new_row = list(row)\n new_row[new_time_ind] = \\\n time_arc[time_var.index(row[time_ind])]\n ins_cursor.insertRow(tuple(new_row))\n del ins_cursor\n del cursor\n else:\n # Write table\n if arcpy.env.overwriteOutput:\n arcpy.Delete_management(output_filename)\n arcpy.da.NumPyArrayToTable(struct[valid_indices], output_filename)\n\n return", "metadata": "root.MultidimensionalZonalStatisticsAsTable.zonal_statistics_as_table_for_discrete", "header": "['class', 'MultidimensionalZonalStatisticsAsTable', '(', 'object', ')', ':', '___EOS___']", "index": 862 } ]
[ { "span": "input_parameter ", "start_line": 257, "start_column": 8, "end_line": 257, "end_column": 23 }, { "span": "type_parameter ", "start_line": 260, "start_column": 8, "end_line": 260, "end_column": 22 }, { "span": "ignore_parameter ", "start_line": 261, "start_column": 8, "end_line": 261, "end_column": 24 }, { "span": "valid_feature_types ", "start_line": 281, "start_column": 12, "end_line": 281, "end_column": 31 }, { "span": "ignore_parameter ", "start_line": 299, "start_column": 8, "end_line": 299, "end_column": 24 }, { "span": "zone_parameter ", "start_line": 417, "start_column": 8, "end_line": 417, "end_column": 22 }, { "span": "type_parameter ", "start_line": 421, "start_column": 8, "end_line": 421, "end_column": 22 }, { "span": "ignore_parameter ", "start_line": 422, "start_column": 8, "end_line": 422, "end_column": 24 }, { "span": "zonefield_parameter ", "start_line": 423, "start_column": 8, "end_line": 423, "end_column": 27 }, { "span": "output_filename ", "start_line": 427, "start_column": 8, "end_line": 427, "end_column": 23 }, { "span": "var_name ", "start_line": 428, "start_column": 8, "end_line": 428, "end_column": 16 }, { "span": "hstack_struct(", "start_line": 711, "start_column": 12, "end_line": 711, "end_column": 25 }, { "span": "dim_names ", "start_line": 894, "start_column": 12, "end_line": 894, "end_column": 21 }, { "span": "hstack_struct(", "start_line": 1003, "start_column": 12, "end_line": 1003, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Multi", "dimension", "al", "Zon", "al", "Statistic", "s", "As", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Parameters_", "(_", "self_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Modifie", "s", " ", "the", " ", "values", " ", "and", " ", "proper", "ties", " ", "of", " ", "parameter", "s", " ", "bef", "ore", " ", "internal", "\\", "10", ";", " ", " ", " ", " ", "validation", " ", "is", " ", "perform", "ed", ".", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "whe", "neve", "r", " ", "a", " ", "parameter", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "bee", "n", " ", "change", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zone", "\\u", "parameter_", "=_", "parameters_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "parameter_", "=_", "parameters_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "parameter_", "=_", "parameters_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "parameter_", "=_", "parameters_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "parameter_", "=_", "parameters_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "parameter_", "=_", "parameters_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "field", "\\u", "parameter_", "=_", "parameters_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Populate", " ", "the", " ", "output", " ", "net", "CD", "F", " ", "file", " ", "parameter", " ", "with", " ", "a", " ", "reason", "able", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "i", ".", "e", ".", " ", "the", " ", "name", " ", "of", " ", "the", " ", "variab", "le", " ", "with", " ", "'", "zona", "l\\u", "'", " ", "append", "ed", " ", "to", " ", "it", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "variab", "le", "\\u", "parameter_", "._", "value_", "is_", "not_", "None_", ")_", "and_", "(_", "not_", "output", "\\u", "parameter_", "._", "alter", "ed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "\\u", "file", "\\u", "name_", "=_", "variab", "le", "\\u", "parameter_", "._", "value", "As", "Text_", "+_", "'\\u", "zona", "l", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Generate", " ", "a", " ", "unique", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "name_", "=_", "out", "\\u", "file", "\\u", "name_", "+_", "'.", "dbf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "arcpy_", "._", "Exists_", "(_", "temp", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "name_", "=_", "out", "\\u", "file", "\\u", "name_", "+_", "str_", "(_", "i_", ")_", "+_", "'.", "dbf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "\\u", "file", "\\u", "name_", "=_", "temp", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workspace_", "=_", "arcpy_", "._", "env_", "._", "workspace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "parameter_", "._", "value_", "=_", "os_", "._", "path_", "._", "join_", "(_", "workspace_", ",_", "out", "\\u", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "zone", " ", "parameter", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "zone", "\\u", "parameter_", "._", "value_", "is_", "not_", "None_", ")_", "and_", "(_", "not_", "zone", "field", "\\u", "parameter_", "._", "alter", "ed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid", "\\u", "rast", "er", "\\u", "types_", "=_", "[_", "\"", "Ras", "ter", "Layer", "\"_", ",_", "\"", "Ras", "ter", "Datas", "et", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "feature", "\\u", "types_", "=_", "[_", "\"", "Shape", "File", "\"_", ",_", "\"", "Feature", "Layer", "\"_", ",_", "\"", "Feature", "Datas", "et", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "arcpy_", "._", "Describe", "_", "(_", "zone", "\\u", "parameter_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "desc_", "._", "data", "Type_", "in_", "valid", "\\u", "rast", "er", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zone", "field", "\\u", "parameter_", "._", "value_", "=_", "\"", "Value", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zone", "field", "\\u", "parameter_", "._", "value_", "=_", "\"", "FID", "\"_", "\\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\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "dimension", "al", "Zon", "al", "Statistic", "s", "As", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Messages_", "(_", "self_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Modifie", "s", " ", "the", " ", "message", "s", " ", "created", " ", "by", " ", "internal", " ", "validation", " ", "for", " ", "each", " ", "tool", "\\", "10", ";", " ", " ", " ", " ", "parameter", ".", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "after", " ", "internal", " ", "validation", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zone", "\\u", "parameter_", "=_", "parameters_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "parameter_", "=_", "parameters_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "parameter_", "=_", "parameters_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "parameter_", "=_", "parameters_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "parameter_", "=_", "parameters_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "parameter_", "=_", "parameters_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "field", "\\u", "parameter_", "=_", "parameters_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "zone", "\\u", "parameter_", "._", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid", "\\u", "rast", "er", "\\u", "types_", "=_", "[_", "\"", "Ras", "ter", "Layer", "\"_", ",_", "\"", "Ras", "ter", "Datas", "et", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "feature", "\\u", "types_", "=_", "[_", "\"", "Shape", "File", "\"_", ",_", "\"", "Feature", "Layer", "\"_", ",_", "\"", "Feature", "Datas", "et", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "arcpy_", "._", "Describe", "_", "(_", "zone", "\\u", "parameter_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "desc_", "._", "data", "Type_", "in_", "valid", "\\u", "rast", "er", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "rast", "er", " ", "is", " ", "of", " ", "an", " ", "integ", "er", " ", "data", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "desc_", ",_", "'", "is", "Integer", "'_", ")_", "or_", "not_", "desc_", "._", "is", "Integer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "zone", "\\u", "parameter_", "._", "set", "Error", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mds", "_", "._", "messages_", "._", "ZONE", "\\u", "RAS", "TER", "\\u", "NOT", "\\u", "INTEGER_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "zone", "\\u", "parameter_", "._", "value", "As", "Text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fil", "l", " ", "zone", " ", "field", " ", "parameter", " ", "for", " ", "raster_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "hasattr_", "(_", "desc_", ",_", "'", "fields", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "zone", "field", "\\u", "parameter_", "._", "filter_", "._", "type_", "=_", "\"", "Value", "List", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "types_", "=_", "[_", "'", "Integer", "'_", ",_", "'", "Small", "Integer", "'_", ",_", "'", "String", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "field", "\\u", "parameter_", "._", "filter_", "._", "list_", "=_", "[_", "zone", "field_", "._", "name_", "for_", "zone", "field_", "in_", "desc_", "._", "fields_", "if_", "zone", "field_", "._", "type_", "in_", "valid", "types_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "zone", "field", "\\u", "parameter_", "._", "filter_", "._", "type_", "=_", "\"", "Value", "List", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "field", "\\u", "parameter_", "._", "filter_", "._", "list_", "=_", "[_", "'", "Value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "desc_", "._", "data", "Type_", "in_", "valid", "\\u", "feature", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fil", "l", " ", "zone", " ", "field", " ", "parameter", " ", "for", " ", "feature", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zone", "field", "\\u", "parameter_", "._", "filter_", "._", "type_", "=_", "\"", "Value", "List", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "types_", "=_", "[_", "'", "OID", "'_", ",_", "'", "Integer", "'_", ",_", "'", "Small", "Integer", "'_", ",_", "'", "String", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "field", "\\u", "parameter_", "._", "filter_", "._", "list_", "=_", "[_", "zone", "field_", "._", "name_", "for_", "zone", "field_", "in_", "desc_", "._", "fields_", "if_", "zone", "field_", "._", "type_", "in_", "valid", "types_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zone", "field", "\\u", "parameter_", "._", "filter_", "._", "type_", "=_", "\"", "Value", "List", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "field", "\\u", "parameter_", "._", "filter_", "._", "list_", "=_", "[_", "]_", "\\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_", "#", " ", "Clear", " ", "zone", " ", "field", " ", "list", " ", "if", " ", "no", " ", "zone", " ", "dataset", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zone", "field", "\\u", "parameter_", "._", "filter_", "._", "type_", "=_", "\"", "Value", "List", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "field", "\\u", "parameter_", "._", "filter_", "._", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "net", "CD", "F", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "input", "\\u", "parameter_", "._", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", "=_", "mds", "_", "._", "netcdf", "_", "._", "Dataset_", "(_", "input", "\\u", "parameter_", "._", "value", "As", "Text_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", ",_", "exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "No", " ", "suc", "h", " ", "file", " ", "or", " ", "director", "y", "\"_", "in_", "str_", "(_", "exception_", ")_", "or_", "\"", "Inva", "lid", " ", "argu", "ment", "\"_", "in_", "str_", "(_", "exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "input", "\\u", "parameter_", "._", "set", "Error", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mds", "_", "._", "messages_", "._", "INPUT", "\\u", "FILE", "\\u", "DO", "ES", "\\u", "NOT", "\\u", "EXIST", "_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "parameter_", "._", "value", "As", "Text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "Mal", "formed", " ", "or", " ", "ina", "ccess", "ibl", "e", " ", "DA", "P", " ", "DD", "S", "\"_", "in_", "str_", "(_", "exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "input", "\\u", "parameter_", "._", "set", "Error", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mds", "_", "._", "messages_", "._", "INPUT", "\\u", "DATASET", "\\u", "URL", "\\u", "MAL", "FORM", "ED_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "parameter_", "._", "value", "As", "Text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "input", "\\u", "parameter_", "._", "set", "Error", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mds", "_", "._", "messages_", "._", "INPUT", "\\u", "DATASET", "\\u", "GENERIC", "\\u", "ERROR_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "parameter_", "._", "value", "As", "Text_", ",_", "str_", "(_", "exception_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "parameter_", "._", "set", "Error", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mds", "_", "._", "messages_", "._", "INPUT", "\\u", "DATASET", "\\u", "GENERIC", "\\u", "ERROR_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "parameter_", "._", "value", "As", "Text_", ",_", "str_", "(_", "exception_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dataset_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "fill", " ", "variab", "le", " ", "list", " ", "with", " ", "spat", "ial", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "\\u", "list_", "=_", "list_", "(_", "dataset_", "._", "spat", "ial", "\\u", "data\\u", "variab", "le", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "var", "\\u", "list_", "!=_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "success", "ful", ",", " ", "we", " ", "like", "ly", " ", "have", " ", "a", " ", "gridd", "ed", " ", "dataset", ".", " ", " ", "We", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "check", " ", "regular", " ", "gridd", "ing", " ", "on", " ", "executi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "variab", "le", "\\u", "parameter_", "._", "filter_", "._", "type_", "=_", "\"", "Value", "List", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "parameter_", "._", "filter_", "._", "list_", "=_", "var", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "unsuc", "cess", "ful", ",", " ", "try", " ", "to", " ", "fill", " ", "variab", "le", " ", "list", " ", "ass", "umi", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dataset", " ", "is", " ", "of", " ", "a", " ", "discrete", " ", "geom", "etry", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "var", "\\u", "list_", "=_", "list_", "(_", "dataset_", "._", "data\\u", "variab", "le", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "filter_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "var", "\\u", "item_", "in_", "var", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "var", "\\u", "stat_", ",_", "var", "\\u", "x_", ",_", "var", "\\u", "y_", "=_", "self_", "._", "get", "\\u", "dependent", "\\u", "variables_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", ",_", "var", "\\u", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "var", "\\u", "stat_", "is_", "not_", "None_", ")_", "and_", "(_", "var", "\\u", "x_", "is_", "not_", "None_", ")_", "and_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "y_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "var", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "variab", "les", "\\u", "by", "\\u", "dimension_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", ",_", "var", "\\u", "stat_", ")_", "\\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_", "variab", "le", "\\u", "parameter_", "._", "filter_", "._", "type_", "=_", "\"", "Value", "List", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "parameter_", "._", "filter_", "._", "list_", "=_", "var", "\\u", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Clear", " ", "variab", "le", " ", "list", " ", "if", " ", "no", " ", "input", " ", "dataset", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "variab", "le", "\\u", "parameter_", "._", "filter_", "._", "type_", "=_", "\"", "Value", "List", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "parameter_", "._", "filter_", "._", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "parameter_", "._", "value_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modif", "y", " ", "statistic", " ", "choice", "s", " ", "so", " ", "tha", "t", ",", " ", "if", " ", "any", " ", "variab", "le", " ", "is", " ", "not", " ", "of", " ", "integer_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "type", ",", " ", "categor", "ical", " ", "statistic", "s", " ", "are", " ", "not", " ", "offered", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "variab", "le", "\\u", "parameter_", "._", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "dataset_", "is_", "not_", "None_", ")_", "and_", "(_", "variab", "le", "\\u", "parameter_", "._", "value_", "in_", "dataset_", "._", "variab", "le", "\\u", "names_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "dataset_", "._", "variable_", "(_", "variab", "le", "\\u", "parameter_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "isp", "acke", "d_", "=_", "hasattr_", "(_", "var_", ",_", "'", "scale", "\\u", "factor", "'_", ")_", "or_", "hasattr_", "(_", "var_", ",_", "'", "add", "\\u", "offset", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flag_", "=_", "(_", "'", "int", "'_", "in_", "str_", "(_", "var_", "._", "dtype_", ")_", ")_", "and_", "not_", "isp", "acke", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "parameter_", "._", "filter_", "._", "list_", "=_", "sorted_", "(_", "[_", "key_", "for_", "stat_", "in_", "self_", "._", "statistics_", "if_", "flag_", "or_", "not_", "stat_", "[_", "2_", "]_", "for_", "key_", "in_", "stat_", "[_", "1_", "]_", "._", "keys_", "(_", ")_", "]_", ")_", "\\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_", "#", " ", "Whe", "n", " ", "variab", "le", " ", "parameter", " ", "is", " ", "clear", "ed", ",", " ", "make", " ", "all", " ", "statistic", "s", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type", "\\u", "parameter_", "._", "filter_", "._", "list_", "=_", "sorted_", "(_", "[_", "key_", "for_", "stat_", "in_", "self_", "._", "statistics_", "for_", "key_", "in_", "stat_", "[_", "1_", "]_", "._", "keys_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "output", " ", "table", " ", "has", " ", "a", " ", ".", "dbf", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "output", "\\u", "parameter_", "._", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "filename_", "=_", "output", "\\u", "parameter_", "._", "value", "As", "Text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "splitext_", "(_", "output", "\\u", "filename_", ")_", "[_", "1_", "]_", "!=_", "\".", "dbf", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "parameter_", "._", "set", "Error", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mds", "_", "._", "messages_", "._", "OUTPU", "T", "\\u", "FILE", "\\u", "EXTENSION", "\\u", "MUS", "T", "\\u", "BE", "\\u", "DB", "F_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "dimension", "al", "Zon", "al", "Statistic", "s", "As", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "parameters_", ",_", "messages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "source", " ", "code", " ", "of", " ", "the", " ", "tool", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zone", "\\u", "parameter_", "=_", "parameters_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "parameter_", "=_", "parameters_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "parameter_", "=_", "parameters_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "parameter_", "=_", "parameters_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "parameter_", "=_", "parameters_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "parameter_", "=_", "parameters_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "field", "\\u", "parameter_", "=_", "parameters_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "parameter", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "dataset", "\\u", "name_", "=_", "input", "\\u", "parameter_", "._", "value", "As", "Text_", "#", " ", "input", " ", "net", "CD", "F", " ", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "filename_", "=_", "output", "\\u", "parameter_", "._", "value", "As", "Text_", "#", " ", "output", " ", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "name_", "=_", "variab", "le", "\\u", "parameter_", "._", "value", "As", "Text_", "#", " ", "net", "CD", "F", " ", "variab", "le", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "open", " ", "the", " ", "net", "CD", "F", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", "=_", "mds", "_", "._", "netcdf", "_", "._", "Dataset_", "(_", "dataset", "\\u", "name_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", ",_", "exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "add", "Error", "Message_", "(_", "str_", "(_", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "arcpy_", "._", "Execut", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Base", "d", " ", "on", " ", "same", " ", "crite", "ria", " ", "used", " ", "to", " ", "populate", " ", "variab", "le", "\\u", "parameter", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "update", "Messag", "es", "()", ",", " ", "check", " ", "if", " ", "input", " ", "dataset", " ", "is", " ", "gridd", "ed", " ", "or", " ", "contains_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "discrete", " ", "geometries", " ", "and", " ", "branch", " ", "code", " ", "appropr", "iate", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "list_", "(_", "dataset_", "._", "spat", "ial", "\\u", "data\\u", "variab", "le", "\\u", "names_", "(_", ")_", ")_", "!=_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "zona", "l\\u", "statistic", "s", "\\u", "as", "\\u", "table", "\\u", "for", "\\u", "grid_", "(_", "parameters_", ",_", "messages_", ",_", "dataset_", ")_", "\\u\\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_", "._", "zona", "l\\u", "statistic", "s", "\\u", "as", "\\u", "table", "\\u", "for", "\\u", "discrete", "_", "(_", "parameters_", ",_", "messages_", ",_", "dataset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "dimension", "al", "Zon", "al", "Statistic", "s", "As", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "zona", "l\\u", "statistic", "s", "\\u", "as", "\\u", "table", "\\u", "for", "\\u", "grid_", "(_", "self_", ",_", "parameters_", ",_", "messages_", ",_", "dataset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", "s", " ", "zona", "l", " ", "statistic", "s", " ", "as", " ", "table", " ", "ass", "umi", "ng", " ", "dataset", " ", "contain", "s", "\\", "10", ";", " ", " ", " ", " ", "regular", "ly", " ", "gridd", "ed", " ", "variab", "les", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zone", "\\u", "parameter_", "=_", "parameters_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "parameter_", "=_", "parameters_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "parameter_", "=_", "parameters_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "parameter_", "=_", "parameters_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "parameter_", "=_", "parameters_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "parameter_", "=_", "parameters_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "field", "\\u", "parameter_", "=_", "parameters_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "parameter", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "dataset", "\\u", "name_", "=_", "input", "\\u", "parameter_", "._", "value", "As", "Text_", "#", " ", "input", " ", "net", "CD", "F", " ", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "filename_", "=_", "output", "\\u", "parameter_", "._", "value", "As", "Text_", "#", " ", "output", " ", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "name_", "=_", "variab", "le", "\\u", "parameter_", "._", "value", "As", "Text_", "#", " ", "net", "CD", "F", " ", "variab", "le", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Extract", " ", "variab", "le", " ", "from", " ", "net", "CD", "F", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "arr", "\\u", "var_", "=_", "dataset_", "._", "variable_", "(_", "var", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "spat", "ial", " ", "dimension", "s", " ", "of", " ", "input", " ", "net", "CD", "F", " ", "variab", "le", " ", "are", " ", "regular", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "gridd", "ed", " ", "and", " ", "obtain", " ", "cell", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "cell", "\\u", "size", "\\u", "x_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cell", "\\u", "size", "\\u", "y_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spat", "\\u", "list_", "=_", "list_", "(_", "dataset_", "._", "space", "\\u", "dimension", "\\u", "names_", "(_", "var", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "spat", "\\u", "list_", ")_", ">=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spat", "\\u", "var_", "=_", "dataset_", "._", "variable_", "(_", "spat", "\\u", "list_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "first_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "spat", "\\u", "var_", "._", "size_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "spat", "\\u", "var_", "._", "size_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell", "\\u", "size", "\\u", "x_", "=_", "spat", "\\u", "var_", "[_", "i_", "+_", "1_", "]_", "-_", "spat", "\\u", "var_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "bl", "first_", ")_", "and_", "(_", "cell", "\\u", "size", "\\u", "x_", "!=_", "last", "\\u", "cell", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "messages_", "._", "add", "Error", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mds", "_", "._", "messages_", "._", "VARIABLE", "\\u", "NOT", "\\u", "REGULA", "RL", "Y", "\\u", "GRID", "DED", "_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "name_", ",_", "spat", "\\u", "list_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "arcpy_", "._", "Execut", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "cell", "\\u", "size_", "=_", "cell", "\\u", "size", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "first_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cell", "\\u", "size", "\\u", "x_", "=_", "float_", "(_", "cell", "\\u", "size", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spat", "\\u", "var_", "=_", "dataset_", "._", "variable_", "(_", "spat", "\\u", "list_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "first_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "spat", "\\u", "var_", "._", "size_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "spat", "\\u", "var_", "._", "size_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell", "\\u", "size", "\\u", "y_", "=_", "spat", "\\u", "var_", "[_", "i_", "+_", "1_", "]_", "-_", "spat", "\\u", "var_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "bl", "first_", ")_", "and_", "(_", "cell", "\\u", "size", "\\u", "y_", "!=_", "last", "\\u", "cell", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "messages_", "._", "add", "Error", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mds", "_", "._", "messages_", "._", "VARIABLE", "\\u", "NOT", "\\u", "REGULA", "RL", "Y", "\\u", "GRID", "DED", "_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "name_", ",_", "spat", "\\u", "list_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "arcpy_", "._", "Execut", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "cell", "\\u", "size_", "=_", "cell", "\\u", "size", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "first_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cell", "\\u", "size", "\\u", "y_", "=_", "float_", "(_", "cell", "\\u", "size", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "bot", "h", " ", "x", " ", "and", " ", "y", " ", "cell", " ", "size", "s", " ", "are", " ", "Non", "e", ",", " ", "the", " ", "dataset", " ", "is", " ", "a", " ", "scala", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "cell", "\\u", "size", "\\u", "x_", "is_", "None_", ")_", "and_", "(_", "cell", "\\u", "size", "\\u", "y_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "add", "Error", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mds", "_", "._", "messages_", "._", "VARIABLE", "\\u", "CONT", "AINS", "\\u", "INS", "UFF", "ICI", "ENT", "\\u", "VALUES_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "arcpy_", "._", "Execut", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "one", " ", "of", " ", "x", " ", "and", " ", "y", " ", "is", " ", "Non", "e", ",", " ", "the", " ", "dataset", " ", "is", " ", "a", " ", "line", ",", " ", "so", " ", "we", " ", "will", " ", "assume", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "the", " ", "singleton", " ", "dimension", " ", "share", "s", " ", "the", " ", "other", "'", "s", " ", "cell", " ", "size", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cell", "\\u", "size", "\\u", "x_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell", "\\u", "size", "\\u", "x_", "=_", "cell", "\\u", "size", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "add", "Warn", "ing", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Assu", "ming", " ", "variab", "le", " ", "dimension", " ", "{}", " ", "share", "s", " ", "a", " ", "cell", " ", "size", " ", "of", " ", "{}", " ", "\"_", "+_", "\"", "with", " ", "{}\"_", ")_", "._", "format_", "(_", "spat", "\\u", "list_", "[_", "0_", "]_", ",_", "cell", "\\u", "size", "\\u", "y_", ",_", "spat", "\\u", "list_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cell", "\\u", "size", "\\u", "y_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell", "\\u", "size", "\\u", "y_", "=_", "cell", "\\u", "size", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "add", "Warn", "ing", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Assu", "ming", " ", "variab", "le", " ", "dimension", " ", "{}", " ", "share", "s", " ", "a", " ", "cell", " ", "size", " ", "of", " ", "{}", " ", "\"_", "+_", "\"", "with", " ", "{}\"_", ")_", "._", "format_", "(_", "spat", "\\u", "list_", "[_", "1_", "]_", ",_", "cell", "\\u", "size", "\\u", "x_", ",_", "spat", "\\u", "list_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fig", "ure", " ", "out", " ", "whi", "ch", " ", "spat", "ial", " ", "variab", "le", " ", "is", " ", "x", " ", "and", " ", "whi", "ch", " ", "is", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "and", " ", "then", " ", "get", " ", "correspond", "ing", " ", "number", " ", "of", " ", "column", "s", " ", "and", " ", "rows_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dataset_", "._", "convention", "_", "._", "is", "\\u", "x", "\\u", "dimension", "\\u", "variable_", "(_", "dataset_", "._", "variable_", "(_", "spat", "\\u", "list_", "[_", "0_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ncol_", "=_", "len_", "(_", "dataset_", "._", "variable_", "(_", "spat", "\\u", "list_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nrow_", "=_", "len_", "(_", "dataset_", "._", "variable_", "(_", "spat", "\\u", "list_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "transpose_", "=_", "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 ", " _", "ncol_", "=_", "len_", "(_", "dataset_", "._", "variable_", "(_", "spat", "\\u", "list_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nrow_", "=_", "len_", "(_", "dataset_", "._", "variable_", "(_", "spat", "\\u", "list_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cell", "\\u", "size", "\\u", "x_", ",_", "cell", "\\u", "size", "\\u", "y_", "=_", "cell", "\\u", "size", "\\u", "y_", ",_", "cell", "\\u", "size", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "transpose_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "extent", " ", "from", " ", "net", "CD", "F", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "i", ".", "e", ".", " ", "[", "x", "\\u", "min", ",", " ", "y", "\\u", "min", ",", " ", "x", "\\u", "max", ",", " ", "y", "\\u", "max", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "var", "\\u", "extent_", "=_", "dataset_", "._", "extent_", "(_", "var", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Lower", " ", "left", " ", "hand", " ", "corn", "er", " ", "of", " ", "net", "CD", "F", " ", "variab", "le", " ", "spat", "ial", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "xl_", "=_", "float_", "(_", "var", "\\u", "extent_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yl", "_", "=_", "float_", "(_", "var", "\\u", "extent_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "whe", "ther", " ", "to", " ", "flip", " ", "the", " ", "zone", " ", "data", " ", "over", " ", "a", " ", "give", "n", " ", "axis", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "transpose", " ", "it", " ", "to", " ", "align", " ", "with", " ", "the", " ", "net", "CD", "F", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "bl", "flip", "x_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "flip", "y_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cell", "\\u", "size", "\\u", "y_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bl", "flip", "x_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cell", "\\u", "size", "\\u", "x_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bl", "flip", "y_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "abs", "olute", " ", "cell", " ", "sizes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cell", "\\u", "size", "\\u", "x_", "=_", "abs_", "(_", "cell", "\\u", "size", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cell", "\\u", "size", "\\u", "y_", "=_", "abs_", "(_", "cell", "\\u", "size", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "extent", " ", "to", " ", "extent", " ", "object", " ", "for", " ", "use", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "extent_", "=_", "arcpy_", "._", "Extent_", "(_", "var", "\\u", "extent_", "[_", "0_", "]_", ",_", "var", "\\u", "extent_", "[_", "1_", "]_", ",_", "var", "\\u", "extent_", "[_", "2_", "]_", ",_", "var", "\\u", "extent_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wa", "s", " ", "a", " ", "temporar", "y", " ", "rast", "er", " ", "created", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "bl", "temp", "Raster_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Describe", " ", "zone", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "arcpy_", "._", "Describe", "_", "(_", "zone", "\\u", "parameter_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Environ", "ments_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "env_", "._", "output", "Coordinat", "e", "System_", "=_", "desc_", "._", "spat", "ial", "Reference_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "snap_", "=_", "arcpy_", "._", "Num", "Py", "Array", "To", "Raster_", "(_", "numpy_", "._", "zeros_", "(_", "(_", "1_", ",_", "1_", ")_", ")_", ",_", "arcpy_", "._", "Point_", "(_", "xl_", ",_", "yl", "_", ")_", ",_", "cell", "\\u", "size", "\\u", "x_", ",_", "cell", "\\u", "size", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "env_", "._", "snap", "Raster_", "=_", "temp", "\\u", "snap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "input", " ", "zone", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "rast", "er", "\\u", "types_", "=_", "[_", "\"", "Ras", "ter", "Layer", "\"_", ",_", "\"", "Ras", "ter", "Datas", "et", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "feature", "\\u", "types_", "=_", "[_", "\"", "Shape", "File", "\"_", ",_", "\"", "Feature", "Layer", "\"_", ",_", "\"", "Feature", "Datas", "et", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "desc_", "._", "data", "Type_", "in_", "valid", "\\u", "feature", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Limit", "ation", " ", "of", " ", "Feature", " ", "to", " ", "Raster_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cell", "\\u", "size", "\\u", "x_", "!=_", "cell", "\\u", "size", "\\u", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "add", "Error", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "variab", "le", " ", "%", "s", " ", "must", " ", "use", " ", "the", " ", "same", " ", "gridd", "ing", " ", "\"_", "+_", "\"", "for", " ", "bot", "h", " ", "its", " ", "spat", "ial", " ", "dimension", "s", " ", "whe", "n", " ", "feature", " ", "zone", " ", "\"_", "+_", "\"", "data", " ", "is", " ", "used", ".\"_", "%_", "var", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "arcpy_", "._", "Execut", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Convert", " ", "features_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "\\u", "raster_", "=_", "'", "in", "\\u", "memory", "\\\\\\\\", "temp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Feature", "To", "Ras", "ter", "\\u", "conversion_", "(_", "zone", "\\u", "parameter_", "._", "value_", ",_", "zone", "field", "\\u", "parameter_", "._", "value_", ",_", "temp", "\\u", "raster_", ",_", "cell", "\\u", "size", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "temp", "Raster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "Data", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "no", "Data", "Value_", "=_", "arcpy_", "._", "Describe", "_", "(_", "temp", "\\u", "raster_", ")_", "._", "no", "Data", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "desc_", "._", "data", "Type_", "in_", "valid", "\\u", "rast", "er", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Map", " ", "non", "-", "Value", " ", "field", " ", "to", " ", "Value", " ", "if", " ", "necessar", "y", " ", "and", " ", "gra", "b", " ", "No", "Data", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "zone", "field", "\\u", "parameter_", "._", "value_", "!=_", "'", "Value", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "raster_", "=_", "arcpy_", "._", "sa_", "._", "Lookup_", "(_", "zone", "\\u", "parameter_", "._", "value_", ",_", "zone", "field", "\\u", "parameter_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ras", "ter", " ", "created", " ", "with", " ", "Look", "up", " ", "will", " ", "have", " ", "default", " ", "no", "Data", "Value_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "used", " ", "for", " ", "give", "n", " ", ".", "pixel", "Type", ",", " ", "but", " ", "not", " ", "assign", "ed", " ", "to", " ", ".", "no", "Data", "Value_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "8", "'_", "in_", "in", "\\u", "raster_", "._", "pixel", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "no", "Data", "Value_", "=_", "-_", "128_", "#", " ", "S", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "no", "Data", "Value_", "=_", "-_", "2147483647", "_", "#", " ", "S", "32_", "\\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 ", " _", "in", "\\u", "raster_", "=_", "zone", "\\u", "parameter_", "._", "value", "As", "Text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "Data", "Value_", "=_", "desc_", "._", "no", "Data", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Res", "ample", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "desc_", "._", "mean", "Cel", "l", "Height_", "!=_", "cell", "\\u", "size", "\\u", "y_", ")_", "or_", "(_", "desc_", "._", "mean", "Cel", "l", "Width_", "!=_", "cell", "\\u", "size", "\\u", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "raster_", "=_", "'", "in", "\\u", "memory", "\\\\\\\\", "temp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Res", "ample", "\\u", "management_", "(_", "in", "\\u", "raster_", ",_", "temp", "\\u", "raster_", ",_", "\"%", "f", " ", "%", "f", "\"_", "%_", "(_", "cell", "\\u", "size", "\\u", "x_", ",_", "cell", "\\u", "size", "\\u", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "temp", "Raster_", "=_", "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 ", " _", "temp", "\\u", "raster_", "=_", "in", "\\u", "raster_", "\\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 ", " _", "messages_", "._", "add", "Error", "Message_", "(_", "\"", "Not", " ", "a", " ", "valid", " ", "zone", " ", "dataset", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "arcpy_", "._", "Execut", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "rast", "er", " ", "object", " ", "from", " ", "zone", " ", "data", " ", "if", " ", "not", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "temp", "\\u", "raster_", ",_", "arcpy_", "._", "Raster_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "raster_", "=_", "arcpy_", "._", "Raster_", "(_", "temp", "\\u", "raster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Limit", " ", "to", " ", "lon", " ", "[-", "180", ",", " ", "180", "]", " ", "and", " ", "lat", " ", "[-", "90", ",", " ", "90", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "convert", "\\u", "coord_", "(_", "num_", ",_", "isl", "on_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim_", "=_", "180_", "if_", "isl", "on_", "else_", "90_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num_", ">_", "lim_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "num_", "%_", "-_", "lim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "num_", "<_", "-_", "lim_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "num_", "%_", "lim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isl", "on_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mult_", "=_", "-_", "1.0_", "if_", "num_", "<_", "0_", "else_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "mult_", "*_", "abs_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "whe", "ther", " ", "input", " ", "zone", " ", "data", " ", "has", " ", "a", " ", "PC", "S", " ", "or", " ", "GC", "S_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "temp", "\\u", "raster_", "._", "spat", "ial", "Reference_", "._", "export", "tostring_", "(_", ")_", "==_", "temp", "\\u", "raster_", "._", "spat", "ial", "Reference_", "._", "GC", "S_", "._", "export", "tostring_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "for", " ", "overl", "ap", " ", "bet", "ween", " ", "zone", " ", "and", " ", "net", "CD", "F", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "temp", "\\u", "raster_", "._", "extent_", "._", "disj", "oint_", "(_", "var", "\\u", "extent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "with", " ", "coordinate", "s", " ", "in", " ", "lon", "[-", "180", ",", "180", "]", " ", "and", " ", "lat", "[-", "90", ",", "90", "]", " ", "ranges_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "\\u", "extent", "\\u", "temp_", "=_", "arcpy_", "._", "Extent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "convert", "\\u", "coord_", "(_", "var", "\\u", "extent_", "._", "XM", "in_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "convert", "\\u", "coord_", "(_", "var", "\\u", "extent_", "._", "YM", "in_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "convert", "\\u", "coord_", "(_", "var", "\\u", "extent_", "._", "XM", "ax_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "convert", "\\u", "coord_", "(_", "var", "\\u", "extent_", "._", "YM", "ax_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xl_", "=_", "var", "\\u", "extent", "\\u", "temp_", "._", "XM", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yl", "_", "=_", "var", "\\u", "extent", "\\u", "temp_", "._", "YM", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "again", " ", "and", " ", "throw", " ", "warn", "ing", " ", "on", " ", "failure_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "temp", "\\u", "raster_", "._", "extent_", "._", "disj", "oint_", "(_", "var", "\\u", "extent", "\\u", "temp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "messages_", "._", "add", "Warn", "ing", "Message_", "(_", "\"", "Data", " ", "extent", "s", " ", "don", "'", "t", " ", "overl", "ap", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "temp", "\\u", "raster_", "._", "extent_", "._", "overlaps_", "(_", "var", "\\u", "extent_", ")_", ")_", "and_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "temp", "\\u", "raster_", "._", "extent_", "._", "equals_", "(_", "var", "\\u", "extent_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "add", "Warn", "ing", "Message_", "(_", "\"", "Data", " ", "extent", "s", " ", "don", "'", "t", " ", "overl", "ap", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Extract", " ", "zone", " ", "data", " ", "from", " ", "raster_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arr", "\\u", "zone_", "=_", "arcpy_", "._", "Ras", "ter", "To", "Num", "Py", "Array_", "(_", "temp", "\\u", "raster_", ",_", "arcpy_", "._", "Point_", "(_", "xl_", ",_", "yl", "_", ")_", ",_", "ncol_", ",_", "nrow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Flip", " ", "zone", " ", "rast", "er", " ", "to", " ", "acco", "rd", " ", "with", " ", "how", " ", "data", " ", "is", " ", "stored_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bl", "flip", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arr", "\\u", "zone_", "=_", "numpy_", "._", "flip", "ud_", "(_", "arr", "\\u", "zone_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bl", "flip", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arr", "\\u", "zone_", "=_", "numpy_", "._", "flip", "lr_", "(_", "arr", "\\u", "zone_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bl", "transpose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arr", "\\u", "zone_", "=_", "numpy_", "._", "transpose_", "(_", "arr", "\\u", "zone_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Delete", " ", "temporar", "y", " ", "rast", "er", " ", "if", " ", "it", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bl", "temp", "Raster_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Delete", "\\u", "management_", "(_", "temp", "\\u", "raster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "variab", "le", " ", "is", " ", "packed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "isp", "acke", "d_", "=_", "hasattr_", "(_", "arr", "\\u", "var_", ",_", "'", "scale", "\\u", "factor", "'_", ")_", "or_", "hasattr_", "(_", "arr", "\\u", "var_", ",_", "'", "add", "\\u", "offset", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "whe", "ther", " ", "give", "n", " ", "statistic", " ", "is", " ", "categor", "ical", " ", "or", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "var", "\\u", "dtype_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "stat_", "in_", "self_", "._", "statistics_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type", "\\u", "parameter_", "._", "value", "As", "Text_", "in_", "stat_", "[_", "1_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "var", "\\u", "dtype_", "=_", "stat_", "[_", "2_", "]_", "\\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_", "type", "\\u", "changed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "'", "int", "'_", "in_", "str_", "(_", "arr", "\\u", "var_", "._", "dtype_", ")_", ")_", "and_", "(_", "not_", "new", "\\u", "var", "\\u", "dtype_", ")_", "and_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "isp", "acke", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type", "\\u", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Slice", " ", "generator_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Adapt", "ed", " ", "from", ":", " ", "http", "://", "code", ".", "active", "state", ".", "com", "/", "recip", "es", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "502", "194", "-", "a", "-", "generat", "or", "-", "for", "-", "an", "-", "arbitra", "ry", "-", "number", "-", "of", "-", "for", "-", "loop", "s", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Origina", "ll", "y", " ", "writt", "en", " ", "by", " ", "Ste", "ven", " ", "Bet", "hard", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "multi", "\\u", "for_", "(_", "iterable", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "iterable", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "iterable", "s_", "[_", "0_", "]_", ",_", "collections_", "._", "Iterable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "item_", "in_", "iterable", "s_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "rest", "\\u", "tuple_", "in_", "multi", "\\u", "for_", "(_", "iterable", "s_", "[_", "1_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "(_", "item_", ",_", ")_", "+_", "rest", "\\u", "tuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "rest", "\\u", "tuple_", "in_", "multi", "\\u", "for_", "(_", "iterable", "s_", "[_", "1_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "(_", "iterable", "s_", "[_", "0_", "]_", ",_", ")_", "+_", "rest", "\\u", "tuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "slice", " ", "list_", "\\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_", "dim", "\\u", "shape_", "=_", "arr", "\\u", "var_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "name_", "=_", "arr", "\\u", "var_", "._", "dimensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "slices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "dims_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "prod_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dim", "\\u", "index_", ",_", "dim", "\\u", "item_", "in_", "enumerate_", "(_", "dim", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "dim", "\\u", "item_", "in_", "spat", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim", "\\u", "prod_", "*=_", "dim", "\\u", "shape_", "[_", "dim", "\\u", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "slices_", "._", "append_", "(_", "xrange_", "(_", "dim", "\\u", "shape_", "[_", "dim", "\\u", "index_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "dims_", "._", "append_", "(_", "(_", "str_", "(_", "dim", "\\u", "item_", ")_", ",_", "numpy_", "._", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim", "\\u", "slices_", "._", "append_", "(_", "Ellips", "is_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bl", "struct", "created_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "hst", "ack", "\\u", "struct_", "(_", "arr", "1_", ",_", "arr", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wil", "l", " ", "only", " ", "work", " ", "correct", "ly", " ", "if", " ", "arr", "1", " ", "and", " ", "arr", "2", " ", "only", " ", "have", " ", "one", " ", "record_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "numpy_", "._", "lib_", "._", "rec", "functions_", "._", "zip", "\\u", "descr_", "(_", "(_", "arr", "1_", ",_", "arr", "2_", ")_", ",_", "flatten_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "array_", "(_", "arr", "1_", "._", "tolist_", "(_", ")_", "+_", "arr", "2_", "._", "tolist_", "(_", ")_", ",_", "dtype_", "=_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "zone", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "no", "Data", "Value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zones_", "=_", "numpy_", "._", "setd", "iff", "1d_", "(_", "numpy_", "._", "unique_", "(_", "arr", "\\u", "zone_", ")_", ",_", "[_", "no", "Data", "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 ", " _", "zones_", "=_", "numpy_", "._", "unique_", "(_", "arr", "\\u", "zone_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Progres", "s", " ", "bar_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dim", "\\u", "prod_", "*=_", "zones_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Reset", "Progres", "sor", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Set", "Progres", "sor", "_", "(_", "'", "step", "'_", ",_", "'", "Calculating", "...'_", ",_", "0_", ",_", "dim", "\\u", "prod_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "through", " ", "slices_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "indices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "vars", "lice", "_", "in_", "multi", "\\u", "for_", "(_", "dim", "\\u", "slices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tak", "e", " ", "slice", " ", "from", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type", "\\u", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arr", "\\u", "slice_", "=_", "arr", "\\u", "var_", "[_", "vars", "lice", "_", "]_", "._", "astype_", "(_", "'", "f8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arr", "\\u", "slice_", "=_", "arr", "\\u", "var_", "[_", "vars", "lice", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "mask", "ed", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "arr", "\\u", "slice_", ",_", "'", "mask", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arr", "\\u", "mask_", "=_", "arr", "\\u", "slice_", "._", "mask_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arr", "\\u", "mask_", "=_", "numpy_", "._", "ma_", "._", "make", "\\u", "mask", "\\u", "none_", "(_", "arr", "\\u", "slice_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arr", "\\u", "slice_", "=_", "numpy_", "._", "ma_", "._", "asarray_", "(_", "arr", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "zones_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "z_", "in_", "zones_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Perform", " ", "for", " ", "zone", " ", "whe", "n", " ", "No", "Data", " ", "is", " ", "ignored_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "or", " ", "whe", "n", " ", "there", " ", "is", " ", "no", " ", "No", "Data", " ", "within", " ", "zone_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ignore", "\\u", "parameter_", "._", "value_", "or_", "(_", "not_", "numpy_", "._", "any_", "(_", "(_", "arr", "\\u", "zone_", "==_", "z_", ")_", "&_", "arr", "\\u", "mask_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "mask", " ", "to", " ", "net", "CD", "F", " ", "No", "Data", " ", "mask_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "arr", "\\u", "slice_", "._", "mask_", "=_", "arr", "\\u", "mask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Apply", " ", "zone", " ", "mask_", "\\u\\u\\uNL\\u\\u\\u_", "arr", "\\u", "slice_", "[_", "arr", "\\u", "zone_", "!=_", "z_", "]_", "=_", "numpy_", "._", "ma_", "._", "masked_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Apply", " ", "opera", "tor", " ", "to", " ", "zone", " ", "mask", "ed", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "calcul", "ate", "\\u", "statistic_", "(_", "arr", "\\u", "slice_", "[_", ":_", "]_", ",_", "type", "\\u", "parameter_", "._", "value", "As", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Structur", "e", " ", "results", " ", "int", "o", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "struct", "\\u", "data_", "=_", "[_", "dataset_", "._", "variable_", "(_", "dim", "\\u", "name_", "[_", "it", "\\u", "ind_", "]_", ")_", "[_", "it_", "]_", "for_", "it", "\\u", "ind_", ",_", "it_", "in_", "enumerate_", "(_", "list_", "(_", "vars", "lice", "_", ")_", ")_", "if_", "it_", "!=_", "Ellips", "is_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct", "\\u", "data_", "._", "append_", "(_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct", "\\u", "data_", "._", "append_", "(_", "numpy_", "._", "ma_", "._", "count_", "(_", "arr", "\\u", "slice_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "iss", "cala", "r_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sing", "le", "-", "valued", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "data_", "._", "append_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Multi", "valued", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "data_", "+=_", "[_", "it", "2_", "for_", "it_", "in_", "result_", "._", "tolist_", "(_", ")_", "for_", "it", "2_", "in_", "it_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "table", " ", "whe", "n", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "bl", "struct", "created_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "dtype_", "=_", "dim", "\\u", "dims_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct", "\\u", "dtype_", "._", "append_", "(_", "(_", "str_", "(_", "zone", "field", "\\u", "parameter_", "._", "value_", ")_", ",_", "numpy_", "._", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct", "\\u", "dtype_", "._", "append_", "(_", "(_", "'", "COUNT", "'_", ",_", "numpy_", "._", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type", "\\u", "parameter_", "._", "value", "As", "Text_", "in_", "self_", "._", "statistic", "s", "\\u", "multiple", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "dtype_", "+=_", "[_", "(_", "it_", ",_", "numpy_", "._", "float_", ")_", "for_", "it_", "in_", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "dtype_", "._", "names_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "dtype_", "._", "append_", "(_", "(_", "str_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "parameter_", "._", "value", "As", "Text_", ")_", ",_", "numpy_", "._", "float_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "struct_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "dim", "\\u", "prod_", ",_", ")_", ",_", "numpy_", "._", "dtype_", "(_", "struct", "\\u", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "struct", "created_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "struct_", "[_", "index_", "]_", "=_", "numpy_", "._", "array_", "(_", "tuple_", "(_", "struct", "\\u", "data_", ")_", ",_", "numpy_", "._", "dtype_", "(_", "struct", "\\u", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "indices_", "._", "append_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "Passi", "ng", " ", "drops", " ", "zone", "s", " ", "with", " ", "No", "Data", " ", "in", " ", "them", " ", "from", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Set", "Progres", "sor", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Reset", "Progres", "sor", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "time", "'_", "in_", "dim", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Output", " ", "zona", "l", " ", "statistic", "s", " ", "to", " ", "temporar", "y", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "table_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", ",_", "'", "temp", "\\u", "table", ".", "dbf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arcpy_", "._", "Exists_", "(_", "temp", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Delete", "\\u", "management_", "(_", "temp", "\\u", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "da_", "._", "Num", "Py", "Array", "To", "Table_", "(_", "struct_", "[_", "valid", "\\u", "indices_", "]_", ",_", "temp", "\\u", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "table", " ", "view", " ", "of", " ", "the", " ", "time", " ", "dimension", " ", "from", " ", "net", "CD", "F", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "\\u", "mdt", "able_", "=_", "r", "\"", "md", "\\u", "table", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Make", "Net", "CD", "FT", "able", "View", "\\u", "md_", "(_", "dataset", "\\u", "name_", ",_", "'", "time", "'_", ",_", "temp", "\\u", "mdt", "able_", ",_", "'", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "time", " ", "field", " ", "from", " ", "table", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "desc", "\\u", "fields_", "=_", "arcpy_", "._", "List", "Fields_", "(_", "temp", "\\u", "mdt", "able_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "field_", "=_", "desc", "\\u", "fields_", "[_", "[_", "field_", "._", "name_", "for_", "field_", "in_", "desc", "\\u", "fields_", "]_", "._", "index_", "(_", "'", "time", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "table", " ", "in", " ", "the", " ", "output", " ", "location_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Creat", "e", "Table", "\\u", "management_", "(_", "*_", "os_", "._", "path_", "._", "split_", "(_", "output", "\\u", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "fields", " ", "from", " ", "temporar", "y", " ", "table", " ", "except", " ", "for", " ", "time", " ", "field", ",", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "we", " ", "add", " ", "from", " ", "the", " ", "Make", "Net", "CD", "FT", "able", "View_", "\\u\\u\\uNL\\u\\u\\u_", "desc", "\\u", "fields_", "=_", "arcpy_", "._", "List", "Fields_", "(_", "temp", "\\u", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index_", ",_", "field_", "in_", "enumerate_", "(_", "desc", "\\u", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field_", "._", "type_", "!=_", "'", "OID", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "field_", "._", "name_", "==_", "'", "time", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "output", "\\u", "filename_", ",_", "time", "\\u", "field_", "._", "name_", ",_", "time", "\\u", "field_", "._", "type_", ",_", "time", "\\u", "field_", "._", "precision_", ",_", "time", "\\u", "field_", "._", "scale_", ",_", "time", "\\u", "field_", "._", "length_", ",_", "time", "\\u", "field_", "._", "alias", "Name_", ",_", "time", "\\u", "field_", "._", "is", "Null", "able_", ",_", "time", "\\u", "field_", "._", "required_", ",_", "time", "\\u", "field_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "output", "\\u", "filename_", ",_", "field_", "._", "name_", ",_", "field_", "._", "type_", ",_", "field_", "._", "precision_", ",_", "field_", "._", "scale_", ",_", "field_", "._", "length_", ",_", "field_", "._", "alias", "Name_", ",_", "field_", "._", "is", "Null", "able_", ",_", "field_", "._", "required_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Delete", "Field", "\\u", "management_", "(_", "output", "\\u", "filename_", ",_", "\"", "Field", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "list", " ", "of", " ", "datetime", " ", "object", "s", " ", "from", " ", "table", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "arc_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Sear", "ch", "Cursor_", "(_", "temp", "\\u", "mdt", "able_", ",_", "'", "time", "'_", ")_", "as_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "row_", "in_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time", "\\u", "arc_", "._", "append_", "(_", "row_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "time", " ", "variab", "le", " ", "from", " ", "net", "CD", "F", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "var_", "=_", "dataset_", "._", "variable_", "(_", "'", "time", "'_", ")_", "[_", ":_", "]_", "._", "tolist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Loop", " ", "through", " ", "entri", "es", " ", "from", " ", "temporar", "y", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Insert", "Cursor_", "(_", "output", "\\u", "filename_", ",_", "'*'_", ")_", "as_", "ins", "\\u", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "time", "\\u", "ind_", "=_", "ins", "\\u", "cursor_", "._", "fields_", "._", "index_", "(_", "'", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Sear", "ch", "Cursor_", "(_", "temp", "\\u", "table_", ",_", "'*'_", ")_", "as_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time", "\\u", "ind_", "=_", "cursor_", "._", "fields_", "._", "index_", "(_", "'", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "new", "\\u", "row_", "=_", "list_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "row_", "[_", "new", "\\u", "time", "\\u", "ind_", "]_", "=_", "time", "\\u", "arc_", "[_", "time", "\\u", "var_", "._", "index_", "(_", "row_", "[_", "time", "\\u", "ind_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ins", "\\u", "cursor_", "._", "insert", "Row_", "(_", "tuple_", "(_", "new", "\\u", "row_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "ins", "\\u", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Write", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arcpy_", "._", "env_", "._", "overwrit", "e", "Output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Delete", "\\u", "management_", "(_", "output", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "da_", "._", "Num", "Py", "Array", "To", "Table_", "(_", "struct_", "[_", "valid", "\\u", "indices_", "]_", ",_", "output", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "dimension", "al", "Zon", "al", "Statistic", "s", "As", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "zona", "l\\u", "statistic", "s", "\\u", "as", "\\u", "table", "\\u", "for", "\\u", "discrete", "_", "(_", "self_", ",_", "parameters_", ",_", "messages_", ",_", "dataset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", "s", " ", "zona", "l", " ", "statistic", "s", " ", "as", " ", "table", " ", "ass", "umi", "ng", " ", "dataset", " ", "is", " ", "a", " ", "CF", " ", "1.6", "\\", "10", ";", " ", " ", " ", " ", "compliant", " ", "discrete", " ", "samp", "ling", " ", "geom", "etry", " ", "dataset", " ", "of", " ", "'", "point", "',", " ", "'", "times", "eries", "',", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "'", "profile", "'", " ", "feature", " ", "type", " ", "usi", "ng", " ", "an", " ", "orthogonal", " ", "or", " ", "incomplete", "\\", "10", ";", " ", " ", " ", " ", "multid", "ime", "nsion", "al", " ", "array", " ", "data", " ", "represent", "ation", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zone", "\\u", "parameter_", "=_", "parameters_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "parameter_", "=_", "parameters_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "parameter_", "=_", "parameters_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "parameter_", "=_", "parameters_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "parameter_", "=_", "parameters_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "\\u", "parameter_", "=_", "parameters_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "field", "\\u", "parameter_", "=_", "parameters_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "parameter", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "dataset", "\\u", "name_", "=_", "input", "\\u", "parameter_", "._", "value", "As", "Text_", "#", " ", "input", " ", "net", "CD", "F", " ", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "filename_", "=_", "output", "\\u", "parameter_", "._", "value", "As", "Text_", "#", " ", "output", " ", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "name_", "=_", "variab", "le", "\\u", "parameter_", "._", "value", "As", "Text_", "#", " ", "net", "CD", "F", " ", "variab", "le", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "associate", "d", " ", "station", ",", " ", "x", ",", " ", "and", " ", "y", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "stat", "\\u", "variable_", ",_", "x", "\\u", "variable_", ",_", "y", "\\u", "variable_", ")_", "=_", "self_", "._", "get", "\\u", "dependent", "\\u", "variables_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", ",_", "var", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "stat", "\\u", "variable_", "is_", "None_", ")_", "or_", "(_", "x", "\\u", "variable_", "is_", "None_", ")_", "or_", "(_", "y", "\\u", "variable_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "add", "Error", "Message_", "(_", "'%", "s", " ", "is", " ", "not", " ", "a", " ", "station", " ", "variab", "le", ".'_", "%_", "var", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "arcpy_", "._", "Execut", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Extract", " ", "variab", "le", " ", "from", " ", "net", "CD", "F", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arr", "\\u", "var_", "=_", "dataset_", "._", "variable_", "(_", "var", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Extract", " ", "coordinate", "s", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "dim", "\\u", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "coordinate", "s", "'_", "in_", "arr", "\\u", "var_", "._", "nca", "ttr", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim", "\\u", "names_", "=_", "str_", "(_", "arr", "\\u", "var_", "._", "getn", "catt", "r_", "(_", "'", "coordinate", "s", "'_", ")_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "coordinate", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "X_", "=_", "dataset_", "._", "variable_", "(_", "x", "\\u", "variable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "dataset_", "._", "variable_", "(_", "y", "\\u", "variable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "array", " ", "of", " ", "station", " ", "indices_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stat", "\\u", "variable_", "in_", "dataset_", "._", "variab", "le", "\\u", "names_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arr", "\\u", "stat_", "=_", "dataset_", "._", "variable_", "(_", "stat", "\\u", "variable_", ")_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arr", "\\u", "stat_", "=_", "numpy_", "._", "arange_", "(_", "len_", "(_", "dataset_", "._", "dimension_", "(_", "stat", "\\u", "variable_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Emp", "ty", " ", "dictionar", "y", " ", "to", " ", "hold", " ", "station", "s", " ", "falling", " ", "within", " ", "each", " ", "zone_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zone", "\\u", "stations_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", "where", " ", "the", " ", "keys", " ", "are", " ", "values", " ", "of", " ", "the", " ", "zone", " ", "field", " ", "and", " ", "the", " ", "key", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "are", " ", "each", " ", "a", " ", "list", " ", "of", " ", "station", " ", "indice", "s", " ", "contain", "ed", " ", "within", " ", "tha", "t", " ", "zone_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "input", " ", "zone", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "arcpy_", "._", "Describe", "_", "(_", "zone", "\\u", "parameter_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wa", "s", " ", "a", " ", "temporar", "y", " ", "feature", " ", "class", " ", "created", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "bl", "temp", "poly_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "rast", "er", " ", "to", " ", "poly", "gon", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "rast", "er", "\\u", "types_", "=_", "[_", "\"", "Ras", "ter", "Layer", "\"_", ",_", "\"", "Ras", "ter", "Datas", "et", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "feature", "\\u", "types_", "=_", "[_", "\"", "Shape", "File", "\"_", ",_", "\"", "Feature", "Layer", "\"_", ",_", "\"", "Feature", "Datas", "et", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "desc_", "._", "data", "Type_", "in_", "valid", "\\u", "rast", "er", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "poly_", "=_", "\"", "in", "\\u", "memory", "\\\\\\\\", "temp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Ras", "ter", "To", "Polygon", "\\u", "conversion_", "(_", "in", "\\u", "raster_", ",_", "temp", "\\u", "poly_", ",_", "\"", "NO", "\\u", "SIM", "PLI", "FY", "\"_", ",_", "zone", "field", "\\u", "parameter_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "field_", "=_", "\"", "GRID", "CODE", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "temp", "poly_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "desc_", "._", "data", "Type_", "in_", "valid", "\\u", "feature", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "poly_", "=_", "zone", "\\u", "parameter_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "field_", "=_", "zone", "field", "\\u", "parameter_", "._", "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 ", " _", "messages_", "._", "add", "Error", "Message_", "(_", "\"", "Not", " ", "a", " ", "valid", " ", "zone", " ", "dataset", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "arcpy_", "._", "Execut", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "recs_", "=_", "int_", "(_", "arcpy_", "._", "Get", "Count", "\\u", "management_", "(_", "temp", "\\u", "poly_", ")_", "._", "get", "Output_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "recs_", "*=_", "numpy_", "._", "prod_", "(_", "arr", "\\u", "stat_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Set", "Progres", "sor", "_", "(_", "\"", "step", "\"_", ",_", "\"", "Building", " ", "zone", " ", "feature", " ", "look", "-", "up", "...\"_", ",_", "0_", ",_", "num", "\\u", "recs_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "zone", "s", " ", "associate", "d", " ", "with", " ", "each", " ", "feature_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "arcpy_", "._", "Describe", "_", "(_", "temp", "\\u", "poly_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "arcpy_", "._", "Sear", "ch", "Cursor_", "(_", "temp", "\\u", "poly_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feat_", "=_", "row_", "._", "get", "Value_", "(_", "desc_", "._", "Shape", "Field", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone_", "=_", "row_", "._", "get", "Value_", "(_", "temp", "\\u", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "station_", "in_", "arr", "\\u", "stat_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "feat_", "._", "contains_", "(_", "arcpy_", "._", "Point_", "(_", "float_", "(_", "X_", "[_", "station_", "]_", ")_", ",_", "float_", "(_", "Y_", "[_", "station_", "]_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "zone_", "in_", "zone", "\\u", "stations_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "zone", "\\u", "stations_", "[_", "zone_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zone", "\\u", "stations_", "[_", "zone_", "]_", "._", "append_", "(_", "station_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Set", "Progres", "sor", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "rows_", ",_", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Reset", "Progres", "sor", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "temporar", "y", " ", "feature", " ", "class", " ", "if", " ", "it", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bl", "temp", "poly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Delete", "\\u", "management_", "(_", "temp", "\\u", "poly_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "variab", "le", " ", "is", " ", "packed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "isp", "acke", "d_", "=_", "hasattr_", "(_", "arr", "\\u", "var_", ",_", "'", "scale", "\\u", "factor", "'_", ")_", "or_", "hasattr_", "(_", "arr", "\\u", "var_", ",_", "'", "add", "\\u", "offset", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "whe", "ther", " ", "give", "n", " ", "statistic", " ", "is", " ", "categor", "ical", " ", "or", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "var", "\\u", "dtype_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "stat_", "in_", "self_", "._", "statistics_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type", "\\u", "parameter_", "._", "value", "As", "Text_", "in_", "stat_", "[_", "1_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "var", "\\u", "dtype_", "=_", "stat_", "[_", "2_", "]_", "\\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_", "type", "\\u", "changed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "'", "int", "'_", "in_", "str_", "(_", "arr", "\\u", "var_", "._", "dtype_", ")_", ")_", "and_", "(_", "not_", "new", "\\u", "var", "\\u", "dtype_", ")_", "and_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "isp", "acke", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type", "\\u", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Slice", " ", "generator_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Adapt", "ed", " ", "from", ":", " ", "http", "://", "code", ".", "active", "state", ".", "com", "/", "recip", "es", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "502", "194", "-", "a", "-", "generat", "or", "-", "for", "-", "an", "-", "arbitra", "ry", "-", "number", "-", "of", "-", "for", "-", "loop", "s", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Origina", "ll", "y", " ", "writt", "en", " ", "by", " ", "Ste", "ven", " ", "Bet", "hard", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "multi", "\\u", "for_", "(_", "iterable", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "iterable", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "iterable", "s_", "[_", "0_", "]_", ",_", "collections_", "._", "Iterable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "item_", "in_", "iterable", "s_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "rest", "\\u", "tuple_", "in_", "multi", "\\u", "for_", "(_", "iterable", "s_", "[_", "1_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "(_", "item_", ",_", ")_", "+_", "rest", "\\u", "tuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "rest", "\\u", "tuple_", "in_", "multi", "\\u", "for_", "(_", "iterable", "s_", "[_", "1_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "(_", "iterable", "s_", "[_", "0_", "]_", ",_", ")_", "+_", "rest", "\\u", "tuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "slice", " ", "list_", "\\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_", "dim", "\\u", "shape_", "=_", "arr", "\\u", "var_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "name_", "=_", "arr", "\\u", "var_", "._", "dimensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "slices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "dims_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "prod_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dim", "\\u", "index_", ",_", "dim", "\\u", "item_", "in_", "enumerate_", "(_", "dim", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dim", "\\u", "item_", "!=_", "stat", "\\u", "variable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim", "\\u", "prod_", "*=_", "dim", "\\u", "shape_", "[_", "dim", "\\u", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "slices_", "._", "append_", "(_", "xrange_", "(_", "dim", "\\u", "shape_", "[_", "dim", "\\u", "index_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "\\u", "dims_", "._", "append_", "(_", "(_", "str_", "(_", "dim", "\\u", "item_", ")_", ",_", "numpy_", "._", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "position", " ", "of", " ", "statistic_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stat", "\\u", "position_", "=_", "dim", "\\u", "name_", "._", "index_", "(_", "stat", "\\u", "variable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bl", "struct", "created_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "hst", "ack", "\\u", "struct_", "(_", "arr", "1_", ",_", "arr", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wil", "l", " ", "only", " ", "work", " ", "correct", "ly", " ", "if", " ", "arr", "1", " ", "and", " ", "arr", "2", " ", "only", " ", "have", " ", "one", " ", "record_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "numpy_", "._", "lib_", "._", "rec", "functions_", "._", "zip", "\\u", "descr_", "(_", "(_", "arr", "1_", ",_", "arr", "2_", ")_", ",_", "flatten_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "array_", "(_", "arr", "1_", "._", "tolist_", "(_", ")_", "+_", "arr", "2_", "._", "tolist_", "(_", ")_", ",_", "dtype_", "=_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Progres", "s", " ", "bar_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dim", "\\u", "prod_", "*=_", "len_", "(_", "zone", "\\u", "stations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Reset", "Progres", "sor", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Set", "Progres", "sor", "_", "(_", "'", "step", "'_", ",_", "'", "Calculating", "...'_", ",_", "0_", ",_", "dim", "\\u", "prod_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "through", " ", "zones_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "indices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "zone_", "in_", "zone", "\\u", "stations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "station", " ", "indice", "s", " ", "associate", "d", " ", "with", " ", "zone_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zone", "\\u", "indices_", "=_", "zone", "\\u", "stations_", "[_", "zone_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "through", " ", "slices_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "vars", "lice", "_", "in_", "multi", "\\u", "for_", "(_", "dim", "\\u", "slices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "station", " ", "indice", "s", " ", "int", "o", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vars", "lice", "_", "=_", "list_", "(_", "vars", "lice", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars", "lice", "_", "._", "insert_", "(_", "stat", "\\u", "position_", ",_", "zone", "\\u", "indices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tak", "e", " ", "slice", " ", "from", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type", "\\u", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "arr", "\\u", "slice_", "=_", "arr", "\\u", "var_", "[_", "vars", "lice", "_", "]_", "._", "astype_", "(_", "'", "f8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "arr", "\\u", "slice_", "=_", "arr", "\\u", "var_", "[_", "vars", "lice", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "mask", "ed", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "arr", "\\u", "slice_", ",_", "'", "mask", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "arr", "\\u", "mask_", "=_", "arr", "\\u", "slice_", "._", "mask_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "arr", "\\u", "mask_", "=_", "numpy_", "._", "ma_", "._", "make", "\\u", "mask", "\\u", "none_", "(_", "arr", "\\u", "slice_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arr", "\\u", "slice_", "=_", "numpy_", "._", "ma_", "._", "asarray_", "(_", "arr", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Perform", " ", "for", " ", "zone", " ", "whe", "n", " ", "No", "Data", " ", "is", " ", "ignored_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "or", " ", "whe", "n", " ", "there", " ", "is", " ", "no", " ", "No", "Data", " ", "within", " ", "zone_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ignore", "\\u", "parameter_", "._", "value_", "or_", "(_", "not_", "numpy_", "._", "any_", "(_", "arr", "\\u", "mask_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "mask_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "arr", "\\u", "slice_", "._", "mask_", "=_", "arr", "\\u", "mask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "opera", "tor", " ", "to", " ", "zone", " ", "mask", "ed", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "calcul", "ate", "\\u", "statistic_", "(_", "arr", "\\u", "slice_", "[_", ":_", "]_", ",_", "type", "\\u", "parameter_", "._", "value", "As", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Structur", "e", " ", "results", " ", "int", "o", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "struct", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "it", "\\u", "ind_", ",_", "it_", "in_", "enumerate_", "(_", "list_", "(_", "vars", "lice", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "it", "\\u", "ind_", "!=_", "stat", "\\u", "position_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "dim", "\\u", "name_", "[_", "it", "\\u", "ind_", "]_", "in_", "dataset_", "._", "variab", "le", "\\u", "names_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dimen", "sion", " ", "with", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "data_", "._", "append_", "(_", "dataset_", "._", "variable_", "(_", "dim", "\\u", "name_", "[_", "it", "\\u", "ind_", "]_", ")_", "[_", "it_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dimen", "sion", " ", "with", "out", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "data_", "._", "append_", "(_", "it_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "struct", "\\u", "data_", "._", "append_", "(_", "zone_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct", "\\u", "data_", "._", "append_", "(_", "numpy_", "._", "ma_", "._", "count_", "(_", "arr", "\\u", "slice_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "iss", "cala", "r_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sing", "le", "-", "valued", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "data_", "._", "append_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Multi", "valued", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "data_", "+=_", "[_", "it", "2_", "for_", "it_", "in_", "result_", "._", "tolist_", "(_", ")_", "for_", "it", "2_", "in_", "it_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "table", " ", "whe", "n", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "bl", "struct", "created_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "dtype_", "=_", "dim", "\\u", "dims_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct", "\\u", "dtype_", "._", "append_", "(_", "(_", "str_", "(_", "zone", "field", "\\u", "parameter_", "._", "value_", ")_", ",_", "numpy_", "._", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct", "\\u", "dtype_", "._", "append_", "(_", "(_", "'", "COUNT", "'_", ",_", "numpy_", "._", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "iss", "cala", "r_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sing", "le", "-", "valued", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "dtype_", "._", "append_", "(_", "(_", "str_", "(_", "type", "\\u", "parameter_", "._", "value", "As", "Text_", ")_", ",_", "numpy_", "._", "float_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Multi", "valued", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "struct", "\\u", "dtype_", "+=_", "[_", "(_", "it_", ",_", "numpy_", "._", "float_", ")_", "for_", "it_", "in_", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "dtype_", "._", "names_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "struct_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "dim", "\\u", "prod_", ",_", ")_", ",_", "numpy_", "._", "dtype_", "(_", "struct", "\\u", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bl", "struct", "created_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "struct_", "[_", "index_", "]_", "=_", "numpy_", "._", "array_", "(_", "tuple_", "(_", "struct", "\\u", "data_", ")_", ",_", "numpy_", "._", "dtype_", "(_", "struct", "\\u", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "indices_", "._", "append_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "Passi", "ng", " ", "drops", " ", "zone", "s", " ", "with", " ", "No", "Data", " ", "in", " ", "them", " ", "from", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Set", "Progres", "sor", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Reset", "Progres", "sor", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "time", "'_", "in_", "dim", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Output", " ", "zona", "l", " ", "statistic", "s", " ", "to", " ", "temporar", "y", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "table_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", ",_", "'", "temp", "\\u", "table", ".", "dbf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arcpy_", "._", "Exists_", "(_", "temp", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Delete", "\\u", "management_", "(_", "temp", "\\u", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "da_", "._", "Num", "Py", "Array", "To", "Table_", "(_", "struct_", "[_", "valid", "\\u", "indices_", "]_", ",_", "temp", "\\u", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "table", " ", "view", " ", "of", " ", "the", " ", "time", " ", "dimension", " ", "from", " ", "net", "CD", "F", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "\\u", "mdt", "able_", "=_", "r", "\"", "md", "\\u", "table", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Make", "Net", "CD", "FT", "able", "View", "\\u", "md_", "(_", "dataset", "\\u", "name_", ",_", "'", "time", "'_", ",_", "temp", "\\u", "mdt", "able_", ",_", "'", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "time", " ", "field", " ", "from", " ", "table", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "desc", "\\u", "fields_", "=_", "arcpy_", "._", "List", "Fields_", "(_", "temp", "\\u", "mdt", "able_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "field_", "=_", "desc", "\\u", "fields_", "[_", "[_", "field_", "._", "name_", "for_", "field_", "in_", "desc", "\\u", "fields_", "]_", "._", "index_", "(_", "'", "time", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "table", " ", "in", " ", "the", " ", "output", " ", "location_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Creat", "e", "Table", "\\u", "management_", "(_", "*_", "os_", "._", "path_", "._", "split_", "(_", "output", "\\u", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "fields", " ", "from", " ", "temporar", "y", " ", "table", " ", "except", " ", "for", " ", "time", " ", "field", ",", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "we", " ", "add", " ", "from", " ", "the", " ", "Make", "Net", "CD", "FT", "able", "View_", "\\u\\u\\uNL\\u\\u\\u_", "desc", "\\u", "fields_", "=_", "arcpy_", "._", "List", "Fields_", "(_", "temp", "\\u", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index_", ",_", "field_", "in_", "enumerate_", "(_", "desc", "\\u", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field_", "._", "type_", "!=_", "'", "OID", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "field_", "._", "name_", "==_", "'", "time", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "output", "\\u", "filename_", ",_", "time", "\\u", "field_", "._", "name_", ",_", "time", "\\u", "field_", "._", "type_", ",_", "time", "\\u", "field_", "._", "precision_", ",_", "time", "\\u", "field_", "._", "scale_", ",_", "time", "\\u", "field_", "._", "length_", ",_", "time", "\\u", "field_", "._", "alias", "Name_", ",_", "time", "\\u", "field_", "._", "is", "Null", "able_", ",_", "time", "\\u", "field_", "._", "required_", ",_", "time", "\\u", "field_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "output", "\\u", "filename_", ",_", "field_", "._", "name_", ",_", "field_", "._", "type_", ",_", "field_", "._", "precision_", ",_", "field_", "._", "scale_", ",_", "field_", "._", "length_", ",_", "field_", "._", "alias", "Name_", ",_", "field_", "._", "is", "Null", "able_", ",_", "field_", "._", "required_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Delete", "Field", "\\u", "management_", "(_", "output", "\\u", "filename_", ",_", "\"", "Field", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "list", " ", "of", " ", "datetime", " ", "object", "s", " ", "from", " ", "table", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "arc_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Sear", "ch", "Cursor_", "(_", "temp", "\\u", "mdt", "able_", ",_", "'", "time", "'_", ")_", "as_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "row_", "in_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time", "\\u", "arc_", "._", "append_", "(_", "row_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "time", " ", "variab", "le", " ", "from", " ", "net", "CD", "F", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "var_", "=_", "dataset_", "._", "variable_", "(_", "'", "time", "'_", ")_", "[_", ":_", "]_", "._", "tolist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Loop", " ", "through", " ", "entri", "es", " ", "from", " ", "temporar", "y", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Insert", "Cursor_", "(_", "output", "\\u", "filename_", ",_", "'*'_", ")_", "as_", "ins", "\\u", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "time", "\\u", "ind_", "=_", "ins", "\\u", "cursor_", "._", "fields_", "._", "index_", "(_", "'", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Sear", "ch", "Cursor_", "(_", "temp", "\\u", "table_", ",_", "'*'_", ")_", "as_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time", "\\u", "ind_", "=_", "cursor_", "._", "fields_", "._", "index_", "(_", "'", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "new", "\\u", "row_", "=_", "list_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "row_", "[_", "new", "\\u", "time", "\\u", "ind_", "]_", "=_", "time", "\\u", "arc_", "[_", "time", "\\u", "var_", "._", "index_", "(_", "row_", "[_", "time", "\\u", "ind_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ins", "\\u", "cursor_", "._", "insert", "Row_", "(_", "tuple_", "(_", "new", "\\u", "row_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "ins", "\\u", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Write", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arcpy_", "._", "env_", "._", "overwrit", "e", "Output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Delete", "\\u", "management_", "(_", "output", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "da_", "._", "Num", "Py", "Array", "To", "Table_", "(_", "struct_", "[_", "valid", "\\u", "indices_", "]_", ",_", "output", "\\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 ]
Unused import
pycollada/pycollada/examples/daeview/renderer/OldStyleRenderer.py
[ { "content": "#!/usr/bin/env python\nimport collada\nimport numpy\nimport pyglet\nfrom pyglet.gl import *\nimport ctypes\nimport glutils\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OldStyleRenderer: \n\n\n\n\n\n", "metadata": "root.OldStyleRenderer", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def __init__(self, dae, window):\n self.dae = dae\n self.window = window\n # to calculate model boundary\n self.z_max = -100000.0\n self.z_min = 100000.0\n self.textures = {}\n\n glShadeModel(GL_SMOOTH) # Enable Smooth Shading\n glClearColor(0.0, 0.0, 0.0, 0.5) # Black Background\n glClearDepth(1.0) # Depth Buffer Setup\n glEnable(GL_DEPTH_TEST) # Enables Depth Testing\n glDepthFunc(GL_LEQUAL) # The Type Of Depth Testing To Do\n \n glEnable(GL_MULTISAMPLE);\n\n glEnable(GL_LIGHTING)\n glEnable(GL_LIGHT0)\n glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)\n glCullFace(GL_BACK)\n\n glEnable(GL_TEXTURE_2D) # Enable Texture Mapping\n # glEnable(GL_TEXTURE_RECTANGLE_ARB) # Enable Texture Mapping\n glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)\n glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)\n\n # create one display list\n print 'Creating display list...'\n print 'It could take some time. Please be patient :-) .'\n self.displist = glGenLists(1)\n # compile the display list, store a triangle in it\n glNewList(self.displist, GL_COMPILE)\n self.drawPrimitives()\n glEndList()\n print 'done. Ready to render.'", "metadata": "root.OldStyleRenderer.__init__", "header": "['class', 'OldStyleRenderer', ':', '___EOS___']", "index": 11 }, { "content": " def drawPrimitives(self):\n glBegin(GL_TRIANGLES)\n \n if self.dae.scene is not None:\n for geom in self.dae.scene.objects('geometry'):\n for prim in geom.primitives():\n mat = prim.material\n diff_color = (GLfloat * 4)(*(0.3,0.3,0.3,0.0))\n spec_color = None \n shininess = None\n amb_color = None\n tex_id = None\n for prop in mat.effect.supported:\n value = getattr(mat.effect, prop)\n # it can be a float, a color (tuple) or a Map\n # ( a texture )\n if isinstance(value, collada.material.Map):\n colladaimage = value.sampler.surface.image\n # Accessing this attribute forces the\n # loading of the image using PIL if\n # available. Unless it is already loaded.\n img = colladaimage.pilimage\n if img: # can read and PIL available\n # See if we already have texture for this image\n if self.textures.has_key(colladaimage.id):\n tex_id = self.textures[colladaimage.id]\n else:\n # If not - create new texture\n try:\n # get image meta-data\n # (dimensions) and data\n (ix, iy, tex_data) = (img.size[0], img.size[1], img.tostring(\"raw\", \"RGBA\", 0, -1))\n except SystemError:\n # has no alpha channel,\n # synthesize one\n (ix, iy, tex_data) = (img.size[0], img.size[1], img.tostring(\"raw\", \"RGBX\", 0, -1))\n # generate a texture ID\n tid = GLuint()\n glGenTextures(1, ctypes.byref(tid))\n tex_id = tid.value\n # make it current\n glBindTexture(GL_TEXTURE_2D, tex_id)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)\n #glPixelStorei(GL_UNPACK_ALIGNMENT, 4)\n # copy the texture into the\n # current texture ID\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex_data)\n\n self.textures[colladaimage.id] = tex_id\n else:\n print ' %s = Texture %s: (not available)'%(\n prop, colladaimage.id)\n else:\n if prop == 'diffuse' and value is not None:\n diff_color = (GLfloat * 4)(*value)\n elif prop == 'specular' and value is not None:\n spec_color = (GLfloat * 4)(*value)\n elif prop == 'ambient' and value is not None:\n amb_color = (GLfloat * 4)(*value)\n elif prop == 'shininess' and value is not None:\n shininess = value\n\n # use primitive-specific ways to get triangles\n prim_type = type(prim).__name__\n if prim_type == 'BoundTriangleSet':\n triangles = prim\n elif prim_type == 'BoundPolylist':\n triangles = prim.triangleset()\n else:\n print 'Unsupported mesh used:', prim_type\n triangles = []\n\n if tex_id is not None:\n glBindTexture(GL_TEXTURE_2D, tex_id)\n else:\n glBindTexture(GL_TEXTURE_2D, 0)\n\n\n # add triangles to the display list\n for t in triangles:\n nidx = 0\n if tex_id is not None and len(t.texcoords) > 0:\n texcoords = t.texcoords[0]\n else:\n texcoords = None\n\n for vidx in t.indices:\n if diff_color is not None:\n glMaterialfv(GL_FRONT, GL_DIFFUSE, diff_color)\n if spec_color is not None:\n glMaterialfv(GL_FRONT, GL_SPECULAR, spec_color)\n if amb_color is not None:\n glMaterialfv(GL_FRONT, GL_AMBIENT, amb_color)\n if shininess is not None:\n glMaterialfv(GL_FRONT, GL_SHININESS, (GLfloat * 1)(shininess))\n\n # if not t.normals is None:\n glNormal3fv((GLfloat * 3)(*t.normals[nidx]))\n if texcoords is not None:\n glTexCoord2fv((GLfloat * 2)(*texcoords[nidx]))\n\n nidx += 1\n\n v = prim.vertex[vidx]\n glVertex3fv((GLfloat * 3)(*v))\n\n # calculate max and min Z coordinate\n if v[2] > self.z_max:\n self.z_max = v[2]\n elif v[2] < self.z_min:\n self.z_min = v[2]\n glutils.getGLError()\n glEnd()", "metadata": "root.OldStyleRenderer.drawPrimitives", "header": "['class', 'OldStyleRenderer', ':', '___EOS___']", "index": 47 }, { "content": " def render(self, rotate_x, rotate_y, rotate_z):\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n glMatrixMode(GL_PROJECTION) # Select The Projection Matrix\n glLoadIdentity() # Reset The Projection Matrix\n if self.window.height == 0: # Calculate The Aspect Ratio Of The Window\n gluPerspective(100, self.window.width, 1.0, 5000.0)\n else:\n gluPerspective(100, self.window.width / self.window.height, 1.0, 5000.0)\n glMatrixMode(GL_MODELVIEW) # Select The Model View Matrix\n glLoadIdentity()\n z_offset = self.z_min - (self.z_max - self.z_min) * 3\n light_pos = (GLfloat * 3)(100.0, 100.0, 100.0 * -z_offset)\n glLightfv(GL_LIGHT0, GL_POSITION, light_pos)\n glTranslatef(0, 0, z_offset)\n glRotatef(rotate_x, 1.0, 0.0, 0.0)\n glRotatef(rotate_y, 0.0, 1.0, 0.0)\n glRotatef(rotate_z, 0.0, 0.0, 1.0)\n \n # draw the display list\n glCallList(self.displist)", "metadata": "root.OldStyleRenderer.render", "header": "['class', 'OldStyleRenderer', ':', '___EOS___']", "index": 165 }, { "content": " def cleanup(self):\n print 'Renderer cleaning up'\n glDeleteLists(self.displist, 1)", "metadata": "root.OldStyleRenderer.cleanup", "header": "['class', 'OldStyleRenderer', ':', '___EOS___']", "index": 187 } ]
[ { "span": "import numpy", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 12 }, { "span": "import pyglet", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "colla", "da_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyglet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "gl_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ctypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glut", "ils_", "\\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_", "Old", "Style", "Renderer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Old", "Style", "Renderer_", ":_", "\\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_", ",_", "dae", "_", ",_", "window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dae", "_", "=_", "dae", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window_", "=_", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "to", " ", "calcul", "ate", " ", "model", " ", "boundary_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "z", "\\u", "max_", "=_", "-_", "100000", ".0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "z", "\\u", "min_", "=_", "100000", ".0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "textures", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Shad", "e", "Model_", "(_", "GL", "\\u", "SMO", "OTH", "_", ")_", "#", " ", "Enable", " ", "Smooth", " ", "Shad", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Clear", "Color_", "(_", "0.0_", ",_", "0.0_", ",_", "0.0_", ",_", "0.5_", ")_", "#", " ", "Black", " ", "Background_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Clear", "Depth_", "(_", "1.0_", ")_", "#", " ", "Dep", "th", " ", "Buffer", " ", "Setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Enable_", "(_", "GL", "\\u", "DEPTH", "\\u", "TEST_", ")_", "#", " ", "Enable", "s", " ", "Dep", "th", " ", "Test", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Dep", "th", "Func_", "(_", "GL", "\\u", "LE", "QUAL", "_", ")_", "#", " ", "The", " ", "Type", " ", "Of", " ", "Dep", "th", " ", "Test", "ing", " ", "To", " ", "Do", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Enable_", "(_", "GL", "\\u", "MULTI", "SAMPLE", "_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Enable_", "(_", "GL", "\\u", "LIGHT", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Enable_", "(_", "GL", "\\u", "LIGHT", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Hint_", "(_", "GL", "\\u", "PERS", "PEC", "TIVE", "\\u", "CORREC", "TIO", "N", "\\u", "HINT", "_", ",_", "GL", "\\u", "NIC", "EST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Cul", "l", "Face_", "(_", "GL", "\\u", "BACK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Enable_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ")_", "#", " ", "Enable", " ", "Text", "ure", " ", "Mapping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gl", "Enable", "(", "GL", "\\u", "TEXT", "URE", "\\u", "RECT", "ANGLE", "\\u", "AR", "B", ")", " ", "#", " ", "Enable", " ", "Text", "ure", " ", "Mapping_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Tex", "Parameter", "f_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ",_", "GL", "\\u", "TEXT", "URE", "\\u", "MAG", "\\u", "FILTER_", ",_", "GL", "\\u", "NEA", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Tex", "Parameter", "f_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ",_", "GL", "\\u", "TEXT", "URE", "\\u", "MIN", "\\u", "FILTER_", ",_", "GL", "\\u", "NEA", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "one", " ", "display", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Creat", "ing", " ", "display", " ", "list", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "It", " ", "coul", "d", " ", "take", " ", "some", " ", "time", ".", " ", "Ple", "ase", " ", "be", " ", "patien", "t", " ", ":-", ")", " ", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "displ", "ist_", "=_", "gl", "Gen", "Lists_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "compile", " ", "the", " ", "display", " ", "list", ",", " ", "store", " ", "a", " ", "triangle", " ", "in", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "New", "List_", "(_", "self_", "._", "displ", "ist_", ",_", "GL", "\\u", "COMPIL", "E_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw", "Primitive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "End", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "don", "e", ".", " ", "Read", "y", " ", "to", " ", "render", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Old", "Style", "Renderer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "Primitive", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gl", "Begin_", "(_", "GL", "\\u", "TRIA", "NG", "LES", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "dae", "_", "._", "scene_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "geom_", "in_", "self_", "._", "dae", "_", "._", "scene_", "._", "objects_", "(_", "'", "geom", "etry", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "prim", "_", "in_", "geom_", "._", "primitives_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mat_", "=_", "prim", "_", "._", "material_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "color_", "=_", "(_", "GL", "float_", "*_", "4_", ")_", "(_", "*_", "(_", "0.3_", ",_", "0.3_", ",_", "0.3_", ",_", "0.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spec", "\\u", "color_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shin", "iness", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "amb", "\\u", "color_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tex", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prop_", "in_", "mat_", "._", "effect_", "._", "supported_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "getattr_", "(_", "mat_", "._", "effect_", ",_", "prop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", " ", "can", " ", "be", " ", "a", " ", "float", ",", " ", "a", " ", "color", " ", "(", "tuple", ")", " ", "or", " ", "a", " ", "Map_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", " ", "a", " ", "textu", "re", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "colla", "da_", "._", "material_", "._", "Map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "colla", "dai", "mage_", "=_", "value_", "._", "sampler_", "._", "surface_", "._", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Access", "ing", " ", "this", " ", "attribute", " ", "force", "s", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", "ing", " ", "of", " ", "the", " ", "image", " ", "usi", "ng", " ", "PI", "L", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "avail", "able", ".", " ", "Un", "less", " ", "it", " ", "is", " ", "alr", "ead", "y", " ", "load", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "img_", "=_", "colla", "dai", "mage_", "._", "pil", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "img_", ":_", "#", " ", "can", " ", "read", " ", "and", " ", "PI", "L", " ", "available_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "if", " ", "we", " ", "alr", "ead", "y", " ", "have", " ", "textu", "re", " ", "for", " ", "this", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "textures", "_", "._", "has", "\\u", "key_", "(_", "colla", "dai", "mage_", "._", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tex", "\\u", "id_", "=_", "self_", "._", "textures", "_", "[_", "colla", "dai", "mage_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "-", " ", "create", " ", "new", " ", "texture_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "image", " ", "meta", "-", "data_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "dimension", "s", ")", " ", "and", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "(_", "ix_", ",_", "iy_", ",_", "tex", "\\u", "data_", ")_", "=_", "(_", "img_", "._", "size_", "[_", "0_", "]_", ",_", "img_", "._", "size_", "[_", "1_", "]_", ",_", "img_", "._", "tostring_", "(_", "\"", "raw", "\"_", ",_", "\"", "RGB", "A", "\"_", ",_", "0_", ",_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "System", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "has", " ", "no", " ", "alpha", " ", "channel", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "synthesi", "ze", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "(_", "ix_", ",_", "iy_", ",_", "tex", "\\u", "data_", ")_", "=_", "(_", "img_", "._", "size_", "[_", "0_", "]_", ",_", "img_", "._", "size_", "[_", "1_", "]_", ",_", "img_", "._", "tostring_", "(_", "\"", "raw", "\"_", ",_", "\"", "RGB", "X", "\"_", ",_", "0_", ",_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "generat", "e", " ", "a", " ", "textu", "re", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tid_", "=_", "GL", "uint_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Gen", "Textures", "_", "(_", "1_", ",_", "ctypes_", "._", "byref_", "(_", "tid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tex", "\\u", "id_", "=_", "tid_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "it", " ", "current_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Bind", "Texture_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ",_", "tex", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Tex", "Parameteri", "_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ",_", "GL", "\\u", "TEXT", "URE", "\\u", "MAG", "\\u", "FILTER_", ",_", "GL", "\\u", "LINEAR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Tex", "Parameteri", "_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ",_", "GL", "\\u", "TEXT", "URE", "\\u", "MIN", "\\u", "FILTER_", ",_", "GL", "\\u", "LINEAR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Tex", "Parameteri", "_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ",_", "GL", "\\u", "TEXT", "URE", "\\u", "WRAP", "\\u", "S_", ",_", "GL", "\\u", "REPEAT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Tex", "Parameteri", "_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ",_", "GL", "\\u", "TEXT", "URE", "\\u", "WRAP", "\\u", "T_", ",_", "GL", "\\u", "REPEAT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "gl", "Pix", "el", "Stor", "ei", "(", "GL", "\\u", "UNP", "AC", "K", "\\u", "ALIGN", "MENT", ",", " ", "4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copy", " ", "the", " ", "textu", "re", " ", "int", "o", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "current", " ", "textu", "re", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Tex", "Image", "2", "D_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ",_", "0_", ",_", "GL", "\\u", "RGB", "A_", ",_", "ix_", ",_", "iy_", ",_", "0_", ",_", "GL", "\\u", "RGB", "A_", ",_", "GL", "\\u", "UNSIGNED", "\\u", "BYTE_", ",_", "tex", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "textures", "_", "[_", "colla", "dai", "mage_", "._", "id_", "]_", "=_", "tex", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", " ", " ", "%", "s", " ", "=", " ", "Text", "ure", " ", "%", "s", ":", " ", "(", "not", " ", "avail", "able", ")'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "prop_", ",_", "colla", "dai", "mage_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "prop_", "==_", "'", "diffuse", "'_", "and_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "diff", "\\u", "color_", "=_", "(_", "GL", "float_", "*_", "4_", ")_", "(_", "*_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "prop_", "==_", "'", "specular", "'_", "and_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "spec", "\\u", "color_", "=_", "(_", "GL", "float_", "*_", "4_", ")_", "(_", "*_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "prop_", "==_", "'", "ambient", "'_", "and_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "amb", "\\u", "color_", "=_", "(_", "GL", "float_", "*_", "4_", ")_", "(_", "*_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "prop_", "==_", "'", "shin", "iness", "'_", "and_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "shin", "iness", "_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "primi", "tiv", "e-", "specific", " ", "way", "s", " ", "to", " ", "get", " ", "triangles_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prim", "\\u", "type_", "=_", "type_", "(_", "prim", "_", ")_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prim", "\\u", "type_", "==_", "'", "Bound", "Triangle", "Set", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "triangles_", "=_", "prim", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "prim", "\\u", "type_", "==_", "'", "Bound", "Poly", "list", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "triangles_", "=_", "prim", "_", "._", "triangle", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "Unsu", "ppo", "rted", " ", "mesh", " ", "used", ":'_", ",_", "prim", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "triangles_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tex", "\\u", "id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "gl", "Bind", "Texture_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ",_", "tex", "\\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 ", " ", " _", "gl", "Bind", "Texture_", "(_", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "triangle", "s", " ", "to", " ", "the", " ", "display", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "t_", "in_", "triangles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "nid", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tex", "\\u", "id_", "is_", "not_", "None_", "and_", "len_", "(_", "t_", "._", "tex", "coords_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tex", "coords_", "=_", "t_", "._", "tex", "coords_", "[_", "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 ", " ", " _", "tex", "coords_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "vid", "x_", "in_", "t_", "._", "indices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "diff", "\\u", "color_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "gl", "Materia", "lf", "v_", "(_", "GL", "\\u", "FRONT", "_", ",_", "GL", "\\u", "DIFF", "USE", "_", ",_", "diff", "\\u", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "spec", "\\u", "color_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "gl", "Materia", "lf", "v_", "(_", "GL", "\\u", "FRONT", "_", ",_", "GL", "\\u", "SPEC", "ULA", "R_", ",_", "spec", "\\u", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "amb", "\\u", "color_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "gl", "Materia", "lf", "v_", "(_", "GL", "\\u", "FRONT", "_", ",_", "GL", "\\u", "AMB", "IENT", "_", ",_", "amb", "\\u", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "shin", "iness", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "gl", "Materia", "lf", "v_", "(_", "GL", "\\u", "FRONT", "_", ",_", "GL", "\\u", "SHI", "NIN", "ESS", "_", ",_", "(_", "GL", "float_", "*_", "1_", ")_", "(_", "shin", "iness", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "t", ".", "normal", "s", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gl", "Normal", "3f", "v_", "(_", "(_", "GL", "float_", "*_", "3_", ")_", "(_", "*_", "t_", "._", "normals_", "[_", "nid", "x_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tex", "coords_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "gl", "Tex", "Coord", "2f", "v_", "(_", "(_", "GL", "float_", "*_", "2_", ")_", "(_", "*_", "tex", "coords_", "[_", "nid", "x_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nid", "x_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "=_", "prim", "_", "._", "vertex_", "[_", "vid", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Vertex", "3f", "v_", "(_", "(_", "GL", "float_", "*_", "3_", ")_", "(_", "*_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "max", " ", "and", " ", "min", " ", "Z", " ", "coordinate_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "v_", "[_", "2_", "]_", ">_", "self_", "._", "z", "\\u", "max_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "z", "\\u", "max_", "=_", "v_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "v_", "[_", "2_", "]_", "<_", "self_", "._", "z", "\\u", "min_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "z", "\\u", "min_", "=_", "v_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glut", "ils_", "._", "get", "GLE", "rror_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Old", "Style", "Renderer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "rota", "te", "\\u", "x_", ",_", "rota", "te", "\\u", "y_", ",_", "rota", "te", "\\u", "z_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gl", "Clear_", "(_", "GL", "\\u", "COLOR", "\\u", "BUFF", "ER", "\\u", "BIT_", "|_", "GL", "\\u", "DEPTH", "\\u", "BUFF", "ER", "\\u", "BIT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Matrix", "Mode_", "(_", "GL", "\\u", "PROJECT", "ION_", ")_", "#", " ", "Select", " ", "The", " ", "Projection", " ", "Matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Load", "Identity_", "(_", ")_", "#", " ", "Reset", " ", "The", " ", "Projection", " ", "Matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "window_", "._", "height_", "==_", "0_", ":_", "#", " ", "Calculat", "e", " ", "The", " ", "Asp", "ect", " ", "Rati", "o", " ", "Of", " ", "The", " ", "Window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glu", "Pers", "pect", "ive_", "(_", "100_", ",_", "self_", "._", "window_", "._", "width_", ",_", "1.0_", ",_", "5000", ".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 ", " _", "glu", "Pers", "pect", "ive_", "(_", "100_", ",_", "self_", "._", "window_", "._", "width_", "/_", "self_", "._", "window_", "._", "height_", ",_", "1.0_", ",_", "5000", ".0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gl", "Matrix", "Mode_", "(_", "GL", "\\u", "MODEL", "VIEW_", ")_", "#", " ", "Select", " ", "The", " ", "Model", " ", "View", " ", "Matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Load", "Identity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z", "\\u", "offset_", "=_", "self_", "._", "z", "\\u", "min_", "-_", "(_", "self_", "._", "z", "\\u", "max_", "-_", "self_", "._", "z", "\\u", "min_", ")_", "*_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "light", "\\u", "pos_", "=_", "(_", "GL", "float_", "*_", "3_", ")_", "(_", "100.0_", ",_", "100.0_", ",_", "100.0_", "*_", "-_", "z", "\\u", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Light", "fv_", "(_", "GL", "\\u", "LIGHT", "0_", ",_", "GL", "\\u", "POSITION", "_", ",_", "light", "\\u", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Translate", "f_", "(_", "0_", ",_", "0_", ",_", "z", "\\u", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Rotate", "f_", "(_", "rota", "te", "\\u", "x_", ",_", "1.0_", ",_", "0.0_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Rotate", "f_", "(_", "rota", "te", "\\u", "y_", ",_", "0.0_", ",_", "1.0_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Rotate", "f_", "(_", "rota", "te", "\\u", "z_", ",_", "0.0_", ",_", "0.0_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "draw", " ", "the", " ", "display", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Call", "List_", "(_", "self_", "._", "displ", "ist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Old", "Style", "Renderer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cleanup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Render", "er", " ", "clean", "ing", " ", "up", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Delete", "Lists_", "(_", "self_", "._", "displ", "ist_", ",_", "1_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
machinalis/featureforge/tests/test_feature_evaluator.py
[ { "content": " def test_sample_is_excluded_if_any_feature_fails_when_evaluating_it(self):\n self.ev = TolerantFeatureEvaluator([DescriptionFeature,\n EntireSampleFeature])\n self.ev.FEATURE_STRICT_UNTIL = 0\n self.ev.FEATURE_MAX_ERRORS_ALLOWED = len(SAMPLES) + 1 # dont exclude\n samples = SAMPLES[:]\n nodescription = {'nodescription': u'this sample has no description'}\n samples.append(nodescription)\n result = self.ev.fit_transform(samples)\n self.assertTrue(len(list(result)) < len(samples))\n # EntireSampleFeature is the last, so is the last value per tuple\n self.assertNotIn(nodescription, [r[-1] for r in result])", "metadata": "root.TolerantEvaluatorFitTransformTests.test_sample_is_excluded_if_any_feature_fails_when_evaluating_it", "header": "['class', 'TolerantEvaluatorFitTransformTests', '(', 'TestCase', ',', 'TolerantFittingCases', ')', ':', '___NEWLINE___', '# We try to mimic most of the cases seen on Fit tests, and check that', '___NL___', '# they are working equivalently with fit_transform', '___NL___', '___EOS___']", "index": 190 } ]
[ { "span": "self.assertTrue(len(list(result)) < len(samples))", "start_line": 199, "start_column": 8, "end_line": 199, "end_column": 57 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Tol", "era", "nt", "Eval", "uator", "Fit", "Transform", "Tests_", "(_", "Test", "Case_", ",_", "Tol", "era", "nt", "Fitt", "ing", "Cases_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "try", " ", "to", " ", "mimic", " ", "most", " ", "of", " ", "the", " ", "case", "s", " ", "see", "n", " ", "on", " ", "Fit", " ", "tests", ",", " ", "and", " ", "check", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", " ", "are", " ", "working", " ", "equivalent", "ly", " ", "with", " ", "fit", "\\u", "transform_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "sample", "\\u", "is", "\\u", "exclu", "ded", "\\u", "if", "\\u", "any", "\\u", "feature", "\\u", "fail", "s", "\\u", "whe", "n", "\\u", "evaluat", "ing", "\\u", "it_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ev_", "=_", "Tol", "era", "nt", "Feature", "Evaluator_", "(_", "[_", "Descripti", "on", "Feature_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ent", "ire", "Sampl", "e", "Feature_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ev_", "._", "FEATURE", "\\u", "STRI", "CT", "\\u", "UNT", "IL", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ev_", "._", "FEATURE", "\\u", "MAX", "\\u", "ERRORS", "\\u", "ALLOWED", "_", "=_", "len_", "(_", "SAMPLES", "_", ")_", "+_", "1_", "#", " ", "don", "t", " ", "exclude_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samples_", "=_", "SAMPLES", "_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes", "cript", "ion_", "=_", "{_", "'", "nodes", "cript", "ion", "'_", ":_", "u", "'", "this", " ", "sample", " ", "has", " ", "no", " ", "description", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samples_", "._", "append_", "(_", "nodes", "cript", "ion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "ev_", "._", "fit", "\\u", "transform_", "(_", "samples_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "list_", "(_", "result_", ")_", ")_", "<_", "len_", "(_", "samples_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ent", "ire", "Sampl", "e", "Feature", " ", "is", " ", "the", " ", "last", ",", " ", "so", " ", "is", " ", "the", " ", "last", " ", "value", " ", "per", " ", "tuple_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "nodes", "cript", "ion_", ",_", "[_", "r_", "[_", "-_", "1_", "]_", "for_", "r_", "in_", "result_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ionelmc/python-aspectlib/tests/test_integrations.py
[ { "content": "from __future__ import print_function\n\nimport os\nimport re\nimport socket\nimport warnings\n\nimport pytest\nfrom process_tests import dump_on_error\nfrom process_tests import wait_for_strings\n\nimport aspectlib\nfrom aspectlib.test import mock\nfrom aspectlib.test import record\nfrom aspectlib.utils import PYPY\n\ntry:\n import thread\nexcept ImportError:\n import _thread as thread\n\ntry:\n from StringIO import StringIO\nexcept ImportError:\n from io import StringIO\n\nLOG_TEST_SOCKET = r\"\"\"^\\{_?socket(object)?\\}.connect\\(\\('127.0.0.1', 1\\)\\) +<<< .*tests[\\/]test_integrations.py:\\d+:test_socket.*\n\\{_?socket(object)?\\}.connect \\~ raised .*(ConnectionRefusedError|error)\\((10061|111), .*refused.*\\)\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_mock_builtin():\n with aspectlib.weave(open, mock('foobar')):\n assert open('???') == 'foobar'\n\n assert open(__file__) != 'foobar'", "metadata": "root.test_mock_builtin", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def test_mock_builtin_os():\n print(os.open.__name__)\n with aspectlib.weave('os.open', mock('foobar')):\n assert os.open('???') == 'foobar'\n\n assert os.open(__file__, 0) != 'foobar'", "metadata": "root.test_mock_builtin_os", "header": "['module', '___EOS___']", "index": 37 }, { "content": "def test_record_warning():\n with aspectlib.weave('warnings.warn', record):\n warnings.warn('crap')\n assert warnings.warn.calls == [(None, ('crap',), {})]", "metadata": "root.test_record_warning", "header": "['module', '___EOS___']", "index": 45 }, { "content": "@pytest.mark.skipif(not hasattr(os, 'fork'), reason=\"os.fork not available\")\ndef test_fork():\n with aspectlib.weave('os.fork', mock('foobar')):\n pid = os.fork()\n if not pid:\n os._exit(0)\n assert pid == 'foobar'\n\n pid = os.fork()\n if not pid:\n os._exit(0)\n assert pid != 'foobar'", "metadata": "root.test_fork", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def test_socket(target=socket.socket):\n buf = StringIO()\n with aspectlib.weave(target, aspectlib.debug.log(\n print_to=buf,\n stacktrace=4,\n module=False\n ), lazy=True):\n s = socket.socket()\n try:\n s.connect(('127.0.0.1', 1))\n except Exception:\n pass\n\n print(buf.getvalue())\n assert re.match(LOG_TEST_SOCKET, buf.getvalue())\n\n s = socket.socket()\n try:\n s.connect(('127.0.0.1', 1))\n except Exception:\n pass\n\n assert re.match(LOG_TEST_SOCKET, buf.getvalue())", "metadata": "root.test_socket", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def test_socket_as_string_target():\n test_socket(target='socket.socket')", "metadata": "root.test_socket_as_string_target", "header": "['module', '___EOS___']", "index": 89 }, { "content": "def test_socket_meth(meth=socket.socket.close):\n calls = []\n with aspectlib.weave(meth, record(calls=calls)):\n s = socket.socket()\n assert s.close() is None\n assert calls == [(s, (), {})]\n del calls[:]\n\n s = socket.socket()\n assert s.close() is None\n assert calls == []", "metadata": "root.test_socket_meth", "header": "['module', '___EOS___']", "index": 93 }, { "content": "def test_socket_meth_as_string_target():\n test_socket_meth('socket.socket.close')", "metadata": "root.test_socket_meth_as_string_target", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def test_socket_all_methods():\n buf = StringIO()\n with aspectlib.weave(\n socket.socket,\n aspectlib.debug.log(print_to=buf, stacktrace=False),\n lazy=True,\n methods=aspectlib.ALL_METHODS\n ):\n s = socket.socket()\n\n assert \"}.__init__ => None\" in buf.getvalue()", "metadata": "root.test_socket_all_methods", "header": "['module', '___EOS___']", "index": 110 }, { "content": "@pytest.mark.skipif(not hasattr(os, 'fork') or PYPY, reason=\"os.fork not available or PYPY\")\ndef test_realsocket_makefile():\n buf = StringIO()\n p = socket.socket()\n p.bind(('127.0.0.1', 0))\n p.listen(1)\n p.settimeout(1)\n pid = os.fork()\n\n if pid:\n with aspectlib.weave(\n ['socket._fileobject' if aspectlib.PY2 else 'socket.SocketIO'] +\n (['socket.socket', 'socket._realsocket'] if aspectlib.PY2 else ['socket.socket']),\n aspectlib.debug.log(print_to=buf, stacktrace=False),\n lazy=True,\n methods=aspectlib.ALL_METHODS,\n ):\n s = socket.socket()\n s.settimeout(1)\n s.connect(p.getsockname())\n if aspectlib.PY3:\n fh = s.makefile('rwb', buffering=0)\n else:\n fh = s.makefile(bufsize=0)\n fh.write(b\"STUFF\\n\")\n fh.readline()\n\n with dump_on_error(buf.getvalue):\n wait_for_strings(\n buf.getvalue, 0,\n \"}.connect\",\n \"}.makefile\",\n \"}.write(\",\n \"}.send\",\n \"}.write =>\",\n \"}.readline()\",\n \"}.recv\",\n \"}.readline => \",\n )\n else:\n try:\n c, _ = p.accept()\n c.settimeout(1)\n if aspectlib.PY3:\n f = c.makefile('rw', buffering=1)\n else:\n f = c.makefile(bufsize=1)\n while f.readline():\n f.write('-\\n')\n finally:\n os._exit(0)", "metadata": "root.test_realsocket_makefile", "header": "['module', '___EOS___']", "index": 123 }, { "content": "def test_weave_os_module():\n calls = []\n\n with aspectlib.weave('os', record(calls=calls, extended=True), methods=\"getenv|walk\"):\n os.getenv('BUBU', 'bubu')\n os.walk('.')\n\n assert calls == [\n (None, 'os.getenv', ('BUBU', 'bubu'), {}),\n (None, 'os.walk', ('.',), {})\n ]", "metadata": "root.test_weave_os_module", "header": "['module', '___EOS___']", "index": 176 } ]
[ { "span": "import thread", "start_line": 17, "start_column": 4, "end_line": 17, "end_column": 17 }, { "span": "import _thread as thread", "start_line": 19, "start_column": 4, "end_line": 19, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "process", "\\u", "tests_", "import_", "dump", "\\u", "on", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "process", "\\u", "tests_", "import_", "wait", "\\u", "for", "\\u", "strings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "aspect", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aspect", "lib_", "._", "test_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aspect", "lib_", "._", "test_", "import_", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aspect", "lib_", "._", "utils_", "import_", "PY", "PY", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u", "thread_", "as_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "io_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOG", "\\u", "TEST", "\\u", "SOCKET_", "=_", "r", "\"\"\"", "^", "\\\\{", "\\u", "?", "socket", "(", "object", ")?", "\\\\}", ".", "connect", "\\\\(\\\\", "('", "127", ".0", ".0", ".1", "',", " ", "1", "\\\\)", "\\\\)", " ", "+", "<<", "<", " ", ".*", "tests", "[\\\\", "/]", "test\\u", "integrati", "ons", ".", "py", ":\\\\", "d", "+:", "test\\u", "socket", ".*", "\\", "10", ";\\\\", "{\\u", "?", "socket", "(", "object", ")?", "\\\\}", ".", "connect", " ", "\\\\", "~", " ", "raise", "d", " ", ".*", "(", "Connect", "ion", "Refu", "sed", "Error", "|", "error", ")\\\\", "((", "1006", "1", "|", "111", "),", " ", ".*", "refuse", "d", ".*\\\\", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "mock", "\\u", "builtin_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "open_", ",_", "mock_", "(_", "'", "fooba", "r", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "open_", "(_", "'?", "??", "'_", ")_", "==_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "open_", "(_", "\\u\\u", "file\\u\\u_", ")_", "!=_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mock", "\\u", "bui", "lti", "n", "\\u", "os_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "os_", "._", "open_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "'", "os", ".", "open", "'_", ",_", "mock_", "(_", "'", "fooba", "r", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "os_", "._", "open_", "(_", "'?", "??", "'_", ")_", "==_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "os_", "._", "open_", "(_", "\\u\\u", "file\\u\\u_", ",_", "0_", ")_", "!=_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "record", "\\u", "warning_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "'", "warn", "ings", ".", "warn", "'_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "'", "cra", "p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "warnings_", "._", "warn_", "._", "calls_", "==_", "[_", "(_", "None_", ",_", "(_", "'", "cra", "p", "'_", ",_", ")_", ",_", "{_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "skipif_", "(_", "not_", "hasattr_", "(_", "os_", ",_", "'", "fork", "'_", ")_", ",_", "reason_", "=_", "\"", "os", ".", "fork", " ", "not", " ", "avail", "able", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "fork_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "'", "os", ".", "fork", "'_", ",_", "mock_", "(_", "'", "fooba", "r", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pid_", "=_", "os_", "._", "fork_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "pid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "\\u", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "pid_", "==_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pid_", "=_", "os_", "._", "fork_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "pid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "\\u", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "pid_", "!=_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "socket_", "(_", "target_", "=_", "socket_", "._", "socket_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "target_", ",_", "aspect", "lib_", "._", "debug_", "._", "log_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "print", "\\u", "to_", "=_", "buf_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stack", "trace_", "=_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "lazy_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "connect_", "(_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "buf_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "re_", "._", "match_", "(_", "LOG", "\\u", "TEST", "\\u", "SOCKET_", ",_", "buf_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "socket_", "._", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "connect_", "(_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "re_", "._", "match_", "(_", "LOG", "\\u", "TEST", "\\u", "SOCKET_", ",_", "buf_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "socket", "\\u", "as", "\\u", "string", "\\u", "target_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "socket_", "(_", "target_", "=_", "'", "socket", ".", "socket", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "socket", "\\u", "meth_", "(_", "meth_", "=_", "socket_", "._", "socket_", "._", "close_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calls_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "meth_", ",_", "record_", "(_", "calls_", "=_", "calls_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "s_", "._", "close_", "(_", ")_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "calls_", "==_", "[_", "(_", "s_", ",_", "(_", ")_", ",_", "{_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "calls_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "socket_", "._", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "s_", "._", "close_", "(_", ")_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "calls_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "socket", "\\u", "meth", "\\u", "as", "\\u", "string", "\\u", "target_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "socket", "\\u", "meth_", "(_", "'", "socket", ".", "socket", ".", "close", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "socket", "\\u", "all", "\\u", "methods_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "socket_", "._", "socket_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aspect", "lib_", "._", "debug_", "._", "log_", "(_", "print", "\\u", "to_", "=_", "buf_", ",_", "stack", "trace_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lazy_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "methods_", "=_", "aspect", "lib_", "._", "ALL", "\\u", "METHODS_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "\"}", ".\\u", "\\u", "init", "\\u\\u", " ", "=>", " ", "Non", "e", "\"_", "in_", "buf_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "skipif_", "(_", "not_", "hasattr_", "(_", "os_", ",_", "'", "fork", "'_", ")_", "or_", "PY", "PY", "_", ",_", "reason_", "=_", "\"", "os", ".", "fork", " ", "not", " ", "avail", "able", " ", "or", " ", "PY", "PY", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "real", "socket", "\\u", "makefile_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "socket_", "._", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "bind_", "(_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "listen_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "settimeout_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pid_", "=_", "os_", "._", "fork_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "socket", ".\\u", "fileo", "bject", "'_", "if_", "aspect", "lib_", "._", "PY", "2_", "else_", "'", "socket", ".", "Sock", "et", "IO", "'_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'", "socket", ".", "socket", "'_", ",_", "'", "socket", ".\\u", "real", "socket", "'_", "]_", "if_", "aspect", "lib_", "._", "PY", "2_", "else_", "[_", "'", "socket", ".", "socket", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aspect", "lib_", "._", "debug_", "._", "log_", "(_", "print", "\\u", "to_", "=_", "buf_", ",_", "stack", "trace_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lazy_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "methods_", "=_", "aspect", "lib_", "._", "ALL", "\\u", "METHODS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "settimeout_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "connect_", "(_", "p_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aspect", "lib_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "=_", "s_", "._", "makefile_", "(_", "'", "rw", "b", "'_", ",_", "bufferi", "ng_", "=_", "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 ", " _", "fh_", "=_", "s_", "._", "makefile_", "(_", "bufsize_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fh_", "._", "write_", "(_", "b", "\"", "STU", "FF", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "dump", "\\u", "on", "\\u", "error_", "(_", "buf_", "._", "getvalue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wait", "\\u", "for", "\\u", "strings_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "buf_", "._", "getvalue_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ".", "connect", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ".", "makefile", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ".", "write", "(\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ".", "send", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ".", "write", " ", "=>", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ".", "readline", "()\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ".", "recv", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"}", ".", "readline", " ", "=>", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", ",_", "\\u_", "=_", "p_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "settimeout_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aspect", "lib_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "c_", "._", "makefile_", "(_", "'", "rw", "'_", ",_", "bufferi", "ng_", "=_", "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 ", " _", "f_", "=_", "c_", "._", "makefile_", "(_", "bufsize_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "f_", "._", "readline_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "'-", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "\\u", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "weave", "\\u", "os", "\\u", "module_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calls_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "'", "os", "'_", ",_", "record_", "(_", "calls_", "=_", "calls_", ",_", "extended_", "=_", "True_", ")_", ",_", "methods_", "=_", "\"", "gete", "nv", "|", "walk", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "getenv_", "(_", "'", "BU", "BU", "'_", ",_", "'", "bu", "bu", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "walk_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "calls_", "==_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "'", "os", ".", "gete", "nv", "'_", ",_", "(_", "'", "BU", "BU", "'_", ",_", "'", "bu", "bu", "'_", ")_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "'", "os", ".", "walk", "'_", ",_", "(_", "'.'_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
msgpack/msgpack-python/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# msgpack documentation build configuration file, created by\n# sphinx-quickstart on Sun Feb 24 14:20:50 2013.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys, os\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.insert(0, os.path.abspath('.'))\n\n# -- General configuration -----------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\n#source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'msgpack'\ncopyright = u'2013, INADA Naoki'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\n# The full version, including alpha/beta/rc tags.\nversion = release = '0.4'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\ntoday_fmt = \"%Y-%m-%d\"\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n\n# -- Options for HTML output ---------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\nhtml_theme = 'sphinxdoc'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_domain_indices = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'msgpackdoc'\n\n\n# -- Options for LaTeX output --------------------------------------------------\n\nlatex_elements = {\n# The paper size ('letterpaper' or 'a4paper').\n#'papersize': 'letterpaper',\n\n# The font size ('10pt', '11pt' or '12pt').\n#'pointsize': '10pt',\n\n# Additional stuff for the LaTeX preamble.\n#'preamble': '',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass [howto/manual]).\nlatex_documents = [\n ('index', 'msgpack.tex', u'msgpack Documentation',\n u'Author', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# If true, show page references after internal links.\n#latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n#latex_show_urls = False\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_domain_indices = True\n\n\n# -- Options for manual page output --------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n ('index', 'msgpack', u'msgpack Documentation',\n [u'Author'], 1)\n]\n\n# If true, show URL addresses after external links.\n#man_show_urls = False\n\n\n# -- Options for Texinfo output ------------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n ('index', 'msgpack', u'msgpack Documentation',\n u'Author', 'msgpack', 'One line description of project.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\n\n\n# -- Options for Epub output ---------------------------------------------------\n\n# Bibliographic Dublin Core info.\nepub_title = u'msgpack'\nepub_author = u'Author'\nepub_publisher = u'Author'\nepub_copyright = u'2013, Author'\n\n# The language of the text. It defaults to the language option\n# or en if the language is not set.\n#epub_language = ''\n\n# The scheme of the identifier. Typical schemes are ISBN or URL.\n#epub_scheme = ''\n\n# The unique identifier of the text. This can be a ISBN number\n# or the project homepage.\n#epub_identifier = ''\n\n# A unique identification for the text.\n#epub_uid = ''\n\n# A tuple containing the cover image and cover page html template filenames.\n#epub_cover = ()\n\n# HTML files that should be inserted before the pages created by sphinx.\n# The format is a list of tuples containing the path and title.\n#epub_pre_files = []\n\n# HTML files shat should be inserted after the pages created by sphinx.\n# The format is a list of tuples containing the path and title.\n#epub_post_files = []\n\n# A list of files that should not be packed into the epub file.\n#epub_exclude_files = []\n\n# The depth of the table of contents in toc.ncx.\n#epub_tocdepth = 3\n\n# Allow duplicate toc entries.\n#epub_tocdup = True\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys, os", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "msgpack", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Sun", " ", "Fe", "b", " ", "24", " ", "14", ":", "20", ":", "50", " ", "2013", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", ",_", "'", "sphinx", ".", "ext", ".", "view", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "-", "sig", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "u", "'", "msgpack", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "2013", ",", " ", "INA", "DA", " ", "Na", "oki", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "release_", "=_", "'", "0.", "4", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "toda", "y", "\\u", "fmt_", "=_", "\"%", "Y", "-%", "m", "-%", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output", " ", "--------------", "--------------", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "See", " ", "the", " ", "documentation", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "of", " ", "bui", "lti", "n", " ", "themes", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "sphinx", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"", "Creat", "ed", " ", "usi", "ng", " ", "Sph", "inx", "\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "sphinx", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"(", "C", ")", " ", "Copy", "right", " ", "...\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "copyr", "ight", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "msgpack", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "elements_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "pape", "r", "'", " ", "or", " ", "'", "a4", "pape", "r", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "papers", "ize", "':", " ", "'", "letter", "pape", "r", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "points", "ize", "':", " ", "'", "10", "pt", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "preamble", "':", " ", "''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "msgpack", ".", "tex", "'_", ",_", "u", "'", "msgpack", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Author", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "page", " ", "reference", "s", " ", "after", " ", "internal", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "pager", "ef", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "manu", "al", " ", "page", " ", "output", " ", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "entry", " ", "per", " ", "manu", "al", " ", "page", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "name", ",", " ", "description", ",", " ", "author", "s", ",", " ", "manu", "al", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "man", "\\u", "pages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "msgpack", "'_", ",_", "u", "'", "msgpack", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "u", "'", "Author", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "man", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "Tex", "info", " ", "output", " ", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "Tex", "info", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "dir", " ", "menu", " ", "entry", ",", " ", "description", ",", " ", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tex", "info", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "msgpack", "'_", ",_", "u", "'", "msgpack", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Author", "'_", ",_", "'", "msgpack", "'_", ",_", "'", "One", " ", "line", " ", "description", " ", "of", " ", "project", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mis", "cell", "ane", "ous", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "footnote", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "Ep", "ub", " ", "output", " ", "--------------", "--------------", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bibl", "io", "graphic", " ", "Du", "blin", " ", "Core", " ", "info", "._", "\\u\\u\\uNL\\u\\u\\u_", "epub", "\\u", "title_", "=_", "u", "'", "msgpack", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epub", "\\u", "author_", "=_", "u", "'", "Author", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epub", "\\u", "publisher_", "=_", "u", "'", "Author", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epub", "\\u", "copyright_", "=_", "u", "'", "2013", ",", " ", "Author", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "of", " ", "the", " ", "text", ".", " ", "It", " ", "default", "s", " ", "to", " ", "the", " ", "language", " ", "option_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "en", " ", "if", " ", "the", " ", "language", " ", "is", " ", "not", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "language", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "sche", "me", " ", "of", " ", "the", " ", "identifi", "er", ".", " ", "Typical", " ", "schemes", " ", "are", " ", "ISB", "N", " ", "or", " ", "URL", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "sche", "me", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "unique", " ", "identifi", "er", " ", "of", " ", "the", " ", "text", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "a", " ", "ISB", "N", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "the", " ", "project", " ", "home", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "identifi", "er", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "unique", " ", "identifica", "tion", " ", "for", " ", "the", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "uid", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "tuple", " ", "contain", "ing", " ", "the", " ", "cover", " ", "image", " ", "and", " ", "cover", " ", "page", " ", "html", " ", "template", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "cover", " ", "=", " ", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HTM", "L", " ", "files", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "inserted", " ", "bef", "ore", " ", "the", " ", "page", "s", " ", "created", " ", "by", " ", "sphinx", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "format", " ", "is", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", " ", "contain", "ing", " ", "the", " ", "path", " ", "and", " ", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "pre", "\\u", "files", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HTM", "L", " ", "files", " ", "sha", "t", " ", "shou", "ld", " ", "be", " ", "inserted", " ", "after", " ", "the", " ", "page", "s", " ", "created", " ", "by", " ", "sphinx", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "format", " ", "is", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", " ", "contain", "ing", " ", "the", " ", "path", " ", "and", " ", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "post", "\\u", "files", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "files", " ", "tha", "t", " ", "shou", "ld", " ", "not", " ", "be", " ", "pack", "ed", " ", "int", "o", " ", "the", " ", "epub", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "exclu", "de", "\\u", "files", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "depth", " ", "of", " ", "the", " ", "table", " ", "of", " ", "content", "s", " ", "in", " ", "toc", ".", "nc", "x", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "toc", "depth", " ", "=", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", "ow", " ", "duplicat", "e", " ", "toc", " ", "entri", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "epub", "\\u", "toc", "dup", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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
PythonCharmers/python-future/src/libfuturize/fixes/fix_division.py
[ { "content": "\"\"\"\nUNFINISHED\nFor the ``future`` package.\n\nAdds this import line:\n\n from __future__ import division\n\nat the top so the code runs identically on Py3 and Py2.6/2.7\n\"\"\"\n\nfrom libpasteurize.fixes.fix_division import FixDivision\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from libpasteurize.fixes.fix_division import FixDivision", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "UN", "FINISH", "ED", "\\", "10", ";", "For", " ", "the", " ", "``", "future", "``", " ", "package", ".", "\\", "10", ";", "\\", "10", ";", "Add", "s", " ", "this", " ", "import", " ", "line", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "\\u\\u", "future", "\\u\\u", " ", "import", " ", "divisi", "on", "\\", "10", ";", "\\", "10", ";", "at", " ", "the", " ", "top", " ", "so", " ", "the", " ", "code", " ", "runs", " ", "identi", "call", "y", " ", "on", " ", "Py", "3", " ", "and", " ", "Py", "2.6", "/", "2.7", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "libpa", "ste", "uri", "ze_", "._", "fixes", "_", "._", "fix", "\\u", "division_", "import_", "Fix", "Divis", "ion_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Except block handles 'BaseException'
tarequeh/django-config/djangoconfig/deployment.py
[ { "content": "def setup_environment(path):\n IDENTIFIERS = get_config_identifiers(path)\n CONFIG_IDENTIFIER = os.environ.get('CONFIG_IDENTIFIER', '')\n\n # If we are trying to use runserver, then look for existing configuration so that auto reload does not keep propmpting for the configuration file.\n if len(sys.argv) >= 2 and sys.argv[1] in ('runserver', 'runserver_plus',):\n if 'CONFIG_IDENTIFIER' in os.environ and CONFIG_IDENTIFIER in [name for id, name in IDENTIFIERS]:\n bootstrap(path)\n return\n\n IDENTIFIERS_LOOKUP = dict(IDENTIFIERS)\n IDENTIFIERS_REVERSE_LOOKUP = dict([[ name, id ] for id, name in IDENTIFIERS ])\n\n CONFIG_IDENTIFIER_ID = IDENTIFIERS_REVERSE_LOOKUP.get(CONFIG_IDENTIFIER, '')\n CONFIG_IDENTIFIER_INTERACTIVE = os.environ.get('CONFIG_IDENTIFIER_INTERACTIVE', 'True')\n\n if CONFIG_IDENTIFIER and CONFIG_IDENTIFIER_INTERACTIVE == 'False':\n print \"WARNING: Forced to run environment with %s configuration.\" % CONFIG_IDENTIFIER.upper()\n return bootstrap(path)\n\n while True:\n print \"Please select your config identifier.\"\n for id, name in IDENTIFIERS:\n print \" %s) %s\" % (id, name)\n\n try:\n selection = raw_input(\"What config identifier would you like to use? [%s] \" % CONFIG_IDENTIFIER_ID)\n except:\n # Capture if they hard escape during the getpass prompt. Clear the newline, and exit.\n print ''\n sys.exit(0)\n\n selection = selection.isdigit() and int(selection) or (selection and selection or CONFIG_IDENTIFIER_ID)\n\n if selection and IDENTIFIERS_LOOKUP.has_key(selection):\n identifier = dict(IDENTIFIERS).get(int(selection))\n\n # We need to load up the selected settings environment to see if we need to double check for security purposes.\n # If the database_host is not empty (not a local database) then we need to confirm that the user REALLY wants\n # to run the command on a potentially production database.\n settings_path = find_settings_path(path)\n\n\n # Set the config identifier to the selected one, so that the correct configuration gets loaded up.\n os.environ['CONFIG_IDENTIFIER'] = identifier\n os.putenv('CONFIG_IDENTIFIER', identifier)\n\n # Import the settings file into local scope.\n settings = imp.load_source('settings', os.path.join(settings_path, 'settings.py'))\n\n # Reset the config identifier and system path to what they were before.\n os.putenv('CONFIG_IDENTIFIER', CONFIG_IDENTIFIER)\n os.environ['CONFIG_IDENTIFIER'] = CONFIG_IDENTIFIER\n\n # If the database host for the selected configuration is not empty (not a local database). Prompt for password.\n if getattr(settings, 'ENABLE_PASSWORD', False) and getattr(settings, 'PASSWORD_DIGEST', ''):\n try:\n password = getpass.getpass('Please enter the password to load <%s>: ' % identifier)\n except:\n # Capture if they hard escape during the getpass prompt. Clear the newline, and exit.\n print ''\n sys.exit(0)\n else:\n if hashlib.md5(password).hexdigest() != settings.PASSWORD_DIGEST:\n print 'Invalid password.'\n continue\n\n\n CONFIG_IDENTIFIER = identifier\n break\n\n # Update the current config identifier.\n os.environ['CONFIG_IDENTIFIER'] = CONFIG_IDENTIFIER\n os.putenv('CONFIG_IDENTIFIER', CONFIG_IDENTIFIER)\n\n # Now that we have setup our identifier, initialize our django project.\n bootstrap(path)", "metadata": "root.setup_environment", "header": "['module', '___EOS___']", "index": 53 } ]
[ { "span": "except:", "start_line": 80, "start_column": 8, "end_line": 80, "end_column": 15 }, { "span": "except:", "start_line": 111, "start_column": 16, "end_line": 111, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "environment_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "IDENTIFIER", "S_", "=_", "get", "\\u", "config", "\\u", "identifiers_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONFIG", "\\u", "IDENTIFIER_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "CONFIG", "\\u", "IDENTIFIER", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "are", " ", "try", "ing", " ", "to", " ", "use", " ", "runs", "erver", ",", " ", "then", " ", "look", " ", "for", " ", "exist", "ing", " ", "configura", "tion", " ", "so", " ", "tha", "t", " ", "auto", " ", "relo", "ad", " ", "doe", "s", " ", "not", " ", "keep", " ", "prop", "mpt", "ing", " ", "for", " ", "the", " ", "configura", "tion", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">=_", "2_", "and_", "sys_", "._", "argv_", "[_", "1_", "]_", "in_", "(_", "'", "runs", "erver", "'_", ",_", "'", "runs", "erver", "\\u", "plus", "'_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "CONFIG", "\\u", "IDENTIFIER", "'_", "in_", "os_", "._", "environ_", "and_", "CONFIG", "\\u", "IDENTIFIER_", "in_", "[_", "name_", "for_", "id_", ",_", "name_", "in_", "IDENTIFIER", "S_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bootstrap_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "IDENTIFIER", "S", "\\u", "LOOKUP", "_", "=_", "dict_", "(_", "IDENTIFIER", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IDENTIFIER", "S", "\\u", "REVERSE", "\\u", "LOOKUP", "_", "=_", "dict_", "(_", "[_", "[_", "name_", ",_", "id_", "]_", "for_", "id_", ",_", "name_", "in_", "IDENTIFIER", "S_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIG", "\\u", "IDENTIFIER", "\\u", "ID_", "=_", "IDENTIFIER", "S", "\\u", "REVERSE", "\\u", "LOOKUP", "_", "._", "get_", "(_", "CONFIG", "\\u", "IDENTIFIER_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONFIG", "\\u", "IDENTIFIER", "\\u", "INTER", "ACTIVE_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "CONFIG", "\\u", "IDENTIFIER", "\\u", "INTER", "ACTI", "VE", "'_", ",_", "'", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "CONFIG", "\\u", "IDENTIFIER_", "and_", "CONFIG", "\\u", "IDENTIFIER", "\\u", "INTER", "ACTIVE_", "==_", "'", "Fal", "se", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "WARN", "ING", ":", " ", "Force", "d", " ", "to", " ", "run", " ", "environ", "ment", " ", "with", " ", "%", "s", " ", "configura", "tion", ".\"_", "%_", "CONFIG", "\\u", "IDENTIFIER_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bootstrap_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Ple", "ase", " ", "select", " ", "your", " ", "config", " ", "identifi", "er", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "id_", ",_", "name_", "in_", "IDENTIFIER", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", " ", "%", "s", ")", " ", "%", "s", "\"_", "%_", "(_", "id_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selection_", "=_", "raw", "\\u", "input_", "(_", "\"", "What", " ", "config", " ", "identifi", "er", " ", "wou", "ld", " ", "you", " ", "like", " ", "to", " ", "use", "?", " ", "[", "%", "s", "]", " ", "\"_", "%_", "CONFIG", "\\u", "IDENTIFIER", "\\u", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Captur", "e", " ", "if", " ", "the", "y", " ", "hard", " ", "escape", " ", "dur", "ing", " ", "the", " ", "getpa", "ss", " ", "prompt", ".", " ", "Clear", " ", "the", " ", "newline", ",", " ", "and", " ", "exit", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "selection_", "=_", "selection_", "._", "isdigit_", "(_", ")_", "and_", "int_", "(_", "selection_", ")_", "or_", "(_", "selection_", "and_", "selection_", "or_", "CONFIG", "\\u", "IDENTIFIER", "\\u", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "selection_", "and_", "IDENTIFIER", "S", "\\u", "LOOKUP", "_", "._", "has", "\\u", "key_", "(_", "selection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "identifier_", "=_", "dict_", "(_", "IDENTIFIER", "S_", ")_", "._", "get_", "(_", "int_", "(_", "selection_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "load", " ", "up", " ", "the", " ", "selecte", "d", " ", "settings", " ", "environ", "ment", " ", "to", " ", "see", " ", "if", " ", "we", " ", "need", " ", "to", " ", "double", " ", "check", " ", "for", " ", "security", " ", "purpose", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "databa", "se", "\\u", "host", " ", "is", " ", "not", " ", "empty", " ", "(", "not", " ", "a", " ", "local", " ", "databa", "se", ")", " ", "then", " ", "we", " ", "need", " ", "to", " ", "confirm", " ", "tha", "t", " ", "the", " ", "user", " ", "REAL", "LY", " ", "want", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "run", " ", "the", " ", "command", " ", "on", " ", "a", " ", "potenti", "ally", " ", "producti", "on", " ", "databa", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "settings", "\\u", "path_", "=_", "find", "\\u", "settings", "\\u", "path_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "config", " ", "identifi", "er", " ", "to", " ", "the", " ", "selecte", "d", " ", "one", ",", " ", "so", " ", "tha", "t", " ", "the", " ", "correct", " ", "configura", "tion", " ", "gets", " ", "load", "ed", " ", "up", "._", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "CONFIG", "\\u", "IDENTIFIER", "'_", "]_", "=_", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "put", "env_", "(_", "'", "CONFIG", "\\u", "IDENTIFIER", "'_", ",_", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "the", " ", "settings", " ", "file", " ", "int", "o", " ", "local", " ", "scope", "._", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "=_", "imp_", "._", "load", "\\u", "source_", "(_", "'", "settings", "'_", ",_", "os_", "._", "path_", "._", "join_", "(_", "settings", "\\u", "path_", ",_", "'", "settings", ".", "py", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reset", " ", "the", " ", "config", " ", "identifi", "er", " ", "and", " ", "system", " ", "path", " ", "to", " ", "what", " ", "the", "y", " ", "wer", "e", " ", "bef", "ore", "._", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "put", "env_", "(_", "'", "CONFIG", "\\u", "IDENTIFIER", "'_", ",_", "CONFIG", "\\u", "IDENTIFIER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "CONFIG", "\\u", "IDENTIFIER", "'_", "]_", "=_", "CONFIG", "\\u", "IDENTIFIER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "databa", "se", " ", "host", " ", "for", " ", "the", " ", "selecte", "d", " ", "configura", "tion", " ", "is", " ", "not", " ", "empty", " ", "(", "not", " ", "a", " ", "local", " ", "databa", "se", ").", " ", "Prom", "pt", " ", "for", " ", "password", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "getattr_", "(_", "settings_", ",_", "'", "ENABLE", "\\u", "PASS", "WORD", "'_", ",_", "False_", ")_", "and_", "getattr_", "(_", "settings_", ",_", "'", "PASS", "WORD", "\\u", "DIG", "EST", "'_", ",_", "''_", ")_", ":_", "\\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 ", " ", "_", "password_", "=_", "getpass_", "._", "getpass_", "(_", "'", "Ple", "ase", " ", "enter", " ", "the", " ", "password", " ", "to", " ", "load", " ", "<", "%", "s", ">:", " ", "'_", "%_", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Captur", "e", " ", "if", " ", "the", "y", " ", "hard", " ", "escape", " ", "dur", "ing", " ", "the", " ", "getpa", "ss", " ", "prompt", ".", " ", "Clear", " ", "the", " ", "newline", ",", " ", "and", " ", "exit", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "hashlib_", "._", "md5_", "(_", "password_", ")_", "._", "hexdigest_", "(_", ")_", "!=_", "settings_", "._", "PASS", "WORD", "\\u", "DIG", "EST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "Inva", "lid", " ", "password", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\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_", "CONFIG", "\\u", "IDENTIFIER_", "=_", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "the", " ", "current", " ", "config", " ", "identifi", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "CONFIG", "\\u", "IDENTIFIER", "'_", "]_", "=_", "CONFIG", "\\u", "IDENTIFIER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "put", "env_", "(_", "'", "CONFIG", "\\u", "IDENTIFIER", "'_", ",_", "CONFIG", "\\u", "IDENTIFIER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "tha", "t", " ", "we", " ", "have", " ", "setup", " ", "our", " ", "identifi", "er", ",", " ", "initialize", " ", "our", " ", "django", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "bootstrap_", "(_", "path_", ")_" ]
[ 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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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 ]
Unused import
zmap/ztag/ztag/annotations/FtpBftpd.py
[ { "content": "import re\nfrom ztag.annotation import Annotation\nfrom ztag.annotation import OperatingSystem\nfrom ztag import protocols\nimport ztag.test\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class FtpBftpd(Annotation):\n protocol = protocols.FTP\n subprotocol = protocols.FTP.BANNER\n port = None\n\n versionStr = \"\\d+\\.\\d+(\\.\\d+)?(([a-z])|(rc\\d))?\"\n impl_1_re = re.compile(\n \"^220 bftpd \" + versionStr + \" at \\d+\\.\\d+\\.\\d+\\.\\d+ ready\",\n re.IGNORECASE\n )\n version_1_re = re.compile(\n \"bftpd (\\d+\\.\\d+) at\",\n re.IGNORECASE\n )\n\n tests = {\n \"FtpBftpd_1\": {\n \"local_metadata\": {\n \"product\": \"bftpd\",\n \"version\": \"2.2\"\n }\n },\n \"FtpBftpd_2\": {\n \"local_metadata\": {\n \"product\": \"bftpd\",\n }\n },\n }\n\n impl_2_re = re.compile(\"^220 \\(bftpd\\)\\r\\n$\", re.IGNORECASE)\n\n\n \"\"\" Tests\n \"220 (bftpd)\\r\\n\"\n \"220 bftpd 2.2 at 186.27.181.33 ready.\\r\\n\"\n \"220 bftpd 2.2 at 92.101.111.69 ready.\\r\\n\"\n \"220 bftpd 2.2 at 190.99.160.80 ready.\\r\\n\"\n \"220 (bftpd)\\r\\n\"\n \"220 bftpd 2.3 at 0.0.0.0 ready.\\r\\n\"\n \"220 bftpd 2.2 at 109.63.172.186 ready.\\r\\n\"\n \"220 bftpd 2.2 at 151.74.240.50 ready.\\r\\n\"\n \"220 (bftpd)\\r\\n\"\n \"220 bftpd 2.2 at 122.177.18.208 ready.\\r\\n\"\n \"220 (bftpd)\\r\\n\"\n \"220 bftpd 2.2 at 37.138.201.201 ready.\\r\\n\"\n \"220 bftpd 2.2 at 178.37.208.162 ready.\\r\\n\"\n \"220 bftpd 2.2 at 41.37.47.129 ready.\\r\\n\"\n \"220 (bftpd)\\r\\n\"\n \"220 (bftpd)\\r\\n\"\n \"220 bftpd 2.2 at 5.155.231.250 ready.\\r\\n\"\n \"220 bftpd 2.3 at 0.0.0.0 ready.\\r\\n\"\n \"220 bftpd 2.2 at 197.88.95.13 ready.\\r\\n\"\n \"220 bftpd 2.2 at 95.107.101.10 ready.\\r\\n\"\n \"220 bftpd 2.2 at 37.122.113.86 ready.\\r\\n\"\n \"220 (bftpd)\\r\\n\"\n \"\"\"", "metadata": "root.FtpBftpd", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def process(self, obj, meta):\n banner = obj[\"banner\"]\n\n if self.impl_1_re.search(banner):\n meta.local_metadata.product = \"bftpd\"\n version = self.version_1_re.search(banner).group(1)\n meta.local_metadata.version = version\n\n if self.impl_2_re.search(banner):\n meta.local_metadata.product = \"bftpd\"\n\n return meta", "metadata": "root.FtpBftpd.process", "header": "['class', 'FtpBftpd', '(', 'Annotation', ')', ':', '___EOS___']", "index": 38 } ]
[ { "span": "from ztag.annotation import OperatingSystem", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 43 }, { "span": "import ztag.test", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "._", "annotation_", "import_", "Annotation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "._", "annotation_", "import_", "Opera", "ting", "System_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "import_", "protocols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zt", "ag_", "._", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ft", "p", "Bf", "tp", "d_", "(_", "Annotation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "protocol_", "=_", "protocols_", "._", "FTP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subpro", "toco", "l_", "=_", "protocols_", "._", "FTP", "_", "._", "BAN", "NER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version", "Str_", "=_", "\"\\\\", "d", "+\\\\.", "\\\\", "d", "+(", "\\\\.\\\\", "d", "+)?", "(([", "a", "-", "z", "])", "|(", "rc", "\\\\", "d", "))", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "impl", "\\u", "1", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "^", "220", " ", "bf", "tp", "d", " ", "\"_", "+_", "version", "Str_", "+_", "\"", " ", "at", " ", "\\\\", "d", "+\\\\.", "\\\\", "d", "+\\\\.", "\\\\", "d", "+\\\\.", "\\\\", "d", "+", " ", "read", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "IGNORECASE_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u", "1", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bf", "tp", "d", " ", "(\\\\", "d", "+\\\\.", "\\\\", "d", "+)", " ", "at", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "IGNORECASE_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ft", "p", "Bf", "tp", "d\\u", "1", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "local", "\\u", "metadata", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "product", "\"_", ":_", "\"", "bf", "tp", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "version", "\"_", ":_", "\"", "2.2", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ft", "p", "Bf", "tp", "d\\u", "2", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "local", "\\u", "metadata", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "product", "\"_", ":_", "\"", "bf", "tp", "d", "\"_", ",_", "\\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_", "impl", "\\u", "2", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "\"", "^", "220", " ", "\\\\(", "bf", "tp", "d", "\\\\)", "\\\\", "r", "\\\\", "n", "$\"_", ",_", "re_", "._", "IGNORECASE_", ")_", "\\u\\u\\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_", "\"\"\"", " ", "Test", "s", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "(", "bf", "tp", "d", ")\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "186", ".2", "7.1", "81.", "3", "3", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "92.", "101.", "111", ".6", "9", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "190", ".99", ".1", "60", ".8", "0", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "(", "bf", "tp", "d", ")\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.3", " ", "at", " ", "0.", "0.", "0.", "0", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "109", ".6", "3.1", "72.", "186", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "151", ".7", "4.2", "40.", "50", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "(", "bf", "tp", "d", ")\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "122.", "177", ".1", "8.2", "0", "8", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "(", "bf", "tp", "d", ")\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "37.", "138", ".2", "01", ".2", "01", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "178", ".3", "7.2", "0", "8.1", "6", "2", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "41.", "37.", "47.", "129", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "(", "bf", "tp", "d", ")\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "(", "bf", "tp", "d", ")\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "5.1", "55.", "231", ".2", "50", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.3", " ", "at", " ", "0.", "0.", "0.", "0", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "197", ".8", "8.9", "5.1", "3", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "95.", "107", ".1", "01", ".1", "0", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "bf", "tp", "d", " ", "2.2", " ", "at", " ", "37.", "122.", "113.", "86", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "(", "bf", "tp", "d", ")\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "[SEP]_", "class_", "Ft", "p", "Bf", "tp", "d_", "(_", "Annotation_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process_", "(_", "self_", ",_", "obj_", ",_", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "banner_", "=_", "obj_", "[_", "\"", "banner", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "impl", "\\u", "1", "\\u", "re_", "._", "search_", "(_", "banner_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "._", "local", "\\u", "metadata_", "._", "product_", "=_", "\"", "bf", "tp", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "self_", "._", "version", "\\u", "1", "\\u", "re_", "._", "search_", "(_", "banner_", ")_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "._", "local", "\\u", "metadata_", "._", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "impl", "\\u", "2", "\\u", "re_", "._", "search_", "(_", "banner_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "._", "local", "\\u", "metadata_", "._", "product_", "=_", "\"", "bf", "tp", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
enthought/traitsui/traitsui/qt4/button_editor.py
[ { "content": "#------------------------------------------------------------------------------\n# Copyright (c) 2007, Riverbank Computing Limited\n# All rights reserved.\n#\n# This software is provided without warranty under the terms of the BSD license.\n# However, when used with the GPL version of PyQt the additional terms described in the PyQt GPL exception also apply\n\n#\n# Author: Riverbank Computing Limited\n#------------------------------------------------------------------------------\n\n\"\"\" Defines the various button editors for the PyQt user interface toolkit.\n\"\"\"\n\n#-------------------------------------------------------------------------------\n# Imports:\n#-------------------------------------------------------------------------------\n\nfrom pyface.qt import QtCore, QtGui\n\nfrom traits.api import Unicode, List, Str, on_trait_change\n\n# FIXME: ToolkitEditorFactory is a proxy class defined here just for backward\n# compatibility. The class has been moved to the\n# traitsui.editors.button_editor file.\nfrom traitsui.editors.button_editor \\\n import ToolkitEditorFactory\n\nfrom editor import Editor\n\n#-------------------------------------------------------------------------------\n# 'SimpleEditor' class:\n#-------------------------------------------------------------------------------\n\n\n#-------------------------------------------------------------------------------\n# 'CustomEditor' class:\n#-------------------------------------------------------------------------------\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SimpleEditor ( Editor ):\n \"\"\" Simple style editor for a button.\n \"\"\"\n\n #---------------------------------------------------------------------------\n # Trait definitions:\n #---------------------------------------------------------------------------\n\n # The button label\n label = Unicode\n\n # The list of items in a drop-down menu, if any\n #menu_items = List\n\n # The selected item in the drop-down menu.\n selected_item = Str\n\n #---------------------------------------------------------------------------\n # Finishes initializing the editor by creating the underlying toolkit\n # widget:\n #---------------------------------------------------------------------------\n\n\n\n\n\n\n", "metadata": "root.SimpleEditor", "header": "['module', '___EOS___']", "index": 34 }, { "content": " def init ( self, parent ):\n \"\"\" Finishes initializing the editor by creating the underlying toolkit\n widget.\n \"\"\"\n label = self.factory.label or self.item.get_label(self.ui)\n\n if self.factory.values_trait:\n self.control = QtGui.QToolButton()\n self.control.toolButtonStyle = QtCore.Qt.ToolButtonTextOnly\n self.control.setText(self.string_value(label))\n self.object.on_trait_change(self._update_menu, self.factory.values_trait)\n self.object.on_trait_change(self._update_menu, self.factory.values_trait + \"_items\")\n self._menu = QtGui.QMenu()\n self._update_menu()\n self.control.setMenu(self._menu)\n\n else:\n self.control = QtGui.QPushButton(self.string_value(label))\n self._menu = None\n self.control.setAutoDefault(False)\n\n self.sync_value(self.factory.label_value, 'label', 'from')\n self.control.clicked.connect(self.update_object)\n self.set_tooltip()", "metadata": "root.SimpleEditor.init", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 56 }, { "content": " def _label_changed(self, label):\n self.control.setText(self.string_value(label))", "metadata": "root.SimpleEditor._label_changed", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 82 }, { "content": " def _update_menu(self):\n self._menu.blockSignals(True)\n self._menu.clear()\n for item in getattr(self.object, self.factory.values_trait):\n action = self._menu.addAction(item)\n action.triggered.connect(lambda event, name=item: self._menu_selected(name))\n self.selected_item = \"\"\n self._menu.blockSignals(False)", "metadata": "root.SimpleEditor._update_menu", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 85 }, { "content": " def _menu_selected(self, item_name):\n self.selected_item = item_name\n self.label = item_name", "metadata": "root.SimpleEditor._menu_selected", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 94 }, { "content": " def update_object(self):\n \"\"\" Handles the user clicking the button by setting the factory value\n on the object.\n \"\"\"\n if self.selected_item != \"\":\n self.value = self.selected_item\n else:\n self.value = self.factory.value\n\n # If there is an associated view, then display it:\n if (self.factory is not None) and (self.factory.view is not None):\n self.object.edit_traits( view = self.factory.view,\n parent = self.control )", "metadata": "root.SimpleEditor.update_object", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 98 }, { "content": " def update_editor(self):\n \"\"\" Updates the editor when the object trait changes externally to the\n editor.\n \"\"\"\n pass", "metadata": "root.SimpleEditor.update_editor", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 112 }, { "content": "class CustomEditor ( SimpleEditor ):\n \"\"\" Custom style editor for a button, which can contain an image.\n \"\"\"\n\n # The mapping of button styles to Qt classes.\n _STYLE_MAP = {\n 'checkbox': QtGui.QCheckBox,\n 'radio': QtGui.QRadioButton,\n 'toolbar': QtGui.QToolButton\n }\n\n #---------------------------------------------------------------------------\n # Finishes initializing the editor by creating the underlying toolkit\n # widget:\n #---------------------------------------------------------------------------\n", "metadata": "root.CustomEditor", "header": "['module', '___EOS___']", "index": 122 }, { "content": " def init ( self, parent ):\n \"\"\" Finishes initializing the editor by creating the underlying toolkit\n widget.\n \"\"\"\n # FIXME: We ignore orientation, width_padding and height_padding.\n\n factory = self.factory\n\n btype = self._STYLE_MAP.get(factory.style, QtGui.QPushButton)\n self.control = btype()\n self.control.setText(self.string_value(factory.label))\n\n if factory.image is not None:\n self.control.setIcon(factory.image.create_icon())\n\n QtCore.QObject.connect(self.control, QtCore.SIGNAL('clicked()'),\n self.update_object )\n self.set_tooltip()", "metadata": "root.CustomEditor.init", "header": "['class', 'CustomEditor', '(', 'SimpleEditor', ')', ':', '___EOS___']", "index": 138 } ]
[ { "span": "from traits.api import Unicode, List, Str, on_trait_change", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 58 }, { "span": "from traitsui.editors.button_editor \\\n import ToolkitEditorFactory", "start_line": 25, "start_column": 0, "end_line": 26, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2007", ",", " ", "River", "bank", " ", "Comp", "uti", "ng", " ", "Limit", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "software", " ", "is", " ", "provided", " ", "with", "out", " ", "warr", "ant", "y", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "BS", "D", " ", "license", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "we", "ver", ",", " ", "whe", "n", " ", "used", " ", "with", " ", "the", " ", "GP", "L", " ", "version", " ", "of", " ", "Py", "Qt", " ", "the", " ", "addition", "al", " ", "term", "s", " ", "descri", "bed", " ", "in", " ", "the", " ", "Py", "Qt", " ", "GP", "L", " ", "exception", " ", "als", "o", " ", "apply_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", ":", " ", "River", "bank", " ", "Comp", "uti", "ng", " ", "Limit", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Define", "s", " ", "the", " ", "vari", "ous", " ", "button", " ", "editors", " ", "for", " ", "the", " ", "Py", "Qt", " ", "user", " ", "interface", " ", "tool", "kit", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Imports", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyf", "ace_", "._", "qt_", "import_", "Qt", "Core_", ",_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "traits_", "._", "api_", "import_", "Unicode_", ",_", "List_", ",_", "Str_", ",_", "on", "\\u", "tra", "it", "\\u", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "Tool", "kit", "Edit", "or", "Factor", "y", " ", "is", " ", "a", " ", "proxy", " ", "class", " ", "defin", "ed", " ", "here", " ", "just", " ", "for", " ", "backward_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compatibility", ".", " ", "The", " ", "class", " ", "has", " ", "bee", "n", " ", "moved", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "traits", "ui", ".", "editors", ".", "button", "\\u", "editor", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "traits", "ui_", "._", "editors", "_", "._", "button", "\\u", "editor_", "import_", "Tool", "kit", "Edit", "or", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "editor_", "import_", "Editor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "'", "Simple", "Edit", "or", "'", " ", "class", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "'", "Custom", "Edit", "or", "'", " ", "class", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Simple", " ", "style", " ", "editor", " ", "for", " ", "a", " ", "button", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Trait", " ", "definit", "ion", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "button", " ", "label_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "Unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "list", " ", "of", " ", "items", " ", "in", " ", "a", " ", "drop", "-", "down", " ", "menu", ",", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "#", "menu", "\\u", "items", " ", "=", " ", "List_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "selecte", "d", " ", "item", " ", "in", " ", "the", " ", "drop", "-", "down", " ", "menu", "._", "\\u\\u\\uNL\\u\\u\\u_", "selecte", "d\\u", "item_", "=_", "Str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Finish", "es", " ", "initiali", "zin", "g", " ", "the", " ", "editor", " ", "by", " ", "creati", "ng", " ", "the", " ", "underl", "ying", " ", "toolkit_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "widget", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "init_", "(_", "self_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Finish", "es", " ", "initiali", "zin", "g", " ", "the", " ", "editor", " ", "by", " ", "creati", "ng", " ", "the", " ", "underl", "ying", " ", "tool", "kit", "\\", "10", ";", " ", " ", " ", " ", "widget", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "self_", "._", "factory_", "._", "label_", "or_", "self_", "._", "item_", "._", "get", "\\u", "label_", "(_", "self_", "._", "ui_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "factory_", "._", "values", "\\u", "trait_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "control_", "=_", "Qt", "Gui_", "._", "QT", "ool", "Button_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "tool", "Butt", "on", "Style_", "=_", "Qt", "Core_", "._", "Qt_", "._", "Tool", "Butt", "on", "Text", "Only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "set", "Text_", "(_", "self_", "._", "string", "\\u", "value_", "(_", "label_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "object_", "._", "on", "\\u", "tra", "it", "\\u", "change_", "(_", "self_", "._", "\\u", "update", "\\u", "menu_", ",_", "self_", "._", "factory_", "._", "values", "\\u", "trait_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "object_", "._", "on", "\\u", "tra", "it", "\\u", "change_", "(_", "self_", "._", "\\u", "update", "\\u", "menu_", ",_", "self_", "._", "factory_", "._", "values", "\\u", "trait_", "+_", "\"\\u", "items", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "menu_", "=_", "Qt", "Gui_", "._", "QM", "enu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "set", "Menu_", "(_", "self_", "._", "\\u", "menu_", ")_", "\\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 ", " _", "self_", "._", "control_", "=_", "Qt", "Gui_", "._", "QP", "ush", "Button_", "(_", "self_", "._", "string", "\\u", "value_", "(_", "label_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "menu_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "set", "Auto", "Default_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "self_", "._", "factory_", "._", "label", "\\u", "value_", ",_", "'", "label", "'_", ",_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "clicked_", "._", "connect_", "(_", "self_", "._", "update", "\\u", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "tooltip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "label", "\\u", "changed_", "(_", "self_", ",_", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "control_", "._", "set", "Text_", "(_", "self_", "._", "string", "\\u", "value_", "(_", "label_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "menu_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "menu_", "._", "block", "Signals_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "menu_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "getattr_", "(_", "self_", "._", "object_", ",_", "self_", "._", "factory_", "._", "values", "\\u", "trait_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action_", "=_", "self_", "._", "\\u", "menu_", "._", "add", "Action_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "._", "triggered_", "._", "connect_", "(_", "lambda_", "event_", ",_", "name_", "=_", "item_", ":_", "self_", "._", "\\u", "menu", "\\u", "selected_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "selecte", "d\\u", "item_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "menu_", "._", "block", "Signals_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "menu", "\\u", "selected_", "(_", "self_", ",_", "item", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "selecte", "d\\u", "item_", "=_", "item", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label_", "=_", "item", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Handle", "s", " ", "the", " ", "user", " ", "click", "ing", " ", "the", " ", "button", " ", "by", " ", "setti", "ng", " ", "the", " ", "factor", "y", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "the", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "selecte", "d\\u", "item_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "self_", "._", "selecte", "d\\u", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "self_", "._", "factory_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "is", " ", "an", " ", "associate", "d", " ", "view", ",", " ", "then", " ", "display", " ", "it", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "factory_", "is_", "not_", "None_", ")_", "and_", "(_", "self_", "._", "factory_", "._", "view_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "object_", "._", "edit", "\\u", "traits_", "(_", "view_", "=_", "self_", "._", "factory_", "._", "view_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "self_", "._", "control_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "editor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Update", "s", " ", "the", " ", "editor", " ", "whe", "n", " ", "the", " ", "object", " ", "tra", "it", " ", "change", "s", " ", "external", "ly", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "editor", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Custom", "Editor_", "(_", "Simple", "Editor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Custom", " ", "style", " ", "editor", " ", "for", " ", "a", " ", "button", ",", " ", "whi", "ch", " ", "can", " ", "contain", " ", "an", " ", "image", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "mapping", " ", "of", " ", "button", " ", "style", "s", " ", "to", " ", "Qt", " ", "classe", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE", "\\u", "MAP_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "checkb", "ox", "'_", ":_", "Qt", "Gui_", "._", "QC", "heck", "Box_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "radio", "'_", ":_", "Qt", "Gui_", "._", "QR", "adio", "Button_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "toolb", "ar", "'_", ":_", "Qt", "Gui_", "._", "QT", "ool", "Button_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Finish", "es", " ", "initiali", "zin", "g", " ", "the", " ", "editor", " ", "by", " ", "creati", "ng", " ", "the", " ", "underl", "ying", " ", "toolkit_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "widget", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Custom", "Editor_", "(_", "Simple", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "init_", "(_", "self_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Finish", "es", " ", "initiali", "zin", "g", " ", "the", " ", "editor", " ", "by", " ", "creati", "ng", " ", "the", " ", "underl", "ying", " ", "tool", "kit", "\\", "10", ";", " ", " ", " ", " ", "widget", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "We", " ", "ignore", " ", "orientation", ",", " ", "widt", "h", "\\u", "padd", "ing", " ", "and", " ", "height", "\\u", "padd", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "factory_", "=_", "self_", "._", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bt", "ype_", "=_", "self_", "._", "\\u", "STYLE", "\\u", "MAP_", "._", "get_", "(_", "factory_", "._", "style_", ",_", "Qt", "Gui_", "._", "QP", "ush", "Button_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "=_", "bt", "ype_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "set", "Text_", "(_", "self_", "._", "string", "\\u", "value_", "(_", "factory_", "._", "label_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "factory_", "._", "image_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "control_", "._", "set", "Icon_", "(_", "factory_", "._", "image_", "._", "create", "\\u", "icon_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "self_", "._", "control_", ",_", "Qt", "Core_", "._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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 ]
Unused import
Impactstory/total-impact-core/totalimpact/providers/twitter.py
[ { "content": "import os, re\n\nfrom totalimpact.providers import provider\nfrom totalimpact.providers.provider import Provider, ProviderContentMalformedError, ProviderRateLimitError\nfrom totalimpact.providers.twitter_paging import TwitterPager\nfrom birdy.twitter import AppClient\nfrom birdy.twitter import TwitterApiError, TwitterRateLimitError, TwitterClientError\n\nimport logging\nlogger = logging.getLogger('ti.providers.twitter')\n\n\n\n\n \n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Twitter(Provider): \n\n example_id = (\"url\", \"http://twitter.com/jasonpriem\")\n\n url = \"http://twitter.com\"\n descr = \"Social networking and microblogging service.\"\n member_items_url_template = \"http://twitter.com/%s\"\n provenance_url_templates = {\n \"twitter:followers\": \"https://twitter.com/%s/followers\",\n \"twitter:lists\": \"https://twitter.com/%s/memberships\",\n \"twitter:number_tweets\": \"https://twitter.com/%s\"\n }\n\n static_meta_dict = {\n \"followers\": {\n \"display_name\": \"followers\",\n \"provider\": \"Twitter\",\n \"provider_url\": \"http://twitter.com\",\n \"description\": \"The number of people following this Twitter account\",\n \"icon\": \"https://twitter.com/favicon.ico\"\n },\n \"lists\": {\n \"display_name\": \"lists\",\n \"provider\": \"Twitter\",\n \"provider_url\": \"http://twitter.com\",\n \"description\": \"The number of people who have included this Twitter account in a Twitter list\",\n \"icon\": \"https://twitter.com/favicon.ico\"\n },\n \"number_tweets\": {\n \"display_name\": \"number of tweets\",\n \"provider\": \"Twitter\",\n \"provider_url\": \"http://twitter.com\",\n \"description\": \"The number of tweets from this Twitter account\",\n \"icon\": \"https://twitter.com/favicon.ico\"\n } \n } \n\n\n\n\n\n\n\n\n\n\n \n\n\n \n\n\n\n\n # overriding default because different provenance url for each metric", "metadata": "root.Twitter", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self):\n super(Twitter, self).__init__()\n self.client = AppClient(os.getenv(\"TWITTER_CONSUMER_KEY\"), \n os.getenv(\"TWITTER_CONSUMER_SECRET\"),\n os.getenv(\"TWITTER_ACCESS_TOKEN\"))", "metadata": "root.Twitter.__init__", "header": "['class', 'Twitter', '(', 'Provider', ')', ':', '___EOS___']", "index": 48 }, { "content": " @property\n def provides_biblio(self):\n return True", "metadata": "root.Twitter.provides_biblio", "header": "['class', 'Twitter', '(', 'Provider', ')', ':', '___EOS___']", "index": 55 }, { "content": " @property\n def provides_metrics(self):\n return True", "metadata": "root.Twitter.provides_metrics", "header": "['class', 'Twitter', '(', 'Provider', ')', ':', '___EOS___']", "index": 59 }, { "content": " def is_relevant_alias(self, alias):\n (namespace, nid) = alias\n try:\n nid = nid.lower()\n except AttributeError:\n return False \n if (namespace == \"url\"):\n if (\"twitter.com\" in nid) and (\"/status/\" not in nid):\n return True\n return False", "metadata": "root.Twitter.is_relevant_alias", "header": "['class', 'Twitter', '(', 'Provider', ')', ':', '___EOS___']", "index": 63 }, { "content": " def screen_name(self, nid):\n #regex from http://stackoverflow.com/questions/4424179/how-to-validate-a-twitter-username-using-regex\n match = re.findall(\"twitter.com/([A-Za-z0-9_]{1,15}$)\", nid)\n return match[0]", "metadata": "root.Twitter.screen_name", "header": "['class', 'Twitter', '(', 'Provider', ')', ':', '___EOS___']", "index": 75 }, { "content": " def member_items(self, \n query_string, \n provider_url_template=None, \n cache_enabled=True):\n\n twitter_username = query_string.replace(\"@\", \"\")\n url = self._get_templated_url(self.member_items_url_template, twitter_username, \"members\")\n members = [(\"url\", url)]\n return(members)", "metadata": "root.Twitter.member_items", "header": "['class', 'Twitter', '(', 'Provider', ')', ':', '___EOS___']", "index": 81 }, { "content": " def get_account_data(self, aliases, number_tweets=20, max_pages=1):\n nid = self.get_best_id(aliases)\n if not nid:\n return None\n\n response_list = []\n def save_to_list(r):\n if r.data:\n response_list.extend(r.data)\n\n pager = TwitterPager(os.getenv(\"TWITTER_CONSUMER_KEY\"), \n os.getenv(\"TWITTER_CONSUMER_SECRET\"),\n os.getenv(\"TWITTER_ACCESS_TOKEN\"), \n default_max_pages=max_pages)\n\n try:\n r = pager.paginated_search(\n page_handler=save_to_list,\n screen_name=self.screen_name(nid), \n count=number_tweets, \n contributor_details=True, \n include_rts=True,\n exclude_replies=False,\n trim_user=False\n )\n except TwitterApiError:\n logger.error(\"TwitterApiError error, skipping\")\n return None\n except TwitterClientError:\n logger.error(\"TwitterClientError error, skipping\")\n return None\n return response_list ", "metadata": "root.Twitter.get_account_data", "header": "['class', 'Twitter', '(', 'Provider', ')', ':', '___EOS___']", "index": 92 }, { "content": " def biblio(self, \n aliases,\n provider_url_template=None,\n cache_enabled=True):\n\n biblio_dict = {}\n biblio_dict[\"repository\"] = \"Twitter\"\n\n data_list = self.get_account_data(aliases, number_tweets=1)\n if not data_list:\n return biblio_dict\n\n data = data_list[0][\"user\"]\n\n twitter_username = data[\"screen_name\"]\n twitter_username_with_at = u\"@{twitter_username}\".format(\n twitter_username=twitter_username)\n biblio_dict[\"title\"] = twitter_username_with_at\n biblio_dict[\"authors\"] = data[\"name\"]\n biblio_dict[\"description\"] = data[\"description\"]\n biblio_dict[\"created_at\"] = data[\"created_at\"]\n biblio_dict[\"url\"] = u\"http://twitter.com/{twitter_username}\".format(\n twitter_username=twitter_username)\n\n biblio_dict[\"is_account\"] = True # special key to tell webapp to render as genre heading\n biblio_dict[\"account\"] = twitter_username_with_at\n biblio_dict[\"genre\"] = \"account\"\n\n return biblio_dict", "metadata": "root.Twitter.biblio", "header": "['class', 'Twitter', '(', 'Provider', ')', ':', '___EOS___']", "index": 126 }, { "content": " def metrics(self, \n aliases,\n provider_url_template=None,\n cache_enabled=True):\n\n data_list = self.get_account_data(aliases, number_tweets=1)\n if not data_list:\n return {}\n data = data_list[0][\"user\"]\n\n dict_of_keylists = {\n 'twitter:followers' : ['followers_count'],\n 'twitter:lists' : ['listed_count'],\n 'twitter:number_tweets' : ['statuses_count']\n }\n\n metrics_dict = {}\n for field in dict_of_keylists:\n metric_value = data[dict_of_keylists[field][0]]\n if metric_value:\n metrics_dict[field] = metric_value\n\n metrics_and_drilldown = {}\n for metric_name in metrics_dict:\n drilldown_url = self.provenance_url(metric_name, aliases)\n metrics_and_drilldown[metric_name] = (metrics_dict[metric_name], drilldown_url)\n\n return metrics_and_drilldown ", "metadata": "root.Twitter.metrics", "header": "['class', 'Twitter', '(', 'Provider', ')', ':', '___EOS___']", "index": 158 }, { "content": " def provenance_url(self, metric_name, aliases):\n nid = self.get_best_id(aliases)\n if not nid:\n return None\n screen_name = self.screen_name(nid)\n provenance_url = self._get_templated_url(self.provenance_url_templates[metric_name], screen_name, \"provenance\")\n return provenance_url", "metadata": "root.Twitter.provenance_url", "header": "['class', 'Twitter', '(', 'Provider', ')', ':', '___EOS___']", "index": 189 } ]
[ { "span": "from totalimpact.providers import provider", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 42 }, { "span": "from totalimpact.providers.provider import Provider, ProviderContentMalformedError, ProviderRateLimitError", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 106 }, { "span": "from birdy.twitter import TwitterApiError, TwitterRateLimitError, TwitterClientError", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 84 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", ",_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "total", "impact", "_", "._", "providers_", "import_", "provider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "total", "impact", "_", "._", "providers_", "._", "provider_", "import_", "Provider_", ",_", "Provider", "Conten", "t", "Mal", "formed", "Error_", ",_", "Provider", "Rat", "e", "Limit", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "total", "impact", "_", "._", "providers_", "._", "twit", "ter", "\\u", "paging", "_", "import_", "Twit", "ter", "Page", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bird", "y_", "._", "twitter_", "import_", "App", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bird", "y_", "._", "twitter_", "import_", "Twit", "ter", "Ap", "i", "Error_", ",_", "Twit", "ter", "Rat", "e", "Limit", "Error_", ",_", "Twit", "ter", "Client", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "ti", ".", "provide", "rs", ".", "twit", "ter", "'_", ")_", "\\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_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "example", "\\u", "id_", "=_", "(_", "\"", "url", "\"_", ",_", "\"", "http", "://", "twit", "ter", ".", "com", "/", "jas", "onp", "rie", "m", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "http", "://", "twit", "ter", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "descr_", "=_", "\"", "Soci", "al", " ", "networking", " ", "and", " ", "micro", "blog", "ging", " ", "service", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "\\u", "items", "\\u", "url", "\\u", "template_", "=_", "\"", "http", "://", "twit", "ter", ".", "com", "/", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "provenance", "\\u", "url", "\\u", "templates_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "twit", "ter", ":", "followers", "\"_", ":_", "\"", "https", "://", "twit", "ter", ".", "com", "/", "%", "s", "/", "followers", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "twit", "ter", ":", "lists", "\"_", ":_", "\"", "https", "://", "twit", "ter", ".", "com", "/", "%", "s", "/", "memberships", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "twit", "ter", ":", "number", "\\u", "tweet", "s", "\"_", ":_", "\"", "https", "://", "twit", "ter", ".", "com", "/", "%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "static", "\\u", "meta", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "followers", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "display", "\\u", "name", "\"_", ":_", "\"", "followers", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "provide", "r", "\"_", ":_", "\"", "Twit", "ter", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "provide", "r", "\\u", "url", "\"_", ":_", "\"", "http", "://", "twit", "ter", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ":_", "\"", "The", " ", "number", " ", "of", " ", "people", " ", "follow", "ing", " ", "this", " ", "Twit", "ter", " ", "account", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "\"", "https", "://", "twit", "ter", ".", "com", "/", "fav", "icon", ".", "ico", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lists", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "display", "\\u", "name", "\"_", ":_", "\"", "lists", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "provide", "r", "\"_", ":_", "\"", "Twit", "ter", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "provide", "r", "\\u", "url", "\"_", ":_", "\"", "http", "://", "twit", "ter", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ":_", "\"", "The", " ", "number", " ", "of", " ", "people", " ", "who", " ", "have", " ", "include", "d", " ", "this", " ", "Twit", "ter", " ", "account", " ", "in", " ", "a", " ", "Twit", "ter", " ", "list", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "\"", "https", "://", "twit", "ter", ".", "com", "/", "fav", "icon", ".", "ico", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "number", "\\u", "tweet", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "display", "\\u", "name", "\"_", ":_", "\"", "number", " ", "of", " ", "tweet", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "provide", "r", "\"_", ":_", "\"", "Twit", "ter", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "provide", "r", "\\u", "url", "\"_", ":_", "\"", "http", "://", "twit", "ter", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ":_", "\"", "The", " ", "number", " ", "of", " ", "tweet", "s", " ", "from", " ", "this", " ", "Twit", "ter", " ", "account", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "\"", "https", "://", "twit", "ter", ".", "com", "/", "fav", "icon", ".", "ico", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "overrid", "ing", " ", "default", " ", "bec", "aus", "e", " ", "different", " ", "provenance", " ", "url", " ", "for", " ", "each", " ", "metric_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\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_", "(_", "Twit", "ter_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "=_", "App", "Client_", "(_", "os_", "._", "getenv_", "(_", "\"", "TWITTER", "\\u", "CONSU", "MER", "\\u", "KEY", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "getenv_", "(_", "\"", "TWITTER", "\\u", "CONSU", "MER", "\\u", "SEC", "RET", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "getenv_", "(_", "\"", "TWITTER", "\\u", "ACCESS", "\\u", "TOKEN", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\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_", "provide", "s", "\\u", "biblio", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\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_", "provide", "s", "\\u", "metrics_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "rele", "van", "t", "\\u", "alias_", "(_", "self_", ",_", "alias_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "namespace_", ",_", "nid_", ")_", "=_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nid_", "=_", "nid_", "._", "lower_", "(_", ")_", "\\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 ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "namespace_", "==_", "\"", "url", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "\"", "twit", "ter", ".", "com", "\"_", "in_", "nid_", ")_", "and_", "(_", "\"/", "status", "/\"_", "not_", "in_", "nid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "screen", "\\u", "name_", "(_", "self_", ",_", "nid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "regex", " ", "from", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "442", "417", "9", "/", "how", "-", "to", "-", "validat", "e-", "a", "-", "twit", "ter", "-", "user", "name", "-", "usi", "ng", "-", "regex_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "findall_", "(_", "\"", "twit", "ter", ".", "com", "/([", "A", "-", "Za", "-", "z", "0", "-", "9", "\\u]", "{", "1", ",", "15", "}$", ")\"_", ",_", "nid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "match_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "member", "\\u", "items_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "query", "\\u", "string_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "r", "\\u", "url", "\\u", "template_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "enabled_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "twit", "ter", "\\u", "username_", "=_", "query", "\\u", "string_", "._", "replace_", "(_", "\"@\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "\\u", "get", "\\u", "template", "d\\u", "url_", "(_", "self_", "._", "member", "\\u", "items", "\\u", "url", "\\u", "template_", ",_", "twit", "ter", "\\u", "username_", ",_", "\"", "member", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "members_", "=_", "[_", "(_", "\"", "url", "\"_", ",_", "url_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "members_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "account", "\\u", "data_", "(_", "self_", ",_", "aliases_", ",_", "number", "\\u", "tweets_", "=_", "20_", ",_", "max", "\\u", "pages_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nid_", "=_", "self_", "._", "get", "\\u", "best", "\\u", "id_", "(_", "aliases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "nid_", ":_", "\\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_", "response", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "save", "\\u", "to", "\\u", "list_", "(_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "r_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "list_", "._", "extend_", "(_", "r_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pager_", "=_", "Twit", "ter", "Page", "r_", "(_", "os_", "._", "getenv_", "(_", "\"", "TWITTER", "\\u", "CONSU", "MER", "\\u", "KEY", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "getenv_", "(_", "\"", "TWITTER", "\\u", "CONSU", "MER", "\\u", "SEC", "RET", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "getenv_", "(_", "\"", "TWITTER", "\\u", "ACCESS", "\\u", "TOKEN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "max", "\\u", "pages_", "=_", "max", "\\u", "pages_", ")_", "\\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 ", " _", "r_", "=_", "pager_", "._", "paginated", "\\u", "search_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "page", "\\u", "handler_", "=_", "save", "\\u", "to", "\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "screen", "\\u", "name_", "=_", "self_", "._", "screen", "\\u", "name_", "(_", "nid_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "number", "\\u", "tweets_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contributor", "\\u", "details_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "rts_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "replies_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trim", "\\u", "user_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Twit", "ter", "Ap", "i", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Twit", "ter", "Ap", "i", "Error", " ", "error", ",", " ", "skip", "ping", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Twit", "ter", "Client", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Twit", "ter", "Client", "Error", " ", "error", ",", " ", "skip", "ping", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "biblio", "_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aliases_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "r", "\\u", "url", "\\u", "template_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "enabled_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "biblio", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "biblio", "\\u", "dict_", "[_", "\"", "repos", "itor", "y", "\"_", "]_", "=_", "\"", "Twit", "ter", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "list_", "=_", "self_", "._", "get", "\\u", "account", "\\u", "data_", "(_", "aliases_", ",_", "number", "\\u", "tweets_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "biblio", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "data\\u", "list_", "[_", "0_", "]_", "[_", "\"", "user", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "twit", "ter", "\\u", "username_", "=_", "data_", "[_", "\"", "screen", "\\u", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twit", "ter", "\\u", "user", "name", "\\u", "with", "\\u", "at_", "=_", "u", "\"@", "{", "twit", "ter", "\\u", "user", "name", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "twit", "ter", "\\u", "username_", "=_", "twit", "ter", "\\u", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "biblio", "\\u", "dict_", "[_", "\"", "title", "\"_", "]_", "=_", "twit", "ter", "\\u", "user", "name", "\\u", "with", "\\u", "at_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "biblio", "\\u", "dict_", "[_", "\"", "author", "s", "\"_", "]_", "=_", "data_", "[_", "\"", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "biblio", "\\u", "dict_", "[_", "\"", "description", "\"_", "]_", "=_", "data_", "[_", "\"", "description", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "biblio", "\\u", "dict_", "[_", "\"", "created", "\\u", "at", "\"_", "]_", "=_", "data_", "[_", "\"", "created", "\\u", "at", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "biblio", "\\u", "dict_", "[_", "\"", "url", "\"_", "]_", "=_", "u", "\"", "http", "://", "twit", "ter", ".", "com", "/{", "twit", "ter", "\\u", "user", "name", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "twit", "ter", "\\u", "username_", "=_", "twit", "ter", "\\u", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "biblio", "\\u", "dict_", "[_", "\"", "is", "\\u", "account", "\"_", "]_", "=_", "True_", "#", " ", "special", " ", "key", " ", "to", " ", "tell", " ", "weba", "pp", " ", "to", " ", "render", " ", "as", " ", "genr", "e", " ", "heading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "biblio", "\\u", "dict_", "[_", "\"", "account", "\"_", "]_", "=_", "twit", "ter", "\\u", "user", "name", "\\u", "with", "\\u", "at_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "biblio", "\\u", "dict_", "[_", "\"", "genr", "e", "\"_", "]_", "=_", "\"", "account", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "biblio", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "metrics_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aliases_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "r", "\\u", "url", "\\u", "template_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "enabled_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "list_", "=_", "self_", "._", "get", "\\u", "account", "\\u", "data_", "(_", "aliases_", ",_", "number", "\\u", "tweets_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data\\u", "list_", ":_", "\\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_", "data_", "=_", "data\\u", "list_", "[_", "0_", "]_", "[_", "\"", "user", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dict", "\\u", "of", "\\u", "keyli", "sts_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "twit", "ter", ":", "followers", "'_", ":_", "[_", "'", "followers", "\\u", "count", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "twit", "ter", ":", "lists", "'_", ":_", "[_", "'", "liste", "d\\u", "count", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "twit", "ter", ":", "number", "\\u", "tweet", "s", "'_", ":_", "[_", "'", "status", "es", "\\u", "count", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "s", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "dict", "\\u", "of", "\\u", "keyli", "sts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metric", "\\u", "value_", "=_", "data_", "[_", "dict", "\\u", "of", "\\u", "keyli", "sts_", "[_", "field_", "]_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "metric", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metric", "s", "\\u", "dict_", "[_", "field_", "]_", "=_", "metric", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metric", "s", "\\u", "and", "\\u", "drill", "down_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "metric", "\\u", "name_", "in_", "metric", "s", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drill", "down", "\\u", "url_", "=_", "self_", "._", "provenance", "\\u", "url_", "(_", "metric", "\\u", "name_", ",_", "aliases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metric", "s", "\\u", "and", "\\u", "drill", "down_", "[_", "metric", "\\u", "name_", "]_", "=_", "(_", "metric", "s", "\\u", "dict_", "[_", "metric", "\\u", "name_", "]_", ",_", "drill", "down", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "metric", "s", "\\u", "and", "\\u", "drill", "down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter_", "(_", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "provenance", "\\u", "url_", "(_", "self_", ",_", "metric", "\\u", "name_", ",_", "aliases_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nid_", "=_", "self_", "._", "get", "\\u", "best", "\\u", "id_", "(_", "aliases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "nid_", ":_", "\\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_", "screen", "\\u", "name_", "=_", "self_", "._", "screen", "\\u", "name_", "(_", "nid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "provenance", "\\u", "url_", "=_", "self_", "._", "\\u", "get", "\\u", "template", "d\\u", "url_", "(_", "self_", "._", "provenance", "\\u", "url", "\\u", "templates_", "[_", "metric", "\\u", "name_", "]_", ",_", "screen", "\\u", "name_", ",_", "\"", "provenance", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "provenance", "\\u", "url_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
sympy/sympy/sympy/stats/tests/test_rv.py
[ { "content": "def test_where():\n X, Y = Die('X'), Die('Y')\n Z = Normal('Z', 0, 1)\n\n assert where(Z**2 <= 1).set == Interval(-1, 1)\n assert where(\n Z**2 <= 1).as_boolean() == Interval(-1, 1).as_relational(Z.symbol)\n assert where(And(X > Y, Y > 4)).as_boolean() == And(\n Eq(X.symbol, 6), Eq(Y.symbol, 5))\n\n assert len(where(X < 3).set) == 2\n assert 1 in where(X < 3).set\n\n X, Y = Normal('X', 0, 1), Normal('Y', 0, 1)\n assert where(And(X**2 <= 1, X >= 0)).set == Interval(0, 1)\n XX = given(X, And(X**2 <= 1, X >= 0))\n assert XX.pspace.domain.set == Interval(0, 1)\n assert XX.pspace.domain.as_boolean() == \\\n And(0 <= X.symbol, X.symbol**2 <= 1, -oo < X.symbol, X.symbol < oo)\n\n with raises(TypeError):\n XX = given(X, X + 3)", "metadata": "root.test_where", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def test_RandomSymbol():\n\n X = Normal('x', 0, 1)\n Y = Normal('x', 0, 2)\n assert X.symbol == Y.symbol\n assert X != Y\n\n assert X.name == X.symbol.name\n\n X = Normal('lambda', 0, 1) # make sure we can use protected terms\n X = Normal('Lambda', 0, 1) # make sure we can use SymPy terms", "metadata": "root.test_RandomSymbol", "header": "['module', '___EOS___']", "index": 66 } ]
[ { "span": "XX ", "start_line": 33, "start_column": 8, "end_line": 33, "end_column": 10 }, { "span": "X ", "start_line": 76, "start_column": 4, "end_line": 76, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "where_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", ",_", "Y_", "=_", "Die", "_", "(_", "'", "X", "'_", ")_", ",_", "Die", "_", "(_", "'", "Y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Z_", "=_", "Normal_", "(_", "'", "Z", "'_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "where_", "(_", "Z_", "**_", "2_", "<=_", "1_", ")_", "._", "set_", "==_", "Interval_", "(_", "-_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "where_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Z_", "**_", "2_", "<=_", "1_", ")_", "._", "as", "\\u", "boolean_", "(_", ")_", "==_", "Interval_", "(_", "-_", "1_", ",_", "1_", ")_", "._", "as", "\\u", "relation", "al_", "(_", "Z_", "._", "symbol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "where_", "(_", "And_", "(_", "X_", ">_", "Y_", ",_", "Y_", ">_", "4_", ")_", ")_", "._", "as", "\\u", "boolean_", "(_", ")_", "==_", "And_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Eq_", "(_", "X_", "._", "symbol_", ",_", "6_", ")_", ",_", "Eq_", "(_", "Y_", "._", "symbol_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "where_", "(_", "X_", "<_", "3_", ")_", "._", "set_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "1_", "in_", "where_", "(_", "X_", "<_", "3_", ")_", "._", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", ",_", "Y_", "=_", "Normal_", "(_", "'", "X", "'_", ",_", "0_", ",_", "1_", ")_", ",_", "Normal_", "(_", "'", "Y", "'_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "where_", "(_", "And_", "(_", "X_", "**_", "2_", "<=_", "1_", ",_", "X_", ">=_", "0_", ")_", ")_", "._", "set_", "==_", "Interval_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XX_", "=_", "given_", "(_", "X_", ",_", "And_", "(_", "X_", "**_", "2_", "<=_", "1_", ",_", "X_", ">=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "XX_", "._", "psp", "ace_", "._", "domain_", "._", "set_", "==_", "Interval_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "XX_", "._", "psp", "ace_", "._", "domain_", "._", "as", "\\u", "boolean_", "(_", ")_", "==_", "And_", "(_", "0_", "<=_", "X_", "._", "symbol_", ",_", "X_", "._", "symbol_", "**_", "2_", "<=_", "1_", ",_", "-_", "oo_", "<_", "X_", "._", "symbol_", ",_", "X_", "._", "symbol_", "<_", "oo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "XX_", "=_", "given_", "(_", "X_", ",_", "X_", "+_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Random", "Symbol_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", "=_", "Normal_", "(_", "'", "x", "'_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "Normal_", "(_", "'", "x", "'_", ",_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "X_", "._", "symbol_", "==_", "Y_", "._", "symbol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "X_", "!=_", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "X_", "._", "name_", "==_", "X_", "._", "symbol_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "Normal_", "(_", "'", "lambda", "'_", ",_", "0_", ",_", "1_", ")_", "#", " ", "make", " ", "sure", " ", "we", " ", "can", " ", "use", " ", "protect", "ed", " ", "terms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Normal_", "(_", "'", "Lam", "bda", "'_", ",_", "0_", ",_", "1_", ")_", "#", " ", "make", " ", "sure", " ", "we", " ", "can", " ", "use", " ", "Sym", "Py", " ", "terms_", "\\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, 0, 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
simpeg/simpeg/setup.py
[ { "content": "#!/usr/bin/env python\n\"\"\"SimPEG: Simulation and Parameter Estimation in Geophysics\n\nSimPEG is a python package for simulation and gradient based\nparameter estimation in the context of geophysical applications.\n\"\"\"\n\nimport numpy as np\n\nimport os\nimport sys\nimport subprocess\n\nfrom distutils.core import setup\nfrom setuptools import find_packages\nfrom distutils.extension import Extension\n\nCLASSIFIERS = [\n'Development Status :: 4 - Beta',\n'Intended Audience :: Developers',\n'Intended Audience :: Science/Research',\n'License :: OSI Approved :: MIT License',\n'Programming Language :: Python',\n'Topic :: Scientific/Engineering',\n'Topic :: Scientific/Engineering :: Mathematics',\n'Topic :: Scientific/Engineering :: Physics',\n'Operating System :: Microsoft :: Windows',\n'Operating System :: POSIX',\n'Operating System :: Unix',\n'Operating System :: MacOS',\n'Natural Language :: English',\n]\n\nargs = sys.argv[1:]\n\n# Make a `cleanall` rule to get rid of intermediate and library files\nif \"cleanall\" in args:\n print \"Deleting cython files...\"\n # Just in case the build directory was created by accident,\n # note that shell=True should be OK here because the command is constant.\n subprocess.Popen(\"rm -rf build\", shell=True, executable=\"/bin/bash\")\n subprocess.Popen(\"find . -name \\*.c -type f -delete\", shell=True, executable=\"/bin/bash\")\n subprocess.Popen(\"find . -name \\*.so -type f -delete\", shell=True, executable=\"/bin/bash\")\n # Now do a normal clean\n sys.argv[sys.argv.index('cleanall')] = \"clean\"\n\n# We want to always use build_ext --inplace\nif args.count(\"build_ext\") > 0 and args.count(\"--inplace\") == 0:\n sys.argv.insert(sys.argv.index(\"build_ext\")+1, \"--inplace\")\n\ntry:\n from Cython.Build import cythonize\n from Cython.Distutils import build_ext\n cythonKwargs = dict(cmdclass={'build_ext': build_ext})\n USE_CYTHON = True\nexcept Exception, e:\n USE_CYTHON = False\n cythonKwargs = dict()\n\next = '.pyx' if USE_CYTHON else '.c'\n\ncython_files = [\n \"SimPEG/Utils/interputils_cython\",\n \"SimPEG/Mesh/TreeUtils\"\n ]\nextensions = [Extension(f, [f+ext]) for f in cython_files]\nscripts = [f+'.pyx' for f in cython_files]\n\nif USE_CYTHON and \"cleanall\" not in args:\n from Cython.Build import cythonize\n extensions = cythonize(extensions)\n\nimport os, os.path\n\nwith open(\"README.rst\") as f:\n LONG_DESCRIPTION = ''.join(f.readlines())\n\nsetup(\n name = \"SimPEG\",\n version = \"0.1.10\",\n packages = find_packages(),\n install_requires = ['numpy>=1.7',\n 'scipy>=0.13',\n 'Cython'\n ],\n author = \"Rowan Cockett\",\n author_email = \"[email protected]\",\n description = \"SimPEG: Simulation and Parameter Estimation in Geophysics\",\n long_description = LONG_DESCRIPTION,\n license = \"MIT\",\n keywords = \"geophysics inverse problem\",\n url = \"http://simpeg.xyz/\",\n download_url = \"http://github.com/simpeg/simpeg\",\n classifiers=CLASSIFIERS,\n platforms = [\"Windows\", \"Linux\", \"Solaris\", \"Mac OS-X\", \"Unix\"],\n use_2to3 = False,\n include_dirs=[np.get_include()],\n ext_modules = extensions,\n scripts=scripts,\n **cythonKwargs\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 9 }, { "span": "import os, os.path", "start_line": 72, "start_column": 0, "end_line": 72, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Sim", "PE", "G", ":", " ", "Simul", "ation", " ", "and", " ", "Parameter", " ", "Estimat", "ion", " ", "in", " ", "Geo", "physi", "cs", "\\", "10", ";", "\\", "10", ";", "Sim", "PE", "G", " ", "is", " ", "a", " ", "python", " ", "package", " ", "for", " ", "simulati", "on", " ", "and", " ", "gradi", "ent", " ", "based", "\\", "10", ";", "parameter", " ", "estimati", "on", " ", "in", " ", "the", " ", "context", " ", "of", " ", "geop", "hys", "ical", " ", "applica", "tion", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "distutils_", "._", "core_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "extension_", "import_", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CLASSIF", "IER", "S_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "4", " ", "-", " ", "Beta", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Sci", "ence", "/", "Rese", "arch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "MIT", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sci", "enti", "fic", "/", "Engine", "erin", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sci", "enti", "fic", "/", "Engine", "erin", "g", " ", "::", " ", "Math", "ema", "tic", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sci", "enti", "fic", "/", "Engine", "erin", "g", " ", "::", " ", "Phys", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Micro", "soft", " ", "::", " ", "Window", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "POSI", "X", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Uni", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Mac", "OS", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nat", "ural", " ", "Lang", "ua", "ge", " ", "::", " ", "Eng", "lish", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "`", "clean", "all", "`", " ", "rule", " ", "to", " ", "get", " ", "rid", " ", "of", " ", "intermediate", " ", "and", " ", "librar", "y", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "clean", "all", "\"_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Del", "eti", "ng", " ", "cython", " ", "files", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "in", " ", "case", " ", "the", " ", "build", " ", "director", "y", " ", "was", " ", "created", " ", "by", " ", "accident", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", " ", "tha", "t", " ", "shell", "=", "Tru", "e", " ", "shou", "ld", " ", "be", " ", "OK", " ", "here", " ", "bec", "aus", "e", " ", "the", " ", "command", " ", "is", " ", "constant", "._", "\\u\\u\\uNL\\u\\u\\u_", "subprocess_", "._", "Popen_", "(_", "\"", "rm", " ", "-", "rf", " ", "build", "\"_", ",_", "shell_", "=_", "True_", ",_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "Popen_", "(_", "\"", "find", " ", ".", " ", "-", "name", " ", "\\\\*", ".", "c", " ", "-", "type", " ", "f", " ", "-", "delete", "\"_", ",_", "shell_", "=_", "True_", ",_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "Popen_", "(_", "\"", "find", " ", ".", " ", "-", "name", " ", "\\\\*", ".", "so", " ", "-", "type", " ", "f", " ", "-", "delete", "\"_", ",_", "shell_", "=_", "True_", ",_", "executable_", "=_", "\"/", "bin", "/", "bash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "do", " ", "a", " ", "normal", " ", "clean_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "argv_", "[_", "sys_", "._", "argv_", "._", "index_", "(_", "'", "clean", "all", "'_", ")_", "]_", "=_", "\"", "clean", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "want", " ", "to", " ", "alw", "ay", "s", " ", "use", " ", "build", "\\u", "ext", " ", "--", "inplace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "count_", "(_", "\"", "build", "\\u", "ext", "\"_", ")_", ">_", "0_", "and_", "args_", "._", "count_", "(_", "\"--", "inpla", "ce", "\"_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "argv_", "._", "insert_", "(_", "sys_", "._", "argv_", "._", "index_", "(_", "\"", "build", "\\u", "ext", "\"_", ")_", "+_", "1_", ",_", "\"--", "inpla", "ce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Cython", "_", "._", "Build_", "import_", "cython", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Cython", "_", "._", "Dist", "utils_", "import_", "build", "\\u", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cython", "Kwargs", "_", "=_", "dict_", "(_", "cmdclass_", "=_", "{_", "'", "build", "\\u", "ext", "'_", ":_", "build", "\\u", "ext_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "USE", "\\u", "CY", "THO", "N_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "USE", "\\u", "CY", "THO", "N_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cython", "Kwargs", "_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ext_", "=_", "'.", "pyx", "'_", "if_", "USE", "\\u", "CY", "THO", "N_", "else_", "'.", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cython", "\\u", "files_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sim", "PE", "G", "/", "Ut", "il", "s", "/", "interp", "util", "s", "\\u", "cython", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sim", "PE", "G", "/", "Mesh", "/", "Tree", "Ut", "il", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extensions_", "=_", "[_", "Extension_", "(_", "f_", ",_", "[_", "f_", "+_", "ext_", "]_", ")_", "for_", "f_", "in_", "cython", "\\u", "files_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scripts_", "=_", "[_", "f_", "+_", "'.", "pyx", "'_", "for_", "f_", "in_", "cython", "\\u", "files_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "USE", "\\u", "CY", "THO", "N_", "and_", "\"", "clean", "all", "\"_", "not_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Cython", "_", "._", "Build_", "import_", "cython", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extensions_", "=_", "cython", "ize_", "(_", "extensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "os_", ",_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "\"", "READ", "ME", ".", "rst", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LONG", "\\u", "DESCRIPTION_", "=_", "''_", "._", "join_", "(_", "f_", "._", "readlines_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Sim", "PE", "G", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\"", "0.", "1.1", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "'", "nump", "y", ">=", "1.7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sci", "py", ">=", "0.13", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cython", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "\"", "Row", "an", " ", "Coc", "ket", "t", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "\"", "row", "an", "@", "3p", "tsc", "ien", "ce", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Sim", "PE", "G", ":", " ", "Simul", "ation", " ", "and", " ", "Parameter", " ", "Estimat", "ion", " ", "in", " ", "Geo", "physi", "cs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "LONG", "\\u", "DESCRIPTION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "\"", "MIT", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "\"", "geop", "hys", "ics", " ", "inv", "erse", " ", "problem", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "http", "://", "simp", "eg", ".", "xyz", "/\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download", "\\u", "url_", "=_", "\"", "http", "://", "git", "hub", ".", "com", "/", "simp", "eg", "/", "simp", "eg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "CLASSIF", "IER", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platforms_", "=_", "[_", "\"", "Window", "s", "\"_", ",_", "\"", "Lin", "ux", "\"_", ",_", "\"", "Sol", "aris", "\"_", ",_", "\"", "Mac", " ", "OS", "-", "X", "\"_", ",_", "\"", "Uni", "x", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "2t", "o3", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "dirs_", "=_", "[_", "np_", "._", "get", "\\u", "include_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ext", "\\u", "modules_", "=_", "extensions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scripts_", "=_", "scripts_", ",_", "\\u\\u\\uN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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
pvlib/pvlib-python/pvlib/test/test_tracking.py
[ { "content": "import logging\npvl_logger = logging.getLogger('pvlib')\n\nimport datetime\n\nimport numpy as np\nfrom numpy import nan\nimport pandas as pd\n\nfrom nose.tools import raises, assert_almost_equals\nfrom nose.plugins.skip import SkipTest\nfrom pandas.util.testing import assert_frame_equal\n\nfrom pvlib.location import Location\nfrom pvlib import solarposition\nfrom pvlib import tracking\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_solar_noon():\n apparent_zenith = pd.Series([10])\n apparent_azimuth = pd.Series([180])\n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=0, axis_azimuth=0,\n max_angle=90, backtrack=True, \n gcr=2.0/7.0)\n \n expect = pd.DataFrame({'aoi': 10, 'surface_azimuth': 90,\n 'surface_tilt': 0, 'tracker_theta': 0},\n index=[0], dtype=np.float64)\n \n assert_frame_equal(expect, tracker_data)", "metadata": "root.test_solar_noon", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def test_azimuth_north_south():\n apparent_zenith = pd.Series([60])\n apparent_azimuth = pd.Series([90])\n\n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=0, axis_azimuth=180,\n max_angle=90, backtrack=True, \n gcr=2.0/7.0)\n \n expect = pd.DataFrame({'aoi': 0, 'surface_azimuth': 90,\n 'surface_tilt': 60, 'tracker_theta': -60},\n index=[0], dtype=np.float64)\n \n assert_frame_equal(expect, tracker_data)\n \n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=0, axis_azimuth=0,\n max_angle=90, backtrack=True, \n gcr=2.0/7.0)\n \n expect['tracker_theta'] *= -1\n \n assert_frame_equal(expect, tracker_data)", "metadata": "root.test_azimuth_north_south", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def test_max_angle():\n apparent_zenith = pd.Series([60])\n apparent_azimuth = pd.Series([90])\n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=0, axis_azimuth=0,\n max_angle=45, backtrack=True, \n gcr=2.0/7.0)\n \n expect = pd.DataFrame({'aoi': 15, 'surface_azimuth': 90,\n 'surface_tilt': 45, 'tracker_theta': 45},\n index=[0], dtype=np.float64)\n \n assert_frame_equal(expect, tracker_data)", "metadata": "root.test_max_angle", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def test_backtrack():\n apparent_zenith = pd.Series([80])\n apparent_azimuth = pd.Series([90])\n\n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=0, axis_azimuth=0,\n max_angle=90, backtrack=False, \n gcr=2.0/7.0)\n \n expect = pd.DataFrame({'aoi': 0, 'surface_azimuth': 90,\n 'surface_tilt': 80, 'tracker_theta': 80},\n index=[0], dtype=np.float64)\n \n assert_frame_equal(expect, tracker_data)\n \n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=0, axis_azimuth=0,\n max_angle=90, backtrack=True, \n gcr=2.0/7.0)\n \n expect = pd.DataFrame({'aoi': 52.5716, 'surface_azimuth': 90,\n 'surface_tilt': 27.42833, 'tracker_theta': 27.4283},\n index=[0], dtype=np.float64)\n \n assert_frame_equal(expect, tracker_data)", "metadata": "root.test_backtrack", "header": "['module', '___EOS___']", "index": 73 }, { "content": "def test_axis_tilt():\n apparent_zenith = pd.Series([30])\n apparent_azimuth = pd.Series([135])\n\n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=30, axis_azimuth=180,\n max_angle=90, backtrack=True, \n gcr=2.0/7.0)\n \n expect = pd.DataFrame({'aoi': 7.286245, 'surface_azimuth': 142.65730,\n 'surface_tilt': 35.98741, 'tracker_theta': -20.88121},\n index=[0], dtype=np.float64)\n \n assert_frame_equal(expect, tracker_data)\n \n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=30, axis_azimuth=0,\n max_angle=90, backtrack=True, \n gcr=2.0/7.0)\n \n expect = pd.DataFrame({'aoi': 47.6632, 'surface_azimuth': 50.96969,\n 'surface_tilt': 42.5152, 'tracker_theta': 31.6655},\n index=[0], dtype=np.float64)\n \n assert_frame_equal(expect, tracker_data)", "metadata": "root.test_axis_tilt", "header": "['module', '___EOS___']", "index": 100 }, { "content": "def test_axis_azimuth():\n apparent_zenith = pd.Series([30])\n apparent_azimuth = pd.Series([90])\n\n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=0, axis_azimuth=90,\n max_angle=90, backtrack=True, \n gcr=2.0/7.0)\n \n expect = pd.DataFrame({'aoi': 30, 'surface_azimuth': 180,\n 'surface_tilt': 0, 'tracker_theta': 0},\n index=[0], dtype=np.float64)\n \n assert_frame_equal(expect, tracker_data)\n \n apparent_zenith = pd.Series([30])\n apparent_azimuth = pd.Series([180])\n \n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=0, axis_azimuth=90,\n max_angle=90, backtrack=True, \n gcr=2.0/7.0)\n \n expect = pd.DataFrame({'aoi': 0, 'surface_azimuth': 180,\n 'surface_tilt': 30, 'tracker_theta': 30},\n index=[0], dtype=np.float64)\n \n assert_frame_equal(expect, tracker_data)", "metadata": "root.test_axis_azimuth", "header": "['module', '___EOS___']", "index": 127 }, { "content": "@raises(ValueError)\ndef test_index_mismatch():\n apparent_zenith = pd.Series([30])\n apparent_azimuth = pd.Series([90,180])\n\n tracker_data = tracking.singleaxis(apparent_zenith, apparent_azimuth,\n axis_tilt=0, axis_azimuth=90,\n max_angle=90, backtrack=True, \n gcr=2.0/7.0)", "metadata": "root.test_index_mismatch", "header": "['module', '___EOS___']", "index": 157 }, { "content": "def test_SingleAxisTracker_creation():\n system = tracking.SingleAxisTracker(max_angle=45,\n gcr=.25,\n module='blah',\n inverter='blarg')\n\n assert system.max_angle == 45\n assert system.gcr == .25\n assert system.module == 'blah'\n assert system.inverter == 'blarg'", "metadata": "root.test_SingleAxisTracker_creation", "header": "['module', '___EOS___']", "index": 168 }, { "content": "def test_SingleAxisTracker_tracking():\n system = tracking.SingleAxisTracker(max_angle=90, axis_tilt=30,\n axis_azimuth=180, gcr=2.0/7.0,\n backtrack=True)\n\n apparent_zenith = pd.Series([30])\n apparent_azimuth = pd.Series([135])\n\n tracker_data = system.singleaxis(apparent_zenith, apparent_azimuth)\n \n expect = pd.DataFrame({'aoi': 7.286245, 'surface_azimuth': 142.65730 ,\n 'surface_tilt': 35.98741, 'tracker_theta': -20.88121},\n index=[0], dtype=np.float64)\n \n assert_frame_equal(expect, tracker_data)\n\n ### results calculated using PVsyst\n pvsyst_solar_azimuth = 7.1609\n pvsyst_solar_height = 27.315\n pvsyst_axis_tilt = 20.\n pvsyst_axis_azimuth = 20.\n pvsyst_system = tracking.SingleAxisTracker(max_angle=60.,\n axis_tilt=pvsyst_axis_tilt,\n axis_azimuth=180+pvsyst_axis_azimuth,\n backtrack=False)\n # the definition of azimuth is different from PYsyst\n apparent_azimuth = pd.Series([180+pvsyst_solar_azimuth])\n apparent_zenith = pd.Series([90-pvsyst_solar_height])\n tracker_data = pvsyst_system.singleaxis(apparent_zenith, apparent_azimuth)\n expect = pd.DataFrame({'aoi': 41.07852 , 'surface_azimuth': 180-18.432 ,\n 'surface_tilt': 24.92122 , 'tracker_theta': -15.18391},\n index=[0], dtype=np.float64)\n\n assert_frame_equal(expect, tracker_data)", "metadata": "root.test_SingleAxisTracker_tracking", "header": "['module', '___EOS___']", "index": 180 }, { "content": "def test_LocalizedSingleAxisTracker_creation():\n localized_system = tracking.LocalizedSingleAxisTracker(latitude=32,\n longitude=-111,\n module='blah',\n inverter='blarg')\n\n assert localized_system.module == 'blah'\n assert localized_system.inverter == 'blarg'\n assert localized_system.latitude == 32\n assert localized_system.longitude == -111", "metadata": "root.test_LocalizedSingleAxisTracker_creation", "header": "['module', '___EOS___']", "index": 217 }, { "content": "def test_SingleAxisTracker_localize():\n system = tracking.SingleAxisTracker(max_angle=45, gcr=.25,\n module='blah', inverter='blarg')\n\n localized_system = system.localize(latitude=32, longitude=-111)\n\n assert localized_system.module == 'blah'\n assert localized_system.inverter == 'blarg'\n assert localized_system.latitude == 32\n assert localized_system.longitude == -111", "metadata": "root.test_SingleAxisTracker_localize", "header": "['module', '___EOS___']", "index": 229 }, { "content": "def test_SingleAxisTracker_localize_location():\n system = tracking.SingleAxisTracker(max_angle=45, gcr=.25,\n module='blah', inverter='blarg')\n location = Location(latitude=32, longitude=-111)\n localized_system = system.localize(location=location)\n\n assert localized_system.module == 'blah'\n assert localized_system.inverter == 'blarg'\n assert localized_system.latitude == 32\n assert localized_system.longitude == -111", "metadata": "root.test_SingleAxisTracker_localize_location", "header": "['module', '___EOS___']", "index": 241 }, { "content": "def test_get_irradiance():\n system = tracking.SingleAxisTracker(max_angle=90, axis_tilt=30,\n axis_azimuth=180, gcr=2.0/7.0,\n backtrack=True)\n times = pd.DatetimeIndex(start='20160101 1200-0700',\n end='20160101 1800-0700', freq='6H')\n location = Location(latitude=32, longitude=-111)\n solar_position = location.get_solarposition(times)\n irrads = pd.DataFrame({'dni':[900,0], 'ghi':[600,0], 'dhi':[100,0]},\n index=times)\n solar_zenith = solar_position['apparent_zenith']\n solar_azimuth = solar_position['azimuth']\n tracker_data = system.singleaxis(solar_zenith, solar_azimuth)\n \n irradiance = system.get_irradiance(irrads['dni'],\n irrads['ghi'],\n irrads['dhi'],\n solar_zenith=solar_zenith,\n solar_azimuth=solar_azimuth,\n surface_tilt=tracker_data['surface_tilt'],\n surface_azimuth=tracker_data['surface_azimuth'])\n \n expected = pd.DataFrame(data=np.array(\n [[ 961.80070, 815.94490, 145.85580, 135.32820,\n 10.52757492],\n [ nan, nan, nan, nan,\n nan]]),\n columns=['poa_global', 'poa_direct',\n 'poa_diffuse', 'poa_sky_diffuse',\n 'poa_ground_diffuse'],\n index=times)\n\n irradiance = np.round(irradiance, 4)\n expected = np.round(expected, 4)\n assert_frame_equal(irradiance, expected)", "metadata": "root.test_get_irradiance", "header": "['module', '___EOS___']", "index": 253 } ]
[ { "span": "import datetime", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 15 }, { "span": "from nose.tools import raises, assert_almost_equals", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 51 }, { "span": "from nose.plugins.skip import SkipTest", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 38 }, { "span": "from pvlib import solarposition", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv", "l\\u", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "pv", "lib", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "import_", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "raises_", ",_", "assert", "\\u", "alm", "ost", "\\u", "equals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "plugins_", "._", "skip_", "import_", "Ski", "p", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "._", "util_", "._", "testing_", "import_", "assert", "\\u", "frame", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pv", "lib_", "._", "location_", "import_", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pv", "lib_", "import_", "solar", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pv", "lib_", "import_", "tracking_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "solar", "\\u", "noo", "n_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appare", "nt", "\\u", "zen", "ith", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "10_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appare", "nt", "\\u", "azimuth", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "180_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "0_", ",_", "axis", "\\u", "azimuth", "_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "90_", ",_", "backtrack", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "10_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "90_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "0_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "azimuth", "\\u", "north", "\\u", "south_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appare", "nt", "\\u", "zen", "ith", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "60_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appare", "nt", "\\u", "azimuth", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "90_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "0_", ",_", "axis", "\\u", "azimuth", "_", "=_", "180_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "90_", ",_", "backtrack", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "0_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "90_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "60_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "-_", "60_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "0_", ",_", "axis", "\\u", "azimuth", "_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "90_", ",_", "backtrack", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "[_", "'", "track", "er", "\\u", "theta", "'_", "]_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "max", "\\u", "angle_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appare", "nt", "\\u", "zen", "ith", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "60_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appare", "nt", "\\u", "azimuth", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "90_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "0_", ",_", "axis", "\\u", "azimuth", "_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "45_", ",_", "backtrack", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "15_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "90_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "45_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "45_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "backtrack", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appare", "nt", "\\u", "zen", "ith", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "80_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appare", "nt", "\\u", "azimuth", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "90_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "0_", ",_", "axis", "\\u", "azimuth", "_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "90_", ",_", "backtrack", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "0_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "90_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "80_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "80_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "0_", ",_", "axis", "\\u", "azimuth", "_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "90_", ",_", "backtrack", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "52.", "571", "6_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "90_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "27.", "428", "33_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "27.", "428", "3_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "axis", "\\u", "tilt", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appare", "nt", "\\u", "zen", "ith", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "30_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appare", "nt", "\\u", "azimuth", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "135_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "30_", ",_", "axis", "\\u", "azimuth", "_", "=_", "180_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "90_", ",_", "backtrack", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "7.2", "862", "45_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "142", ".6", "5730", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "35.", "987", "41_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "-_", "20.", "881", "21_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "30_", ",_", "axis", "\\u", "azimuth", "_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "90_", ",_", "backtrack", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "47.", "663", "2_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "50.", "969", "69_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "42.", "515", "2_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "31.", "665", "5_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "axis", "\\u", "azimuth", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appare", "nt", "\\u", "zen", "ith", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "30_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appare", "nt", "\\u", "azimuth", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "90_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "0_", ",_", "axis", "\\u", "azimuth", "_", "=_", "90_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "90_", ",_", "backtrack", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "30_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "180_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "0_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "appare", "nt", "\\u", "zen", "ith", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "30_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appare", "nt", "\\u", "azimuth", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "180_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "0_", ",_", "axis", "\\u", "azimuth", "_", "=_", "90_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "90_", ",_", "backtrack", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "0_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "180_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "30_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "30_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "raises_", "(_", "Value", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "mismatch_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appare", "nt", "\\u", "zen", "ith", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "30_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appare", "nt", "\\u", "azimuth", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "90_", ",_", "180_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "tracking_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "0_", ",_", "axis", "\\u", "azimuth", "_", "=_", "90_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "angle_", "=_", "90_", ",_", "backtrack", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Sing", "le", "Axi", "s", "Track", "er", "\\u", "creation_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "tracking_", "._", "Sing", "le", "Axi", "s", "Tracker_", "(_", "max", "\\u", "angle_", "=_", "45_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "r_", "=_", ".25_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "=_", "'", "bla", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "invert", "er_", "=_", "'", "bla", "rg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "system_", "._", "max", "\\u", "angle_", "==_", "45_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "system_", "._", "gc", "r_", "==_", ".25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "system_", "._", "module_", "==_", "'", "bla", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "system_", "._", "invert", "er_", "==_", "'", "bla", "rg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Sing", "le", "Axi", "s", "Track", "er", "\\u", "tracking_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "tracking_", "._", "Sing", "le", "Axi", "s", "Tracker_", "(_", "max", "\\u", "angle_", "=_", "90_", ",_", "axis", "\\u", "tilt", "_", "=_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "azimuth", "_", "=_", "180_", ",_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backtrack", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "appare", "nt", "\\u", "zen", "ith", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "30_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appare", "nt", "\\u", "azimuth", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "135_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "system_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "7.2", "862", "45_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "142", ".6", "5730", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "35.", "987", "41_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "-_", "20.", "881", "21_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "results", " ", "calculated", " ", "usi", "ng", " ", "PV", "syst", "_", "\\u\\u\\uNL\\u\\u\\u_", "pvs", "yst", "\\u", "solar", "\\u", "azimuth", "_", "=_", "7.1", "609", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pvs", "yst", "\\u", "solar", "\\u", "height_", "=_", "27.", "315", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pvs", "yst", "\\u", "axis", "\\u", "tilt", "_", "=_", "20._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pvs", "yst", "\\u", "axis", "\\u", "azimuth", "_", "=_", "20._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pvs", "yst", "\\u", "system_", "=_", "tracking_", "._", "Sing", "le", "Axi", "s", "Tracker_", "(_", "max", "\\u", "angle_", "=_", "60._", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tilt", "_", "=_", "pvs", "yst", "\\u", "axis", "\\u", "tilt", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "azimuth", "_", "=_", "180_", "+_", "pvs", "yst", "\\u", "axis", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backtrack", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "definit", "ion", " ", "of", " ", "azimuth", " ", "is", " ", "different", " ", "from", " ", "PY", "syst", "_", "\\u\\u\\uNL\\u\\u\\u_", "appare", "nt", "\\u", "azimuth", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "180_", "+_", "pvs", "yst", "\\u", "solar", "\\u", "azimuth", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appare", "nt", "\\u", "zen", "ith", "_", "=_", "pd_", "._", "Series_", "(_", "[_", "90_", "-_", "pvs", "yst", "\\u", "solar", "\\u", "height_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "pvs", "yst", "\\u", "system_", "._", "single", "axis_", "(_", "appare", "nt", "\\u", "zen", "ith", "_", ",_", "appare", "nt", "\\u", "azimuth", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "ao", "i", "'_", ":_", "41.", "078", "52_", ",_", "'", "surf", "ace", "\\u", "azimuth", "'_", ":_", "180_", "-_", "18.", "432", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "surf", "ace", "\\u", "tilt", "'_", ":_", "24.", "921", "22_", ",_", "'", "track", "er", "\\u", "theta", "'_", ":_", "-_", "15.", "183", "91_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "[_", "0_", "]_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "expect_", ",_", "track", "er", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Locali", "zed", "Sing", "le", "Axi", "s", "Track", "er", "\\u", "creation_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "localized", "\\u", "system_", "=_", "tracking_", "._", "Locali", "zed", "Sing", "le", "Axi", "s", "Tracker_", "(_", "latitude_", "=_", "32_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "longitude_", "=_", "-_", "111_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "=_", "'", "bla", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "invert", "er_", "=_", "'", "bla", "rg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "module_", "==_", "'", "bla", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "invert", "er_", "==_", "'", "bla", "rg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "latitude_", "==_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "longitude_", "==_", "-_", "111_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Sing", "le", "Axi", "s", "Track", "er", "\\u", "localize_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "tracking_", "._", "Sing", "le", "Axi", "s", "Tracker_", "(_", "max", "\\u", "angle_", "=_", "45_", ",_", "gc", "r_", "=_", ".25_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "=_", "'", "bla", "h", "'_", ",_", "invert", "er_", "=_", "'", "bla", "rg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "localized", "\\u", "system_", "=_", "system_", "._", "localize_", "(_", "latitude_", "=_", "32_", ",_", "longitude_", "=_", "-_", "111_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "module_", "==_", "'", "bla", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "invert", "er_", "==_", "'", "bla", "rg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "latitude_", "==_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "longitude_", "==_", "-_", "111_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Sing", "le", "Axi", "s", "Track", "er", "\\u", "localiz", "e\\u", "location_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "tracking_", "._", "Sing", "le", "Axi", "s", "Tracker_", "(_", "max", "\\u", "angle_", "=_", "45_", ",_", "gc", "r_", "=_", ".25_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "=_", "'", "bla", "h", "'_", ",_", "invert", "er_", "=_", "'", "bla", "rg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "Location_", "(_", "latitude_", "=_", "32_", ",_", "longitude_", "=_", "-_", "111_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "localized", "\\u", "system_", "=_", "system_", "._", "localize_", "(_", "location_", "=_", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "module_", "==_", "'", "bla", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "invert", "er_", "==_", "'", "bla", "rg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "latitude_", "==_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "system_", "._", "longitude_", "==_", "-_", "111_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "irr", "adi", "ance_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "tracking_", "._", "Sing", "le", "Axi", "s", "Tracker_", "(_", "max", "\\u", "angle_", "=_", "90_", ",_", "axis", "\\u", "tilt", "_", "=_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "azimuth", "_", "=_", "180_", ",_", "gc", "r_", "=_", "2.0_", "/_", "7.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backtrack", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "times_", "=_", "pd_", "._", "Date", "time", "Index_", "(_", "start_", "=_", "'", "20160", "101", " ", "1200", "-0", "700", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end_", "=_", "'", "20160", "101", " ", "1800", "-0", "700", "'_", ",_", "freq_", "=_", "'", "6", "H", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "Location_", "(_", "latitude_", "=_", "32_", ",_", "longitude_", "=_", "-_", "111_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "solar", "\\u", "position_", "=_", "location_", "._", "get", "\\u", "solar", "position_", "(_", "times_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "irr", "ads_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "dni", "'_", ":_", "[_", "900_", ",_", "0_", "]_", ",_", "'", "gh", "i", "'_", ":_", "[_", "600_", ",_", "0_", "]_", ",_", "'", "dh", "i", "'_", ":_", "[_", "100_", ",_", "0_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "times_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "solar", "\\u", "zen", "ith", "_", "=_", "solar", "\\u", "position_", "[_", "'", "appare", "nt", "\\u", "zen", "ith", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "solar", "\\u", "azimuth", "_", "=_", "solar", "\\u", "position_", "[_", "'", "azimuth", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "er", "\\u", "data_", "=_", "system_", "._", "single", "axis_", "(_", "solar", "\\u", "zen", "ith", "_", ",_", "solar", "\\u", "azimuth", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "irr", "adi", "ance_", "=_", "system_", "._", "get", "\\u", "irr", "adi", "ance_", "(_", "irr", "ads_", "[_", "'", "dni", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "irr", "ads_", "[_", "'", "gh", "i", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "irr", "ads_", "[_", "'", "dh", "i", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solar", "\\u", "zen", "ith", "_", "=_", "solar", "\\u", "zen", "ith", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solar", "\\u", "azimuth", "_", "=_", "solar", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "surf", "ace", "\\u", "tilt", "_", "=_", "track", "er", "\\u", "data_", "[_", "'", "surf", "ace", "\\u", "tilt", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "surf", "ace", "\\u", "azimuth", "_", "=_", "track", "er", "\\u", "data_", "[_", "'", "surf", "ace", "\\u", "azimuth", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "pd_", "._", "Data", "Frame_", "(_", "data_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "961", ".8", "007", "0_", ",_", "815", ".9", "449", "0_", ",_", "145", ".8", "558", "0_", ",_", "135", ".3", "282", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "10.5", "275", "749", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "nan_", ",_", "nan_", ",_", "nan_", ",_", "nan_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nan_", "]_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "[_", "'", "po", "a", "\\u", "global", "'_", ",_", "'", "po", "a", "\\u", "direct", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "po", "a", "\\u", "diffuse", "'_", ",_", "'", "po", "a", "\\u", "sky", "\\u", "diffuse", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "po", "a", "\\u", "ground", "\\u", "diffuse", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "times_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "irr", "adi", "ance_", "=_", "np_", "._", "round_", "(_", "irr", "adi", "ance_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "np_", "._", "round_", "(_", "expected_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "frame", "\\u", "equal_", "(_", "irr", "adi", "ance_", ",_", "expected_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dimagi/commcare-hq/corehq/form_processor/backends/sql/ledger.py
[ { "content": "from itertools import groupby\nfrom operator import attrgetter\n\nfrom corehq.apps.commtrack.processing import compute_ledger_values\nfrom corehq.form_processor.backends.sql.dbaccessors import LedgerAccessorSQL\nfrom corehq.form_processor.exceptions import LedgerValueNotFound\nfrom corehq.form_processor.interfaces.ledger_processor import LedgerProcessorInterface, StockModelUpdateResult, \\\n LedgerDBInterface\nfrom corehq.form_processor.models import LedgerValue, LedgerTransaction\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LedgerDBSQL(LedgerDBInterface):\n\n", "metadata": "root.LedgerDBSQL", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def get_ledgers_for_case(self, case_id):\n return LedgerAccessorSQL.get_ledger_values_for_case(case_id)", "metadata": "root.LedgerDBSQL.get_ledgers_for_case", "header": "['class', 'LedgerDBSQL', '(', 'LedgerDBInterface', ')', ':', '___EOS___']", "index": 12 }, { "content": " def _get_ledger(self, unique_ledger_reference):\n try:\n return LedgerAccessorSQL.get_ledger_value(**unique_ledger_reference._asdict())\n except LedgerValueNotFound:\n return None", "metadata": "root.LedgerDBSQL._get_ledger", "header": "['class', 'LedgerDBSQL', '(', 'LedgerDBInterface', ')', ':', '___EOS___']", "index": 15 }, { "content": " def get_current_ledger_value(self, unique_ledger_reference):\n ledger = self.get_ledger(unique_ledger_reference)\n return ledger.balance if ledger else 0", "metadata": "root.LedgerDBSQL.get_current_ledger_value", "header": "['class', 'LedgerDBSQL', '(', 'LedgerDBInterface', ')', ':', '___EOS___']", "index": 21 }, { "content": "class LedgerProcessorSQL(LedgerProcessorInterface):\n \"\"\"\n Ledger processor for new SQL-based code.\n \"\"\"\n\n\n\n\n\n", "metadata": "root.LedgerProcessorSQL", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def get_models_to_update(self, form_id, stock_report_helpers, deprecated_helpers, ledger_db=None):\n ledger_db = ledger_db or LedgerDBSQL()\n result = StockModelUpdateResult()\n\n ledgers_needing_rebuild = {\n deprecated_transaction.ledger_reference\n for deprecated_helper in deprecated_helpers\n for deprecated_transaction in deprecated_helper.transactions\n }\n\n updated_ledgers = []\n for helper in stock_report_helpers:\n for stock_trans in helper.transactions:\n ledger_value = self._process_transaction(helper, stock_trans, ledger_db)\n updated_ledgers.append(ledger_value)\n\n for ledger_value in updated_ledgers:\n if ledger_value.ledger_reference in ledgers_needing_rebuild:\n rebuilt_ledger_value = self._rebuild_ledger(form_id, ledger_value)\n result.to_save.append(rebuilt_ledger_value)\n else:\n result.to_save.append(ledger_value)\n\n return result", "metadata": "root.LedgerProcessorSQL.get_models_to_update", "header": "['class', 'LedgerProcessorSQL', '(', 'LedgerProcessorInterface', ')', ':', '___EOS___']", "index": 31 }, { "content": " @staticmethod\n def _process_transaction(stock_report_helper, stock_trans, ledger_db):\n def _lazy_original_balance():\n # needs to be in closures because it's zero-argument.\n # see compute_ledger_values for more information\n reference = stock_trans.ledger_reference\n return ledger_db.get_current_ledger_value(reference)\n\n new_ledger_values = compute_ledger_values(\n _lazy_original_balance, stock_report_helper.report_type, stock_trans.relative_quantity\n )\n ledger_value = ledger_db.get_ledger(stock_trans.ledger_reference)\n if not ledger_value:\n ledger_value = LedgerValue(**stock_trans.ledger_reference._asdict())\n transaction = _get_ledger_transaction(\n _lazy_original_balance,\n stock_report_helper,\n stock_trans,\n new_ledger_values.balance\n )\n ledger_value.track_create(transaction)\n # only do this after we've created the transaction otherwise we'll get the wrong delta\n ledger_value.balance = new_ledger_values.balance\n return ledger_value", "metadata": "root.LedgerProcessorSQL._process_transaction", "header": "['class', 'LedgerProcessorSQL', '(', 'LedgerProcessorInterface', ')', ':', '___EOS___']", "index": 56 }, { "content": " def _rebuild_ledger(self, form_id, ledger_value):\n \"\"\"\n Rebuild a LedgerValue and its associated transactions during a form edit workflow.\n\n :param form_id: ID of edited form\n :param ledger_value: LedgerValue to rebuild with transactions from new form tracked on the model\n :return: updated LedgerValue object\n \"\"\"\n transactions = LedgerAccessorSQL.get_ledger_transactions_for_case(\n **ledger_value.ledger_reference._asdict()\n )\n transaction_excluding_deprecated_form = [tx for tx in transactions if tx.form_id != form_id]\n new_transactions = ledger_value.get_tracked_models_to_create(LedgerTransaction)\n all_transactions = transaction_excluding_deprecated_form + new_transactions\n sorted_transactions = sorted(all_transactions, key=lambda t: t.report_date)\n\n ledger_value.clear_tracked_models(LedgerTransaction)\n ledger_value = self._rebuild_ledger_value_from_transactions(ledger_value, sorted_transactions)\n return ledger_value", "metadata": "root.LedgerProcessorSQL._rebuild_ledger", "header": "['class', 'LedgerProcessorSQL', '(', 'LedgerProcessorInterface', ')', ':', '___EOS___']", "index": 81 }, { "content": " def rebuild_ledger_state(self, case_id, section_id, entry_id):\n LedgerProcessorSQL.hard_rebuild_ledgers(case_id, section_id, entry_id)", "metadata": "root.LedgerProcessorSQL.rebuild_ledger_state", "header": "['class', 'LedgerProcessorSQL', '(', 'LedgerProcessorInterface', ')', ':', '___EOS___']", "index": 101 }, { "content": " @staticmethod\n def hard_rebuild_ledgers(case_id, section_id=None, entry_id=None):\n transactions = LedgerAccessorSQL.get_ledger_transactions_for_case(case_id, section_id, entry_id)\n ledger_value = LedgerAccessorSQL.get_ledger_value(case_id, section_id, entry_id)\n ledger_value = LedgerProcessorSQL._rebuild_ledger_value_from_transactions(ledger_value, transactions)\n LedgerAccessorSQL.save_ledger_values([ledger_value])", "metadata": "root.LedgerProcessorSQL.hard_rebuild_ledgers", "header": "['class', 'LedgerProcessorSQL', '(', 'LedgerProcessorInterface', ')', ':', '___EOS___']", "index": 104 }, { "content": " @staticmethod\n def _rebuild_ledger_value_from_transactions(ledger_value, transactions):\n balance = 0\n for transaction in transactions:\n updated_values = _compute_ledger_values(balance, transaction)\n new_balance = updated_values.balance\n new_delta = updated_values.balance - balance\n if new_balance != transaction.updated_balance or new_delta != transaction.delta:\n transaction.delta = new_delta\n transaction.updated_balance = new_balance\n ledger_value.track_update(transaction)\n elif not transaction.is_saved():\n ledger_value.track_create(transaction)\n balance = new_balance\n if balance != ledger_value.balance or ledger_value.has_tracked_models():\n ledger_value.balance = balance\n\n return ledger_value", "metadata": "root.LedgerProcessorSQL._rebuild_ledger_value_from_transactions", "header": "['class', 'LedgerProcessorSQL', '(', 'LedgerProcessorInterface', ')', ':', '___EOS___']", "index": 111 }, { "content": "def _compute_ledger_values(original_balance, transaction):\n if transaction.type == LedgerTransaction.TYPE_BALANCE:\n quantity = transaction.updated_balance\n elif transaction.type == LedgerTransaction.TYPE_TRANSFER:\n quantity = transaction.delta\n else:\n raise ValueError()\n\n ledger_values = compute_ledger_values(\n lambda: original_balance, transaction.readable_type, quantity\n )\n\n return ledger_values", "metadata": "root._compute_ledger_values", "header": "['module', '___EOS___']", "index": 131 }, { "content": "def _get_ledger_transaction(lazy_original_balance, stock_report_helper, stock_trans, new_balance):\n return LedgerTransaction(\n form_id=stock_report_helper.form_id,\n server_date=stock_report_helper.server_date,\n report_date=stock_report_helper.timestamp,\n type=_report_type_to_ledger_type(stock_report_helper.report_type),\n case_id=stock_trans.case_id,\n section_id=stock_trans.section_id,\n entry_id=stock_trans.product_id,\n user_defined_type=stock_trans.subaction,\n delta=new_balance - lazy_original_balance(),\n updated_balance=new_balance\n )", "metadata": "root._get_ledger_transaction", "header": "['module', '___EOS___']", "index": 146 }, { "content": "def _report_type_to_ledger_type(report_type):\n from casexml.apps.stock.const import REPORT_TYPE_BALANCE, REPORT_TYPE_TRANSFER\n if report_type == REPORT_TYPE_BALANCE:\n return LedgerTransaction.TYPE_BALANCE\n if report_type == REPORT_TYPE_TRANSFER:\n return LedgerTransaction.TYPE_TRANSFER\n\n raise ValueError('Invalid stock report type {}!'.format(report_type))", "metadata": "root._report_type_to_ledger_type", "header": "['module', '___EOS___']", "index": 161 } ]
[ { "span": "from itertools import groupby", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 29 }, { "span": "from operator import attrgetter", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "itertools_", "import_", "groupby_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "operator_", "import_", "attrgetter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "comm", "track_", "._", "processing_", "import_", "compute", "\\u", "ledger", "\\u", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "backends_", "._", "sql_", "._", "dba", "ccess", "ors_", "import_", "Led", "ger", "Accessor", "SQL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "exceptions_", "import_", "Led", "ger", "Value", "Not", "Found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "interfaces_", "._", "ledger", "\\u", "processor_", "import_", "Led", "ger", "Process", "or", "Interface_", ",_", "Stock", "Model", "Update", "Result_", ",_", "Led", "ger", "DB", "Interface_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "models_", "import_", "Led", "ger", "Value_", ",_", "Led", "ger", "Transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Led", "ger", "DB", "SQL_", "(_", "Led", "ger", "DB", "Interface_", ")_", ":_", "\\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_", "Led", "ger", "DB", "SQL_", "(_", "Led", "ger", "DB", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "ledger", "s", "\\u", "for", "\\u", "case_", "(_", "self_", ",_", "case", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Led", "ger", "Accessor", "SQL_", "._", "get", "\\u", "ledger", "\\u", "values", "\\u", "for", "\\u", "case_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Led", "ger", "DB", "SQL_", "(_", "Led", "ger", "DB", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "ledger", "_", "(_", "self_", ",_", "unique", "\\u", "ledger", "\\u", "reference_", ")_", ":_", "\\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_", "Led", "ger", "Accessor", "SQL_", "._", "get", "\\u", "ledger", "\\u", "value_", "(_", "**_", "unique", "\\u", "ledger", "\\u", "reference_", "._", "\\u", "asd", "ict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Led", "ger", "Value", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Led", "ger", "DB", "SQL_", "(_", "Led", "ger", "DB", "Interface_", ")_", ":_", "\\u\\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", "current", "\\u", "ledger", "\\u", "value_", "(_", "self_", ",_", "unique", "\\u", "ledger", "\\u", "reference_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ledger", "_", "=_", "self_", "._", "get", "\\u", "ledger", "_", "(_", "unique", "\\u", "ledger", "\\u", "reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ledger", "_", "._", "balance_", "if_", "ledger", "_", "else_", "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_", "Led", "ger", "Process", "or", "SQL_", "(_", "Led", "ger", "Process", "or", "Interface_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Led", "ger", " ", "process", "or", " ", "for", " ", "new", " ", "SQL", "-", "based", " ", "code", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Led", "ger", "Process", "or", "SQL_", "(_", "Led", "ger", "Process", "or", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "model", "s", "\\u", "to", "\\u", "update_", "(_", "self_", ",_", "form", "\\u", "id_", ",_", "stock", "\\u", "report", "\\u", "helpers_", ",_", "depre", "cated", "\\u", "helpers_", ",_", "ledger", "\\u", "db_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ledger", "\\u", "db_", "=_", "ledger", "\\u", "db_", "or_", "Led", "ger", "DB", "SQL_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "Stock", "Model", "Update", "Result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ledger", "s", "\\u", "need", "ing", "\\u", "rebuild_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "depre", "cated", "\\u", "transaction_", "._", "ledger", "\\u", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "depre", "cated", "\\u", "helper_", "in_", "depre", "cated", "\\u", "helpers_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "depre", "cated", "\\u", "transaction_", "in_", "depre", "cated", "\\u", "helper_", "._", "transactions_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "d\\u", "ledger", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "helper_", "in_", "stock", "\\u", "report", "\\u", "helpers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "stock", "\\u", "trans_", "in_", "helper_", "._", "transactions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ledger", "\\u", "value_", "=_", "self_", "._", "\\u", "process", "\\u", "transaction_", "(_", "helper_", ",_", "stock", "\\u", "trans_", ",_", "ledger", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d\\u", "ledger", "s_", "._", "append_", "(_", "ledger", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ledger", "\\u", "value_", "in_", "update", "d\\u", "ledger", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ledger", "\\u", "value_", "._", "ledger", "\\u", "reference_", "in_", "ledger", "s", "\\u", "need", "ing", "\\u", "rebuild_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebu", "ilt", "\\u", "ledger", "\\u", "value_", "=_", "self_", "._", "\\u", "rebu", "ild", "\\u", "ledger", "_", "(_", "form", "\\u", "id_", ",_", "ledger", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "to", "\\u", "save_", "._", "append_", "(_", "rebu", "ilt", "\\u", "ledger", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "to", "\\u", "save_", "._", "append_", "(_", "ledger", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Led", "ger", "Process", "or", "SQL_", "(_", "Led", "ger", "Process", "or", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "process", "\\u", "transaction_", "(_", "stock", "\\u", "report", "\\u", "helper_", ",_", "stock", "\\u", "trans_", ",_", "ledger", "\\u", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "lazy", "\\u", "original", "\\u", "balance_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "need", "s", " ", "to", " ", "be", " ", "in", " ", "clos", "ure", "s", " ", "bec", "aus", "e", " ", "it", "'", "s", " ", "zero", "-", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "compute", "\\u", "ledger", "\\u", "values", " ", "for", " ", "more", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reference_", "=_", "stock", "\\u", "trans_", "._", "ledger", "\\u", "reference_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ledger", "\\u", "db_", "._", "get", "\\u", "current", "\\u", "ledger", "\\u", "value_", "(_", "reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "ledger", "\\u", "values_", "=_", "compute", "\\u", "ledger", "\\u", "values_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "lazy", "\\u", "original", "\\u", "balance_", ",_", "stock", "\\u", "report", "\\u", "helper_", "._", "report", "\\u", "type_", ",_", "stock", "\\u", "trans_", "._", "relative", "\\u", "quantity_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ledger", "\\u", "value_", "=_", "ledger", "\\u", "db_", "._", "get", "\\u", "ledger", "_", "(_", "stock", "\\u", "trans_", "._", "ledger", "\\u", "reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ledger", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ledger", "\\u", "value_", "=_", "Led", "ger", "Value_", "(_", "**_", "stock", "\\u", "trans_", "._", "ledger", "\\u", "reference_", "._", "\\u", "asd", "ict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transaction_", "=_", "\\u", "get", "\\u", "ledger", "\\u", "transaction_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "lazy", "\\u", "original", "\\u", "balance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stock", "\\u", "report", "\\u", "helper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stock", "\\u", "trans_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "ledger", "\\u", "values_", "._", "balance_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ledger", "\\u", "value_", "._", "track", "\\u", "create_", "(_", "transaction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "do", " ", "this", " ", "after", " ", "we", "'", "ve", " ", "created", " ", "the", " ", "transaction", " ", "other", "wis", "e", " ", "we", "'", "ll", " ", "get", " ", "the", " ", "wrong", " ", "delta_", "\\u\\u\\uNL\\u\\u\\u_", "ledger", "\\u", "value_", "._", "balance_", "=_", "new", "\\u", "ledger", "\\u", "values_", "._", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ledger", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Led", "ger", "Process", "or", "SQL_", "(_", "Led", "ger", "Process", "or", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rebu", "ild", "\\u", "ledger", "_", "(_", "self_", ",_", "form", "\\u", "id_", ",_", "ledger", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Reb", "uild", " ", "a", " ", "Led", "ger", "Value", " ", "and", " ", "its", " ", "associate", "d", " ", "transaction", "s", " ", "dur", "ing", " ", "a", " ", "form", " ", "edit", " ", "workf", "low", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "form", "\\u", "id", ":", " ", "ID", " ", "of", " ", "edited", " ", "form", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ledger", "\\u", "value", ":", " ", "Led", "ger", "Value", " ", "to", " ", "rebu", "ild", " ", "with", " ", "transaction", "s", " ", "from", " ", "new", " ", "form", " ", "tracked", " ", "on", " ", "the", " ", "model", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "update", "d", " ", "Led", "ger", "Value", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transactions_", "=_", "Led", "ger", "Accessor", "SQL_", "._", "get", "\\u", "ledger", "\\u", "transaction", "s", "\\u", "for", "\\u", "case_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "ledger", "\\u", "value_", "._", "ledger", "\\u", "reference_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction", "\\u", "excluding", "\\u", "depre", "cated", "\\u", "form_", "=_", "[_", "tx_", "for_", "tx_", "in_", "transactions_", "if_", "tx_", "._", "form", "\\u", "id_", "!=_", "form", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "transactions_", "=_", "ledger", "\\u", "value_", "._", "get", "\\u", "tracked", "\\u", "model", "s", "\\u", "to", "\\u", "create_", "(_", "Led", "ger", "Transaction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "transactions_", "=_", "transaction", "\\u", "excluding", "\\u", "depre", "cated", "\\u", "form_", "+_", "new", "\\u", "transactions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sorte", "d\\u", "transactions_", "=_", "sorted_", "(_", "all", "\\u", "transactions_", ",_", "key_", "=_", "lambda_", "t_", ":_", "t_", "._", "report", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ledger", "\\u", "value_", "._", "clear", "\\u", "tracked", "\\u", "models_", "(_", "Led", "ger", "Transaction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ledger", "\\u", "value_", "=_", "self_", "._", "\\u", "rebu", "ild", "\\u", "ledger", "\\u", "value", "\\u", "from", "\\u", "transactions_", "(_", "ledger", "\\u", "value_", ",_", "sorte", "d\\u", "transactions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ledger", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Led", "ger", "Process", "or", "SQL_", "(_", "Led", "ger", "Process", "or", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rebu", "ild", "\\u", "ledger", "\\u", "state_", "(_", "self_", ",_", "case", "\\u", "id_", ",_", "section", "\\u", "id_", ",_", "entry", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Led", "ger", "Process", "or", "SQL_", "._", "hard", "\\u", "rebu", "ild", "\\u", "ledger", "s_", "(_", "case", "\\u", "id_", ",_", "section", "\\u", "id_", ",_", "entry", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Led", "ger", "Process", "or", "SQL_", "(_", "Led", "ger", "Process", "or", "Interface_", ")_", ":_", "\\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_", "hard", "\\u", "rebu", "ild", "\\u", "ledger", "s_", "(_", "case", "\\u", "id_", ",_", "section", "\\u", "id_", "=_", "None_", ",_", "entry", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transactions_", "=_", "Led", "ger", "Accessor", "SQL_", "._", "get", "\\u", "ledger", "\\u", "transaction", "s", "\\u", "for", "\\u", "case_", "(_", "case", "\\u", "id_", ",_", "section", "\\u", "id_", ",_", "entry", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ledger", "\\u", "value_", "=_", "Led", "ger", "Accessor", "SQL_", "._", "get", "\\u", "ledger", "\\u", "value_", "(_", "case", "\\u", "id_", ",_", "section", "\\u", "id_", ",_", "entry", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ledger", "\\u", "value_", "=_", "Led", "ger", "Process", "or", "SQL_", "._", "\\u", "rebu", "ild", "\\u", "ledger", "\\u", "value", "\\u", "from", "\\u", "transactions_", "(_", "ledger", "\\u", "value_", ",_", "transactions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Led", "ger", "Accessor", "SQL_", "._", "save", "\\u", "ledger", "\\u", "values_", "(_", "[_", "ledger", "\\u", "value_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Led", "ger", "Process", "or", "SQL_", "(_", "Led", "ger", "Process", "or", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "rebu", "ild", "\\u", "ledger", "\\u", "value", "\\u", "from", "\\u", "transactions_", "(_", "ledger", "\\u", "value_", ",_", "transactions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "balance_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "transaction_", "in_", "transactions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "d\\u", "values_", "=_", "\\u", "compute", "\\u", "ledger", "\\u", "values_", "(_", "balance_", ",_", "transaction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "balance_", "=_", "update", "d\\u", "values_", "._", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "delta_", "=_", "update", "d\\u", "values_", "._", "balance_", "-_", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "balance_", "!=_", "transaction_", "._", "update", "d\\u", "balance_", "or_", "new", "\\u", "delta_", "!=_", "transaction_", "._", "delta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transaction_", "._", "delta_", "=_", "new", "\\u", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "update", "d\\u", "balance_", "=_", "new", "\\u", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ledger", "\\u", "value_", "._", "track", "\\u", "update_", "(_", "transaction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "transaction_", "._", "is", "\\u", "saved_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ledger", "\\u", "value_", "._", "track", "\\u", "create_", "(_", "transaction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "balance_", "=_", "new", "\\u", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "balance_", "!=_", "ledger", "\\u", "value_", "._", "balance_", "or_", "ledger", "\\u", "value_", "._", "has", "\\u", "tracked", "\\u", "models_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ledger", "\\u", "value_", "._", "balance_", "=_", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ledger", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compute", "\\u", "ledger", "\\u", "values_", "(_", "original", "\\u", "balance_", ",_", "transaction_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "transaction_", "._", "type_", "==_", "Led", "ger", "Transaction_", "._", "TYPE", "\\u", "BALA", "NCE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quantity_", "=_", "transaction_", "._", "update", "d\\u", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "transaction_", "._", "type_", "==_", "Led", "ger", "Transaction_", "._", "TYPE", "\\u", "TRANSFER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quantity_", "=_", "transaction_", "._", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ledger", "\\u", "values_", "=_", "compute", "\\u", "ledger", "\\u", "values_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", ":_", "original", "\\u", "balance_", ",_", "transaction_", "._", "reada", "ble", "\\u", "type_", ",_", "quantity_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "ledger", "\\u", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "ledger", "\\u", "transaction_", "(_", "lazy", "\\u", "original", "\\u", "balance_", ",_", "stock", "\\u", "report", "\\u", "helper_", ",_", "stock", "\\u", "trans_", ",_", "new", "\\u", "balance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Led", "ger", "Transaction_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "id_", "=_", "stock", "\\u", "report", "\\u", "helper_", "._", "form", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "date_", "=_", "stock", "\\u", "report", "\\u", "helper_", "._", "server", "\\u", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "report", "\\u", "date_", "=_", "stock", "\\u", "report", "\\u", "helper_", "._", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\\u", "report", "\\u", "type", "\\u", "to", "\\u", "ledger", "\\u", "type_", "(_", "stock", "\\u", "report", "\\u", "helper_", "._", "report", "\\u", "type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "id_", "=_", "stock", "\\u", "trans_", "._", "case", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "section", "\\u", "id_", "=_", "stock", "\\u", "trans_", "._", "section", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "\\u", "id_", "=_", "stock", "\\u", "trans_", "._", "product", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "defin", "ed", "\\u", "type_", "=_", "stock", "\\u", "trans_", "._", "suba", "ction_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delta_", "=_", "new", "\\u", "balance_", "-_", "lazy", "\\u", "original", "\\u", "balance_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "d\\u", "balance_", "=_", "new", "\\u", "balance_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "report", "\\u", "type", "\\u", "to", "\\u", "ledger", "\\u", "type_", "(_", "report", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "case", "xml_", "._", "apps_", "._", "stock_", "._", "const_", "import_", "REPORT", "\\u", "TYPE", "\\u", "BALA", "NCE_", ",_", "REPORT", "\\u", "TYPE", "\\u", "TRANSFER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "report", "\\u", "type_", "==_", "REPORT", "\\u", "TYPE", "\\u", "BALA", "NCE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Led", "ger", "Transaction_", "._", "TYPE", "\\u", "BALA", "NCE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "report", "\\u", "type_", "==_", "REPORT", "\\u", "TYPE", "\\u", "TRANSFER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Led", "ger", "Transaction_", "._", "TYPE", "\\u", "TRANSFER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "'", "Inva", "lid", " ", "stock", " ", "report", " ", "type", " ", "{}", "!'_", "._", "format_", "(_", "report", "\\u", "type_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, **kwargs):\n self.set_from_args(**kwargs)\n \n # generate uuid if need be\n if 'uuid' in self.FIELDS and (not hasattr(self, 'uuid') or self.uuid == None):\n self.uuid = str(uuid.uuid4())", "metadata": "root.HeliosObject.__init__", "header": "['class', 'HeliosObject', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": " def process_value_in(self, field_name, field_value):\n \"\"\"\n process some fields on the way into the object\n \"\"\"\n if field_value == None:\n return None\n \n val = self._process_value_in(field_name, field_value)\n if val != None:\n return val\n else:\n return field_value", "metadata": "root.HeliosObject.process_value_in", "header": "['class', 'HeliosObject', '(', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def process_value_out(self, field_name, field_value):\n \"\"\"\n process some fields on the way out of the object\n \"\"\"\n if field_value == None:\n return None\n \n val = self._process_value_out(field_name, field_value)\n if val != None:\n return val\n else:\n return field_value", "metadata": "root.HeliosObject.process_value_out", "header": "['class', 'HeliosObject', '(', 'object', ')', ':', '___EOS___']", "index": 99 }, { "content": " def __init__(self, *args, **kwargs):\n super(Tally, self).__init__(*args, **kwargs)\n\n self.election = kwargs.get('election',None)\n\n if self.election:\n self.init_election(self.election)\n else:\n self.questions = None\n self.public_key = None\n \n if not self.tally:\n self.tally = None\n \n # initialize\n if self.num_tallied == None:\n self.num_tallied = 0 ", "metadata": "root.Tally.__init__", "header": "['class', 'Tally', '(', 'HeliosObject', ')', ':', '___EOS___']", "index": 606 } ]
[ { "span": "self.uuid == None)", "start_line": 26, "start_column": 63, "end_line": 26, "end_column": 80 }, { "span": "field_value == None:", "start_line": 87, "start_column": 7, "end_line": 87, "end_column": 26 }, { "span": "field_value == None:", "start_line": 103, "start_column": 7, "end_line": 103, "end_column": 26 }, { "span": "self.num_tallied == None:", "start_line": 621, "start_column": 7, "end_line": 621, "end_column": 31 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Heli", "os", "Object_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "from", "\\u", "args_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "uuid", " ", "if", " ", "need", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "uuid", "'_", "in_", "self_", "._", "FIELDS_", "and_", "(_", "not_", "hasattr_", "(_", "self_", ",_", "'", "uuid", "'_", ")_", "or_", "self_", "._", "uuid_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "uuid_", "=_", "str_", "(_", "uuid_", "._", "uuid4_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Heli", "os", "Object_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "value", "\\u", "in_", "(_", "self_", ",_", "field", "\\u", "name_", ",_", "field", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "process", " ", "some", " ", "fields", " ", "on", " ", "the", " ", "way", " ", "int", "o", " ", "the", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "value_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "self_", "._", "\\u", "process", "\\u", "value", "\\u", "in_", "(_", "field", "\\u", "name_", ",_", "field", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "field", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Heli", "os", "Object_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "value", "\\u", "out_", "(_", "self_", ",_", "field", "\\u", "name_", ",_", "field", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "process", " ", "some", " ", "fields", " ", "on", " ", "the", " ", "way", " ", "out", " ", "of", " ", "the", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "value_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "self_", "._", "\\u", "process", "\\u", "value", "\\u", "out_", "(_", "field", "\\u", "name_", ",_", "field", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "field", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tal", "ly_", "(_", "Heli", "os", "Object_", ")_", ":_", "\\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\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Tal", "ly_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "election_", "=_", "kwargs_", "._", "get_", "(_", "'", "election", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "election_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "\\u", "election_", "(_", "self_", "._", "election_", ")_", "\\u\\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_", "._", "questions_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "public", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "tally", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tally", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "initialize_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "num", "\\u", "tall", "ied_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "num", "\\u", "tall", "ied_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
eBay/restcommander/play-1.2.4/framework/pym/play/commands/check.py
[ { "content": " def __init__(self, strversion):\n self.strversion = strversion\n try:\n self.numpart = re.findall(\"\\d+[\\.\\d+]+\", strversion)[0]\n except:\n self.numpart = ''\n self.rest = strversion.replace(self.numpart, \"\")\n try:\n self.versions = map(lambda x: int(x), self.numpart.split(\".\"))\n except:\n self.versions = [0,0]\n if not self.rest: self.rest = \"Z\"", "metadata": "root.Release.__init__", "header": "['class', 'Release', ':', '___NEWLINE___', '___NL___', '# TODO: Be smarter at analysing the rest (ex: RC1 vs RC2)', '___NL___', '___EOS___']", "index": 62 }, { "content": " def __lt__(self, other):\n try:\n if self == other:\n return False\n for i in range(len(self.versions)):\n if self.versions[i] < other.versions[i]:\n return True # ex: 1.1 vs 1.2\n if self.versions[i] > other.versions[i]:\n return False\n if len(self.versions) < len(other.versions):\n return True\n if len(self.versions) > len(other.versions):\n return False\n # From here, numeric part is the same - now having a rest means older version\n if len(other.numpart) > 0 and len(self.numpart) == 0:\n return False\n if len(self.numpart) > 0 and len(other.numpart) == 0:\n return True\n # Both have a rest, use a string comparison\n # alpha1 < beta1 < rc1 < rc2...\n return self.rest < other.rest\n except:\n return False", "metadata": "root.Release.__lt__", "header": "['class', 'Release', ':', '___NEWLINE___', '___NL___', '# TODO: Be smarter at analysing the rest (ex: RC1 vs RC2)', '___NL___', '___EOS___']", "index": 80 } ]
[ { "span": "except:", "start_line": 66, "start_column": 8, "end_line": 66, "end_column": 15 }, { "span": "except:", "start_line": 71, "start_column": 8, "end_line": 71, "end_column": 15 }, { "span": "except:", "start_line": 101, "start_column": 8, "end_line": 101, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Release_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Be", " ", "smart", "er", " ", "at", " ", "analys", "ing", " ", "the", " ", "rest", " ", "(", "ex", ":", " ", "RC", "1", " ", "vs", " ", "RC", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", ",_", "str", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "str", "version_", "=_", "str", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nump", "art_", "=_", "re_", "._", "findall_", "(_", "\"\\\\", "d", "+[", "\\\\.\\\\", "d", "+]", "+\"_", ",_", "str", "version_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nump", "art_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "rest_", "=_", "str", "version_", "._", "replace_", "(_", "self_", "._", "nump", "art_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "versions_", "=_", "map_", "(_", "lambda_", "x_", ":_", "int_", "(_", "x_", ")_", ",_", "self_", "._", "nump", "art_", "._", "split_", "(_", "\".\"_", ")_", ")_", "\\u\\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_", "._", "versions_", "=_", "[_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "rest_", ":_", "self_", "._", "rest_", "=_", "\"", "Z", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Release_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Be", " ", "smart", "er", " ", "at", " ", "analys", "ing", " ", "the", " ", "rest", " ", "(", "ex", ":", " ", "RC", "1", " ", "vs", " ", "RC", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\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_", "==_", "other_", ":_", "\\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_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "self_", "._", "versions_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "versions_", "[_", "i_", "]_", "<_", "other_", "._", "versions_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "True_", "#", " ", "ex", ":", " ", "1.1", " ", "vs", " ", "1.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "versions_", "[_", "i_", "]_", ">_", "other_", "._", "versions_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "versions_", ")_", "<_", "len_", "(_", "other_", "._", "versions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "versions_", ")_", ">_", "len_", "(_", "other_", "._", "versions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fro", "m", " ", "here", ",", " ", "numeri", "c", " ", "part", " ", "is", " ", "the", " ", "same", " ", "-", " ", "now", " ", "hav", "ing", " ", "a", " ", "rest", " ", "means", " ", "older", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "other_", "._", "nump", "art_", ")_", ">_", "0_", "and_", "len_", "(_", "self_", "._", "nump", "art_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "nump", "art_", ")_", ">_", "0_", "and_", "len_", "(_", "other_", "._", "nump", "art_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Bot", "h", " ", "have", " ", "a", " ", "rest", ",", " ", "use", " ", "a", " ", "string", " ", "comparison_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alpha", "1", " ", "<", " ", "beta1", " ", "<", " ", "rc", "1", " ", "<", " ", "rc", "2", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "rest_", "<_", "other_", "._", "rest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,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/PortalContentPost.py
[ { "content": "def publish_portal(portaladdress,contentpath,adminuser,adminpassword, users, hostname_map, specified_groups, id_mapping_file):\n os.chdir(contentpath)\n \n portal_properties = json.load(open(\"portal_properties.json\"))\n portaladmin = Portal(portaladdress, adminuser, adminpassword)\n \n print_script_header(portaladmin, portal_processing, users, specified_groups)\n\n # Create Portal log folder for this portal\n portalLogPath = os.path.join(contentpath, portalLogFolder, get_servername_from_url(portaladmin.url))\n makeFolder(portalLogPath)\n \n # ------------------------------------------------------------------------\n # Get info about the groups on disk to filter items based on group membership\n # ------------------------------------------------------------------------\n # Get the groups on disk\n grps_on_disk = get_groups_on_disk(contentpath)\n \n # Validate that each specified group is valid\n if specified_groups:\n invalid_specified_groups = []\n for specified_group in specified_groups:\n found = False\n for grp in grps_on_disk.itervalues():\n if specified_group == grp:\n found = True\n if not found:\n invalid_specified_groups.append(specified_group)\n \n if len(invalid_specified_groups) > 0:\n print '\\n***ERROR: the following specified groups do not exist; NOTE: group owner and group title must match exactly including case:\\n'\n print invalid_specified_groups\n return\n \n # ------------------------------------------------------------------------\n # Create users\n # ------------------------------------------------------------------------\n print titleBreak\n print 'Create users...\\n'\n \n # Only create users if this is not an online organization\n if portaladmin.properties()['id'] == '0123456789ABCDEF': # All portals have this id.\n for username, userinfo in users.iteritems():\n create_user(portaladmin, contentpath, userinfo)\n else:\n print '\\tThis is an online organization. Users must already have been created.'\n\n # ------------------------------------------------------------------------\n # Create user folders\n # ------------------------------------------------------------------------\n print '\\n'+ titleBreak\n print 'Create user folders...\\n'\n \n for username, userinfo in users.iteritems():\n print '\\nUser: ' + userinfo['target_username']\n create_user_folders(portaladmin, contentpath, userinfo)\n\n # ------------------------------------------------------------------------\n # Create groups and add users to groups\n # ------------------------------------------------------------------------\n print \"\\n\" + titleBreak\n print \"Creating groups ...\\n\"\n \n oldGrpID_newGrpID = {}\n for username, userinfo in users.iteritems():\n newGroups = publish_user_groups(portaladmin, contentpath, userinfo, users)\n \n for key,val in newGroups.iteritems():\n oldGrpID_newGrpID[key] = {'id': val}\n \n # ------------------------------------------------------------------------\n # Publish Items and Update their sharing info\n # ------------------------------------------------------------------------\n print \"\\n\" + titleBreak\n print \"Publishing items and setting sharing ...\"\n print titleBreak\n \n for username, userinfo in users.iteritems():\n \n username = userinfo['target_username']\n password = userinfo['target_password']\n userfoldername = userinfo['username']\n \n # ---------------------------------------\n # Publish all the users' items\n # ---------------------------------------\n usercontentpath = os.path.join(contentpath, userfoldername)\n \n newItems, origItemSourceIDs = publish_user_items(portaladmin, username, usercontentpath, source_hostname,\n new_hostname, new_port, specified_groups, id_mapping_file, grps_on_disk)\n \n # Dump info about new items to JSON to use for resetting IDs of related items\n dump_newItem_info(newItems, origItemSourceIDs, os.path.join(portalLogPath, username))\n \n # ---------------------------------------\n # Share the users' items with the\n # appropriate groups\n # ---------------------------------------\n userItemsPath = os.path.join(contentpath, userfoldername, \"items\")\n share_items(portaladmin, userItemsPath, newItems, origItemSourceIDs, originGroupToDestGroups)\n \n \n # Dump info about all items (old, new ids) into json\n os.chdir(portalLogPath)\n json.dump(origIDToNewID, open('oldID_newID.json','w'))\n json.dump(oldGrpID_newGrpID, open('oldGrpID_newGrpID.json', 'w'))\n\n # ------------------------------------------------------------------------\n # Post publishing processing: Update URLs and item ids\n # ------------------------------------------------------------------------\n print \"\\n\" + titleBreak\n print \"Update URLs and Item IDs...\"\n print titleBreak + \"\\n\"\n \n # Add the group ids to the dictionary of old/new ids\n origIDToNewID.update(oldGrpID_newGrpID)\n \n update_post_publish(portaladmin, hostname_map, origIDToNewID)\n\n # Comment out: this functionality is now available out of the box\n # # ------------------------------------------------------------------------\n # # Share items in default web apps template and default gallery\n # # ------------------------------------------------------------------------ \n # # Share the items in the default web apps template and\n # # default gallery template built-in group with the\n # # 'OpsServer' user 'AFMI Web Application Templates' and\n # # 'AFMI Gallery Templates'\n # print \"\\n\" + sectionBreak\n # print \"Share the items in the default web apps and gallery template groups...\"\n # group_owner = 'OpsServer'\n # if users.get(group_owner):\n # share_templates(portaladdress, users[group_owner]['target_username'], users[group_owner]['target_password'])\n # else:\n # print \"-Skipping...user {} was not created. Can perform same operation through portal 'Edit Settings'.\".format(group_owner)\n\n print \"\\nDONE: Finished posting content to portal.\"", "metadata": "root.publish_portal", "header": "['module', '___EOS___']", "index": 195 }, { "content": "def share_items(portal, userItemsPath, newItems, origItemSourceIDs, originGroupToDestGroups):\n #newItems - info on the items that were added to portal\n #origItemSourceIDs - the original source ids of the newItems, order of ids must match\n # order of newItems\n\n print \"Sharing items...\"\n \n for x in range(0, len(origItemSourceIDs)):\n newItem = newItems[x]\n newID = newItem[\"id\"]\n origID = origItemSourceIDs[x]\n\n itemIdfolder = os.path.join(userItemsPath,str(origID))\n \n if not os.path.exists(itemIdfolder):\n continue\n \n # Load sharing json file\n os.chdir(itemIdfolder)\n sharing = json.load(open('sharing.json'))\n \n new_group_ids = []\n new_group_names = []\n everyone = False\n org = False\n \n if sharing:\n #TODO: check if owner belongs to the groups being shared to??\n # swap stored group ids with portal group ids??\n old_group_ids = sharing['groups']\n for g in old_group_ids:\n if g in originGroupToDestGroups.keys():\n new_group_id = originGroupToDestGroups[g]\n new_group_ids.append(new_group_id)\n new_group_names = destGroupID_GroupName[new_group_id] #EL used for display\n \n if len(new_group_ids) == 0:\n new_group_ids = None\n \n print \"\\tSharing item \" + str(newItem.get(\"title\")) + \\\n \"[\" + str(newItem.get(\"type\")) + \"] with: \" + \\\n sharing['access'] + \", \" + str(new_group_names) + \"...\"\n \n if sharing['access'].lower() == \"public\":\n everyone = True\n org = True\n elif sharing['access'].lower() == \"org\":\n everyone = False\n org = True\n \n #TODO: should this function be located outside the if sharing statement...\n resp = portal.share_item(newID, new_group_ids, org, everyone)\n\n else:\n pass # nothing to share??\n del sharing", "metadata": "root.share_items", "header": "['module', '___EOS___']", "index": 388 }, { "content": "def publish_user_groups(portal,contentpath, userinfo, users):\n \n username = userinfo['target_username']\n password = userinfo['target_password']\n userfoldername = userinfo['username']\n \n groupfolder = os.path.join(contentpath, userfoldername, 'groups')\n groupfolders = os.listdir(groupfolder)\n \n numTotalGroupFolders = len(groupfolders)\n if numTotalGroupFolders == 0:\n print \"\\nUser '{}' does not own any groups.\".format(username)\n else:\n print \"\\nCreating '{}' group(s) for user '{}'...\".format(str(numTotalGroupFolders), username)\n \n groupcount = 0\n groupsprocessed = 0\n groupsFailed = [\"None\"] #TODO: later we append to this list, but why do we initialize\n # list with one element with \"None\" string? Was this supposed to be\n # groupsFailed = []\n for folder in groupfolders:\n groupcount = groupcount + 1\n oldGroupID = folder #was groupID = folder\n groupidfolder = os.path.join(groupfolder, folder)\n os.chdir(groupidfolder)\n group = json.load(open(\"group.json\"))\n group_users = json.load(open(\"group_users.json\"))\n \n # Check if group to add already exists\n groupId = getGroupID(portal, username, str(group['title']))\n \n # Create group if it doesn't exist\n if not groupId:\n print \"... group '\" + str(group['title']) + \"'\"\n groupId = portal.create_group(group,group['thumbfile'])\n # Reassign group\n portal.reassign_group(groupId, username)\n else:\n print \"... group '\" + str(group['title']) + \"' already exists.\"\n \n destGroupID_GroupName[groupId] = str(group['title']) #Track new group id and group name for later use\n \n print \"...... adding users to group\"\n if groupId:\n originGroupToDestGroups[oldGroupID] = groupId\n groups = []\n groups.append(groupId)\n \n # Check if users are in the list we added to the portal\n users_to_invite = []\n portal_users = get_target_users(users)\n for u in map_group_users(group_users[\"users\"], users):\n u = str(u) #dict keys are unicode, make them ascii\n if u in portal_users:\n users_to_invite.append(u)\n \n if len(users_to_invite) != 0:\n print \"......... adding the following users: \" + str(users_to_invite)\n results = portal.add_group_users(users_to_invite, groups)\n else:\n print \"......... no users to add.\"\n groupsprocessed = groupsprocessed + 1\n else:\n groupsFailed.append(groupID) #TODO: we append to this list, but don't use it anywhere.\n os.chdir(groupfolder)\n \n return originGroupToDestGroups", "metadata": "root.publish_user_groups", "header": "['module', '___EOS___']", "index": 604 }, { "content": "def publish_portal_resources(portaladmin,portal_properties):\n #publish resources from disk\n portalID = portal_properties['id']\n resourcesJSON = json.load(open(os.path.join(contentpath,'resources.json')))\n resourcesList = resourcesJSON['resources']\n \n print \"Posting resources\"\n for rsc in resourcesList:\n key = rsc['key']\n if key != 'accountSettings':\n datafile = os.path.join(contentpath,key)\n resp = portaladmin.add_resource(portalID,key,datafile,None)", "metadata": "root.publish_portal_resources", "header": "['module', '___EOS___']", "index": 686 } ]
[ { "span": "portal_properties ", "start_line": 198, "start_column": 4, "end_line": 198, "end_column": 21 }, { "span": "password ", "start_line": 275, "start_column": 8, "end_line": 275, "end_column": 16 }, { "span": "resp ", "start_line": 439, "start_column": 12, "end_line": 439, "end_column": 16 }, { "span": "password ", "start_line": 607, "start_column": 4, "end_line": 607, "end_column": 12 }, { "span": "results ", "start_line": 662, "start_column": 16, "end_line": 662, "end_column": 23 }, { "span": "resp ", "start_line": 697, "start_column": 12, "end_line": 697, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "publi", "sh", "\\u", "portal_", "(_", "portal", "address_", ",_", "content", "path_", ",_", "admin", "user_", ",_", "admin", "password_", ",_", "users_", ",_", "host", "name", "\\u", "map_", ",_", "specified", "\\u", "groups_", ",_", "id", "\\u", "mapping", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "content", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "portal", "\\u", "properties_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "\"", "portal", "\\u", "proper", "ties", ".", "json", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "admin_", "=_", "Porta", "l_", "(_", "portal", "address_", ",_", "admin", "user_", ",_", "admin", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print", "\\u", "script", "\\u", "header_", "(_", "portal", "admin_", ",_", "portal", "\\u", "processing_", ",_", "users_", ",_", "specified", "\\u", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "Porta", "l", " ", "log", " ", "folder", " ", "for", " ", "this", " ", "portal_", "\\u\\u\\uNL\\u\\u\\u_", "portal", "Log", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "portal", "Log", "Folder_", ",_", "get", "\\u", "server", "name", "\\u", "from", "\\u", "url_", "(_", "portal", "admin_", "._", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "Folder_", "(_", "portal", "Log", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "info", " ", "abo", "ut", " ", "the", " ", "group", "s", " ", "on", " ", "disk", " ", "to", " ", "filter", " ", "items", " ", "based", " ", "on", " ", "group", " ", "membership_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "group", "s", " ", "on", " ", "disk_", "\\u\\u\\uNL\\u\\u\\u_", "grp", "s", "\\u", "on", "\\u", "disk_", "=_", "get", "\\u", "group", "s", "\\u", "on", "\\u", "disk_", "(_", "content", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "tha", "t", " ", "each", " ", "specified", " ", "group", " ", "is", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "specified", "\\u", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "invalid", "\\u", "specified", "\\u", "groups_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "specified", "\\u", "group_", "in_", "specified", "\\u", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "grp_", "in_", "grp", "s", "\\u", "on", "\\u", "disk_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "specified", "\\u", "group_", "==_", "grp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "invalid", "\\u", "specified", "\\u", "groups_", "._", "append_", "(_", "specified", "\\u", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "invalid", "\\u", "specified", "\\u", "groups_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "***", "ERROR", ":", " ", "the", " ", "follow", "ing", " ", "specified", " ", "group", "s", " ", "do", " ", "not", " ", "exist", ";", " ", "NOTE", ":", " ", "group", " ", "owner", " ", "and", " ", "group", " ", "title", " ", "must", " ", "match", " ", "exact", "ly", " ", "inclu", "ding", " ", "case", ":\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "invalid", "\\u", "specified", "\\u", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Creat", "e", " ", "users", "...", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "create", " ", "users", " ", "if", " ", "this", " ", "is", " ", "not", " ", "an", " ", "onli", "ne", " ", "organization_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "portal", "admin_", "._", "properties_", "(_", ")_", "[_", "'", "id", "'_", "]_", "==_", "'", "0123456", "789", "ABCDE", "F", "'_", ":_", "#", " ", "All", " ", "portal", "s", " ", "have", " ", "this", " ", "id", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "username_", ",_", "userinfo_", "in_", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "create", "\\u", "user_", "(_", "portal", "admin_", ",_", "content", "path_", ",_", "userinfo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "t", "Thi", "s", " ", "is", " ", "an", " ", "onli", "ne", " ", "organization", ".", " ", "User", "s", " ", "must", " ", "alr", "ead", "y", " ", "have", " ", "bee", "n", " ", "created", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "user", " ", "folders_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'\\\\", "n", "'_", "+_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Creat", "e", " ", "user", " ", "folder", "s", "...", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "username_", ",_", "userinfo_", "in_", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "User", ":", " ", "'_", "+_", "userinfo_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "user", "\\u", "folders_", "(_", "portal", "admin_", ",_", "content", "path_", ",_", "userinfo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "group", "s", " ", "and", " ", "add", " ", "users", " ", "to", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\\\\", "n", "\"_", "+_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Creat", "ing", " ", "group", "s", " ", "...", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "Grp", "ID", "\\u", "new", "Grp", "ID_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "username_", ",_", "userinfo_", "in_", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Groups_", "=_", "publi", "sh", "\\u", "user", "\\u", "groups_", "(_", "portal", "admin_", ",_", "content", "path_", ",_", "userinfo_", ",_", "users_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "new", "Groups_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "Grp", "ID", "\\u", "new", "Grp", "ID_", "[_", "key_", "]_", "=_", "{_", "'", "id", "'_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Publish", " ", "Item", "s", " ", "and", " ", "Update", " ", "thei", "r", " ", "shar", "ing", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\\\\", "n", "\"_", "+_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Publish", "ing", " ", "items", " ", "and", " ", "setti", "ng", " ", "shar", "ing", " ", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "username_", ",_", "userinfo_", "in_", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "userinfo_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "userinfo_", "[_", "'", "target", "\\u", "password", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "folder", "name_", "=_", "userinfo_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Publish", " ", "all", " ", "the", " ", "users", "'", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "userco", "ntent", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "user", "folder", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Items_", ",_", "orig", "Item", "Sou", "rce", "ID", "s_", "=_", "publi", "sh", "\\u", "user", "\\u", "items_", "(_", "portal", "admin_", ",_", "username_", ",_", "userco", "ntent", "path_", ",_", "source", "\\u", "hostname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "hostname_", ",_", "new", "\\u", "port_", ",_", "specified", "\\u", "groups_", ",_", "id", "\\u", "mapping", "\\u", "file_", ",_", "grp", "s", "\\u", "on", "\\u", "disk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dump", " ", "info", " ", "abo", "ut", " ", "new", " ", "items", " ", "to", " ", "JSO", "N", " ", "to", " ", "use", " ", "for", " ", "reset", "ting", " ", "ID", "s", " ", "of", " ", "relate", "d", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "dump", "\\u", "new", "Item", "\\u", "info_", "(_", "new", "Items_", ",_", "orig", "Item", "Sou", "rce", "ID", "s_", ",_", "os_", "._", "path_", "._", "join_", "(_", "portal", "Log", "Path_", ",_", "username_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Share", " ", "the", " ", "users", "'", " ", "items", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appropr", "iate", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "user", "Item", "s", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "user", "folder", "name_", ",_", "\"", "items", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "share", "\\u", "items_", "(_", "portal", "admin_", ",_", "user", "Item", "s", "Path_", ",_", "new", "Items_", ",_", "orig", "Item", "Sou", "rce", "ID", "s_", ",_", "orig", "in", "Group", "To", "Dest", "Groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dump", " ", "info", " ", "abo", "ut", " ", "all", " ", "items", " ", "(", "old", ",", " ", "new", " ", "ids", ")", " ", "int", "o", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "portal", "Log", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "orig", "ID", "To", "New", "ID_", ",_", "open_", "(_", "'", "old", "ID", "\\u", "new", "ID", ".", "json", "'_", ",_", "'", "w", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "old", "Grp", "ID", "\\u", "new", "Grp", "ID_", ",_", "open_", "(_", "'", "old", "Grp", "ID", "\\u", "new", "Grp", "ID", ".", "json", "'_", ",_", "'", "w", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Post", " ", "publishing", " ", "process", "ing", ":", " ", "Update", " ", "URL", "s", " ", "and", " ", "item", " ", "ids_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "\"_", "+_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Update", " ", "URL", "s", " ", "and", " ", "Item", " ", "ID", "s", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "title", "Break", "_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "group", " ", "ids", " ", "to", " ", "the", " ", "dictionar", "y", " ", "of", " ", "old", "/", "new", " ", "ids_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "ID", "To", "New", "ID_", "._", "update_", "(_", "old", "Grp", "ID", "\\u", "new", "Grp", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "post", "\\u", "publish_", "(_", "portal", "admin_", ",_", "host", "name", "\\u", "map_", ",_", "orig", "ID", "To", "New", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Comme", "nt", " ", "out", ":", " ", "this", " ", "functional", "it", "y", " ", "is", " ", "now", " ", "avail", "able", " ", "out", " ", "of", " ", "the", " ", "box_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "Share", " ", "items", " ", "in", " ", "default", " ", "web", " ", "apps", " ", "template", " ", "and", " ", "default", " ", "gallery", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "Share", " ", "the", " ", "items", " ", "in", " ", "the", " ", "default", " ", "web", " ", "apps", " ", "template", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "default", " ", "gallery", " ", "template", " ", "bui", "lt", "-", "in", " ", "group", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "'", "Op", "s", "Server", "'", " ", "user", " ", "'", "AF", "MI", " ", "Web", " ", "Applica", "tion", " ", "Templa", "tes", "'", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "'", "AF", "MI", " ", "Gallery", " ", "Templa", "tes", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"\\\\", "n", "\"", " ", "+", " ", "section", "Break", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"", "Share", " ", "the", " ", "items", " ", "in", " ", "the", " ", "default", " ", "web", " ", "apps", " ", "and", " ", "gallery", " ", "template", " ", "group", "s", "...\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "group", "\\u", "owner", " ", "=", " ", "'", "Op", "s", "Server", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "users", ".", "get", "(", "group", "\\u", "owner", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "share", "\\u", "template", "s", "(", "portal", "address", ",", " ", "users", "[", "group", "\\u", "owner", "]['", "target", "\\u", "user", "name", "']", ",", " ", "users", "[", "group", "\\u", "owner", "]['", "target", "\\u", "password", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"-", "Ski", "ppi", "ng", "...", "user", " ", "{}", " ", "was", " ", "not", " ", "created", ".", " ", "Can", " ", "perform", " ", "same", " ", "operati", "on", " ", "through", " ", "portal", " ", "'", "Edit", " ", "Sett", "ings", "'.", "\".", "format", "(", "group", "\\u", "owner", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "DON", "E", ":", " ", "Finish", "ed", " ", "posting", " ", "content", " ", "to", " ", "portal", ".\"_", "\\u\\u\\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_", "share", "\\u", "items_", "(_", "portal_", ",_", "user", "Item", "s", "Path_", ",_", "new", "Items_", ",_", "orig", "Item", "Sou", "rce", "ID", "s_", ",_", "orig", "in", "Group", "To", "Dest", "Groups_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "new", "Item", "s", " ", "-", " ", "info", " ", "on", " ", "the", " ", "items", " ", "tha", "t", " ", "wer", "e", " ", "adde", "d", " ", "to", " ", "portal_", "\\u\\u\\uNL\\u\\u\\u_", "#", "orig", "Item", "Sou", "rce", "ID", "s", " ", "-", " ", "the", " ", "original", " ", "source", " ", "ids", " ", "of", " ", "the", " ", "new", "Item", "s", ",", " ", "order", " ", "of", " ", "ids", " ", "must", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "order", " ", "of", " ", "new", "Items_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Shar", "ing", " ", "items", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "orig", "Item", "Sou", "rce", "ID", "s_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Item_", "=_", "new", "Items_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "ID_", "=_", "new", "Item_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "ID_", "=_", "orig", "Item", "Sou", "rce", "ID", "s_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "item", "Id", "folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "user", "Item", "s", "Path_", ",_", "str_", "(_", "orig", "ID_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "item", "Id", "folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "shar", "ing", " ", "json", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "item", "Id", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shar", "ing_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "'", "shar", "ing", ".", "json", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "group", "\\u", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "group", "\\u", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "everyone", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "org_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shar", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "check", " ", "if", " ", "owner", " ", "belo", "ngs", " ", "to", " ", "the", " ", "group", "s", " ", "bei", "ng", " ", "shared", " ", "to", "??", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "swap", " ", "store", "d", " ", "group", " ", "ids", " ", "with", " ", "portal", " ", "group", " ", "ids", "??", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "group", "\\u", "ids_", "=_", "shar", "ing_", "[_", "'", "group", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "g_", "in_", "old", "\\u", "group", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "g_", "in_", "orig", "in", "Group", "To", "Dest", "Groups_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "group", "\\u", "id_", "=_", "orig", "in", "Group", "To", "Dest", "Groups_", "[_", "g_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "group", "\\u", "ids_", "._", "append_", "(_", "new", "\\u", "group", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "group", "\\u", "names_", "=_", "dest", "Group", "ID", "\\u", "Group", "Name_", "[_", "new", "\\u", "group", "\\u", "id_", "]_", "#", "EL", " ", "used", " ", "for", " ", "display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "new", "\\u", "group", "\\u", "ids_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "group", "\\u", "ids_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\\\\", "t", "Shar", "ing", " ", "item", " ", "\"_", "+_", "str_", "(_", "new", "Item_", "._", "get_", "(_", "\"", "title", "\"_", ")_", ")_", "+_", "\"[\"_", "+_", "str_", "(_", "new", "Item_", "._", "get_", "(_", "\"", "type", "\"_", ")_", ")_", "+_", "\"]", " ", "with", ":", " ", "\"_", "+_", "shar", "ing_", "[_", "'", "access", "'_", "]_", "+_", "\",", " ", "\"_", "+_", "str_", "(_", "new", "\\u", "group", "\\u", "names_", ")_", "+_", "\"...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shar", "ing_", "[_", "'", "access", "'_", "]_", "._", "lower_", "(_", ")_", "==_", "\"", "public", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "everyone", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "org_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "shar", "ing_", "[_", "'", "access", "'_", "]_", "._", "lower_", "(_", ")_", "==_", "\"", "org", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "everyone", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "org_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "shou", "ld", " ", "this", " ", "function", " ", "be", " ", "located", " ", "outsi", "de", " ", "the", " ", "if", " ", "shar", "ing", " ", "statem", "ent", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "=_", "portal_", "._", "share", "\\u", "item_", "(_", "new", "ID_", ",_", "new", "\\u", "group", "\\u", "ids_", ",_", "org_", ",_", "everyone", "_", ")_", "\\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 ", " _", "pass_", "#", " ", "not", "hing", " ", "to", " ", "share", "??", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "shar", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "publi", "sh", "\\u", "user", "\\u", "groups_", "(_", "portal_", ",_", "content", "path_", ",_", "userinfo_", ",_", "users_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "userinfo_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "userinfo_", "[_", "'", "target", "\\u", "password", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "folder", "name_", "=_", "userinfo_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "group", "folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "user", "folder", "name_", ",_", "'", "group", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "folders_", "=_", "os_", "._", "listdir_", "(_", "group", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Total", "Group", "Folders", "_", "=_", "len_", "(_", "group", "folders_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "Total", "Group", "Folders", "_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "n", "User", " ", "'{}'", " ", "doe", "s", " ", "not", " ", "own", " ", "any", " ", "group", "s", ".\"_", "._", "format_", "(_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "n", "Creat", "ing", " ", "'{}'", " ", "group", "(", "s", ")", " ", "for", " ", "user", " ", "'{}'", "...\"_", "._", "format_", "(_", "str_", "(_", "num", "Total", "Group", "Folders", "_", ")_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "group", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "spro", "cess", "ed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "s", "Failed_", "=_", "[_", "\"", "Non", "e", "\"_", "]_", "#", "TOD", "O", ":", " ", "late", "r", " ", "we", " ", "append", " ", "to", " ", "this", " ", "list", ",", " ", "but", " ", "wh", "y", " ", "do", " ", "we", " ", "initialize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "list", " ", "with", " ", "one", " ", "element", " ", "with", " ", "\"", "Non", "e", "\"", " ", "string", "?", " ", "Wa", "s", " ", "this", " ", "supposed", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "group", "s", "Fail", "ed", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "folder_", "in_", "group", "folders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "count_", "=_", "group", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Group", "ID_", "=_", "folder_", "#", "was", " ", "group", "ID", " ", "=", " ", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groupid", "folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "group", "folder_", ",_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "groupid", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "\"", "group", ".", "json", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "users_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "\"", "group", "\\u", "users", ".", "json", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "group", " ", "to", " ", "add", " ", "alr", "ead", "y", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "group", "Id_", "=_", "get", "Group", "ID_", "(_", "portal_", ",_", "username_", ",_", "str_", "(_", "group_", "[_", "'", "title", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "group", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "group", "Id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"...", " ", "group", " ", "'\"_", "+_", "str_", "(_", "group_", "[_", "'", "title", "'_", "]_", ")_", "+_", "\"'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "Id_", "=_", "portal_", "._", "create", "\\u", "group_", "(_", "group_", ",_", "group_", "[_", "'", "thumb", "file", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rea", "ssi", "gn", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "portal_", "._", "reass", "ign", "\\u", "group_", "(_", "group", "Id_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"...", " ", "group", " ", "'\"_", "+_", "str_", "(_", "group_", "[_", "'", "title", "'_", "]_", ")_", "+_", "\"'", " ", "alr", "ead", "y", " ", "exist", "s", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest", "Group", "ID", "\\u", "Group", "Name_", "[_", "group", "Id_", "]_", "=_", "str_", "(_", "group_", "[_", "'", "title", "'_", "]_", ")_", "#", "Track", " ", "new", " ", "group", " ", "id", " ", "and", " ", "group", " ", "name", " ", "for", " ", "late", "r", " ", "use_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"...", "...", " ", "addin", "g", " ", "users", " ", "to", " ", "group", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "group", "Id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig", "in", "Group", "To", "Dest", "Groups_", "[_", "old", "Group", "ID_", "]_", "=_", "group", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groups_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groups_", "._", "append_", "(_", "group", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "users", " ", "are", " ", "in", " ", "the", " ", "list", " ", "we", " ", "adde", "d", " ", "to", " ", "the", " ", "portal_", "\\u\\u\\uNL\\u\\u\\u_", "users", "\\u", "to", "\\u", "invite_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "users_", "=_", "get", "\\u", "target", "\\u", "users_", "(_", "users_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "u_", "in_", "map", "\\u", "group", "\\u", "users_", "(_", "group", "\\u", "users_", "[_", "\"", "users", "\"_", "]_", ",_", "users_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u_", "=_", "str_", "(_", "u_", ")_", "#", "dict", " ", "keys", " ", "are", " ", "unicode", ",", " ", "make", " ", "them", " ", "ascii_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "u_", "in_", "portal", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "users", "\\u", "to", "\\u", "invite_", "._", "append_", "(_", "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_", "len_", "(_", "users", "\\u", "to", "\\u", "invite_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"...", "......", " ", "addin", "g", " ", "the", " ", "follow", "ing", " ", "users", ":", " ", "\"_", "+_", "str_", "(_", "users", "\\u", "to", "\\u", "invite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "portal_", "._", "add", "\\u", "group", "\\u", "users_", "(_", "users", "\\u", "to", "\\u", "invite_", ",_", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"...", "......", " ", "no", " ", "users", " ", "to", " ", "add", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "group", "spro", "cess", "ed_", "=_", "group", "spro", "cess", "ed_", "+_", "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 ", " _", "group", "s", "Failed_", "._", "append_", "(_", "group", "ID_", ")_", "#", "TOD", "O", ":", " ", "we", " ", "append", " ", "to", " ", "this", " ", "list", ",", " ", "but", " ", "don", "'", "t", " ", "use", " ", "it", " ", "any", "where", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "group", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "orig", "in", "Group", "To", "Dest", "Groups_", "\\u\\u\\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_", "publi", "sh", "\\u", "portal", "\\u", "resources_", "(_", "portal", "admin_", ",_", "portal", "\\u", "properties_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "publi", "sh", " ", "resource", "s", " ", "from", " ", "disk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal", "ID_", "=_", "portal", "\\u", "properties_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "s", "JSON_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "'", "resource", "s", ".", "json", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "s", "List_", "=_", "resource", "s", "JSON_", "[_", "'", "resource", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Post", "ing", " ", "resource", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rsc", "_", "in_", "resource", "s", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "rsc", "_", "[_", "'", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "!=_", "'", "account", "Sett", "ings", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datafile_", "=_", "os_", "._", "path_", "._", "join_", "(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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Esri/solutions-geoprocessing-toolbox/operational_graphics/toolboxes/scripts/NumberFeatures.py
[ { "content": "# coding: utf-8\n#------------------------------------------------------------------------------\n# Copyright 2015 Esri\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#------------------------------------------------------------------------------\n#\n# ==================================================\n# NumberFeatures.py\n# --------------------------------------------------\n# Built on ArcGIS\n# ==================================================\n#\n# This tool will number features within a point feature class spatially from left to right,\n# top to bottom for a selected area.\n#\n# ==================================================\n# HISTORY:\n#\n# 8/25/2015 - mf - Needed to update script for non-ArcMap/Pro testing environment\n#\n# ==================================================\n\nimport os, sys, math, traceback\nimport arcpy\nfrom arcpy import env\nfrom arcpy import sa\nimport Utilities\n\n# Read in the Parameters\nareaToNumber = arcpy.GetParameterAsText(0)\npointFeatures = arcpy.GetParameterAsText(1)\nnumberingField = arcpy.GetParameterAsText(2)\noutputFeatureClass = arcpy.GetParameterAsText(3)\n\nDEBUG = True\nappEnvironment = None\nmxd, df, aprx, mp, mapList = None, None, None, None, None\n\n\n\n\n\n\n\n\n# MAIN =============================================\nif __name__ == \"__main__\":\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def labelFeatures(layer, field):\n\n ''' set up labeling for layer '''\n if appEnvironment == \"ARCGIS_PRO\":\n if layer.supports(\"SHOWLABELS\"):\n for lblclass in layer.listLabelClasses():\n lblclass.visible = True\n lblclass.expression = \" [\" + str(field) + \"]\"\n layer.showLabels = True\n elif appEnvironment == \"ARCMAP\":\n if layer.supports(\"LABELCLASSES\"):\n for lblclass in layer.labelClasses:\n lblclass.showClassLabels = True\n lblclass.expression = \" [\" + str(field) + \"]\"\n layer.showLabels = True\n arcpy.RefreshActiveView()\n else:\n pass # if returns \"OTHER\"", "metadata": "root.labelFeatures", "header": "['module', '___EOS___']", "index": 48 }, { "content": "def findLayerByName(layerName):\n #UPDATE\n if appEnvironment == \"ARCGIS_PRO\":\n #if gisVersion == \"1.0\": #Pro:\n if DEBUG == True:\n arcpy.AddMessage(\"Pro labeling for \" + layerName + \"...\")\n for layer in mapList.listLayers():\n if layer.name == layerName:\n arcpy.AddMessage(\"Found matching layer [\" + layer.name + \"]\")\n return layer\n else:\n arcpy.AddMessage(\"Incorrect layer: [\" + layer.name + \"]\")\n\n #else:\n elif appEnvironment == \"ARCMAP\":\n if DEBUG == True: arcpy.AddMessage(\"Map labeling for \" + layerName + \"...\")\n\n for layer in arcpy.mapping.ListLayers(mxd):\n if layer.name == layerName:\n arcpy.AddMessage(\"Found matching layer [\" + layer.name + \"]\")\n return layer\n else:\n arcpy.AddMessage(\"Incorrect layer: [\" + layer.name + \"]\")\n else:\n arcpy.AddMessage(\"Non-map environment, no layers to find...\")", "metadata": "root.findLayerByName", "header": "['module', '___EOS___']", "index": 67 }, { "content": "def GetApplication():\n '''Return app environment as ARCMAP, ARCGIS_PRO, OTHER'''\n try:\n from arcpy import mp\n return \"ARCGIS_PRO\"\n except ImportError:\n try:\n from arcpy import mapping\n mxd = arcpy.mapping.MapDocument(\"CURRENT\")\n return \"ARCMAP\"\n except:\n return \"OTHER\"", "metadata": "root.GetApplication", "header": "['module', '___EOS___']", "index": 94 }, { "content": "def main():\n ''' main '''\n #UPDATE\n # Create a feature layer from the input point features if it is not one already\n #df = arcpy.mapping.ListDataFrames(mxd)[0]\n pointFeatureName = os.path.basename(pointFeatures)\n layerExists = False\n\n try:\n # Check that area to number is a polygon\n descArea = arcpy.Describe(areaToNumber)\n areaGeom = descArea.shapeType\n arcpy.AddMessage(\"Shape type: \" + str(areaGeom))\n if (descArea.shapeType != \"Polygon\"):\n raise Exception(\"ERROR: The area to number must be a polygon.\")\n\n gisVersion = arcpy.GetInstallInfo()[\"Version\"]\n global appEnvironment\n appEnvironment = Utilities.GetApplication()\n if DEBUG == True: arcpy.AddMessage(\"App environment: \" + appEnvironment)\n\n global mxd\n global df\n global aprx\n global mp\n global mapList\n # mxd, df, aprx, mp = None, None, None, None\n #if gisVersion == \"1.0\": #Pro:\n if appEnvironment == \"ARCGIS_PRO\":\n from arcpy import mp\n aprx = arcpy.mp.ArcGISProject(\"CURRENT\")\n mapList = aprx.listMaps()[0]\n for lyr in mapList.listLayers():\n if lyr.name == pointFeatureName:\n layerExists = True\n #else:\n if appEnvironment == \"ARCMAP\":\n from arcpy import mapping\n mxd = arcpy.mapping.MapDocument('CURRENT')\n df = arcpy.mapping.ListDataFrames(mxd)[0]\n for lyr in arcpy.mapping.ListLayers(mxd):\n if lyr.name == pointFeatureName:\n layerExists = True\n\n if layerExists == False:\n arcpy.MakeFeatureLayer_management(pointFeatures, pointFeatureName)\n else:\n pointFeatureName = pointFeatures\n\n # Select all the points that are inside of area\n arcpy.AddMessage(\"Selecting points from (\" + str(os.path.basename(pointFeatureName)) +\\\n \") inside of the area (\" + str(os.path.basename(areaToNumber)) + \")\")\n selectionLayer = arcpy.SelectLayerByLocation_management(pointFeatureName, \"INTERSECT\",\n areaToNumber, \"#\", \"NEW_SELECTION\")\n if DEBUG == True:\n arcpy.AddMessage(\"Selected \" + str(arcpy.GetCount_management(pointFeatureName).getOutput(0)) + \" points\")\n\n # If no output FC is specified, then set it a temporary one, as this will be copied to the input and then deleted.\n # Sort layer by upper right across and then down spatially,\n overwriteFC = False\n global outputFeatureClass\n if outputFeatureClass == \"\":\n outputFeatureClass = \"tempSortedPoints\"\n overwriteFC = True;\n arcpy.AddMessage(\"Sorting the selected points geographically, right to left, top to bottom\")\n arcpy.Sort_management(selectionLayer, outputFeatureClass, [[\"Shape\", \"ASCENDING\"]])\n\n\n # Number the fields\n arcpy.AddMessage(\"Numbering the fields\")\n i = 1\n cursor = arcpy.UpdateCursor(outputFeatureClass)\n for row in cursor:\n row.setValue(numberingField, i)\n cursor.updateRow(row)\n i += 1\n\n\n # Clear the selection\n arcpy.AddMessage(\"Clearing the selection\")\n arcpy.SelectLayerByAttribute_management(pointFeatureName, \"CLEAR_SELECTION\")\n\n\n # Overwrite the Input Point Features, and then delete the temporary output feature class\n targetLayerName = \"\"\n if (overwriteFC):\n arcpy.AddMessage(\"Copying the features to the input, and then deleting the temporary feature class\")\n desc = arcpy.Describe(pointFeatureName)\n overwriteFC = os.path.join(os.path.sep, desc.path, pointFeatureName)\n fields = (numberingField, \"SHAPE@\")\n overwriteCursor = arcpy.da.UpdateCursor(overwriteFC, fields)\n for overwriteRow in overwriteCursor:\n sortedPointsCursor = arcpy.da.SearchCursor(outputFeatureClass, fields)\n for sortedRow in sortedPointsCursor:\n if sortedRow[1].equals(overwriteRow[1]):\n overwriteRow[0] = sortedRow[0]\n overwriteCursor.updateRow(overwriteRow)\n arcpy.Delete_management(outputFeatureClass)\n\n #UPDATE\n #if layerExists == False:\n #layerToAdd = arcpy.mapping.Layer(pointFeatureName)\n #arcpy.mapping.AddLayer(df, layerToAdd, \"AUTO_ARRANGE\")\n targetLayerName = pointFeatureName\n else:\n #UPDATE\n #layerToAdd = arcpy.mapping.Layer(outputFeatureClass)\n #arcpy.mapping.AddLayer(df, layerToAdd, \"AUTO_ARRANGE\")\n targetLayerName = os.path.basename(outputFeatureClass)\n\n\n # Get and label the output feature\n if appEnvironment == \"ARCGIS_PRO\":\n results = arcpy.MakeFeatureLayer_management(outputFeatureClass, targetLayerName).getOutput(0)\n mapList.addLayer(results, \"AUTO_ARRANGE\")\n layer = findLayerByName(targetLayerName)\n if(layer):\n labelFeatures(layer, numberingField)\n elif appEnvironment == \"ARCMAP\":\n arcpy.AddMessage(\"Adding features to map (\" + str(targetLayerName) + \")...\")\n arcpy.MakeFeatureLayer_management(outputFeatureClass, targetLayerName)\n layer = arcpy.mapping.Layer(targetLayerName)\n arcpy.mapping.AddLayer(df, layer, \"AUTO_ARRANGE\")\n arcpy.AddMessage(\"Labeling output features (\" + str(targetLayerName) + \")...\")\n layer = findLayerByName(targetLayerName)\n if (layer):\n labelFeatures(layer, numberingField)\n else:\n arcpy.AddMessage(\"Non-map application, skipping labeling...\")\n\n\n arcpy.SetParameter(3, outputFeatureClass)\n\n\n except arcpy.ExecuteError:\n # Get the tool error messages\n msgs = arcpy.GetMessages()\n arcpy.AddError(msgs)\n print(msgs)\n\n except:\n # Get the traceback object\n tb = sys.exc_info()[2]\n tbinfo = traceback.format_tb(tb)[0]\n\n # Concatenate information together concerning the error into a message string\n pymsg = \"PYTHON ERRORS:\\nTraceback info:\\n\" + tbinfo + \"\\nError Info:\\n\" + str(sys.exc_info()[1])\n msgs = \"ArcPy ERRORS:\\n\" + arcpy.GetMessages() + \"\\n\"\n\n # Return python error messages for use in script tool or Python Window\n arcpy.AddError(pymsg)\n arcpy.AddError(msgs)\n\n # Print Python error messages for use in Python / Python Window\n print(pymsg + \"\\n\")\n print(msgs)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 109 } ]
[ { "span": "import os, sys, math, traceback", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 31 }, { "span": "from arcpy import env", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 21 }, { "span": "from arcpy import sa", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "Es", "ri_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Number", "Feature", "s", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bu", "ilt", " ", "on", " ", "Arc", "GI", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "tool", " ", "will", " ", "number", " ", "features", " ", "within", " ", "a", " ", "point", " ", "feature", " ", "class", " ", "spat", "ial", "ly", " ", "from", " ", "left", " ", "to", " ", "right", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "top", " ", "to", " ", "bottom", " ", "for", " ", "a", " ", "selecte", "d", " ", "area", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HISTORY", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "8", "/", "25", "/", "201", "5", " ", "-", " ", "mf", " ", "-", " ", "Needed", " ", "to", " ", "update", " ", "script", " ", "for", " ", "non", "-", "Arc", "Map", "/", "Pro", " ", "testi", "ng", " ", "environment_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "math_", ",_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "arcpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "arcpy_", "import_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "arcpy_", "import_", "sa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Utilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "in", " ", "the", " ", "Parameters_", "\\u\\u\\uNL\\u\\u\\u_", "area", "To", "Number_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point", "Features_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "numbering", "Field_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "Feature", "Class_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "Environment_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mx", "d_", ",_", "df_", ",_", "apr", "x_", ",_", "mp_", ",_", "map", "List_", "=_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "MAIN", " ", "==============", "==============", "==============", "===", "_", "\\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 ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "label", "Features_", "(_", "layer_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "set", " ", "up", " ", "labeling", " ", "for", " ", "layer", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "app", "Environment_", "==_", "\"", "ARC", "GI", "S", "\\u", "PRO", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "layer_", "._", "support", "s_", "(_", "\"", "SHOW", "LAB", "ELS", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "lbl", "class_", "in_", "layer_", "._", "list", "Label", "Classes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lbl", "class_", "._", "visible_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lbl", "class_", "._", "expression_", "=_", "\"", " ", "[\"_", "+_", "str_", "(_", "field_", ")_", "+_", "\"]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "layer_", "._", "show", "Labels_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "app", "Environment_", "==_", "\"", "ARC", "MAP", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "layer_", "._", "support", "s_", "(_", "\"", "LAB", "EL", "CLASSE", "S", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "lbl", "class_", "in_", "layer_", "._", "label", "Classes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lbl", "class_", "._", "show", "Class", "Labels_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lbl", "class_", "._", "expression_", "=_", "\"", " ", "[\"_", "+_", "str_", "(_", "field_", ")_", "+_", "\"]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "layer_", "._", "show", "Labels_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Refr", "esh", "Activ", "e", "View_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "if", " ", "return", "s", " ", "\"", "OTHER", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "Layer", "By", "Name_", "(_", "layer", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "app", "Environment_", "==_", "\"", "ARC", "GI", "S", "\\u", "PRO", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "gi", "s", "Version", " ", "==", " ", "\"", "1.0", "\":", " ", "#", "Pro", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "DEBUG_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Pro", " ", "labeling", " ", "for", " ", "\"_", "+_", "layer", "Name_", "+_", "\"...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "layer_", "in_", "map", "List_", "._", "list", "Layers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "layer_", "._", "name_", "==_", "layer", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Foun", "d", " ", "matchi", "ng", " ", "layer", " ", "[\"_", "+_", "layer_", "._", "name_", "+_", "\"]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "layer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Inco", "rrect", " ", "layer", ":", " ", "[\"_", "+_", "layer_", "._", "name_", "+_", "\"]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "app", "Environment_", "==_", "\"", "ARC", "MAP", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "DEBUG_", "==_", "True_", ":_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Map", " ", "labeling", " ", "for", " ", "\"_", "+_", "layer", "Name_", "+_", "\"...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "layer_", "in_", "arcpy_", "._", "mapping_", "._", "List", "Layers_", "(_", "mx", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "layer_", "._", "name_", "==_", "layer", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Foun", "d", " ", "matchi", "ng", " ", "layer", " ", "[\"_", "+_", "layer_", "._", "name_", "+_", "\"]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "layer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Inco", "rrect", " ", "layer", ":", " ", "[\"_", "+_", "layer_", "._", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Non", "-", "map", " ", "environ", "ment", ",", " ", "no", " ", "layer", "s", " ", "to", " ", "find", "...\"_", ")_", "\\u\\u\\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", "Application_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "app", " ", "environ", "ment", " ", "as", " ", "ARC", "MAP", ",", " ", "ARC", "GI", "S", "\\u", "PRO", ",", " ", "OTHER", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "arcpy_", "import_", "mp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "ARC", "GI", "S", "\\u", "PRO", "\"_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "arcpy_", "import_", "mapping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mx", "d_", "=_", "arcpy_", "._", "mapping_", "._", "Map", "Document_", "(_", "\"", "CURREN", "T", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "ARC", "MAP", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "OTHER", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "main", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "feature", " ", "layer", " ", "from", " ", "the", " ", "input", " ", "point", " ", "features", " ", "if", " ", "it", " ", "is", " ", "not", " ", "one", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", "df", " ", "=", " ", "arc", "py", ".", "mapping", ".", "List", "Data", "Frame", "s", "(", "mx", "d", ")[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "point", "Feature", "Name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "point", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layer", "Exists_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "area", " ", "to", " ", "number", " ", "is", " ", "a", " ", "polygon_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "desc", "Area_", "=_", "arcpy_", "._", "Describe", "_", "(_", "area", "To", "Number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "area", "Geom_", "=_", "desc", "Area_", "._", "shape", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Shape", " ", "type", ":", " ", "\"_", "+_", "str_", "(_", "area", "Geom_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "desc", "Area_", "._", "shape", "Type_", "!=_", "\"", "Polygon", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "ERROR", ":", " ", "The", " ", "area", " ", "to", " ", "number", " ", "must", " ", "be", " ", "a", " ", "poly", "gon", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gi", "s", "Version_", "=_", "arcpy_", "._", "Get", "Install", "Info_", "(_", ")_", "[_", "\"", "Version", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "app", "Environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "Environment_", "=_", "Utilities_", "._", "Get", "Application_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", "==_", "True_", ":_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "App", " ", "environ", "ment", ":", " ", "\"_", "+_", "app", "Environment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "mx", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "apr", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "mp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "map", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mx", "d", ",", " ", "df", ",", " ", "apr", "x", ",", " ", "mp", " ", "=", " ", "Non", "e", ",", " ", "Non", "e", ",", " ", "Non", "e", ",", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "gi", "s", "Version", " ", "==", " ", "\"", "1.0", "\":", " ", "#", "Pro", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "app", "Environment_", "==_", "\"", "ARC", "GI", "S", "\\u", "PRO", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "arcpy_", "import_", "mp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apr", "x_", "=_", "arcpy_", "._", "mp_", "._", "Arc", "GI", "SP", "roj", "ect_", "(_", "\"", "CURREN", "T", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "List_", "=_", "apr", "x_", "._", "list", "Maps_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lyr_", "in_", "map", "List_", "._", "list", "Layers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lyr_", "._", "name_", "==_", "point", "Feature", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "layer", "Exists_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "app", "Environment_", "==_", "\"", "ARC", "MAP", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "arcpy_", "import_", "mapping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mx", "d_", "=_", "arcpy_", "._", "mapping_", "._", "Map", "Document_", "(_", "'", "CURREN", "T", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "arcpy_", "._", "mapping_", "._", "List", "Data", "Frames_", "(_", "mx", "d_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lyr_", "in_", "arcpy_", "._", "mapping_", "._", "List", "Layers_", "(_", "mx", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lyr_", "._", "name_", "==_", "point", "Feature", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "layer", "Exists_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "layer", "Exists_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Make", "Feature", "Layer", "\\u", "management_", "(_", "point", "Features_", ",_", "point", "Feature", "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 ", " _", "point", "Feature", "Name_", "=_", "point", "Features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "all", " ", "the", " ", "points", " ", "tha", "t", " ", "are", " ", "insi", "de", " ", "of", " ", "area_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Selecti", "ng", " ", "points", " ", "from", " ", "(\"_", "+_", "str_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "point", "Feature", "Name_", ")_", ")_", "+_", "\")", " ", "insi", "de", " ", "of", " ", "the", " ", "area", " ", "(\"_", "+_", "str_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "area", "To", "Number_", ")_", ")_", "+_", "\")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selection", "Layer_", "=_", "arcpy_", "._", "Select", "Layer", "By", "Locat", "ion", "\\u", "management_", "(_", "point", "Feature", "Name_", ",_", "\"", "INTER", "SEC", "T", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "area", "To", "Number_", ",_", "\"#\"_", ",_", "\"", "NEW", "\\u", "SELECTION", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Select", "ed", " ", "\"_", "+_", "str_", "(_", "arcpy_", "._", "Get", "Count", "\\u", "management_", "(_", "point", "Feature", "Name_", ")_", "._", "get", "Output_", "(_", "0_", ")_", ")_", "+_", "\"", " ", "points", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "output", " ", "FC", " ", "is", " ", "specified", ",", " ", "then", " ", "set", " ", "it", " ", "a", " ", "temporar", "y", " ", "one", ",", " ", "as", " ", "this", " ", "will", " ", "be", " ", "copie", "d", " ", "to", " ", "the", " ", "input", " ", "and", " ", "then", " ", "delete", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sort", " ", "layer", " ", "by", " ", "upper", " ", "right", " ", "acro", "ss", " ", "and", " ", "then", " ", "down", " ", "spat", "ial", "ly", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "overwrit", "e", "FC_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "output", "Feature", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output", "Feature", "Class_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "Feature", "Class_", "=_", "\"", "temp", "Sorte", "d", "Point", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "overwrit", "e", "FC_", "=_", "True_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Sort", "ing", " ", "the", " ", "selecte", "d", " ", "points", " ", "geographic", "ally", ",", " ", "right", " ", "to", " ", "left", ",", " ", "top", " ", "to", " ", "bottom", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Sort", "\\u", "management_", "(_", "selection", "Layer_", ",_", "output", "Feature", "Class_", ",_", "[_", "[_", "\"", "Shape", "\"_", ",_", "\"", "ASC", "ENDI", "NG", "\"_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Number", " ", "the", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Number", "ing", " ", "the", " ", "fields", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "=_", "arcpy_", "._", "Update", "Cursor_", "(_", "output", "Feature", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "._", "set", "Value_", "(_", "numbering", "Field_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "update", "Row_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clear", " ", "the", " ", "selection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Clear", "ing", " ", "the", " ", "selection", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Select", "Layer", "By", "Attribute", "\\u", "management_", "(_", "point", "Feature", "Name_", ",_", "\"", "CLEAR", "\\u", "SELECTION", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Over", "write", " ", "the", " ", "Inp", "ut", " ", "Point", " ", "Feature", "s", ",", " ", "and", " ", "then", " ", "delete", " ", "the", " ", "temporar", "y", " ", "output", " ", "feature", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Layer", "Name_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "overwrit", "e", "FC_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Copy", "ing", " ", "the", " ", "features", " ", "to", " ", "the", " ", "input", ",", " ", "and", " ", "then", " ", "delet", "ing", " ", "the", " ", "temporar", "y", " ", "feature", " ", "class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "arcpy_", "._", "Describe", "_", "(_", "point", "Feature", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "overwrit", "e", "FC_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "sep_", ",_", "desc_", "._", "path_", ",_", "point", "Feature", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "numbering", "Field_", ",_", "\"", "SHAPE", "@\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "overwrit", "e", "Cursor_", "=_", "arcpy_", "._", "da_", "._", "Update", "Cursor_", "(_", "overwrit", "e", "FC_", ",_", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "overwrit", "e", "Row_", "in_", "overwrit", "e", "Cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sorte", "d", "Point", "s", "Cursor_", "=_", "arcpy_", "._", "da_", "._", "Sear", "ch", "Cursor_", "(_", "output", "Feature", "Class_", ",_", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sorte", "d", "Row_", "in_", "sorte", "d", "Point", "s", "Cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "sorte", "d", "Row_", "[_", "1_", "]_", "._", "equals_", "(_", "overwrit", "e", "Row_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "overwrit", "e", "Row_", "[_", "0_", "]_", "=_", "sorte", "d", "Row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "overwrit", "e", "Cursor_", "._", "update", "Row_", "(_", "overwrit", "e", "Row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Delete", "\\u", "management_", "(_", "output", "Feature", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "layer", "Exist", "s", " ", "==", " ", "Fal", "se", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "layer", "To", "Add", " ", "=", " ", "arc", "py", ".", "mapping", ".", "Layer", "(", "point", "Feature", "Name", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "arc", "py", ".", "mapping", ".", "Add", "Layer", "(", "df", ",", " ", "layer", "To", "Add", ",", " ", "\"", "AUTO", "\\u", "ARR", "ANGE", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Layer", "Name_", "=_", "point", "Feature", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "#", "layer", "To", "Add", " ", "=", " ", "arc", "py", ".", "mapping", ".", "Layer", "(", "output", "Feature", "Class", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "arc", "py", ".", "mapping", ".", "Add", "Layer", "(", "df", ",", " ", "layer", "To", "Add", ",", " ", "\"", "AUTO", "\\u", "ARR", "ANGE", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "Layer", "Name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "output", "Feature", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "and", " ", "label", " ", "the", " ", "output", " ", "feature_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "app", "Environment_", "==_", "\"", "ARC", "GI", "S", "\\u", "PRO", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "arcpy_", "._", "Make", "Feature", "Layer", "\\u", "management_", "(_", "output", "Feature", "Class_", ",_", "target", "Layer", "Name_", ")_", "._", "get", "Output_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "List_", "._", "add", "Layer_", "(_", "results_", ",_", "\"", "AUTO", "\\u", "ARR", "ANGE", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layer_", "=_", "find", "Layer", "By", "Name_", "(_", "target", "Layer", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "layer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label", "Features_", "(_", "layer_", ",_", "numbering", "Field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "app", "Environment_", "==_", "\"", "ARC", "MAP", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Add", "ing", " ", "features", " ", "to", " ", "map", " ", "(\"_", "+_", "str_", "(_", "target", "Layer", "Name_", ")_", "+_", "\")", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Make", "Feature", "Layer", "\\u", "management_", "(_", "output", "Feature", "Class_", ",_", "target", "Layer", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layer_", "=_", "arcpy_", "._", "mapping_", "._", "Layer_", "(_", "target", "Layer", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "mapping_", "._", "Add", "Layer_", "(_", "df_", ",_", "layer_", ",_", "\"", "AUTO", "\\u", "ARR", "ANGE", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Label", "ing", " ", "output", " ", "features", " ", "(\"_", "+_", "str_", "(_", "target", "Layer", "Name_", ")_", "+_", "\")", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layer_", "=_", "find", "Layer", "By", "Name_", "(_", "target", "Layer", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "layer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label", "Features_", "(_", "layer_", ",_", "numbering", "Field_", ")_", "\\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 ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Non", "-", "map", " ", "applica", "tion", ",", " ", "skip", "ping", " ", "labeling", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Set", "Parameter_", "(_", "3_", ",_", "output", "Feature", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "arcpy_", "._", "Execut", "e", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "tool", " ", "error", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msgs_", "=_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "traceback", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "info_", "=_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Concat", "enat", "e", " ", "informati", "on", " ", "tog", "ether", " ", "concern", "ing", " ", "the", " ", "error", " ", "int", "o", " ", "a", " ", "message", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "pym", "sg_", "=_", "\"", "PYTHON", " ", "ERRORS", ":\\\\", "n", "Trace", "back", " ", "info", ":\\\\", "n", "\"_", "+_", "tb", "info_", "+_", "\"\\\\", "n", "Error", " ", "Info", ":\\\\", "n", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs_", "=_", "\"", "Arc", "Py", " ", "ERRORS", ":\\\\", "n", "\"_", "+_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "python", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "script", " ", "tool", " ", "or", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "pym", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "Pyth", "on", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "Pyth", "on", " ", "/", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "pym", "sg_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
python-provy/provy/docs.py
[ { "content": "def main():\n path = \"/tmp/docs.json\"\n source_path = join(os.curdir, 'provy', 'more')\n\n if not exists(dirname(path)):\n os.makedirs(dirname(path))\n\n root_namespace = 'provy.more'\n\n roles_to_document = {\n 'Role': RoleDoc(Role, 'Role', 'provy.core.roles', Role.__doc__)\n }\n\n for root, dirs, files in os.walk(source_path):\n for file_name in files:\n if file_name == \"__init__.py\":\n continue\n if not fnmatch.fnmatch(file_name, '*.py'):\n continue\n\n module_path = '%s.%s.%s' % (root_namespace,\n get_namespace_for(root),\n splitext(file_name)[0])\n\n module = import_module(module_path)\n\n for name, member in inspect.getmembers(module):\n if not inspect.isclass(member) or not issubclass(member, Role):\n continue\n if member.__module__ != module_path:\n continue\n\n if not member.__doc__:\n print \"Warning: Role %s.%s does not have docstring.\" % (member.__module__, name)\n\n roles_to_document[module_path] = RoleDoc(member,\n name,\n member.__module__,\n member.__doc__)\n\n tree = {}\n\n for full_name, role_doc in roles_to_document.iteritems():\n role = role_doc.role\n name = role_doc.name\n current = tree\n module = __import__(role.__module__)\n for part in role.__module__.split('.'):\n if hasattr(module, part):\n module = getattr(module, part)\n if not part in current:\n if not module.__doc__:\n print \"Warning: Module %s does not have docstring.\" % module.__name__\n\n current[part] = {\n '__name__': module.__name__,\n '__doc__': module.__doc__ and module.__doc__.strip() or None\n }\n if part == role.__module__.split('.')[-1]:\n current[part][role_doc.name] = role_doc.to_dict()\n current = current[part]\n\n contents = dumps(tree, sort_keys=True, separators=(',', ':'))\n with open(path, 'w') as f:\n f.write(contents)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 62 } ]
[ { "span": "name ", "start_line": 106, "start_column": 8, "end_line": 106, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "\"/", "tmp", "/", "docs", ".", "json", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "path_", "=_", "join_", "(_", "os_", "._", "curdir_", ",_", "'", "prov", "y", "'_", ",_", "'", "more", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "exists_", "(_", "dirname_", "(_", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "dirname_", "(_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "\\u", "namespace_", "=_", "'", "prov", "y", ".", "more", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "role", "s", "\\u", "to", "\\u", "document_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ro", "le", "'_", ":_", "Ro", "le", "Doc_", "(_", "Role_", ",_", "'", "Ro", "le", "'_", ",_", "'", "prov", "y", ".", "core", ".", "role", "s", "'_", ",_", "Role_", "._", "\\u\\u", "doc\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "root_", ",_", "dirs_", ",_", "files_", "in_", "os_", "._", "walk_", "(_", "source", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "file", "\\u", "name_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file", "\\u", "name_", "==_", "\"\\u\\u", "init", "\\u\\u", ".", "py", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "fnmatch_", "._", "fnmatch_", "(_", "file", "\\u", "name_", ",_", "'*", ".", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module", "\\u", "path_", "=_", "'%", "s", ".", "%", "s", ".", "%", "s", "'_", "%_", "(_", "root", "\\u", "namespace_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "namespace", "\\u", "for_", "(_", "root_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "splitext_", "(_", "file", "\\u", "name_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "=_", "import", "\\u", "module_", "(_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", ",_", "member_", "in_", "inspect_", "._", "getmember", "s_", "(_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "inspect_", "._", "iscl", "ass_", "(_", "member_", ")_", "or_", "not_", "issubclass_", "(_", "member_", ",_", "Role_", ")_", ":_", "\\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_", "member_", "._", "\\u\\u", "module\\u\\u_", "!=_", "module", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "member_", "._", "\\u\\u", "doc\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "Warn", "ing", ":", " ", "Ro", "le", " ", "%", "s", ".", "%", "s", " ", "doe", "s", " ", "not", " ", "have", " ", "docstr", "ing", ".\"_", "%_", "(_", "member_", "._", "\\u\\u", "module\\u\\u_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "role", "s", "\\u", "to", "\\u", "document_", "[_", "module", "\\u", "path_", "]_", "=_", "Ro", "le", "Doc_", "(_", "member_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member_", "._", "\\u\\u", "module\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member_", "._", "\\u\\u", "doc\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tree_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "full", "\\u", "name_", ",_", "role", "\\u", "doc_", "in_", "role", "s", "\\u", "to", "\\u", "document_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "role_", "=_", "role", "\\u", "doc_", "._", "role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "role", "\\u", "doc_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "=_", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "\\u\\u", "import\\u\\u_", "(_", "role_", "._", "\\u\\u", "module\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "part_", "in_", "role_", "._", "\\u\\u", "module\\u\\u_", "._", "split_", "(_", "'.'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "module_", ",_", "part_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "=_", "getattr_", "(_", "module_", ",_", "part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "part_", "in_", "current_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "module_", "._", "\\u\\u", "doc\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "Warn", "ing", ":", " ", "Modul", "e", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "have", " ", "docstr", "ing", ".\"_", "%_", "module_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current_", "[_", "part_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "name", "\\u\\u'_", ":_", "module_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "doc", "\\u\\u'_", ":_", "module_", "._", "\\u\\u", "doc\\u\\u_", "and_", "module_", "._", "\\u\\u", "doc\\u\\u_", "._", "strip_", "(_", ")_", "or_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "part_", "==_", "role_", "._", "\\u\\u", "module\\u\\u_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current_", "[_", "part_", "]_", "[_", "role", "\\u", "doc_", "._", "name_", "]_", "=_", "role", "\\u", "doc_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current_", "=_", "current_", "[_", "part_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "contents_", "=_", "dumps_", "(_", "tree_", ",_", "sort", "\\u", "keys_", "=_", "True_", ",_", "separators_", "=_", "(_", "','_", ",_", "':'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "path_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "contents_", ")_", "\\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, 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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 ]
Testing equality to None
google/memcache-collections/memcache_collections.py
[ { "content": "def _get_cas_ids(mc):\n \"\"\"Get implementation-specific CAS ID dictionary.\"\"\"\n # TODO: pluggable CAS ID access\n cas_ids = getattr(mc, 'cas_ids', None) # python-memcached client\n if cas_ids == None:\n cas_ids = getattr(mc, '_cas_ids', None) # App Engine\n assert cas_ids != None, 'Explicit CAS not supported for memcache client'\n return cas_ids", "metadata": "root._get_cas_ids", "header": "['module', '___EOS___']", "index": 482 }, { "content": "def _explicit_cas(mc, key, value, cas_id):\n \"\"\"Perform CAS given explicit unique ID.\"\"\"\n cas_ids = _get_cas_ids(mc)\n original_id = cas_ids.get(key)\n cas_ids[key] = cas_id\n result = mc.cas(key, value)\n if original_id == None:\n del cas_ids[key]\n else:\n cas_ids[key] = original_id\n return result", "metadata": "root._explicit_cas", "header": "['module', '___EOS___']", "index": 492 } ]
[ { "span": "cas_ids == None:", "start_line": 486, "start_column": 7, "end_line": 486, "end_column": 22 }, { "span": "original_id == None:", "start_line": 498, "start_column": 7, "end_line": 498, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "cas", "\\u", "ids_", "(_", "mc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "implementation", "-", "specific", " ", "CAS", " ", "ID", " ", "dictionar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "plug", "gab", "le", " ", "CAS", " ", "ID", " ", "access_", "\\u\\u\\uNL\\u\\u\\u_", "cas", "\\u", "ids_", "=_", "getattr_", "(_", "mc_", ",_", "'", "cas", "\\u", "ids", "'_", ",_", "None_", ")_", "#", " ", "python", "-", "memcached", " ", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cas", "\\u", "ids_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cas", "\\u", "ids_", "=_", "getattr_", "(_", "mc_", ",_", "'\\u", "cas", "\\u", "ids", "'_", ",_", "None_", ")_", "#", " ", "App", " ", "Engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "cas", "\\u", "ids_", "!=_", "None_", ",_", "'", "Exp", "licit", " ", "CAS", " ", "not", " ", "support", "ed", " ", "for", " ", "memc", "ache", " ", "client", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cas", "\\u", "ids_", "\\u\\u\\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", "explicit", "\\u", "cas_", "(_", "mc_", ",_", "key_", ",_", "value_", ",_", "cas", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", " ", "CAS", " ", "give", "n", " ", "explicit", " ", "unique", " ", "ID", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cas", "\\u", "ids_", "=_", "\\u", "get", "\\u", "cas", "\\u", "ids_", "(_", "mc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "id_", "=_", "cas", "\\u", "ids_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cas", "\\u", "ids_", "[_", "key_", "]_", "=_", "cas", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "mc_", "._", "cas_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "original", "\\u", "id_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "cas", "\\u", "ids_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cas", "\\u", "ids_", "[_", "key_", "]_", "=_", "original", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\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, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
divmain/GitSavvy/common/util/debug.py
[ { "content": "def log_on_exception(fn):\n def wrapped_fn(*args, **kwargs):\n try:\n fn(*args, **kwargs)\n except Exception as e:\n add_to_log({\n \"type\": \"exception\",\n \"exception\": repr(e)\n })\n raise e", "metadata": "root.log_on_exception", "header": "['module', '___EOS___']", "index": 45 } ]
[ { "span": "wrapped_fn(", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "\\u", "on", "\\u", "exception_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "wrapp", "ed", "\\u", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\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 ", " _", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "\\u", "to", "\\u", "log_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "exception", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "exception", "\"_", ":_", "repr_", "(_", "e_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
arvinddoraiswamy/mywebappscripts/ForceSSL/force_http_req.py
[ { "content": "#http://stackoverflow.com/questions/110498/is-there-an-easy-way-to-request-a-url-in-python-and-not-follow-redirects\n#http://kentsjohnson.com/kk/00010.html\n#http://stackoverflow.com/questions/4560288/python-try-except-showing-the-cause-of-the-error-after-displaying-my-variables\n\nimport sys\nimport re\nimport urllib2\nimport traceback\nimport threading\nimport time\n\nrequests='https_urls'; urls_accessible_http=[]\n\n\n\n\n\nmain()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main():\n list_of_requests=read_https_urls(requests)\n urls_accessible_http=request_over_http(list_of_requests)\n create_report(urls_accessible_http)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def create_report(urls_accessible_http):\n try:\n f=open('url_http_request_report','w')\n except:\n print 'Cannot open file to write report'\n traceback.print_exc(file=sys.stdout)\n\n if len(urls_accessible_http) > 0:\n for url in urls_accessible_http:\n f.write(url+'\\n')\n else:\n f.write('None of the URLs can be accessed over HTTP.')\n\n f.close()", "metadata": "root.create_report", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def read_https_urls(requests):\n list_of_requests=[]\n try:\n f=open(requests,'r')\n except:\n print 'Could not open file containing requests'\n for url in f:\n url=re.sub(r'^https',r'http',url)\n list_of_requests.append(url)\n f.close()\n return list_of_requests", "metadata": "root.read_https_urls", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def request_over_http(list_of_requests):\n threads=[]\n for url in list_of_requests:\n url=re.sub(r'\\s+$',r'',url)\n url=re.sub(r'^\\s+',r'',url)\n print 'Testing URL '+url\n try:\n f = urllib2.urlopen(url)\n t1=f.geturl().split(':')\n if t1[0] != 'https':\n urls_accessible_http.append(url)\n except Exception:\n pass\n\n time.sleep(5)\n return urls_accessible_http", "metadata": "root.request_over_http", "header": "['module', '___EOS___']", "index": 45 } ]
[ { "span": "import threading", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "110", "498", "/", "is", "-", "there", "-", "an", "-", "easy", "-", "way", "-", "to", "-", "request", "-", "a", "-", "url", "-", "in", "-", "python", "-", "and", "-", "not", "-", "follow", "-", "redirects_", "\\u\\u\\uNL\\u\\u\\u_", "#", "http", "://", "ken", "ts", "john", "son", ".", "com", "/", "kk", "/", "00010", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "#", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "456", "028", "8", "/", "python", "-", "try", "-", "except", "-", "showin", "g", "-", "the", "-", "caus", "e-", "of", "-", "the", "-", "error", "-", "after", "-", "display", "ing", "-", "my", "-", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "requests_", "=_", "'", "https", "\\u", "urls", "'_", ";_", "urls", "\\u", "accessible", "\\u", "http_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "main_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "of", "\\u", "requests_", "=_", "read", "\\u", "https", "\\u", "urls_", "(_", "requests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urls", "\\u", "accessible", "\\u", "http_", "=_", "request", "\\u", "over", "\\u", "http_", "(_", "list", "\\u", "of", "\\u", "requests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "report_", "(_", "urls", "\\u", "accessible", "\\u", "http_", ")_", "\\u\\u\\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_", "create", "\\u", "report_", "(_", "urls", "\\u", "accessible", "\\u", "http_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'", "url", "\\u", "http", "\\u", "request", "\\u", "report", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Cann", "ot", " ", "open", " ", "file", " ", "to", " ", "write", " ", "report", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", "file_", "=_", "sys_", "._", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "urls", "\\u", "accessible", "\\u", "http_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "url_", "in_", "urls", "\\u", "accessible", "\\u", "http_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "url_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "'", "Non", "e", " ", "of", " ", "the", " ", "URL", "s", " ", "can", " ", "be", " ", "accesse", "d", " ", "over", " ", "HTTP", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "https", "\\u", "urls_", "(_", "requests_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "of", "\\u", "requests_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "requests_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Cou", "ld", " ", "not", " ", "open", " ", "file", " ", "contain", "ing", " ", "request", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "url_", "in_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "re_", "._", "sub_", "(_", "r", "'", "^", "https", "'_", ",_", "r", "'", "http", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "of", "\\u", "requests_", "._", "append_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "list", "\\u", "of", "\\u", "requests_", "\\u\\u\\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_", "request", "\\u", "over", "\\u", "http_", "(_", "list", "\\u", "of", "\\u", "requests_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threads_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "url_", "in_", "list", "\\u", "of", "\\u", "requests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "re_", "._", "sub_", "(_", "r", "'\\\\", "s", "+$", "'_", ",_", "r", "''_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "re_", "._", "sub_", "(_", "r", "'", "^", "\\\\", "s", "+'_", ",_", "r", "''_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Test", "ing", " ", "URL", " ", "'_", "+_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "urllib2_", "._", "urlopen_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "f_", "._", "geturl", "_", "(_", ")_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "t1_", "[_", "0_", "]_", "!=_", "'", "https", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urls", "\\u", "accessible", "\\u", "http_", "._", "append_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "urls", "\\u", "accessible", "\\u", "http_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
pravj/HackLime/HackLime.py
[ { "content": "\"\"\"\nSublime-Text API Interface of HackLime\nwith help of https://www.sublimetext.com/docs/2/api_reference.html\n\nAuthor : Pravendra Singh (pravj)\nContact : [email protected] (https://pravj.github.io)\n\"\"\"\n\nimport os\n\n# modules for Sublime-Text's API\nimport sublime\nimport sublime_plugin\n\n# module to talk with HackerEarth API\nfrom HackerEarth import HackerEarth\n\n# Help guide text for HackLime\nimport HelpGuide\n\n\n# class for code-compile command\n\n\n# class for code-run command\n\n\n# class for help with package, kind of ways to use\n\n\n# shows result in new file\n\n\n# returns output file's name using a given file\n\n# shows error in quick panel\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HacklimeCompileCommand(sublime_plugin.TextCommand):", "metadata": "root.HacklimeCompileCommand", "header": "['module', '___EOS___']", "index": 22 }, { "content": "\tdef run(self, edit):\n\t\tfilepath = self.view.file_name().encode(\"utf-8\")\n\t\t#print (filepath) maybe you are not waiting for it to load all\n\t\tinstance = HackerEarth(filepath)\n\n\t\t# HackerEarth API response and text to write in output\n\t\tresponse = instance.Contact()\n\n\t\t\"\"\"\n\t\tcreates file for output response, if not present already\n\t\toutput file will have a prefix 'output_' to main file\n\t\t\"\"\"\n\n\t\t# shows error in quick panel\n\t\tif('er' in response):\n\t\t\tshow_error(self.view.window, [response['er']])\n\t\telse:\n\t\t\toutput_text = instance.Output(response)\n\n\t\t\t# shows the output buffer/file\n\t\t\toutput = HacklimeOutput(self.view, file_handler(filepath), output_text)\n\t\t\toutput.show()", "metadata": "root.HacklimeCompileCommand.run", "header": "['class', 'HacklimeCompileCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 23 }, { "content": "class HacklimeRunCommand(sublime_plugin.TextCommand):", "metadata": "root.HacklimeRunCommand", "header": "['module', '___EOS___']", "index": 48 }, { "content": "\tdef run(self, edit):\n\t\tfilepath = self.view.file_name().encode(\"utf-8\")\n\t\t#print (filepath) maybe you are not waiting for it to load all\n\t\tinstance = HackerEarth(filepath)\n\n\t\tresponse = instance.Contact()\n\n\t\t# shows error in quick panel\n\t\tif('er' in response):\n\t\t\tshow_error(self.view.window, [response['er']])\n\t\telse:\n\t\t\toutput_text = instance.Output(response)\n\n\t\t\t# shows the output buffer/file\n\t\t\toutput = HacklimeOutput(self.view, file_handler(filepath), output_text)\n\t\t\toutput.show()", "metadata": "root.HacklimeRunCommand.run", "header": "['class', 'HacklimeRunCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 49 }, { "content": "class HacklimeHelpCommand(sublime_plugin.WindowCommand):", "metadata": "root.HacklimeHelpCommand", "header": "['module', '___EOS___']", "index": 68 }, { "content": " def run(self):\n \t# view instance representing help guide\n self.help_view = self.window.get_output_panel(\"HackLime-Help\")\n\n # allows to write custom help text in view object\n self.help_view.set_read_only(False)\n\n # writing to help view\n edit = self.help_view.begin_edit()\n self.help_view.insert(edit, self.help_view.size(), HelpGuide.helptext)\n self.help_view.end_edit(edit)\n\n # help guide is now read only\n self.help_view.set_read_only(True)\n\n # running the show_panel window command \n # with the panel argument set to the name with an \"output.\" prefix.\n # Sublime-API Docs : sublime.Window.get_output_panel() -> Description\n self.window.run_command(\"show_panel\", {\"panel\": \"output.HackLime-Help\"})", "metadata": "root.HacklimeHelpCommand.run", "header": "['class', 'HacklimeHelpCommand', '(', 'sublime_plugin', '.', 'WindowCommand', ')', ':', '___EOS___']", "index": 69 }, { "content": "class HacklimeOutput:\n", "metadata": "root.HacklimeOutput", "header": "['module', '___EOS___']", "index": 91 }, { "content": "\tdef __init__(self, view, output_file, text):\n\t\t# view object for current open file\n\t\tself.view = view\n\n\t\t# output file's name\n\t\tself.filename = output_file\n\n\t\t# output file's content\n\t\tself.text = text", "metadata": "root.HacklimeOutput.__init__", "header": "['class', 'HacklimeOutput', ':', '___EOS___']", "index": 92 }, { "content": "\tdef show(self):\n\t\t# window object containing current view\n\t\twindow = self.view.window()\n\n\t\t# output file's view object\n\t\toutput_view = window.new_file()\n\n\t\t# shakespeare was wrong, name is necessary\n\t\t# names the output buffer/file\n\t\toutput_view.set_name(self.filename)\n\n\t\t# edites the content of file\n\t\teditor = output_view.begin_edit()\n\t\toutput_view.insert(editor, output_view.size(), self.text)\n\t\toutput_view.end_edit(editor)", "metadata": "root.HacklimeOutput.show", "header": "['class', 'HacklimeOutput', ':', '___EOS___']", "index": 102 }, { "content": "def file_handler(filepath):\n\t# original file name\n\tFile = filepath.split('/')[-1]\n\n\t# output file name\n\toutput_File = 'output_' + File.replace(File.split('.')[-1], 'txt')\n\n\treturn output_File", "metadata": "root.file_handler", "header": "['module', '___EOS___']", "index": 120 }, { "content": "def show_error(errors, window):\n\twindow.show_quick_panel(errors, None, sublime.MONOSPACE_FONT)", "metadata": "root.show_error", "header": "['module', '___EOS___']", "index": 130 } ]
[ { "span": "import os", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Sub", "lim", "e-", "Text", " ", "API", " ", "Interface", " ", "of", " ", "Hack", "Lim", "e", "\\", "10", ";", "with", " ", "help", " ", "of", " ", "https", "://", "www", ".", "sublim", "ete", "xt", ".", "com", "/", "docs", "/", "2", "/", "api", "\\u", "reference", ".", "html", "\\", "10", ";", "\\", "10", ";", "Author", " ", " ", ":", " ", "Pra", "vend", "ra", " ", "Sing", "h", " ", "(", "pra", "vj", ")", "\\", "10", ";", "Conta", "ct", " ", ":", " ", "hack", "pra", "vj", "@", "gma", "il", ".", "com", " ", "(", "https", "://", "pra", "vj", ".", "git", "hub", ".", "io", ")", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "module", "s", " ", "for", " ", "Sub", "lim", "e-", "Text", "'", "s", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sublime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sublim", "e\\u", "plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "module", " ", "to", " ", "talk", " ", "with", " ", "Hack", "er", "Ear", "th", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Hack", "er", "Ear", "th_", "import_", "Hack", "er", "Ear", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Help", " ", "guide", " ", "text", " ", "for", " ", "Hack", "Lim", "e_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Help", "Guide", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "for", " ", "code", "-", "compile", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "for", " ", "code", "-", "run", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "for", " ", "help", " ", "with", " ", "package", ",", " ", "kind", " ", "of", " ", "way", "s", " ", "to", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "s", " ", "result", " ", "in", " ", "new", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", "s", " ", "output", " ", "file", "'", "s", " ", "name", " ", "usi", "ng", " ", "a", " ", "give", "n", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "s", " ", "error", " ", "in", " ", "quick", " ", "panel_", "\\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_", "Hack", "lim", "e", "Compil", "e", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hack", "lim", "e", "Compil", "e", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "run_", "(_", "self_", ",_", "edit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "filepath_", "=_", "self_", "._", "view_", "._", "file", "\\u", "name_", "(_", ")_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "(", "filepath", ")", " ", " ", "may", "be", " ", "you", " ", "are", " ", "not", " ", "wait", "ing", " ", "for", " ", "it", " ", "to", " ", "load", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", "=_", "Hack", "er", "Ear", "th_", "(_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hack", "er", "Ear", "th", " ", "API", " ", "response", " ", "and", " ", "text", " ", "to", " ", "write", " ", "in", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "instance_", "._", "Contact_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t", "\t", "create", "s", " ", "file", " ", "for", " ", "output", " ", "response", ",", " ", "if", " ", "not", " ", "presen", "t", " ", "alr", "ead", "y", "\\", "10", ";", "\t", "\t", "output", " ", "file", " ", "will", " ", "have", " ", "a", " ", "prefix", " ", "'", "output", "\\u", "'", " ", "to", " ", "main", " ", "file", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "s", " ", "error", " ", "in", " ", "quick", " ", "panel_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "'", "er", "'_", "in_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "show", "\\u", "error_", "(_", "self_", "._", "view_", "._", "window_", ",_", "[_", "response_", "[_", "'", "er", "'_", "]_", "]_", ")_", "\\u\\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_", "output", "\\u", "text_", "=_", "instance_", "._", "Output_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "s", " ", "the", " ", "output", " ", "buffer", "/", "file_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "Hack", "lim", "e", "Output_", "(_", "self_", "._", "view_", ",_", "file", "\\u", "handler_", "(_", "filepath_", ")_", ",_", "output", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Hack", "lim", "e", "Run", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hack", "lim", "e", "Run", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "run_", "(_", "self_", ",_", "edit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "filepath_", "=_", "self_", "._", "view_", "._", "file", "\\u", "name_", "(_", ")_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "(", "filepath", ")", " ", " ", "may", "be", " ", "you", " ", "are", " ", "not", " ", "wait", "ing", " ", "for", " ", "it", " ", "to", " ", "load", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", "=_", "Hack", "er", "Ear", "th_", "(_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "instance_", "._", "Contact_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "s", " ", "error", " ", "in", " ", "quick", " ", "panel_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "'", "er", "'_", "in_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "show", "\\u", "error_", "(_", "self_", "._", "view_", "._", "window_", ",_", "[_", "response_", "[_", "'", "er", "'_", "]_", "]_", ")_", "\\u\\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_", "output", "\\u", "text_", "=_", "instance_", "._", "Output_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "s", " ", "the", " ", "output", " ", "buffer", "/", "file_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "Hack", "lim", "e", "Output_", "(_", "self_", "._", "view_", ",_", "file", "\\u", "handler_", "(_", "filepath_", ")_", ",_", "output", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Hack", "lim", "e", "Help", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Window", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hack", "lim", "e", "Help", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Window", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "view", " ", "instance", " ", "represent", "ing", " ", "help", " ", "guide_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "help", "\\u", "view_", "=_", "self_", "._", "window_", "._", "get", "\\u", "output", "\\u", "panel_", "(_", "\"", "Hack", "Lim", "e-", "Help", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "allow", "s", " ", "to", " ", "write", " ", "custom", " ", "help", " ", "text", " ", "in", " ", "view", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "help", "\\u", "view_", "._", "set\\u", "read", "\\u", "only_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "writ", "ing", " ", "to", " ", "help", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "edit_", "=_", "self_", "._", "help", "\\u", "view_", "._", "begin", "\\u", "edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "help", "\\u", "view_", "._", "insert_", "(_", "edit_", ",_", "self_", "._", "help", "\\u", "view_", "._", "size_", "(_", ")_", ",_", "Help", "Guide", "_", "._", "help", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "help", "\\u", "view_", "._", "end", "\\u", "edit_", "(_", "edit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "help", " ", "guide", " ", "is", " ", "now", " ", "read", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "help", "\\u", "view_", "._", "set\\u", "read", "\\u", "only_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "runn", "ing", " ", "the", " ", "show", "\\u", "panel", " ", "window", " ", "command", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "the", " ", "panel", " ", "argu", "ment", " ", "set", " ", "to", " ", "the", " ", "name", " ", "with", " ", "an", " ", "\"", "output", ".\"", " ", "prefix", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sub", "lim", "e-", "API", " ", "Docs", " ", ":", " ", "sublim", "e", ".", "Window", ".", "get", "\\u", "output", "\\u", "panel", "()", " ", "->", " ", "Description_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "window_", "._", "run", "\\u", "command_", "(_", "\"", "show", "\\u", "panel", "\"_", ",_", "{_", "\"", "panel", "\"_", ":_", "\"", "output", ".", "Hack", "Lim", "e-", "Help", "\"_", "}_", ")_", "\\u\\u\\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_", "Hack", "lim", "e", "Output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Hack", "lim", "e", "Output_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "view_", ",_", "output", "\\u", "file_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "view", " ", "object", " ", "for", " ", "current", " ", "open", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "view_", "=_", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", " ", "file", "'", "s", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filename_", "=_", "output", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", " ", "file", "'", "s", " ", "content_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hack", "lim", "e", "Output_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "window", " ", "object", " ", "contain", "ing", " ", "current", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "window_", "=_", "self_", "._", "view_", "._", "window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", " ", "file", "'", "s", " ", "view", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "view_", "=_", "window_", "._", "new", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shake", "spear", "e", " ", "was", " ", "wrong", ",", " ", "name", " ", "is", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "names", " ", "the", " ", "output", " ", "buffer", "/", "file_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "view_", "._", "set\\u", "name_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "edit", "es", " ", "the", " ", "content", " ", "of", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "editor_", "=_", "output", "\\u", "view_", "._", "begin", "\\u", "edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "view_", "._", "insert_", "(_", "editor_", ",_", "output", "\\u", "view_", "._", "size_", "(_", ")_", ",_", "self_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "view_", "._", "end", "\\u", "edit_", "(_", "editor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "file", "\\u", "handler_", "(_", "filepath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "original", " ", "file", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "File_", "=_", "filepath_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", " ", "file", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "File_", "=_", "'", "output", "\\u'_", "+_", "File_", "._", "replace_", "(_", "File_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", ",_", "'", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "output", "\\u", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "error_", "(_", "errors_", ",_", "window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "window_", "._", "show", "\\u", "quick", "\\u", "panel_", "(_", "errors_", ",_", "None_", ",_", "sublime_", "._", "MON", "OSP", "ACE", "\\u", "FONT_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
Exa-Networks/exabgp/lib/exabgp/dep/pyparsing.py
[ { "content": " def __getattr__( self, name ):\n try:\n return self[name]\n except KeyError:\n return \"\"\n \n if name in self.__tokdict:\n if name not in self.__accumNames:\n return self.__tokdict[name][-1][0]\n else:\n return ParseResults([ v[0] for v in self.__tokdict[name] ])\n else:\n return \"\"", "metadata": "root.ParseResults.__getattr__", "header": "['class', 'ParseResults', '(', 'object', ')', ':', '___EOS___']", "index": 466 } ]
[ { "span": "if name in self.__tokdict:", "start_line": 472, "start_column": 8, "end_line": 472, "end_column": 34 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Pars", "e", "Results_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "in_", "self_", "._", "\\u\\u", "tok", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "not_", "in_", "self_", "._", "\\u\\u", "accum", "Names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "tok", "dict_", "[_", "name_", "]_", "[_", "-_", "1_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Pars", "e", "Results_", "(_", "[_", "v_", "[_", "0_", "]_", "for_", "v_", "in_", "self_", "._", "\\u\\u", "tok", "dict_", "[_", "name_", "]_", "]_", ")_", "\\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_", "\"\"_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
uwdata/termite-data-server/web2py/scripts/autoroutes.py
[ { "content": "# -*- coding: utf-8 -*-\n'''\nautoroutes writes routes for you based on a simpler routing\nconfiguration file called routes.conf. Example:\n\n----- BEGIN routes.conf-------\n127.0.0.1 /examples/default\ndomain1.com /app1/default\ndomain2.com /app2/default\ndomain3.com /app3/default\n----- END ----------\n\nIt maps a domain (the left-hand side) to an app (one app per domain),\nand shortens the URLs for the app by removing the listed path prefix. That means:\n\nhttp://domain1.com/index is mapped to /app1/default/index\nhttp://domain2.com/index is mapped to /app2/default/index\n\nIt preserves admin, appadmin, static files, favicon.ico and robots.txt:\n\nhttp://domain1.com/favicon.ico /welcome/static/favicon.ico\nhttp://domain1.com/robots.txt /welcome/static/robots.txt\nhttp://domain1.com/admin/... /admin/...\nhttp://domain1.com/appadmin/... /app1/appadmin/...\nhttp://domain1.com/static/... /app1/static/...\n\nand vice-versa.\n\nTo use, cp scripts/autoroutes.py routes.py\n\nand either edit the config string below, or set config = \"\" and edit routes.conf\n'''\n\nconfig = '''\n127.0.0.1 /examples/default\ndomain1.com /app1/default\ndomain2.com /app2/default\ndomain3.com /app3/defcon3\n'''\nif not config.strip():\n try:\n config_file = open('routes.conf', 'r')\n try:\n config = config_file.read()\n finally:\n config_file.close()\n except:\n config = ''\n\n\n\n\n\nroutes_in = auto_in(config)\nroutes_out = auto_out(config)\n\n\n\nif __name__ == '__main__':\n try:\n import gluon.main\n except ImportError:\n import sys\n import os\n os.chdir(os.path.dirname(os.path.dirname(__file__)))\n sys.path.append(os.path.dirname(os.path.dirname(__file__)))\n import gluon.main\n from gluon.rewrite import regex_select, load, filter_url, regex_filter_out\n regex_select() # use base routing parameters\n load(routes=__file__) # load this file\n\n import doctest\n doctest.testmod()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 46, "start_column": 4, "end_line": 46, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "autor", "oute", "s", " ", "writes", " ", "route", "s", " ", "for", " ", "you", " ", "based", " ", "on", " ", "a", " ", "simple", "r", " ", "routin", "g", "\\", "10", ";", "configura", "tion", " ", "file", " ", "call", "ed", " ", "route", "s", ".", "conf", ".", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", "-----", " ", "BEGIN", " ", "route", "s", ".", "conf", "-------", "\\", "10", ";", "127", ".0", ".0", ".1", " ", " ", " ", "/", "example", "s", "/", "default", "\\", "10", ";", "domain", "1", ".", "com", " ", "/", "app", "1", "/", "default", "\\", "10", ";", "domain", "2", ".", "com", " ", "/", "app", "2", "/", "default", "\\", "10", ";", "domain", "3", ".", "com", " ", "/", "app", "3", "/", "default", "\\", "10", ";", "-----", " ", "END", " ", "----------", "\\", "10", ";", "\\", "10", ";", "It", " ", "maps", " ", "a", " ", "domain", " ", "(", "the", " ", "left", "-", "hand", " ", "side", ")", " ", "to", " ", "an", " ", "app", " ", "(", "one", " ", "app", " ", "per", " ", "domain", "),", "\\", "10", ";", "and", " ", "shorten", "s", " ", "the", " ", "URL", "s", " ", "for", " ", "the", " ", "app", " ", "by", " ", "remo", "ving", " ", "the", " ", "liste", "d", " ", "path", " ", "prefix", ".", " ", "Tha", "t", " ", "means", ":", "\\", "10", ";", "\\", "10", ";", "http", "://", "domain", "1", ".", "com", "/", "index", " ", "is", " ", "mapp", "ed", " ", "to", " ", "/", "app", "1", "/", "default", "/", "index", "\\", "10", ";", "http", "://", "domain", "2", ".", "com", "/", "index", " ", "is", " ", "mapp", "ed", " ", "to", " ", "/", "app", "2", "/", "default", "/", "index", "\\", "10", ";", "\\", "10", ";", "It", " ", "preserve", "s", " ", "admin", ",", " ", "appa", "dmin", ",", " ", "static", " ", "files", ",", " ", "fav", "icon", ".", "ico", " ", "and", " ", "robots", ".", "txt", ":", "\\", "10", ";", "\\", "10", ";", "http", "://", "domain", "1", ".", "com", "/", "fav", "icon", ".", "ico", " ", " ", "/", "welcome", "/", "static", "/", "fav", "icon", ".", "ico", "\\", "10", ";", "http", "://", "domain", "1", ".", "com", "/", "robots", ".", "txt", " ", " ", " ", "/", "welcome", "/", "static", "/", "robots", ".", "txt", "\\", "10", ";", "http", "://", "domain", "1", ".", "com", "/", "admin", "/.", "..", " ", " ", " ", " ", "/", "admin", "/.", "..", "\\", "10", ";", "http", "://", "domain", "1", ".", "com", "/", "appa", "dmin", "/.", "..", " ", "/", "app", "1", "/", "appa", "dmin", "/.", "..", "\\", "10", ";", "http", "://", "domain", "1", ".", "com", "/", "static", "/.", "..", " ", " ", " ", "/", "app", "1", "/", "static", "/.", "..", "\\", "10", ";", "\\", "10", ";", "and", " ", "vice", "-", "versa", ".", "\\", "10", ";", "\\", "10", ";", "To", " ", "use", ",", " ", "cp", " ", "scripts", "/", "autor", "oute", "s", ".", "py", " ", "route", "s", ".", "py", "\\", "10", ";", "\\", "10", ";", "and", " ", "eit", "her", " ", "edit", " ", "the", " ", "config", " ", "string", " ", "belo", "w", ",", " ", "or", " ", "set", " ", "config", " ", "=", " ", "\"\"", " ", "and", " ", "edit", " ", "route", "s", ".", "conf", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "'''", "\\", "10", ";", "127", ".0", ".0", ".1", " ", " ", " ", "/", "example", "s", "/", "default", "\\", "10", ";", "domain", "1", ".", "com", " ", "/", "app", "1", "/", "default", "\\", "10", ";", "domain", "2", ".", "com", " ", "/", "app", "2", "/", "default", "\\", "10", ";", "domain", "3", ".", "com", " ", "/", "app", "3", "/", "def", "con", "3", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "config_", "._", "strip_", "(_", ")_", ":_", "\\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 ", " _", "config", "\\u", "file_", "=_", "open_", "(_", "'", "route", "s", ".", "conf", "'_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "config", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "route", "s", "\\u", "in_", "=_", "auto", "\\u", "in_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route", "s", "\\u", "out_", "=_", "auto", "\\u", "out_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "gluon_", "._", "main_", "\\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_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gluon_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "gluon_", "._", "rewrite", "_", "import_", "regex", "\\u", "select_", ",_", "load_", ",_", "filter", "\\u", "url_", ",_", "regex", "\\u", "filter", "\\u", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regex", "\\u", "select_", "(_", ")_", "#", " ", "use", " ", "base", " ", "routin", "g", " ", "parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load_", "(_", "routes_", "=_", "\\u\\u", "file\\u\\u_", ")_", "#", " ", "load", " ", "this", " ", "file_", "\\u\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
google/grr/grr/gui/plugins/semantic.py
[ { "content": " def Layout(self, request, response):\n \"\"\"Render the protobuf as a table.\"\"\"\n self.result = []\n for descriptor, value in self.proxy.ListSetFields():\n name = descriptor.name\n friendly_name = descriptor.friendly_name or name\n\n # Try to translate the value if there is a special translator for it.\n if name in self.translator:\n try:\n value = self.translator[name](self, request, value)\n if value is not None:\n self.result.append((friendly_name, descriptor.description, value))\n\n # If the translation fails for whatever reason, just output the string\n # value literally (after escaping)\n except KeyError:\n value = self.FormatFromTemplate(self.translator_error_template,\n value=value)\n except Exception as e: # pylint: disable=broad-except\n logging.warn(\"Failed to render {0}. Err: {1}\".format(name, e))\n value = \"\"\n\n else:\n renderer = FindRendererForObject(value)\n\n self.result.append((friendly_name, descriptor.description,\n renderer.RawHTML(request)))\n\n return super(RDFProtoRenderer, self).Layout(request, response)", "metadata": "root.RDFProtoRenderer.Layout", "header": "['class', 'RDFProtoRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 295 } ]
[ { "span": "value ", "start_line": 312, "start_column": 10, "end_line": 312, "end_column": 15 }, { "span": "value ", "start_line": 316, "start_column": 10, "end_line": 316, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "RDF", "Proto", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", " ", "the", " ", "proto", "buf", " ", "as", " ", "a", " ", "table", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "descriptor_", ",_", "value_", "in_", "self_", "._", "proxy_", "._", "List", "Set", "Fields_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "descriptor_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frie", "ndl", "y", "\\u", "name_", "=_", "descriptor_", "._", "frie", "ndl", "y", "\\u", "name_", "or_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "translat", "e", " ", "the", " ", "value", " ", "if", " ", "there", " ", "is", " ", "a", " ", "special", " ", "translator", " ", "for", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name_", "in_", "self_", "._", "translator_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "translator_", "[_", "name_", "]_", "(_", "self_", ",_", "request_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "._", "append_", "(_", "(_", "frie", "ndl", "y", "\\u", "name_", ",_", "descriptor_", "._", "description_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "translatio", "n", " ", "fail", "s", " ", "for", " ", "what", "ever", " ", "reason", ",", " ", "just", " ", "output", " ", "the", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", " ", "literal", "ly", " ", "(", "after", " ", "esca", "ping", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "Format", "Fro", "m", "Template_", "(_", "self_", "._", "translator", "\\u", "error", "\\u", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "broad", "-", "except_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "\"", "Fail", "ed", " ", "to", " ", "render", " ", "{", "0", "}.", " ", "Err", ":", " ", "{", "1", "}\"_", "._", "format_", "(_", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "renderer_", "=_", "Fin", "d", "Render", "er", "For", "Object_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "result_", "._", "append_", "(_", "(_", "frie", "ndl", "y", "\\u", "name_", ",_", "descriptor_", "._", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "renderer_", "._", "Ra", "w", "HTML_", "(_", "request_", ")_", ")_", ")_", "\\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_", "super_", "(_", "RDF", "Proto", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "response_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Implicit string concatenation in a list
azoft-dev-team/imagrium/env/Lib/test/test_subprocess.py
[ { "content": " def test_call_kwargs(self):\n # call() function with keyword args\n newenv = os.environ.copy()\n newenv[\"FRUIT\"] = \"banana\"\n rc = subprocess.call([sys.executable, \"-c\",\n 'import sys, os;' \\\n 'sys.exit(os.getenv(\"FRUIT\")==\"banana\")'],\n env=newenv)\n self.assertEqual(rc, 1)", "metadata": "root.ProcessTestCase.test_call_kwargs", "header": "['class', 'ProcessTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 80 }, { "content": " def test_stdout_none(self):\n # .stdout is None when not redirected\n p = subprocess.Popen([sys.executable, \"-c\",\n 'print \" this bit of output is from a '\n 'test of stdout in a different '\n 'process ...\"'],\n stdin=subprocess.PIPE, stderr=subprocess.PIPE)\n p.wait()\n self.assertEqual(p.stdout, None)", "metadata": "root.ProcessTestCase.test_stdout_none", "header": "['class', 'ProcessTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 97 }, { "content": " def test_stdout_stderr_pipe(self):\n # capture stdout and stderr to the same pipe\n p = subprocess.Popen([sys.executable, \"-c\",\n 'import sys;' \\\n 'sys.stdout.write(\"apple\");' \\\n 'sys.stdout.flush();' \\\n 'sys.stderr.write(\"orange\")'],\n stdout=subprocess.PIPE,\n stderr=subprocess.STDOUT)\n output = p.stdout.read()\n stripped = remove_stderr_debug_decorations(output)\n self.assertEqual(stripped, \"appleorange\")", "metadata": "root.ProcessTestCase.test_stdout_stderr_pipe", "header": "['class', 'ProcessTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 213 }, { "content": " def test_stdout_stderr_file(self):\n # capture stdout and stderr to the same open file\n tf = tempfile.TemporaryFile()\n p = subprocess.Popen([sys.executable, \"-c\",\n 'import sys;' \\\n 'sys.stdout.write(\"apple\");' \\\n 'sys.stdout.flush();' \\\n 'sys.stderr.write(\"orange\")'],\n stdout=tf,\n stderr=tf)\n p.wait()\n tf.seek(0)\n output = tf.read()\n stripped = remove_stderr_debug_decorations(output)\n self.assertEqual(stripped, \"appleorange\")", "metadata": "root.ProcessTestCase.test_stdout_stderr_file", "header": "['class', 'ProcessTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 226 }, { "content": " def test_cwd(self):\n tmpdir = tempfile.gettempdir()\n # We cannot use os.path.realpath to canonicalize the path,\n # since it doesn't expand Tru64 {memb} strings. See bug 1063571.\n cwd = os.getcwd()\n os.chdir(tmpdir)\n tmpdir = os.getcwd()\n os.chdir(cwd)\n p = subprocess.Popen([sys.executable, \"-c\",\n 'import sys,os;' \\\n 'sys.stdout.write(os.getcwd())'],\n stdout=subprocess.PIPE,\n cwd=tmpdir)\n normcase = os.path.normcase\n self.assertEqual(normcase(p.stdout.read()), normcase(tmpdir))", "metadata": "root.ProcessTestCase.test_cwd", "header": "['class', 'ProcessTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 249 }, { "content": " def test_env(self):\n newenv = os.environ.copy()\n newenv[\"FRUIT\"] = \"orange\"\n p = subprocess.Popen([sys.executable, \"-c\",\n 'import sys,os;' \\\n 'sys.stdout.write(os.getenv(\"FRUIT\"))'],\n stdout=subprocess.PIPE,\n env=newenv)\n self.assertEqual(p.stdout.read(), \"orange\")", "metadata": "root.ProcessTestCase.test_env", "header": "['class', 'ProcessTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 265 }, { "content": " def test_communicate(self):\n p = subprocess.Popen([sys.executable, \"-c\",\n 'import sys,os;' \\\n 'sys.stderr.write(\"pineapple\");' \\\n 'sys.stdout.write(sys.stdin.read())'],\n stdin=subprocess.PIPE,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE)\n (stdout, stderr) = p.communicate(\"banana\")\n self.assertEqual(stdout, \"banana\")\n self.assertEqual(remove_stderr_debug_decorations(stderr),\n \"pineapple\")", "metadata": "root.ProcessTestCase.test_communicate", "header": "['class', 'ProcessTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 300 }, { "content": " def test_writes_before_communicate(self):\n # stdin.write before communicate()\n p = subprocess.Popen([sys.executable, \"-c\",\n 'import sys,os;' \\\n 'sys.stdout.write(sys.stdin.read())'],\n stdin=subprocess.PIPE,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE)\n p.stdin.write(\"banana\")\n (stdout, stderr) = p.communicate(\"split\")\n self.assertEqual(stdout, \"bananasplit\")\n self.assertEqual(remove_stderr_debug_decorations(stderr), \"\")", "metadata": "root.ProcessTestCase.test_writes_before_communicate", "header": "['class', 'ProcessTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 346 }, { "content": " def test_preexec(self):\n # preexec function\n p = subprocess.Popen([sys.executable, \"-c\",\n 'import sys,os;' \\\n 'sys.stdout.write(os.getenv(\"FRUIT\"))'],\n stdout=subprocess.PIPE,\n preexec_fn=lambda: os.putenv(\"FRUIT\", \"apple\"))\n self.assertEqual(p.stdout.read(), \"apple\")", "metadata": "root.ProcessTestCase.test_preexec", "header": "['class', 'ProcessTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 535 } ]
[ { "span": "'import sys, os;' \\\n 'sys.exit(os.getenv(\"FRUIT\")==\"banana\")']", "start_line": 85, "start_column": 26, "end_line": 86, "end_column": 66 }, { "span": "'print \" this bit of output is from a '\n 'test of stdout in a different '\n 'process ...\"']", "start_line": 100, "start_column": 29, "end_line": 102, "end_column": 43 }, { "span": "'import sys;' \\\n 'sys.stdout.write(\"apple\");' \\\n 'sys.stdout.flush();' \\\n 'sys.stderr.write(\"orange\")']", "start_line": 216, "start_column": 26, "end_line": 219, "end_column": 54 }, { "span": "'import sys;' \\\n 'sys.stdout.write(\"apple\");' \\\n 'sys.stdout.flush();' \\\n 'sys.stderr.write(\"orange\")']", "start_line": 230, "start_column": 26, "end_line": 233, "end_column": 54 }, { "span": "'import sys,os;' \\\n 'sys.stdout.write(os.getcwd())']", "start_line": 258, "start_column": 26, "end_line": 259, "end_column": 57 }, { "span": "'import sys,os;' \\\n 'sys.stdout.write(os.getenv(\"FRUIT\"))']", "start_line": 269, "start_column": 26, "end_line": 270, "end_column": 64 }, { "span": "'import sys,os;' \\\n 'sys.stderr.write(\"pineapple\");' \\\n 'sys.stdout.write(sys.stdin.read())']", "start_line": 302, "start_column": 26, "end_line": 304, "end_column": 62 }, { "span": "'import sys,os;' \\\n 'sys.stdout.write(sys.stdin.read())']", "start_line": 349, "start_column": 26, "end_line": 350, "end_column": 62 }, { "span": "'import sys,os;' \\\n 'sys.stdout.write(os.getenv(\"FRUIT\"))']", "start_line": 538, "start_column": 30, "end_line": 539, "end_column": 68 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "class_", "Process", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "call", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", "()", " ", "function", " ", "with", " ", "keyw", "ord", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newe", "nv_", "=_", "os_", "._", "environ_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newe", "nv_", "[_", "\"", "FR", "UI", "T", "\"_", "]_", "=_", "\"", "banana", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "=_", "subprocess_", "._", "call_", "(_", "[_", "sys_", "._", "executable_", ",_", "\"-", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "import", " ", "sys", ",", " ", "os", ";'_", "'", "sys", ".", "exit", "(", "os", ".", "gete", "nv", "(\"", "FR", "UI", "T", "\")", "==", "\"", "banana", "\")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "newe", "nv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rc_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "stdout", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", ".", "stdout", " ", "is", " ", "Non", "e", " ", "whe", "n", " ", "not", " ", "redirected", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "sys_", "._", "executable_", ",_", "\"-", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "print", " ", "\"", " ", " ", " ", " ", "this", " ", "bit", " ", "of", " ", "output", " ", "is", " ", "from", " ", "a", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", " ", "of", " ", "stdout", " ", "in", " ", "a", " ", "different", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "process", " ", "...\"", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p_", "._", "stdout_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "stdout", "\\u", "std", "err", "\\u", "pipe_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "captur", "e", " ", "stdout", " ", "and", " ", "std", "err", " ", "to", " ", "the", " ", "same", " ", "pipe_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "sys_", "._", "executable_", ",_", "\"-", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "import", " ", "sys", ";'_", "'", "sys", ".", "stdout", ".", "write", "(\"", "apple", "\");", "'_", "'", "sys", ".", "stdout", ".", "flush", "();", "'_", "'", "sys", ".", "std", "err", ".", "write", "(\"", "orange", "\")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "p_", "._", "stdout_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stripped_", "=_", "remove", "\\u", "std", "err", "\\u", "debug", "\\u", "decorat", "ions_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stripped_", ",_", "\"", "apple", "orange", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "stdout", "\\u", "std", "err", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "captur", "e", " ", "stdout", " ", "and", " ", "std", "err", " ", "to", " ", "the", " ", "same", " ", "open", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tf_", "=_", "tempfile_", "._", "Tempora", "ry", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "sys_", "._", "executable_", ",_", "\"-", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "import", " ", "sys", ";'_", "'", "sys", ".", "stdout", ".", "write", "(\"", "apple", "\");", "'_", "'", "sys", ".", "stdout", ".", "flush", "();", "'_", "'", "sys", ".", "std", "err", ".", "write", "(\"", "orange", "\")'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "tf_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "tf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "tf_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stripped_", "=_", "remove", "\\u", "std", "err", "\\u", "debug", "\\u", "decorat", "ions_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stripped_", ",_", "\"", "apple", "orange", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cwd_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "cann", "ot", " ", "use", " ", "os", ".", "path", ".", "real", "path", " ", "to", " ", "canonicaliz", "e", " ", "the", " ", "path", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "it", " ", "doe", "sn", "'", "t", " ", "expand", " ", "Tru", "64", " ", "{", "memb", "}", " ", "string", "s", ".", " ", "See", " ", "bug", " ", "106", "357", "1._", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpdir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "cwd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "sys_", "._", "executable_", ",_", "\"-", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "import", " ", "sys", ",", "os", ";'_", "'", "sys", ".", "stdout", ".", "write", "(", "os", ".", "getc", "wd", "())", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "norm", "case_", "=_", "os_", "._", "path_", "._", "norm", "case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "norm", "case_", "(_", "p_", "._", "stdout_", "._", "read_", "(_", ")_", ")_", ",_", "norm", "case_", "(_", "tmpdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "env_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newe", "nv_", "=_", "os_", "._", "environ_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newe", "nv_", "[_", "\"", "FR", "UI", "T", "\"_", "]_", "=_", "\"", "orange", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "sys_", "._", "executable_", ",_", "\"-", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "import", " ", "sys", ",", "os", ";'_", "'", "sys", ".", "stdout", ".", "write", "(", "os", ".", "gete", "nv", "(\"", "FR", "UI", "T", "\"))", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "newe", "nv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p_", "._", "stdout_", "._", "read_", "(_", ")_", ",_", "\"", "orange", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "communicate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "sys_", "._", "executable_", ",_", "\"-", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "import", " ", "sys", ",", "os", ";'_", "'", "sys", ".", "std", "err", ".", "write", "(\"", "pin", "eap", "ple", "\");", "'_", "'", "sys", ".", "stdout", ".", "write", "(", "sys", ".", "std", "in", ".", "read", "())", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "stdout_", ",_", "stderr_", ")_", "=_", "p_", "._", "communicate_", "(_", "\"", "banana", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stdout_", ",_", "\"", "banana", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "remove", "\\u", "std", "err", "\\u", "debug", "\\u", "decorat", "ions_", "(_", "stderr_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pin", "eap", "ple", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "writes", "\\u", "bef", "ore", "\\u", "communicate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "std", "in", ".", "write", " ", "bef", "ore", " ", "communi", "cate", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "sys_", "._", "executable_", ",_", "\"-", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "import", " ", "sys", ",", "os", ";'_", "'", "sys", ".", "stdout", ".", "write", "(", "sys", ".", "std", "in", ".", "read", "())", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "stdin_", "._", "write_", "(_", "\"", "banana", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "stdout_", ",_", "stderr_", ")_", "=_", "p_", "._", "communicate_", "(_", "\"", "split", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stdout_", ",_", "\"", "banana", "split", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "remove", "\\u", "std", "err", "\\u", "debug", "\\u", "decorat", "ions_", "(_", "stderr_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pree", "xec", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pree", "xec", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "sys_", "._", "executable_", ",_", "\"-", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "import", " ", "sys", ",", "os", ";'_", "'", "sys", ".", "stdout", ".", "write", "(", "os", ".", "gete", "nv", "(\"", "FR", "UI", "T", "\"))", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pree", "xec", "\\u", "fn_", "=_", "lambda_", ":_", "os_", "._", "put", "env_", "(_", "\"", "FR", "UI", "T", "\"_", ",_", "\"", "apple", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p_", "._", "stdout_", "._", "read_", "(_", ")_", ",_", "\"", "apple", "\"_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
StackStorm/st2/st2api/tests/unit/controllers/v1/test_rules.py
[ { "content": " def test_post_trigger_parameter_schema_validation_fails(self):\n post_resp = self.__do_post(TestRuleController.RULE_2)\n self.assertEqual(post_resp.status_int, http_client.BAD_REQUEST)\n\n expected_msg = 'Additional properties are not allowed (u\\'minutex\\' was unexpected)'\n self.assertTrue(expected_msg in post_resp.body)", "metadata": "root.TestRuleController.test_post_trigger_parameter_schema_validation_fails", "header": "['class', 'TestRuleController', '(', 'FunctionalTest', ')', ':', '___EOS___']", "index": 141 }, { "content": " def test_post_trigger_parameter_schema_validation_fails_missing_required_param(self):\n post_resp = self.__do_post(TestRuleController.RULE_5)\n self.assertEqual(post_resp.status_int, http_client.BAD_REQUEST)\n\n expected_msg = '\\'date\\' is a required property'\n self.assertTrue(expected_msg in post_resp.body)", "metadata": "root.TestRuleController.test_post_trigger_parameter_schema_validation_fails_missing_required_param", "header": "['class', 'TestRuleController', '(', 'FunctionalTest', ')', ':', '___EOS___']", "index": 148 }, { "content": " def test_post_invalid_crontimer_trigger_parameters(self):\n post_resp = self.__do_post(TestRuleController.RULE_6)\n self.assertEqual(post_resp.status_int, http_client.BAD_REQUEST)\n\n expected_msg = '1000 is greater than the maximum of 6'\n self.assertTrue(expected_msg in post_resp.body)\n\n post_resp = self.__do_post(TestRuleController.RULE_7)\n self.assertEqual(post_resp.status_int, http_client.BAD_REQUEST)\n\n expected_msg = 'Invalid weekday name \\\\\"abcdef\\\\\"'\n self.assertTrue(expected_msg in post_resp.body)\n\n post_resp = self.__do_post(TestRuleController.RULE_8)\n self.assertEqual(post_resp.status_int, http_client.BAD_REQUEST)\n\n expected_msg = 'Invalid weekday name \\\\\"a\\\\\"'\n self.assertTrue(expected_msg in post_resp.body)", "metadata": "root.TestRuleController.test_post_invalid_crontimer_trigger_parameters", "header": "['class', 'TestRuleController', '(', 'FunctionalTest', ')', ':', '___EOS___']", "index": 155 }, { "content": " def test_put_no_pack_info(self):\n post_resp = self.__do_post(TestRuleController.RULE_1)\n test_rule = post_resp.json\n if 'pack' in test_rule:\n del test_rule['pack']\n self.assertTrue('pack' not in test_rule)\n put_resp = self.__do_put(self.__get_rule_id(post_resp), test_rule)\n self.assertEqual(put_resp.json['pack'], DEFAULT_PACK_NAME)\n self.assertEqual(put_resp.status_int, http_client.OK)\n self.__do_delete(self.__get_rule_id(put_resp))", "metadata": "root.TestRuleController.test_put_no_pack_info", "header": "['class', 'TestRuleController', '(', 'FunctionalTest', ')', ':', '___EOS___']", "index": 196 } ]
[ { "span": "self.assertTrue(expected_msg in post_resp.body)", "start_line": 146, "start_column": 8, "end_line": 146, "end_column": 55 }, { "span": "self.assertTrue(expected_msg in post_resp.body)", "start_line": 153, "start_column": 8, "end_line": 153, "end_column": 55 }, { "span": "self.assertTrue(expected_msg in post_resp.body)", "start_line": 160, "start_column": 8, "end_line": 160, "end_column": 55 }, { "span": "self.assertTrue(expected_msg in post_resp.body)", "start_line": 166, "start_column": 8, "end_line": 166, "end_column": 55 }, { "span": "self.assertTrue(expected_msg in post_resp.body)", "start_line": 172, "start_column": 8, "end_line": 172, "end_column": 55 }, { "span": "self.assertTrue('pack' not in test_rule)", "start_line": 201, "start_column": 8, "end_line": 201, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Rule", "Controller_", "(_", "Function", "al", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "trigger", "\\u", "parameter", "\\u", "schema", "\\u", "validation", "\\u", "fails_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "resp_", "=_", "self_", "._", "\\u\\u", "do", "\\u", "post_", "(_", "Test", "Rule", "Controller_", "._", "RULE", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "post", "\\u", "resp_", "._", "status", "\\u", "int_", ",_", "http", "\\u", "client_", "._", "BAD", "\\u", "REQUEST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "msg_", "=_", "'", "Addition", "al", " ", "proper", "ties", " ", "are", " ", "not", " ", "allow", "ed", " ", "(", "u", "\\\\'", "minute", "x", "\\\\'", " ", "was", " ", "unexpected", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "expected", "\\u", "msg_", "in_", "post", "\\u", "resp_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Controller_", "(_", "Function", "al", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "trigger", "\\u", "parameter", "\\u", "schema", "\\u", "validation", "\\u", "fail", "s", "\\u", "missi", "ng", "\\u", "require", "d\\u", "param_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "resp_", "=_", "self_", "._", "\\u\\u", "do", "\\u", "post_", "(_", "Test", "Rule", "Controller_", "._", "RULE", "\\u", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "post", "\\u", "resp_", "._", "status", "\\u", "int_", ",_", "http", "\\u", "client_", "._", "BAD", "\\u", "REQUEST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "msg_", "=_", "'\\\\'", "date", "\\\\'", " ", "is", " ", "a", " ", "require", "d", " ", "property", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "expected", "\\u", "msg_", "in_", "post", "\\u", "resp_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Controller_", "(_", "Function", "al", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "invalid", "\\u", "cron", "timer", "\\u", "trigger", "\\u", "parameters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "resp_", "=_", "self_", "._", "\\u\\u", "do", "\\u", "post_", "(_", "Test", "Rule", "Controller_", "._", "RULE", "\\u", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "post", "\\u", "resp_", "._", "status", "\\u", "int_", ",_", "http", "\\u", "client_", "._", "BAD", "\\u", "REQUEST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "msg_", "=_", "'", "1000", " ", "is", " ", "great", "er", " ", "than", " ", "the", " ", "maxim", "um", " ", "of", " ", "6", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "expected", "\\u", "msg_", "in_", "post", "\\u", "resp_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "resp_", "=_", "self_", "._", "\\u\\u", "do", "\\u", "post_", "(_", "Test", "Rule", "Controller_", "._", "RULE", "\\u", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "post", "\\u", "resp_", "._", "status", "\\u", "int_", ",_", "http", "\\u", "client_", "._", "BAD", "\\u", "REQUEST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "msg_", "=_", "'", "Inva", "lid", " ", "weekday", " ", "name", " ", "\\\\\\\\\"", "abcde", "f", "\\\\\\\\\"", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "expected", "\\u", "msg_", "in_", "post", "\\u", "resp_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "resp_", "=_", "self_", "._", "\\u\\u", "do", "\\u", "post_", "(_", "Test", "Rule", "Controller_", "._", "RULE", "\\u", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "post", "\\u", "resp_", "._", "status", "\\u", "int_", ",_", "http", "\\u", "client_", "._", "BAD", "\\u", "REQUEST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "msg_", "=_", "'", "Inva", "lid", " ", "weekday", " ", "name", " ", "\\\\\\\\\"", "a", "\\\\\\\\\"", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "expected", "\\u", "msg_", "in_", "post", "\\u", "resp_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Controller_", "(_", "Function", "al", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "put", "\\u", "no", "\\u", "pack", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "resp_", "=_", "self_", "._", "\\u\\u", "do", "\\u", "post_", "(_", "Test", "Rule", "Controller_", "._", "RULE", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "rule_", "=_", "post", "\\u", "resp_", "._", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "pack", "'_", "in_", "test\\u", "rule_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "test\\u", "rule_", "[_", "'", "pack", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "pack", "'_", "not_", "in_", "test\\u", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put", "\\u", "resp_", "=_", "self_", "._", "\\u\\u", "do", "\\u", "put_", "(_", "self_", "._", "\\u\\u", "get", "\\u", "rule", "\\u", "id_", "(_", "post", "\\u", "resp_", ")_", ",_", "test\\u", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "put", "\\u", "resp_", "._", "json_", "[_", "'", "pack", "'_", "]_", ",_", "DEF", "AUL", "T", "\\u", "PACK", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "put", "\\u", "resp_", "._", "status", "\\u", "int_", ",_", "http", "\\u", "client_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "do", "\\u", "delete_", "(_", "self_", "._", "\\u\\u", "get", "\\u", "rule", "\\u", "id_", "(_", "put", "\\u", "resp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 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 ]
Unused import
CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/extras/completion/py/maya/app/general/nodeEditorBookmarks.py
[ { "content": "\"\"\"\nBookmarks are saved using the special nodes hyperGraphInfo, hyperView and hyperLayout.\n\nEach Node Editor Bookmark is represented by a hyperGraphInfo which stores the bookmark info, and which is connected to at least one hyperView. The hyperView stores one view state and is linked to one hyperLayout. The hyperLayout stores the graph state, including the state of each individual node in the scene.\n\"\"\"\n\nimport re\nimport maya.cmds as cmds\nimport maya\n\nfrom functools import partial\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n_instance = None\n\nwindowName = 'nodeEditorBookmarksWindow'\n\n_panelInfos = {}\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class NodeEditorBookmarksWindow(object):\n \"\"\"\n Tracks the state of the Bookmarks window UI\n \"\"\"\n \n \n \n \n \n \n \n \n \n __dict__ = None\n \n __weakref__ = None", "metadata": "root.NodeEditorBookmarksWindow", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self, ned):\n pass", "metadata": "root.NodeEditorBookmarksWindow.__init__", "header": "['class', 'NodeEditorBookmarksWindow', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": " def reset(self):\n pass", "metadata": "root.NodeEditorBookmarksWindow.reset", "header": "['class', 'NodeEditorBookmarksWindow', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": " def selectLastLoadedInfo(self):\n pass", "metadata": "root.NodeEditorBookmarksWindow.selectLastLoadedInfo", "header": "['class', 'NodeEditorBookmarksWindow', '(', 'object', ')', ':', '___EOS___']", "index": 27 }, { "content": "def buildToolbar(ned):\n \"\"\"\n builds the bookmarking toolbar elmenets for the given editor\n \"\"\"\n\n pass", "metadata": "root.buildToolbar", "header": "['module', '___EOS___']", "index": 37 }, { "content": "def buildMenu(ned):\n \"\"\"\n builds the Bookmarks menu for the panel menuBar\n \"\"\"\n\n pass", "metadata": "root.buildMenu", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def removeCallback(ned=None):\n \"\"\"\n called when the owning panel is removed, and on file-new\n \"\"\"\n\n pass", "metadata": "root.removeCallback", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def _naturalKey(str_):\n pass", "metadata": "root._naturalKey", "header": "['module', '___EOS___']", "index": 61 }, { "content": "def _refreshWindow():\n pass", "metadata": "root._refreshWindow", "header": "['module', '___EOS___']", "index": 65 }, { "content": "def _deleteBookmarks(infos):\n pass", "metadata": "root._deleteBookmarks", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def _getBookmarkInfos():\n pass", "metadata": "root._getBookmarkInfos", "header": "['module', '___EOS___']", "index": 73 }, { "content": "def _getInstance():\n pass", "metadata": "root._getInstance", "header": "['module', '___EOS___']", "index": 77 }, { "content": "def _getDescriptionForInfo(info):\n pass", "metadata": "root._getDescriptionForInfo", "header": "['module', '___EOS___']", "index": 81 }, { "content": "def _renameBookmark(info, name):\n pass", "metadata": "root._renameBookmark", "header": "['module', '___EOS___']", "index": 85 }, { "content": "def loadPreviousBookmark(ned):\n \"\"\"\n load the previous bookmark, based on alphabetical ordering of bookmarks\n \"\"\"\n\n pass", "metadata": "root.loadPreviousBookmark", "header": "['module', '___EOS___']", "index": 89 }, { "content": "def _getBookmarkName(name):\n pass", "metadata": "root._getBookmarkName", "header": "['module', '___EOS___']", "index": 97 }, { "content": "def showWindow(ned, *args):\n \"\"\"\n Show the Bookmarks window. If it already exists, re-build it\n \"\"\"\n\n pass", "metadata": "root.showWindow", "header": "['module', '___EOS___']", "index": 101 }, { "content": "def _getNextBookmark(ned, incr):\n pass", "metadata": "root._getNextBookmark", "header": "['module', '___EOS___']", "index": 109 }, { "content": "def addCallback(ned):\n \"\"\"\n called when a panel is added\n \"\"\"\n\n pass", "metadata": "root.addCallback", "header": "['module', '___EOS___']", "index": 113 }, { "content": "def loadNextBookmark(ned):\n \"\"\"\n load the next bookmark, based on alphabetical ordering of bookmarks\n \"\"\"\n\n pass", "metadata": "root.loadNextBookmark", "header": "['module', '___EOS___']", "index": 121 }, { "content": "def renameBookmark(ned, oldname, info, *args):\n \"\"\"\n Rename the supplied bookmark, given the old name\n \"\"\"\n\n pass", "metadata": "root.renameBookmark", "header": "['module', '___EOS___']", "index": 129 }, { "content": "def createBookmark(ned, *args):\n \"\"\"\n create a new bookmark\n \"\"\"\n\n pass", "metadata": "root.createBookmark", "header": "['module', '___EOS___']", "index": 137 }, { "content": "def loadBookmark(ned, info, *args):\n \"\"\"\n apply the supplied bookmark\n \"\"\"\n\n pass", "metadata": "root.loadBookmark", "header": "['module', '___EOS___']", "index": 145 } ]
[ { "span": "import re", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 9 }, { "span": "import maya.cmds as cmds", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 24 }, { "span": "import maya", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 11 }, { "span": "from functools import partial", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Bookmark", "s", " ", "are", " ", "saved", " ", "usi", "ng", " ", "the", " ", "special", " ", "nodes", " ", "hyper", "Graph", "Info", ",", " ", "hyper", "View", " ", "and", " ", "hyper", "Lay", "out", ".", "\\", "10", ";", "\\", "10", ";", "Ea", "ch", " ", "Node", " ", "Edit", "or", " ", "Bookmark", " ", "is", " ", "represent", "ed", " ", "by", " ", "a", " ", "hyper", "Graph", "Info", " ", "whi", "ch", " ", "store", "s", " ", "the", " ", "bookmark", " ", "info", ",", " ", "and", " ", "whi", "ch", " ", "is", " ", "connect", "ed", " ", "to", " ", "at", " ", "leas", "t", " ", "one", " ", "hyper", "View", ".", " ", " ", "The", " ", "hyper", "View", " ", "store", "s", " ", "one", " ", "view", " ", "state", " ", "and", " ", "is", " ", "linked", " ", "to", " ", "one", " ", "hyper", "Lay", "out", ".", " ", " ", "The", " ", "hyper", "Lay", "out", " ", "store", "s", " ", "the", " ", "graph", " ", "state", ",", " ", "inclu", "ding", " ", "the", " ", "state", " ", "of", " ", "each", " ", "individual", " ", "node", " ", "in", " ", "the", " ", "scen", "e", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "maya", "_", "._", "cmds_", "as_", "cmds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "maya", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\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\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "instance_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "window", "Name_", "=_", "'", "node", "Edit", "or", "Bookmark", "s", "Window", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "panel", "Infos_", "=_", "{_", "}_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Node", "Edit", "or", "Bookmark", "s", "Window_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Track", "s", " ", "the", " ", "state", " ", "of", " ", "the", " ", "Bookmark", "s", " ", "window", " ", "UI", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "dict\\u\\u_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "weak", "ref", "\\u\\u_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Edit", "or", "Bookmark", "s", "Window_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "ned", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Edit", "or", "Bookmark", "s", "Window_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Edit", "or", "Bookmark", "s", "Window_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "select", "Las", "t", "Load", "ed", "Info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "Toolbar_", "(_", "ned", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "builds", " ", "the", " ", "bookmark", "ing", " ", "toolb", "ar", " ", "elm", "ene", "ts", " ", "for", " ", "the", " ", "give", "n", " ", "editor", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "Menu_", "(_", "ned", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "builds", " ", "the", " ", "Bookmark", "s", " ", "menu", " ", "for", " ", "the", " ", "panel", " ", "menu", "Bar", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "Callback_", "(_", "ned", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", " ", "whe", "n", " ", "the", " ", "own", "ing", " ", "panel", " ", "is", " ", "remove", "d", ",", " ", "and", " ", "on", " ", "file", "-", "new", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "natur", "al", "Key_", "(_", "str", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "refre", "sh", "Window_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "delete", "Bookmark", "s_", "(_", "infos_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Bookmark", "Infos_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Instance_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Descripti", "on", "For", "Info_", "(_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rename", "Bookmark", "_", "(_", "info_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Prev", "ious", "Bookmark", "_", "(_", "ned", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "load", " ", "the", " ", "previ", "ous", " ", "bookmark", ",", " ", "based", " ", "on", " ", "alphabetic", "al", " ", "orderi", "ng", " ", "of", " ", "bookmark", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Bookmark", "Name_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "Window_", "(_", "ned", "_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "the", " ", "Bookmark", "s", " ", "window", ".", " ", " ", "If", " ", "it", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "re", "-", "build", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Ne", "xt", "Bookmark", "_", "(_", "ned", "_", ",_", "incr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Callback_", "(_", "ned", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", " ", "whe", "n", " ", "a", " ", "panel", " ", "is", " ", "adde", "d", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Ne", "xt", "Bookmark", "_", "(_", "ned", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "load", " ", "the", " ", "next", " ", "bookmark", ",", " ", "based", " ", "on", " ", "alphabetic", "al", " ", "orderi", "ng", " ", "of", " ", "bookmark", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rename", "Bookmark", "_", "(_", "ned", "_", ",_", "oldn", "ame_", ",_", "info_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rename", " ", "the", " ", "supplie", "d", " ", "bookmark", ",", " ", "give", "n", " ", "the", " ", "old", " ", "name", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Bookmark", "_", "(_", "ned", "_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "create", " ", "a", " ", "new", " ", "bookmark", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Bookmark", "_", "(_", "ned", "_", ",_", "info_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "appl", "y", " ", "the", " ", "supplie", "d", " ", "bookmark", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
Esri/ops-server-config/Install/ArcGISServer/SupportFiles/PreConfigurationChecks.py
[ { "content": "def PreConfigChecks(agsSiteAdminUserName, password):\n try:\n \n success = True\n msgPrefix = \"Failed: \"\n print\n print \"--Running pre-configuration checks...\"\n print\n \n # ---------------------------------------------------------------------\n # Check if site already exists\n # ---------------------------------------------------------------------\n if siteExistsCheck:\n print \"\\t-Checking if ArcGIS Server site already exists on server '\" + serverName + \"'\"\n token = getToken(agsSiteAdminUserName, password, serverName, serverPort)\n\t print\n if token is None:\n # Site does not exist; so configuration can continue.\n print \"\\tPassed: ArcGIS Server site does _not_ exist.\\n\"\n success = True\n else:\n # Site EXISTS; so we don't want configuration of server to continue.\n print \"\\t**Failed: ArcGIS Server site already exists.\\n\"\n success = False\n\t print\n\t \n # ---------------------------------------------------------------------\n # Check if databases already exist\n # --------------------------------------------------------------------- \n \n if dbExistsCheck:\n print \"\\t-Checking if databases already exist...\"\n print\n dbList = getPostgreSQLDatabases(password)\n \n #Convert list to comma-separated string\n dbListAsStr = str(dbList).strip('[]')\n dbListAsStr = dbListAsStr.replace(\"'\", \"\").lower()\n \n print\n for db in dbsForOpsServer:\n if dbListAsStr.find(db.lower()) > -1:\n success = False\n print \"\\t\\t**Failed: database '\" + db + \"' already exists.\"\n else:\n print \"\\t\\tPassed: database '\" + db + \"' does _not_ exist.\"\n \n except:\n success = False\n \n # Get the traceback object\n tb = sys.exc_info()[2]\n tbinfo = traceback.format_tb(tb)[0]\n \n # Concatenate information together concerning the error into a message string\n pymsg = \"PYTHON ERRORS:\\nTraceback info:\\n\" + tbinfo + \"\\nError Info:\\n\" + str(sys.exc_info()[1])\n msgs = \"ArcPy ERRORS:\\n\" + arcpy.GetMessages() + \"\\n\"\n \n # Print Python error messages for use in Python / Python Window\n print\n print \"***** ERROR ENCOUNTERED *****\"\n print pymsg + \"\\n\"\n print msgs\n \n finally:\n # Return success flag\n return success", "metadata": "root.PreConfigChecks", "header": "['module', '___EOS___']", "index": 47 } ]
[ { "span": "msgPrefix ", "start_line": 51, "start_column": 8, "end_line": 51, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Pre", "Config", "Check", "s_", "(_", "ags", "Site", "Admi", "n", "User", "Name_", ",_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Prefix_", "=_", "\"", "Fail", "ed", ":", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"--", "Run", "ning", " ", "pre", "-", "configura", "tion", " ", "checks", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "site", " ", "alr", "ead", "y", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "site", "Exist", "s", "Check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", "-", "Check", "ing", " ", "if", " ", "Arc", "GI", "S", " ", "Server", " ", "site", " ", "alr", "ead", "y", " ", "exist", "s", " ", "on", " ", "server", " ", "'\"_", "+_", "server", "Name_", "+_", "\"'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "get", "Token_", "(_", "ags", "Site", "Admi", "n", "User", "Name_", ",_", "password_", ",_", "server", "Name_", ",_", "server", "Port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "token_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Site", " ", "doe", "s", " ", "not", " ", "exist", ";", " ", "so", " ", "configura", "tion", " ", "can", " ", "continue", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", "Passe", "d", ":", " ", "Arc", "GI", "S", " ", "Server", " ", "site", " ", "doe", "s", " ", "\\u", "not", "\\u", " ", "exist", ".\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Site", " ", "EXIST", "S", ";", " ", "so", " ", "we", " ", "don", "'", "t", " ", "want", " ", "configura", "tion", " ", "of", " ", "server", " ", "to", " ", "continue", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", "**", "Fail", "ed", ":", " ", "Arc", "GI", "S", " ", "Server", " ", "site", " ", "alr", "ead", "y", " ", "exist", "s", ".\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "False_", "\\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\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "databa", "ses", " ", "alr", "ead", "y", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "Exist", "s", "Check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", "-", "Check", "ing", " ", "if", " ", "databa", "ses", " ", "alr", "ead", "y", " ", "exist", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "List_", "=_", "get", "Post", "gre", "SQL", "Databa", "ses_", "(_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Convert", " ", "list", " ", "to", " ", "comma", "-", "separate", "d", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "db", "List", "As", "Str_", "=_", "str_", "(_", "db", "List_", ")_", "._", "strip_", "(_", "'[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "List", "As", "Str_", "=_", "db", "List", "As", "Str_", "._", "replace_", "(_", "\"'\"_", ",_", "\"\"_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "db_", "in_", "dbs", "For", "Op", "s", "Server_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "List", "As", "Str_", "._", "find_", "(_", "db_", "._", "lower_", "(_", ")_", ")_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "\\\\", "t", "**", "Fail", "ed", ":", " ", "databa", "se", " ", "'\"_", "+_", "db_", "+_", "\"'", " ", "alr", "ead", "y", " ", "exist", "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 ", " ", "_", "print_", "\"\\\\", "t", "\\\\", "t", "Passe", "d", ":", " ", "databa", "se", " ", "'\"_", "+_", "db_", "+_", "\"'", " ", "doe", "s", " ", "\\u", "not", "\\u", " ", "exist", ".\"_", "\\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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "traceback", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "info_", "=_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Concat", "enat", "e", " ", "informati", "on", " ", "tog", "ether", " ", "concern", "ing", " ", "the", " ", "error", " ", "int", "o", " ", "a", " ", "message", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "pym", "sg_", "=_", "\"", "PYTHON", " ", "ERRORS", ":\\\\", "n", "Trace", "back", " ", "info", ":\\\\", "n", "\"_", "+_", "tb", "info_", "+_", "\"\\\\", "n", "Error", " ", "Info", ":\\\\", "n", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs_", "=_", "\"", "Arc", "Py", " ", "ERRORS", ":\\\\", "n", "\"_", "+_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "Pyth", "on", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "Pyth", "on", " ", "/", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"****", "*", " ", "ERROR", " ", "ENC", "OUN", "TER", "ED", " ", "*****", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "pym", "sg_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "msgs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Return", " ", "success", " ", "flag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "success_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Unused local variable
django-oscar/django-oscar/tests/functional/customer/auth_tests.py
[ { "content": " def test_receives_an_email_when_their_password_is_changed(self):\n page = self.get(reverse('customer:change-password'))\n form = page.forms['change_password_form']\n form['old_password'] = self.password\n form['new_password1'] = u'anotherfancypassword'\n form['new_password2'] = u'anotherfancypassword'\n page = form.submit()\n\n self.assertEqual(len(mail.outbox), 1)\n self.assertIn(\"your password has been changed\", mail.outbox[0].body)", "metadata": "root.TestAnAuthenticatedUser.test_receives_an_email_when_their_password_is_changed", "header": "['class', 'TestAnAuthenticatedUser', '(', 'WebTestCase', ')', ':', '___EOS___']", "index": 57 }, { "content": " def test_receives_an_email_when_their_email_address_is_changed(self):\n page = self.get(reverse('customer:profile-update'))\n form = page.forms['profile_form']\n\n new_email = '[email protected]'\n form['email'] = new_email\n page = form.submit()\n\n self.assertEqual(len(mail.outbox), 1)\n self.assertEqual(mail.outbox[0].to[0], self.email)\n self.assertEqual(User.objects.get(id=self.user.id).email, new_email)\n self.assertIn(\"your email address has been changed\",\n mail.outbox[0].body)", "metadata": "root.TestAnAuthenticatedUser.test_receives_an_email_when_their_email_address_is_changed", "header": "['class', 'TestAnAuthenticatedUser', '(', 'WebTestCase', ')', ':', '___EOS___']", "index": 79 } ]
[ { "span": "page ", "start_line": 63, "start_column": 8, "end_line": 63, "end_column": 12 }, { "span": "page ", "start_line": 85, "start_column": 8, "end_line": 85, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "An", "Auth", "entica", "ted", "User_", "(_", "Web", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "receive", "s", "\\u", "an", "\\u", "email", "\\u", "whe", "n", "\\u", "thei", "r", "\\u", "password", "\\u", "is", "\\u", "changed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "self_", "._", "get_", "(_", "reverse_", "(_", "'", "customer", ":", "change", "-", "password", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "page_", "._", "forms_", "[_", "'", "change", "\\u", "password", "\\u", "form", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "old", "\\u", "password", "'_", "]_", "=_", "self_", "._", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "new", "\\u", "password", "1", "'_", "]_", "=_", "u", "'", "anot", "her", "fancy", "password", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "new", "\\u", "password", "2", "'_", "]_", "=_", "u", "'", "anot", "her", "fancy", "password", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "form_", "._", "submit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "mail_", "._", "outbox_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "your", " ", "password", " ", "has", " ", "bee", "n", " ", "change", "d", "\"_", ",_", "mail_", "._", "outbox_", "[_", "0_", "]_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "An", "Auth", "entica", "ted", "User_", "(_", "Web", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "receive", "s", "\\u", "an", "\\u", "email", "\\u", "whe", "n", "\\u", "thei", "r", "\\u", "email", "\\u", "address", "\\u", "is", "\\u", "changed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "self_", "._", "get_", "(_", "reverse_", "(_", "'", "customer", ":", "profile", "-", "update", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "page_", "._", "forms_", "[_", "'", "profile", "\\u", "form", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "email_", "=_", "'", "a", ".", "new", ".", "email", "@", "user", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "email", "'_", "]_", "=_", "new", "\\u", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "form_", "._", "submit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "mail_", "._", "outbox_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mail_", "._", "outbox_", "[_", "0_", "]_", "._", "to_", "[_", "0_", "]_", ",_", "self_", "._", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "User_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "self_", "._", "user_", "._", "id_", ")_", "._", "email_", ",_", "new", "\\u", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "your", " ", "email", " ", "address", " ", "has", " ", "bee", "n", " ", "change", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mail_", "._", "outbox_", "[_", "0_", "]_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Import of deprecated module
golismero/golismero/thirdparty_libs/dns/hash.py
[ { "content": "def _setup():\n global _hashes\n _hashes = {}\n try:\n import hashlib\n _hashes['MD5'] = hashlib.md5\n _hashes['SHA1'] = hashlib.sha1\n _hashes['SHA224'] = hashlib.sha224\n _hashes['SHA256'] = hashlib.sha256\n if sys.hexversion >= 0x02050200:\n _hashes['SHA384'] = hashlib.sha384\n _hashes['SHA512'] = hashlib.sha512\n else:\n _hashes['SHA384'] = _need_later_python('SHA384')\n _hashes['SHA512'] = _need_later_python('SHA512')\n\n if sys.hexversion < 0x02050000:\n # hashlib doesn't conform to PEP 247: API for\n # Cryptographic Hash Functions, which hmac before python\n # 2.5 requires, so add the necessary items.\n class HashlibWrapper:\n def __init__(self, basehash):\n self.basehash = basehash\n self.digest_size = self.basehash().digest_size\n\n def new(self, *args, **kwargs):\n return self.basehash(*args, **kwargs)\n\n for name in _hashes:\n _hashes[name] = HashlibWrapper(_hashes[name])\n\n except ImportError:\n import md5, sha\n _hashes['MD5'] = md5\n _hashes['SHA1'] = sha", "metadata": "root._setup", "header": "['module', '___EOS___']", "index": 27 } ]
[ { "span": "md5,", "start_line": 59, "start_column": 15, "end_line": 59, "end_column": 18 }, { "span": "sha", "start_line": 59, "start_column": 20, "end_line": 59, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "hashes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "hashes_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "hashes_", "[_", "'", "MD", "5", "'_", "]_", "=_", "hashlib_", "._", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "hashes_", "[_", "'", "SHA", "1", "'_", "]_", "=_", "hashlib_", "._", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "hashes_", "[_", "'", "SHA", "224", "'_", "]_", "=_", "hashlib_", "._", "sha2", "24_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "hashes_", "[_", "'", "SHA", "256", "'_", "]_", "=_", "hashlib_", "._", "sha256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "hex", "version_", ">=_", "0x02", "050", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "hashes_", "[_", "'", "SHA", "384", "'_", "]_", "=_", "hashlib_", "._", "sha", "384_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "hashes_", "[_", "'", "SHA", "512", "'_", "]_", "=_", "hashlib_", "._", "sha512", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "hashes_", "[_", "'", "SHA", "384", "'_", "]_", "=_", "\\u", "need", "\\u", "late", "r", "\\u", "python_", "(_", "'", "SHA", "384", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "hashes_", "[_", "'", "SHA", "512", "'_", "]_", "=_", "\\u", "need", "\\u", "late", "r", "\\u", "python_", "(_", "'", "SHA", "512", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "hex", "version_", "<_", "0x02", "0500", "00_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "hash", "lib", " ", "doe", "sn", "'", "t", " ", "conform", " ", "to", " ", "PE", "P", " ", "247", ":", " ", "API", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Crypto", "graphic", " ", "Hash", " ", "Function", "s", ",", " ", "whi", "ch", " ", "hmac", " ", "bef", "ore", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2.5", " ", "require", "s", ",", " ", "so", " ", "add", " ", "the", " ", "necessar", "y", " ", "items", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Hash", "lib", "Wrapper_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "base", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "base", "hash_", "=_", "base", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "digest", "\\u", "size_", "=_", "self_", "._", "base", "hash_", "(_", ")_", "._", "digest", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "base", "hash_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "\\u", "hashes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "hashes_", "[_", "name_", "]_", "=_", "Hash", "lib", "Wrapper_", "(_", "\\u", "hashes_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "md5_", ",_", "sha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "hashes_", "[_", "'", "MD", "5", "'_", "]_", "=_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "hashes_", "[_", "'", "SHA", "1", "'_", "]_", "=_", "sha_", "\\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, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/internal/pwarnings.py
[ { "content": "\"\"\"\nRedefine format warning to avoid getting garbage at end of line when raised directly from Maya console\nand define a UserWarning class that does only print it's message (no line or module info)\n\n\n\"\"\"\nimport warnings\nfrom warnings import formatwarning, linecache\n\n\nwarnings.formatwarning = formatwarning\n\n#def showwarning(message, category, filename, lineno, file=None, line=None):\n# msg = warnings.formatwarning(message, category, filename, lineno, line)\n# if file:\n# msg += \" >> %r\" % file\n# _logger.warning(msg)\n#\n#warnings.showwarning = showwarning\n\n\n\n\nif __name__ == '__main__' :\n import doctest\n doctest.testmod()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import warnings", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Red", "efin", "e", " ", "format", " ", "warn", "ing", " ", "to", " ", "avoid", " ", "getti", "ng", " ", "gar", "bage", " ", "at", " ", "end", " ", "of", " ", "line", " ", "whe", "n", " ", "raise", "d", " ", "direct", "ly", " ", "from", " ", "Maya", " ", "console", "\\", "10", ";", "and", " ", "defin", "e", " ", "a", " ", "User", "Warn", "ing", " ", "class", " ", "tha", "t", " ", "doe", "s", " ", "only", " ", "print", " ", "it", "'", "s", " ", "message", " ", "(", "no", " ", "line", " ", "or", " ", "module", " ", "info", ")", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "warnings_", "import_", "format", "warning_", ",_", "linec", "ache_", "\\u\\u\\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_", "warnings_", "._", "format", "warning_", "=_", "format", "warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "show", "warn", "ing", "(", "message", ",", " ", "category", ",", " ", "filename", ",", " ", "linen", "o", ",", " ", "file", "=", "Non", "e", ",", " ", "line", "=", "Non", "e", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "msg", " ", "=", " ", "warn", "ings", ".", "format", "warn", "ing", "(", "message", ",", " ", "category", ",", " ", "filename", ",", " ", "linen", "o", ",", " ", "line", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "file", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "msg", " ", "+=", " ", "\"", " ", ">>", " ", "%", "r", "\"", " ", "%", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "logg", "er", ".", "warn", "ing", "(", "msg", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "warn", "ings", ".", "show", "warn", "ing", " ", "=", " ", "show", "warning_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\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_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doctest_", "._", "testmod_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dokipen/whoosh/src/whoosh/filedb/structfile.py
[ { "content": "#===============================================================================\n# Copyright 2009 Matt Chaput\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 mmap, os\nfrom cPickle import dump as dump_pickle\nfrom cPickle import load as load_pickle\nfrom struct import calcsize, pack, unpack, Struct\n\nfrom whoosh.system import _INT_SIZE, _USHORT_SIZE, _ULONG_SIZE, _FLOAT_SIZE\nfrom whoosh.util import varint, read_varint, float_to_byte, byte_to_float\n\n\n_SIZEMAP = dict((typecode, calcsize(typecode)) for typecode in \"bBiIhHlLf\")\n_ORDERMAP = {\"little\": \"<\", \"big\": \">\"}\n\n# Struct functions\n\n_types = ((\"sbyte\", \"b\"), (\"ushort\", \"H\"), (\"int\", \"i\"),\n (\"ulong\", \"L\"), (\"float\", \"f\"))\n\n_sbyte_struct = Struct(\"!b\")\n_ushort_struct = Struct(\"!H\")\n_int_struct = Struct(\"!i\")\n_uint_struct = Struct(\"!I\")\n_ulong_struct = Struct(\"!L\")\n_float_struct = Struct(\"!f\")\n\npack_sbyte = _sbyte_struct.pack\npack_ushort = _ushort_struct.pack\npack_int = _int_struct.pack\npack_uint = _uint_struct.pack\npack_ulong = _ulong_struct.pack\npack_float = _float_struct.pack\n\nunpack_sbyte = _sbyte_struct.unpack\nunpack_ushort = _ushort_struct.unpack\nunpack_int = _int_struct.unpack\nunpack_uint = _uint_struct.unpack\nunpack_ulong = _ulong_struct.unpack\nunpack_float = _float_struct.unpack\n\n\n# Main function\n\n \n \n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class StructFile(object):\n \"\"\"Returns a \"structured file\" object that wraps the given file object and provides\n numerous additional methods for writing structured data, such as \"write_varint\"\n and \"write_ulong\".\n \"\"\"\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ", "metadata": "root.StructFile", "header": "['module', '___EOS___']", "index": 57 }, { "content": " def __init__(self, fileobj, name=None, onclose=None, mapped=True):\n self.file = fileobj\n self._name = name\n self.onclose = onclose\n self.is_closed = False\n \n for attr in (\"read\", \"write\", \"tell\", \"seek\"):\n if hasattr(fileobj, attr):\n setattr(self, attr, getattr(fileobj, attr))\n \n # If mapped is True, set the 'map' attribute to a memory-mapped\n # representation of the file. Otherwise, the fake 'map' that\n # set up by the base class will be used.\n if mapped and hasattr(fileobj, \"mode\") and \"r\" in fileobj.mode:\n fd = fileobj.fileno()\n self.size = os.fstat(fd).st_size\n try:\n self.map = mmap.mmap(fd, self.size, access=mmap.ACCESS_READ)\n except OSError:\n self._setup_fake_map()\n else:\n self._setup_fake_map()", "metadata": "root.StructFile.__init__", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 63 }, { "content": " def __repr__(self):\n return \"%s(%r)\" % (self.__class__.__name__, self._name)", "metadata": "root.StructFile.__repr__", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 86 }, { "content": " def flush(self):\n \"\"\"Flushes the buffer of the wrapped file. This is a no-op\n if the wrapped file does not have a flush method.\n \"\"\"\n if hasattr(self.file, \"flush\"):\n self.file.flush()", "metadata": "root.StructFile.flush", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 89 }, { "content": " def close(self):\n \"\"\"Closes the wrapped file. This is a no-op\n if the wrapped file does not have a close method.\n \"\"\"\n \n del self.map\n if self.onclose:\n self.onclose(self)\n if hasattr(self.file, \"close\"):\n self.file.close()\n self.is_closed = True", "metadata": "root.StructFile.close", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 96 }, { "content": " def _setup_fake_map(self): \n _self = self\n class fakemap(object):\n def __getitem__(self, slice):\n if isinstance(slice, (int, long)):\n _self.seek(slice)\n return _self.read(1)\n else:\n _self.seek(slice.start)\n return _self.read(slice.stop - slice.start)\n self.map = fakemap()", "metadata": "root.StructFile._setup_fake_map", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 108 }, { "content": " def write_string(self, s):\n \"\"\"Writes a string to the wrapped file. This method writes the\n length of the string first, so you can read the string back\n without having to know how long it was.\n \"\"\"\n self.write_varint(len(s))\n self.file.write(s)", "metadata": "root.StructFile.write_string", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 120 }, { "content": " def write_string2(self, s):\n self.write(pack_ushort(len(s)) + s)", "metadata": "root.StructFile.write_string2", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 128 }, { "content": " def read_string(self):\n \"\"\"Reads a string from the wrapped file.\n \"\"\"\n return self.file.read(self.read_varint())", "metadata": "root.StructFile.read_string", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 131 }, { "content": " def read_string2(self):\n l = self.read_ushort()\n return self.read(l)", "metadata": "root.StructFile.read_string2", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 136 }, { "content": " def skip_string(self):\n l = self.read_varint()\n self.seek(l, 1)", "metadata": "root.StructFile.skip_string", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 140 }, { "content": " def write_varint(self, i):\n \"\"\"Writes a variable-length integer to the wrapped file.\n \"\"\"\n self.file.write(varint(i))", "metadata": "root.StructFile.write_varint", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 144 }, { "content": " def read_varint(self):\n \"\"\"Reads a variable-length encoded integer from the wrapped\n file.\n \"\"\"\n return read_varint(self.file.read)", "metadata": "root.StructFile.read_varint", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 149 }, { "content": " def write_byte(self, n):\n \"\"\"Writes a single byte to the wrapped file, shortcut for\n file.write(chr(n)).\n \"\"\"\n self.file.write(chr(n))", "metadata": "root.StructFile.write_byte", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 155 }, { "content": " def read_byte(self):\n return ord(self.file.read(1))", "metadata": "root.StructFile.read_byte", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 161 }, { "content": " def get_byte(self, position):\n return ord(self.map[position])", "metadata": "root.StructFile.get_byte", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 164 }, { "content": " def write_8bitfloat(self, f, mantissabits = 5, zeroexp = 2):\n \"\"\"Writes a byte-sized representation of floating point value\n f to the wrapped file.\n mantissabits is the number of bits to use for the mantissa\n (with the rest used for the exponent).\n zeroexp is the zero point for the exponent.\n \"\"\"\n \n self.write_byte(float_to_byte(f, mantissabits, zeroexp))", "metadata": "root.StructFile.write_8bitfloat", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 167 }, { "content": " def read_8bitfloat(self, mantissabits = 5, zeroexp = 2):\n \"\"\"Reads a byte-sized representation of a floating point value.\n mantissabits is the number of bits to use for the mantissa\n (with the rest used for the exponent).\n zeroexp is the zero point for the exponent.\n \"\"\"\n return byte_to_float(self.read_byte(), mantissabits, zeroexp)", "metadata": "root.StructFile.read_8bitfloat", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 177 }, { "content": " def write_pickle(self, obj, protocol=-1):\n \"\"\"Writes a pickled representation of obj to the wrapped file.\n \"\"\"\n dump_pickle(obj, self.file, protocol)", "metadata": "root.StructFile.write_pickle", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 185 }, { "content": " def read_pickle(self):\n \"\"\"Reads a pickled object from the wrapped file.\n \"\"\"\n return load_pickle(self.file)", "metadata": "root.StructFile.read_pickle", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 190 }, { "content": " def write_sbyte(self, n):\n self.file.write(pack_sbyte(n))", "metadata": "root.StructFile.write_sbyte", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 195 }, { "content": " def write_int(self, n):\n self.file.write(pack_int(n))", "metadata": "root.StructFile.write_int", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 197 }, { "content": " def write_uint(self, n):\n self.file.write(pack_uint(n))", "metadata": "root.StructFile.write_uint", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 199 }, { "content": " def write_ushort(self, n):\n self.file.write(pack_ushort(n))", "metadata": "root.StructFile.write_ushort", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 201 }, { "content": " def write_ulong(self, n):\n self.file.write(pack_ulong(n))", "metadata": "root.StructFile.write_ulong", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 203 }, { "content": " def write_float(self, n):\n self.file.write(pack_float(n))", "metadata": "root.StructFile.write_float", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 205 }, { "content": " def write_array(self, arry):\n a = Struct(\"!\" + arry.typecode * len(arry)).pack(*arry)\n self.file.write(a)", "metadata": "root.StructFile.write_array", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 207 }, { "content": " def read_sbyte(self):\n return unpack_sbyte(self.file.read(1))[0]", "metadata": "root.StructFile.read_sbyte", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 211 }, { "content": " def read_int(self):\n return unpack_int(self.file.read(_INT_SIZE))[0]", "metadata": "root.StructFile.read_int", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 213 }, { "content": " def read_uint(self):\n return unpack_uint(self.file.read(_INT_SIZE))[0]", "metadata": "root.StructFile.read_uint", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 215 }, { "content": " def read_ushort(self):\n return unpack_ushort(self.file.read(_USHORT_SIZE))[0]", "metadata": "root.StructFile.read_ushort", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 217 }, { "content": " def read_ulong(self):\n return unpack_ulong(self.file.read(_ULONG_SIZE))[0]", "metadata": "root.StructFile.read_ulong", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 219 }, { "content": " def read_float(self):\n return unpack_float(self.file.read(_FLOAT_SIZE))[0]", "metadata": "root.StructFile.read_float", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 221 }, { "content": " def read_array(self, typecode, length):\n packed = self.file.read(_SIZEMAP[typecode] * length)\n return Struct(\"!\" + typecode * length).unpack(packed)", "metadata": "root.StructFile.read_array", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 223 }, { "content": " def get_sbyte(self, position):\n return unpack_sbyte(self.map[position:position+1])[0]", "metadata": "root.StructFile.get_sbyte", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 227 }, { "content": " def get_int(self, position):\n return unpack_int(self.map[position:position+_INT_SIZE])[0]", "metadata": "root.StructFile.get_int", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 229 }, { "content": " def get_uint(self, position):\n return unpack_uint(self.map[position:position+_INT_SIZE])[0]", "metadata": "root.StructFile.get_uint", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 231 }, { "content": " def get_ushort(self, position):\n return unpack_ushort(self.map[position:position+_USHORT_SIZE])[0]", "metadata": "root.StructFile.get_ushort", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 233 }, { "content": " def get_ulong(self, position):\n return unpack_ulong(self.map[position:position+_ULONG_SIZE])[0]", "metadata": "root.StructFile.get_ulong", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 235 }, { "content": " def get_float(self, position):\n return unpack_float(self.map[position:position+_FLOAT_SIZE])[0]", "metadata": "root.StructFile.get_float", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 237 }, { "content": " def get_array(self, position, typecode, length):\n return unpack(\"!\" + typecode * length,\n self.map[position:position+_SIZEMAP[typecode] * length])", "metadata": "root.StructFile.get_array", "header": "['class', 'StructFile', '(', 'object', ')', ':', '___EOS___']", "index": 239 } ]
[ { "span": "from struct import calcsize, pack, unpack, Struct", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "=========", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "200", "9", " ", "Matt", " ", "Chap", "ut_", "\\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_", "mmap_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "c", "Pickle_", "import_", "dump_", "as_", "dump", "\\u", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "c", "Pickle_", "import_", "load_", "as_", "load", "\\u", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "struct_", "import_", "calcsize_", ",_", "pack_", ",_", "unpack_", ",_", "Struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "who", "osh", "_", "._", "system_", "import_", "\\u", "INT", "\\u", "SIZE_", ",_", "\\u", "US", "HOR", "T", "\\u", "SIZE_", ",_", "\\u", "ULONG", "\\u", "SIZE_", ",_", "\\u", "FLOAT", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "who", "osh", "_", "._", "util_", "import_", "vari", "nt_", ",_", "read", "\\u", "vari", "nt_", ",_", "float", "\\u", "to", "\\u", "byte_", ",_", "byte", "\\u", "to", "\\u", "float_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "SIZE", "MAP_", "=_", "dict_", "(_", "(_", "typecode_", ",_", "calcsize_", "(_", "typecode_", ")_", ")_", "for_", "typecode_", "in_", "\"", "b", "Bi", "Ih", "Hl", "Lf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ORDE", "RM", "AP_", "=_", "{_", "\"", "litt", "le", "\"_", ":_", "\"<\"_", ",_", "\"", "big", "\"_", ":_", "\">\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stru", "ct", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "types_", "=_", "(_", "(_", "\"", "sb", "yte", "\"_", ",_", "\"", "b", "\"_", ")_", ",_", "(_", "\"", "ushort", "\"_", ",_", "\"", "H", "\"_", ")_", ",_", "(_", "\"", "int", "\"_", ",_", "\"", "i", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ulo", "ng", "\"_", ",_", "\"", "L", "\"_", ")_", ",_", "(_", "\"", "float", "\"_", ",_", "\"", "f", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "sb", "yte", "\\u", "struct_", "=_", "Struct_", "(_", "\"!", "b", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ushort", "\\u", "struct_", "=_", "Struct_", "(_", "\"!", "H", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "int\\u", "struct_", "=_", "Struct_", "(_", "\"!", "i", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "uint", "\\u", "struct_", "=_", "Struct_", "(_", "\"!", "I", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ulo", "ng", "\\u", "struct_", "=_", "Struct_", "(_", "\"!", "L", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "float", "\\u", "struct_", "=_", "Struct_", "(_", "\"!", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pack", "\\u", "sb", "yte", "_", "=_", "\\u", "sb", "yte", "\\u", "struct_", "._", "pack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pack", "\\u", "ushort", "_", "=_", "\\u", "ushort", "\\u", "struct_", "._", "pack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pack", "\\u", "int_", "=_", "\\u", "int\\u", "struct_", "._", "pack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pack", "\\u", "uint_", "=_", "\\u", "uint", "\\u", "struct_", "._", "pack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pack", "\\u", "ulong_", "=_", "\\u", "ulo", "ng", "\\u", "struct_", "._", "pack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pack", "\\u", "float_", "=_", "\\u", "float", "\\u", "struct_", "._", "pack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "unpack", "\\u", "sb", "yte", "_", "=_", "\\u", "sb", "yte", "\\u", "struct_", "._", "unpack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unpack", "\\u", "ushort", "_", "=_", "\\u", "ushort", "\\u", "struct_", "._", "unpack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unpack", "\\u", "int_", "=_", "\\u", "int\\u", "struct_", "._", "unpack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unpack", "\\u", "uint_", "=_", "\\u", "uint", "\\u", "struct_", "._", "unpack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unpack", "\\u", "ulong_", "=_", "\\u", "ulo", "ng", "\\u", "struct_", "._", "unpack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unpack", "\\u", "float_", "=_", "\\u", "float", "\\u", "struct_", "._", "unpack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Main", " ", "function_", "\\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_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "\"", "structure", "d", " ", "file", "\"", " ", "object", " ", "tha", "t", " ", "wrap", "s", " ", "the", " ", "give", "n", " ", "file", " ", "object", " ", "and", " ", "provide", "s", "\\", "10", ";", " ", " ", " ", " ", "numero", "us", " ", "addition", "al", " ", "method", "s", " ", "for", " ", "writ", "ing", " ", "structure", "d", " ", "data", ",", " ", "suc", "h", " ", "as", " ", "\"", "write", "\\u", "vari", "nt", "\"", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "\"", "write", "\\u", "ulo", "ng", "\".\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "fileobj_", ",_", "name_", "=_", "None_", ",_", "onc", "lose", "_", "=_", "None_", ",_", "mapped_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "=_", "fileobj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "onc", "lose", "_", "=_", "onc", "lose", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "closed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "attr_", "in_", "(_", "\"", "read", "\"_", ",_", "\"", "write", "\"_", ",_", "\"", "tell", "\"_", ",_", "\"", "seek", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "fileobj_", ",_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "attr_", ",_", "getattr_", "(_", "fileobj_", ",_", "attr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "mapp", "ed", " ", "is", " ", "Tru", "e", ",", " ", "set", " ", "the", " ", "'", "map", "'", " ", "attribute", " ", "to", " ", "a", " ", "memory", "-", "mapped_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "represent", "ation", " ", "of", " ", "the", " ", "file", ".", " ", "Ot", "her", "wis", "e", ",", " ", "the", " ", "fake", " ", "'", "map", "'", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "up", " ", "by", " ", "the", " ", "base", " ", "class", " ", "will", " ", "be", " ", "used", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mapped_", "and_", "hasattr_", "(_", "fileobj_", ",_", "\"", "mode", "\"_", ")_", "and_", "\"", "r", "\"_", "in_", "fileobj_", "._", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "=_", "fileobj_", "._", "fileno_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "size_", "=_", "os_", "._", "fsta", "t_", "(_", "fd_", ")_", "._", "st", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "map_", "=_", "mmap_", "._", "mmap_", "(_", "fd_", ",_", "self_", "._", "size_", ",_", "access_", "=_", "mmap_", "._", "ACCESS", "\\u", "READ_", ")_", "\\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 ", " _", "self_", "._", "\\u", "setup", "\\u", "fake", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "setup", "\\u", "fake", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", "(%", "r", ")\"_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "self_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flush_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Flu", "she", "s", " ", "the", " ", "buffer", " ", "of", " ", "the", " ", "wrapp", "ed", " ", "file", ".", " ", "Thi", "s", " ", "is", " ", "a", " ", "no", "-", "op", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "the", " ", "wrapp", "ed", " ", "file", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "flush", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "file_", ",_", "\"", "flush", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Closes", " ", "the", " ", "wrapp", "ed", " ", "file", ".", " ", "Thi", "s", " ", "is", " ", "a", " ", "no", "-", "op", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "the", " ", "wrapp", "ed", " ", "file", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "close", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "self_", "._", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "onc", "lose", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "onc", "lose", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "file_", ",_", "\"", "close", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "is", "\\u", "closed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "\\u", "fake", "\\u", "map_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "self_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "fake", "map_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "slice_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "slice_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "self_", "._", "seek_", "(_", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "self_", "._", "read_", "(_", "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 ", " ", "_", "\\u", "self_", "._", "seek_", "(_", "slice_", "._", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "self_", "._", "read_", "(_", "slice_", "._", "stop_", "-_", "slice_", "._", "start_", ")_", "\\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_", "._", "map_", "=_", "fake", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "string_", "(_", "self_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", "s", " ", "a", " ", "string", " ", "to", " ", "the", " ", "wrapp", "ed", " ", "file", ".", " ", "Thi", "s", " ", "method", " ", "writes", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "length", " ", "of", " ", "the", " ", "string", " ", "first", ",", " ", "so", " ", "you", " ", "can", " ", "read", " ", "the", " ", "string", " ", "back", "\\", "10", ";", " ", " ", " ", " ", "with", "out", " ", "hav", "ing", " ", "to", " ", "know", " ", "how", " ", "long", " ", "it", " ", "was", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "\\u", "vari", "nt_", "(_", "len_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file_", "._", "write_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "string", "2_", "(_", "self_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "pack", "\\u", "ushort", "_", "(_", "len_", "(_", "s_", ")_", ")_", "+_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", "s", " ", "a", " ", "string", " ", "from", " ", "the", " ", "wrapp", "ed", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "file_", "._", "read_", "(_", "self_", "._", "read", "\\u", "vari", "nt_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "string", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "self_", "._", "read", "\\u", "ushort", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "read_", "(_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "skip", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "self_", "._", "read", "\\u", "vari", "nt_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "seek_", "(_", "l_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "vari", "nt_", "(_", "self_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", "s", " ", "a", " ", "variab", "le", "-", "length", " ", "integ", "er", " ", "to", " ", "the", " ", "wrapp", "ed", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file_", "._", "write_", "(_", "vari", "nt_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "vari", "nt_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", "s", " ", "a", " ", "variab", "le", "-", "length", " ", "encode", "d", " ", "integ", "er", " ", "from", " ", "the", " ", "wrapp", "ed", "\\", "10", ";", " ", " ", " ", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "read", "\\u", "vari", "nt_", "(_", "self_", "._", "file_", "._", "read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "byte_", "(_", "self_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", "s", " ", "a", " ", "single", " ", "byte", " ", "to", " ", "the", " ", "wrapp", "ed", " ", "file", ",", " ", "shortcut", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "file", ".", "write", "(", "chr", "(", "n", "))", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file_", "._", "write_", "(_", "chr_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "byte_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ord_", "(_", "self_", "._", "file_", "._", "read_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "byte_", "(_", "self_", ",_", "position_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ord_", "(_", "self_", "._", "map_", "[_", "position_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "8b", "it", "float_", "(_", "self_", ",_", "f_", ",_", "mant", "issa", "bits_", "=_", "5_", ",_", "zero", "exp_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", "s", " ", "a", " ", "byte", "-", "sized", " ", "represent", "ation", " ", "of", " ", "float", "ing", " ", "point", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "f", " ", "to", " ", "the", " ", "wrapp", "ed", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "mant", "issa", "bits", " ", "is", " ", "the", " ", "number", " ", "of", " ", "bits", " ", "to", " ", "use", " ", "for", " ", "the", " ", "mant", "issa", "\\", "10", ";", " ", " ", " ", " ", "(", "with", " ", "the", " ", "rest", " ", "used", " ", "for", " ", "the", " ", "expon", "ent", ").", "\\", "10", ";", " ", " ", " ", " ", "zero", "exp", " ", "is", " ", "the", " ", "zero", " ", "point", " ", "for", " ", "the", " ", "expon", "ent", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write", "\\u", "byte_", "(_", "float", "\\u", "to", "\\u", "byte_", "(_", "f_", ",_", "mant", "issa", "bits_", ",_", "zero", "exp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "8b", "it", "float_", "(_", "self_", ",_", "mant", "issa", "bits_", "=_", "5_", ",_", "zero", "exp_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", "s", " ", "a", " ", "byte", "-", "sized", " ", "represent", "ation", " ", "of", " ", "a", " ", "float", "ing", " ", "point", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "mant", "issa", "bits", " ", "is", " ", "the", " ", "number", " ", "of", " ", "bits", " ", "to", " ", "use", " ", "for", " ", "the", " ", "mant", "issa", "\\", "10", ";", " ", " ", " ", " ", "(", "with", " ", "the", " ", "rest", " ", "used", " ", "for", " ", "the", " ", "expon", "ent", ").", "\\", "10", ";", " ", " ", " ", " ", "zero", "exp", " ", "is", " ", "the", " ", "zero", " ", "point", " ", "for", " ", "the", " ", "expon", "ent", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "byte", "\\u", "to", "\\u", "float_", "(_", "self_", "._", "read", "\\u", "byte_", "(_", ")_", ",_", "mant", "issa", "bits_", ",_", "zero", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "pickle_", "(_", "self_", ",_", "obj_", ",_", "protocol_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", "s", " ", "a", " ", "pickled", " ", "represent", "ation", " ", "of", " ", "obj", " ", "to", " ", "the", " ", "wrapp", "ed", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump", "\\u", "pickle_", "(_", "obj_", ",_", "self_", "._", "file_", ",_", "protocol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "pickle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", "s", " ", "a", " ", "pickled", " ", "object", " ", "from", " ", "the", " ", "wrapp", "ed", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "load", "\\u", "pickle_", "(_", "self_", "._", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "sb", "yte", "_", "(_", "self_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "write_", "(_", "pack", "\\u", "sb", "yte", "_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "int_", "(_", "self_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "write_", "(_", "pack", "\\u", "int_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "uint_", "(_", "self_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "write_", "(_", "pack", "\\u", "uint_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "ushort", "_", "(_", "self_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "write_", "(_", "pack", "\\u", "ushort", "_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "ulong_", "(_", "self_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "write_", "(_", "pack", "\\u", "ulong_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "float_", "(_", "self_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "write_", "(_", "pack", "\\u", "float_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "array_", "(_", "self_", ",_", "arr", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "Struct_", "(_", "\"!\"_", "+_", "arr", "y_", "._", "typecode_", "*_", "len_", "(_", "arr", "y_", ")_", ")_", "._", "pack_", "(_", "*_", "arr", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file_", "._", "write_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "sb", "yte", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "sb", "yte", "_", "(_", "self_", "._", "file_", "._", "read_", "(_", "1_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "int_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "int_", "(_", "self_", "._", "file_", "._", "read_", "(_", "\\u", "INT", "\\u", "SIZE_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "uint_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "uint_", "(_", "self_", "._", "file_", "._", "read_", "(_", "\\u", "INT", "\\u", "SIZE_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "ushort", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "ushort", "_", "(_", "self_", "._", "file_", "._", "read_", "(_", "\\u", "US", "HOR", "T", "\\u", "SIZE_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "ulong_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "ulong_", "(_", "self_", "._", "file_", "._", "read_", "(_", "\\u", "ULONG", "\\u", "SIZE_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "float_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "float_", "(_", "self_", "._", "file_", "._", "read_", "(_", "\\u", "FLOAT", "\\u", "SIZE_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "array_", "(_", "self_", ",_", "typecode_", ",_", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "packed_", "=_", "self_", "._", "file_", "._", "read_", "(_", "\\u", "SIZE", "MAP_", "[_", "typecode_", "]_", "*_", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Struct_", "(_", "\"!\"_", "+_", "typecode_", "*_", "length_", ")_", "._", "unpack_", "(_", "packed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "sb", "yte", "_", "(_", "self_", ",_", "position_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "sb", "yte", "_", "(_", "self_", "._", "map_", "[_", "position_", ":_", "position_", "+_", "1_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "int_", "(_", "self_", ",_", "position_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "int_", "(_", "self_", "._", "map_", "[_", "position_", ":_", "position_", "+_", "\\u", "INT", "\\u", "SIZE_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "uint_", "(_", "self_", ",_", "position_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "uint_", "(_", "self_", "._", "map_", "[_", "position_", ":_", "position_", "+_", "\\u", "INT", "\\u", "SIZE_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "ushort", "_", "(_", "self_", ",_", "position_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "ushort", "_", "(_", "self_", "._", "map_", "[_", "position_", ":_", "position_", "+_", "\\u", "US", "HOR", "T", "\\u", "SIZE_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "ulong_", "(_", "self_", ",_", "position_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "ulong_", "(_", "self_", "._", "map_", "[_", "position_", ":_", "position_", "+_", "\\u", "ULONG", "\\u", "SIZE_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "float_", "(_", "self_", ",_", "position_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack", "\\u", "float_", "(_", "self_", "._", "map_", "[_", "position_", ":_", "position_", "+_", "\\u", "FLOAT", "\\u", "SIZE_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stru", "ct", "File_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "array_", "(_", "self_", ",_", "position_", ",_", "typecode_", ",_", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unpack_", "(_", "\"!\"_", "+_", "typecode_", "*_", "length_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "map_", "[_", "position_", ":_", "position_", "+_", "\\u", "SIZE", "MAP_", "[_", "typecode_", "]_", "*_", "length_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
pydata/pandas/doc/plots/stats/moment_plots.py
[ { "content": "import numpy as np\n\nimport matplotlib.pyplot as plt\nimport pandas.util.testing as t\nimport pandas.stats.moments as m\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_series(n=1000):\n t.N = n\n s = t.makeTimeSeries()\n return s", "metadata": "root.test_series", "header": "['module', '___EOS___']", "index": 7 }, { "content": "def plot_timeseries(*args, **kwds):\n n = len(args)\n\n fig, axes = plt.subplots(n, 1, figsize=kwds.get('size', (10, 5)),\n sharex=True)\n titles = kwds.get('titles', None)\n\n for k in range(1, n + 1):\n ax = axes[k - 1]\n ts = args[k - 1]\n ax.plot(ts.index, ts.values)\n\n if titles:\n ax.set_title(titles[k - 1])\n\n fig.autofmt_xdate()\n fig.subplots_adjust(bottom=0.10, top=0.95)", "metadata": "root.plot_timeseries", "header": "['module', '___EOS___']", "index": 13 } ]
[ { "span": "import numpy as np", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 18 }, { "span": "import pandas.stats.moments as m", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 32 } ]
[]
1
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_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "._", "util_", "._", "testing_", "as_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "._", "stats_", "._", "moments_", "as_", "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\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "series_", "(_", "n_", "=_", "1000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "N_", "=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "t_", "._", "make", "Time", "Series_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot", "\\u", "timeseries_", "(_", "*_", "args_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "len_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "axes_", "=_", "plt_", "._", "subplots_", "(_", "n_", ",_", "1_", ",_", "figsize_", "=_", "kwds_", "._", "get_", "(_", "'", "size", "'_", ",_", "(_", "10_", ",_", "5_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sharex", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "titles_", "=_", "kwds_", "._", "get_", "(_", "'", "titles", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "1_", ",_", "n_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax_", "=_", "axes_", "[_", "k_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts_", "=_", "args_", "[_", "k_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "plot_", "(_", "ts_", "._", "index_", ",_", "ts_", "._", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "titles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax_", "._", "set\\u", "title_", "(_", "titles_", "[_", "k_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fig_", "._", "autof", "mt", "\\u", "xdat", "e_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "._", "subplot", "s", "\\u", "adjust_", "(_", "bottom_", "=_", "0.10", "_", ",_", "top_", "=_", "0.95_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
evfredericksen/pynacea/pynhost/pynhost/commands.py
[ { "content": "def new_action_list(raw_actions, rule_match=None):\n words = rule_match.matched_words if rule_match else ()\n new_actions = []\n for action in raw_actions:\n if isinstance(action, dynamic.Num):\n action = action.evaluate(rule_match)\n elif isinstance (action, (list, tuple)):\n func = action[0]\n for action in self.actions:\n if not isinstance(action, (int, dynamic.RepeatCommand)):\n return True\n return False\n\n def __str__(self):\n return '<ActionList matching words {}>'.format(' '.join(self.matched_words))\n\n def __repr__(self):\n return str(self)", "metadata": "root.new_action_list", "header": "['module', '___EOS___']", "index": 81 } ]
[ { "span": "action ", "start_line": 86, "start_column": 12, "end_line": 86, "end_column": 18 } ]
[ { "span": "action ", "start_line": 89, "start_column": 12, "end_line": 89, "end_column": 18 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "\\u", "action", "\\u", "list_", "(_", "raw", "\\u", "actions_", ",_", "rule", "\\u", "match_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "words_", "=_", "rule", "\\u", "match_", "._", "matche", "d\\u", "words_", "if_", "rule", "\\u", "match_", "else_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "actions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "raw", "\\u", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "action_", ",_", "dynamic_", "._", "Num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action_", "=_", "action_", "._", "evaluate_", "(_", "rule", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "action_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func_", "=_", "action_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "action_", "in_", "self_", "._", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "action_", ",_", "(_", "int_", ",_", "dynamic_", "._", "Repeat", "Command_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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_", "'<", "Action", "List", " ", "matchi", "ng", " ", "words", " ", "{}>", "'_", "._", "format_", "(_", "'", " ", "'_", "._", "join_", "(_", "self_", "._", "matche", "d\\u", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
EasyCTF/easyctf-2015/api/api/routes/team.py
[ { "content": "from flask import request, session\nfrom flask import Blueprint\n\nimport api\nimport json\nimport mimetypes\nimport os.path\n\nimport api.auth\nimport api.team\n\nfrom api.annotations import *\nfrom api.common import flat_multi\nfrom api.exceptions import *\n\nblueprint = Blueprint(\"team_api\", __name__)\n\n\n\n\n\n\n\n\n\t\n\n\t", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@blueprint.route(\"/public_info\", methods=[\"GET\"])\n@api_wrapper\ndef team_public_info_hook():\n\tteamname = request.args.get(\"teamname\")\n\tif api.team.get_team(teamname=teamname) is None:\n\t\traise WebException(\"No team found under that name.\")\n\tdata = api.team.public_info(teamname=teamname)\n\tdata[\"max_score\"] = api.problem.get_max_points()\n\treturn { \"success\": 1, \"data\": data }", "metadata": "root.team_public_info_hook", "header": "['module', '___EOS___']", "index": 17 }, { "content": "@blueprint.route(\"/create\", methods=[\"POST\"])\n@api_wrapper\n@require_login\ndef team_create_hook():\n\ttid = api.team.create(api.common.flat_multi(request.form))\n\treturn { \"success\": 1, \"message\": \"Your team was successfully created!\" }", "metadata": "root.team_create_hook", "header": "['module', '___EOS___']", "index": 27 }, { "content": "@blueprint.route(\"/members\", methods=[\"GET\"])\n@api_wrapper\ndef team_members_hook():\n\tmembers = api.team.members()\n\treturn { \"success\": 1, \"data\": members }", "metadata": "root.team_members_hook", "header": "['module', '___EOS___']", "index": 34 }, { "content": "@blueprint.route(\"/join\", methods=[\"POST\"])\n@api_wrapper\n@require_login\ndef team_join_hook():\n\tif request.form.get(\"join_code\") is None or len(request.form.get(\"join_code\")) < 1:\n\t\traise WebException(\"Please provide a join code.\")\n\tjoin_code = request.form.get(\"join_code\")\n\tmessage = api.team.join(join_code)\n\treturn { \"success\": 1, \"message\": message }", "metadata": "root.team_join_hook", "header": "['module', '___EOS___']", "index": 40 }, { "content": "@blueprint.route(\"/join_code\", methods=[\"GET\"])\n@api_wrapper\n@require_login\n@require_team\ndef team_join_code_hook():\n\tcode = api.team.join_code()\n\treturn { \"success\": 1, \"data\": code }", "metadata": "root.team_join_code_hook", "header": "['module', '___EOS___']", "index": 50 }, { "content": "@blueprint.route(\"/join_code/new\", methods=[\"POST\"])\n@api_wrapper\n@require_login\n@require_team\ndef team_join_code_new_hook():\n\tcode = api.team.join_code(force=True)\n\treturn { \"success\": 1, \"data\": code }", "metadata": "root.team_join_code_new_hook", "header": "['module', '___EOS___']", "index": 58 }, { "content": "@blueprint.route(\"/remove\", methods=[\"POST\"])\n@api_wrapper\n@require_login\n@require_team\ndef team_remove_hook():\n\tif api.auth.is_logged_in() and api.user.in_team():\n\t\tuid = request.form.get(\"uid\")\n\t\tuser = api.user.get_user()\n\t\tif uid == user[\"uid\"]:\n\t\t\tconfirm = request.form.get(\"confirm\")\n\t\t\tteam = api.team.get_team()\n\t\t\tif confirm != team[\"teamname\"]:\n\t\t\t\traise WebException(\"Please confirm your name.\")\n\t\tmessage = api.team.remove(uid)\n\t\treturn { \"success\": 1, \"message\": message }\n\telse:\n\t\traise WebException(\"Stop. Just stop.\")", "metadata": "root.team_remove_hook", "header": "['module', '___EOS___']", "index": 66 }, { "content": "@blueprint.route(\"/info\", methods=[\"GET\"])\n@api_wrapper\n@require_login\ndef team_info_hook():\n\tteam = api.team.get_team()\n\tteam_info = {\n\t\t\"tid\": team['tid'],\n\t\t\"teamname\": team['teamname'],\n\t\t\"members\": api.team.members(),\n\t}\n\tif \"school\" in team: team_info[\"school\"] = team[\"school\"]\n\treturn { \"success\": 1, \"data\": team_info }", "metadata": "root.team_info_hook", "header": "['module', '___EOS___']", "index": 84 }, { "content": "@blueprint.route(\"/update\", methods=[\"POST\"])\n@api_wrapper\n@require_login\ndef team_update_hook():\n\tupdated = api.team.update(api.common.flat_multi(request.form))\n\tif updated: return { \"success\": 1, \"message\": \"saved!\" }\n\telse: return { \"success\": 0, \"message\": \"nothing updated.\" }", "metadata": "root.team_update_hook", "header": "['module', '___EOS___']", "index": 97 }, { "content": "@blueprint.route(\"/schools\", methods=[\"GET\"])\n@api_wrapper\n@require_login\ndef team_schools_hook():\n\tschools = api.team.get_schools()\n\treturn { \"success\": 1, \"data\": schools }", "metadata": "root.team_schools_hook", "header": "['module', '___EOS___']", "index": 105 }, { "content": "@blueprint.route(\"/shell\", methods=[\"GET\"])\n@api_wrapper\n@require_login\ndef team_shell_hook():\n\tteam = api.team.get_team()\n\tif \"shell_user\" in team and \"shell_pass\" in team:\n\t\treturn {\n\t\t\t\"success\": 1,\n\t\t\t\"user\": team[\"shell_user\"],\n\t\t\t\"pass\": team[\"shell_pass\"]\n\t\t}\n\telse:\n\t\tshell_account = api.team.assign_shell_account(team[\"tid\"])\n\t\tprint(shell_account)\n\t\treturn {\n\t\t\t\"success\": 1,\n\t\t\t\"user\": shell_account[\"username\"],\n\t\t\t\"pass\": shell_account[\"password\"]\n\t\t}", "metadata": "root.team_shell_hook", "header": "['module', '___EOS___']", "index": 112 } ]
[ { "span": "from flask import request, session", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 34 }, { "span": "import json", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 11 }, { "span": "import mimetypes", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 16 }, { "span": "import os.path", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 14 }, { "span": "from api.common import flat_multi", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "flask_", "import_", "request_", ",_", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "Blueprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "api_", "._", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "api_", "._", "team_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "api_", "._", "annotations_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "api_", "._", "common_", "import_", "flat", "\\u", "multi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "api_", "._", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "blueprint_", "=_", "Blueprint_", "(_", "\"", "team", "\\u", "api", "\"_", ",_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "public", "\\u", "info", "\"_", ",_", "methods_", "=_", "[_", "\"", "GET", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "public", "\\u", "info", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "team", "name_", "=_", "request_", "._", "args_", "._", "get_", "(_", "\"", "team", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "api_", "._", "team_", "._", "get", "\\u", "team_", "(_", "team", "name_", "=_", "team", "name_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Web", "Exception_", "(_", "\"", "No", " ", "team", " ", "found", " ", "under", " ", "tha", "t", " ", "name", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "api_", "._", "team_", "._", "public", "\\u", "info_", "(_", "team", "name_", "=_", "team", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "\"", "max", "\\u", "score", "\"_", "]_", "=_", "api_", "._", "problem_", "._", "get", "\\u", "max", "\\u", "points_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "success", "\"_", ":_", "1_", ",_", "\"", "data", "\"_", ":_", "data_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "create", "\"_", ",_", "methods_", "=_", "[_", "\"", "POST", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "create", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "tid_", "=_", "api_", "._", "team_", "._", "create_", "(_", "api_", "._", "common_", "._", "flat", "\\u", "multi_", "(_", "request_", "._", "form_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "success", "\"_", ":_", "1_", ",_", "\"", "message", "\"_", ":_", "\"", "You", "r", " ", "team", " ", "was", " ", "success", "full", "y", " ", "created", "!\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "member", "s", "\"_", ",_", "methods_", "=_", "[_", "\"", "GET", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "member", "s", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "members_", "=_", "api_", "._", "team_", "._", "members_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "success", "\"_", ":_", "1_", ",_", "\"", "data", "\"_", ":_", "members_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "join", "\"_", ",_", "methods_", "=_", "[_", "\"", "POST", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "join", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "request_", "._", "form_", "._", "get_", "(_", "\"", "join", "\\u", "code", "\"_", ")_", "is_", "None_", "or_", "len_", "(_", "request_", "._", "form_", "._", "get_", "(_", "\"", "join", "\\u", "code", "\"_", ")_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Web", "Exception_", "(_", "\"", "Ple", "ase", " ", "provide", " ", "a", " ", "join", " ", "code", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "join", "\\u", "code_", "=_", "request_", "._", "form_", "._", "get_", "(_", "\"", "join", "\\u", "code", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "api_", "._", "team_", "._", "join_", "(_", "join", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "success", "\"_", ":_", "1_", ",_", "\"", "message", "\"_", ":_", "message_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "join", "\\u", "code", "\"_", ",_", "methods_", "=_", "[_", "\"", "GET", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "team_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "join", "\\u", "code", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "code_", "=_", "api_", "._", "team_", "._", "join", "\\u", "code_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "success", "\"_", ":_", "1_", ",_", "\"", "data", "\"_", ":_", "code_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "join", "\\u", "code", "/", "new", "\"_", ",_", "methods_", "=_", "[_", "\"", "POST", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "team_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "join", "\\u", "code", "\\u", "new", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "code_", "=_", "api_", "._", "team_", "._", "join", "\\u", "code_", "(_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "success", "\"_", ":_", "1_", ",_", "\"", "data", "\"_", ":_", "code_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "remove", "\"_", ",_", "methods_", "=_", "[_", "\"", "POST", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "team_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "remove", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "api_", "._", "auth_", "._", "is", "\\u", "logged", "\\u", "in_", "(_", ")_", "and_", "api_", "._", "user_", "._", "in", "\\u", "team_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "uid_", "=_", "request_", "._", "form_", "._", "get_", "(_", "\"", "uid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "api_", "._", "user_", "._", "get", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uid_", "==_", "user_", "[_", "\"", "uid", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "confirm_", "=_", "request_", "._", "form_", "._", "get_", "(_", "\"", "confirm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "team_", "=_", "api_", "._", "team_", "._", "get", "\\u", "team_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "confirm_", "!=_", "team_", "[_", "\"", "team", "name", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "Web", "Exception_", "(_", "\"", "Ple", "ase", " ", "confirm", " ", "your", " ", "name", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "api_", "._", "team_", "._", "remove_", "(_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "success", "\"_", ":_", "1_", ",_", "\"", "message", "\"_", ":_", "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\t", "\t_", "raise_", "Web", "Exception_", "(_", "\"", "Sto", "p", ".", " ", "Ju", "st", " ", "stop", ".\"_", ")_", "\\u\\u\\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_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "info", "\"_", ",_", "methods_", "=_", "[_", "\"", "GET", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "info", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "team_", "=_", "api_", "._", "team_", "._", "get", "\\u", "team_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "team", "\\u", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tid", "\"_", ":_", "team_", "[_", "'", "tid", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "team", "name", "\"_", ":_", "team_", "[_", "'", "team", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "member", "s", "\"_", ":_", "api_", "._", "team_", "._", "members_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "school", "\"_", "in_", "team_", ":_", "team", "\\u", "info_", "[_", "\"", "school", "\"_", "]_", "=_", "team_", "[_", "\"", "school", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "success", "\"_", ":_", "1_", ",_", "\"", "data", "\"_", ":_", "team", "\\u", "info_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "update", "\"_", ",_", "methods_", "=_", "[_", "\"", "POST", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "update", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "updated_", "=_", "api_", "._", "team_", "._", "update_", "(_", "api_", "._", "common_", "._", "flat", "\\u", "multi_", "(_", "request_", "._", "form_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "updated_", ":_", "return_", "{_", "\"", "success", "\"_", ":_", "1_", ",_", "\"", "message", "\"_", ":_", "\"", "saved", "!\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "return_", "{_", "\"", "success", "\"_", ":_", "0_", ",_", "\"", "message", "\"_", ":_", "\"", "not", "hing", " ", "update", "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_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "school", "s", "\"_", ",_", "methods_", "=_", "[_", "\"", "GET", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "school", "s", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "school", "s_", "=_", "api_", "._", "team_", "._", "get", "\\u", "school", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "success", "\"_", ":_", "1_", ",_", "\"", "data", "\"_", ":_", "school", "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_", "@_", "blueprint_", "._", "route_", "(_", "\"/", "shell", "\"_", ",_", "methods_", "=_", "[_", "\"", "GET", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "api", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "team", "\\u", "shell", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "team_", "=_", "api_", "._", "team_", "._", "get", "\\u", "team_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "shell", "\\u", "user", "\"_", "in_", "team_", "and_", "\"", "shell", "\\u", "pass", "\"_", "in_", "team_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "success", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "\"_", ":_", "team_", "[_", "\"", "shell", "\\u", "user", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pass", "\"_", ":_", "team_", "[_", "\"", "shell", "\\u", "pass", "\"_", "]_", "\\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\t", "\t_", "shell", "\\u", "account_", "=_", "api_", "._", "team_", "._", "assign", "\\u", "shell", "\\u", "account_", "(_", "team_", "[_", "\"", "tid", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "shell", "\\u", "account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "success", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "\"_", ":_", "shell", "\\u", "account_", "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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 ]
Imprecise assert
shinymud/ShinyMUD/tests/shinytest/commands/test_commands.py
[ { "content": " def test_chat_command(self):\n from shinymud.models.area import Area\n from shinymud.data import config\n from shinymud.models.player import Player\n from shinymud.commands.commands import Chat\n\n bob = Player(('bob', 'bar'))\n alice = Player(('alice', 'bar'))\n sam = Player(('sam', 'bar'))\n bob.mode = None\n bob.playerize({'name':'bob', 'password':'pork'})\n bob.outq = []\n sam.mode = None\n sam.playerize({'name':'sam', 'password':'pork'})\n sam.outq = []\n self.world.player_add(bob)\n self.world.player_add(sam)\n self.world.player_add(alice)\n \n Chat(bob, 'lol, hey guys!', 'chat').run()\n chat = config.chat_color + 'Bob chats, \"lol, hey guys!\"' + config.clear_fcolor\n self.assertTrue(chat in sam.outq)\n self.assertTrue(chat in bob.outq)\n self.assertFalse(chat in alice.outq)\n \n sam.channels['chat'] = False\n print sam.channels\n print bob.channels\n sam.outq = []\n bob.outq = []\n alice.outq = []\n \n Chat(bob, 'lol, hey guys!', 'chat').run()\n print sam.channels\n print sam.outq\n print bob.channels\n print bob.outq\n self.assertFalse(chat in sam.outq)\n self.assertTrue(chat in bob.outq)\n self.assertFalse(chat in alice.outq)", "metadata": "root.TestGeneralCommands.test_chat_command", "header": "['class', 'TestGeneralCommands', '(', 'ShinyTestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_give_command(self):\n from shinymud.models.area import Area\n from shinymud.data import config\n from shinymud.models.player import Player\n from shinymud.commands.commands import Give\n area = Area.create({'name':'blarg'})\n room = area.new_room()\n bob = Player(('bob', 'bar'))\n bob.mode = None\n bob.playerize({'name':'bob', 'password':'pork'})\n alice = Player(('alice', 'bar'))\n alice.mode = None\n alice.playerize({'name':'alice', 'password':'pork'})\n self.world.player_add(bob)\n self.world.player_add(alice)\n \n room.add_char(bob)\n room.add_char(alice)\n alice.location = room\n bob.location = room\n proto_npc = area.new_npc()\n npc = proto_npc.load()\n room.add_char(npc)\n \n item = area.new_item()\n item.build_set_keywords('bauble', bob)\n item.build_set_name('a bauble', bob)\n bob.item_add(item.load())\n \n self.assertEqual(len(bob.inventory), 1)\n Give(bob, 'bauble to alice', 'give').run()\n self.assertEqual(len(bob.inventory), 0)\n self.assertEqual(len(alice.inventory), 1)\n to_alice = 'Bob gives you a bauble.'\n self.assertTrue(to_alice in alice.outq)\n to_bob = 'You give a bauble to Alice.'\n self.assertTrue(to_bob in bob.outq)\n \n Give(alice, 'bauble to shiny', 'give').run()\n self.assertEqual(len(alice.inventory), 0)\n self.assertEqual(len(npc.inventory), 1)\n to_alice = 'You give a bauble to %s.' % npc.name\n alice.world.log.debug(alice.outq)\n self.assertTrue(to_alice in alice.outq)\n to_shiny = 'Alice gives you a bauble.'\n self.assertTrue(to_shiny in npc.actionq)\n \n #Test Money\n bob.currency = 100\n com = config.CURRENCY + ' to alice'\n #Test give one currency unit\n self.assertEqual(alice.currency, 0)\n Give(bob, com, 'give').run()\n self.assertEqual(bob.currency, 99)\n self.assertEqual(alice.currency, 1)\n #test give multiple currencies\n com = '99' + config.CURRENCY + ' to alice'\n Give(bob, com, 'give').run()\n self.assertEqual(bob.currency, 0)\n self.assertEqual(alice.currency, 100)\n #test give more than bob has\n com = '1000' + config.CURRENCY + ' to alice'\n Give(bob, com, 'give').run()\n self.assertEqual(bob.currency, 0)\n self.assertEqual(alice.currency, 100)", "metadata": "root.TestGeneralCommands.test_give_command", "header": "['class', 'TestGeneralCommands', '(', 'ShinyTestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " def test_set_command(self):\n from shinymud.models.area import Area\n from shinymud.data import config\n from shinymud.models.player import Player\n from shinymud.commands.commands import Set\n bob = Player(('bob', 'bar'))\n bob.mode = None\n bob.playerize({'name':'bob', 'password':'pork'})\n \n # Test setting e-mail\n Set(bob, 'email [email protected]', 'set').run()\n self.assertEqual('[email protected]', bob.email)\n \n # Test setting title\n Set(bob, 'title is the best EVAR', 'set').run()\n self.assertEqual('is the best EVAR', bob.title)\n \n # Try to set goto_appear and goto_disappear (both should fail\n # since this player shouldn't have permissions)\n Set(bob, 'goto_appear Bob pops in from nowhere.', 'set').run()\n eresult = 'You don\\'t have the permissions to set that.'\n self.assertTrue(eresult in bob.outq)\n bob.outq = []\n Set(bob, 'goto_disappear foo', 'set').run()\n self.assertTrue(eresult in bob.outq)\n \n bob.permissions = bob.permissions | config.BUILDER\n \n # Try to set goto_appear and goto_disappear (both should now\n # succeed now that the player has adequate permissions)\n Set(bob, 'goto_appear Bob pops in from nowhere.', 'set').run()\n self.assertEqual('Bob pops in from nowhere.', bob.goto_appear)\n bob.outq = []\n Set(bob, 'goto_disappear foo', 'set').run()\n self.assertEqual('foo', bob.goto_disappear)", "metadata": "root.TestGeneralCommands.test_set_command", "header": "['class', 'TestGeneralCommands', '(', 'ShinyTestCase', ')', ':', '___EOS___']", "index": 130 }, { "content": " def test_goto_command(self):\n from shinymud.models.area import Area\n from shinymud.data import config\n from shinymud.models.player import Player\n from shinymud.commands.commands import Goto\n blarg_area = Area.create({'name':'blarg'})\n foo_area = Area.create({'name':'foo'})\n blarg_room = blarg_area.new_room()\n foo_room = foo_area.new_room()\n bob = Player(('bob', 'bar'))\n bob.mode = None\n bob.playerize({'name':'bob', 'password':'pork'})\n self.world.player_add(bob)\n bob.permissions = bob.permissions | config.BUILDER\n generic_fail = 'Type \"help goto\" for help with this command.'\n \n # We should fail if we only specify a room number when we aren't in\n # an area \n Goto(bob, '%s' % foo_room.id, 'goto').run()\n self.assertEqual(bob.location, None)\n bob.world.log.debug(bob.outq)\n self.assertTrue(generic_fail in bob.outq)\n \n # We should fail if we try to go to a room in an area that doesn't \n # exist\n message = 'Area \"food\" doesn\\'t exist.'\n Goto(bob, '1 food', 'goto').run()\n self.assertEqual(bob.location, None)\n bob.world.log.debug(bob.outq)\n self.assertTrue(message in bob.outq)\n \n # We should fail if we try to go to a room that doesn't exist (in an\n # area that does)\n message = 'Room \"4005\" doesn\\'t exist in area blarg.'\n Goto(bob, '4005 blarg', 'goto').run()\n self.assertEqual(bob.location, None)\n bob.world.log.debug(bob.outq)\n self.assertTrue(message in bob.outq)\n \n # We should succeed in going to a room and area that exists\n Goto(bob, '%s %s' % (foo_room.id, foo_room.area.name), 'goto').run()\n self.assertEqual(bob.location, foo_room)\n \n Goto(bob, '%s %s' % (blarg_room.id, blarg_room.area.name), 'goto').run()\n self.assertEqual(bob.location, blarg_room)\n \n blarg_r2 = blarg_area.new_room()\n Goto(bob, '%s' % (blarg_r2.id), 'goto').run()\n self.assertEqual(bob.location, blarg_r2)\n \n # We should get a help message if there is only white space given\n bob.outq = []\n Goto(bob, ' ', 'goto').run()\n fail = 'Type \"help goto\" for help with this command.'\n self.assertTrue(fail in bob.outq)", "metadata": "root.TestGeneralCommands.test_goto_command", "header": "['class', 'TestGeneralCommands', '(', 'ShinyTestCase', ')', ':', '___EOS___']", "index": 166 } ]
[ { "span": "self.assertTrue(chat in sam.outq)", "start_line": 43, "start_column": 8, "end_line": 43, "end_column": 41 }, { "span": "self.assertTrue(chat in bob.outq)", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 41 }, { "span": "self.assertFalse(chat in alice.outq)", "start_line": 45, "start_column": 8, "end_line": 45, "end_column": 44 }, { "span": "self.assertFalse(chat in sam.outq)", "start_line": 59, "start_column": 8, "end_line": 59, "end_column": 42 }, { "span": "self.assertTrue(chat in bob.outq)", "start_line": 60, "start_column": 8, "end_line": 60, "end_column": 41 }, { "span": "self.assertFalse(chat in alice.outq)", "start_line": 61, "start_column": 8, "end_line": 61, "end_column": 44 }, { "span": "self.assertTrue(to_alice in alice.outq)", "start_line": 97, "start_column": 8, "end_line": 97, "end_column": 47 }, { "span": "self.assertTrue(to_bob in bob.outq)", "start_line": 99, "start_column": 8, "end_line": 99, "end_column": 43 }, { "span": "self.assertTrue(to_alice in alice.outq)", "start_line": 106, "start_column": 8, "end_line": 106, "end_column": 47 }, { "span": "self.assertTrue(to_shiny in npc.actionq)", "start_line": 108, "start_column": 8, "end_line": 108, "end_column": 48 }, { "span": "self.assertTrue(eresult in bob.outq)", "start_line": 151, "start_column": 8, "end_line": 151, "end_column": 44 }, { "span": "self.assertTrue(eresult in bob.outq)", "start_line": 154, "start_column": 8, "end_line": 154, "end_column": 44 }, { "span": "self.assertTrue(generic_fail in bob.outq)", "start_line": 187, "start_column": 8, "end_line": 187, "end_column": 49 }, { "span": "self.assertTrue(message in bob.outq)", "start_line": 195, "start_column": 8, "end_line": 195, "end_column": 44 }, { "span": "self.assertTrue(message in bob.outq)", "start_line": 203, "start_column": 8, "end_line": 203, "end_column": 44 }, { "span": "self.assertTrue(fail in bob.outq)", "start_line": 220, "start_column": 8, "end_line": 220, "end_column": 41 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "General", "Commands_", "(_", "Shi", "ny", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "chat", "\\u", "command_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "shin", "ym", "ud_", "._", "models_", "._", "area_", "import_", "Area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "data_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "models_", "._", "player_", "import_", "Player_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "commands_", "._", "commands_", "import_", "Chat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bob_", "=_", "Player_", "(_", "(_", "'", "bob", "'_", ",_", "'", "bar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alice_", "=_", "Player_", "(_", "(_", "'", "alic", "e", "'_", ",_", "'", "bar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sam", "_", "=_", "Player_", "(_", "(_", "'", "sam", "'_", ",_", "'", "bar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "mode_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "player", "ize_", "(_", "{_", "'", "name", "'_", ":_", "'", "bob", "'_", ",_", "'", "password", "'_", ":_", "'", "por", "k", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "out", "q_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sam", "_", "._", "mode_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sam", "_", "._", "player", "ize_", "(_", "{_", "'", "name", "'_", ":_", "'", "sam", "'_", ",_", "'", "password", "'_", ":_", "'", "por", "k", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sam", "_", "._", "out", "q_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "world_", "._", "player", "\\u", "add_", "(_", "bob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "world_", "._", "player", "\\u", "add_", "(_", "sam", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "world_", "._", "player", "\\u", "add_", "(_", "alice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Chat_", "(_", "bob_", ",_", "'", "lol", ",", " ", "hey", " ", "guy", "s", "!'_", ",_", "'", "chat", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chat_", "=_", "config_", "._", "chat", "\\u", "color_", "+_", "'", "Bob", " ", "chat", "s", ",", " ", "\"", "lol", ",", " ", "hey", " ", "guy", "s", "!\"", "'_", "+_", "config_", "._", "clear", "\\u", "fco", "lor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "chat_", "in_", "sam", "_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "chat_", "in_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "chat_", "in_", "alice_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sam", "_", "._", "channels_", "[_", "'", "chat", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "sam", "_", "._", "channels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "bob_", "._", "channels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sam", "_", "._", "out", "q_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "out", "q_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alice_", "._", "out", "q_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Chat_", "(_", "bob_", ",_", "'", "lol", ",", " ", "hey", " ", "guy", "s", "!'_", ",_", "'", "chat", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "sam", "_", "._", "channels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "sam", "_", "._", "out", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "bob_", "._", "channels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "bob_", "._", "out", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "chat_", "in_", "sam", "_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "chat_", "in_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "chat_", "in_", "alice_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "General", "Commands_", "(_", "Shi", "ny", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "give", "\\u", "command_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "shin", "ym", "ud_", "._", "models_", "._", "area_", "import_", "Area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "data_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "models_", "._", "player_", "import_", "Player_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "commands_", "._", "commands_", "import_", "Give", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "area_", "=_", "Area_", "._", "create_", "(_", "{_", "'", "name", "'_", ":_", "'", "bla", "rg", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "room_", "=_", "area_", "._", "new", "\\u", "room_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "=_", "Player_", "(_", "(_", "'", "bob", "'_", ",_", "'", "bar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "mode_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "player", "ize_", "(_", "{_", "'", "name", "'_", ":_", "'", "bob", "'_", ",_", "'", "password", "'_", ":_", "'", "por", "k", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alice_", "=_", "Player_", "(_", "(_", "'", "alic", "e", "'_", ",_", "'", "bar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alice_", "._", "mode_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alice_", "._", "player", "ize_", "(_", "{_", "'", "name", "'_", ":_", "'", "alic", "e", "'_", ",_", "'", "password", "'_", ":_", "'", "por", "k", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "world_", "._", "player", "\\u", "add_", "(_", "bob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "world_", "._", "player", "\\u", "add_", "(_", "alice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "room_", "._", "add", "\\u", "char_", "(_", "bob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "room_", "._", "add", "\\u", "char_", "(_", "alice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alice_", "._", "location_", "=_", "room_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "location_", "=_", "room_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto", "\\u", "npc_", "=_", "area_", "._", "new", "\\u", "npc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npc_", "=_", "proto", "\\u", "npc_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "room_", "._", "add", "\\u", "char_", "(_", "npc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "item_", "=_", "area_", "._", "new", "\\u", "item_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "build", "\\u", "set\\u", "keywords_", "(_", "'", "ba", "uble", "'_", ",_", "bob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "build", "\\u", "set\\u", "name_", "(_", "'", "a", " ", "ba", "uble", "'_", ",_", "bob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "item", "\\u", "add_", "(_", "item_", "._", "load_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "bob_", "._", "inventory_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Give", "_", "(_", "bob_", ",_", "'", "ba", "uble", " ", "to", " ", "alic", "e", "'_", ",_", "'", "give", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "bob_", "._", "inventory_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "alice_", "._", "inventory_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "alice_", "=_", "'", "Bob", " ", "give", "s", " ", "you", " ", "a", " ", "ba", "uble", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "to", "\\u", "alice_", "in_", "alice_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "bob_", "=_", "'", "You", " ", "give", " ", "a", " ", "ba", "uble", " ", "to", " ", "Ali", "ce", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "to", "\\u", "bob_", "in_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Give", "_", "(_", "alice_", ",_", "'", "ba", "uble", " ", "to", " ", "shin", "y", "'_", ",_", "'", "give", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "alice_", "._", "inventory_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "npc_", "._", "inventory_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "alice_", "=_", "'", "You", " ", "give", " ", "a", " ", "ba", "uble", " ", "to", " ", "%", "s", ".'_", "%_", "npc_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alice_", "._", "world_", "._", "log_", "._", "debug_", "(_", "alice_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "to", "\\u", "alice_", "in_", "alice_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "shin", "y_", "=_", "'", "Ali", "ce", " ", "give", "s", " ", "you", " ", "a", " ", "ba", "uble", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "to", "\\u", "shin", "y_", "in_", "npc_", "._", "action", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "Mone", "y_", "\\u\\u\\uNL\\u\\u\\u_", "bob_", "._", "currency_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "com_", "=_", "config_", "._", "CURREN", "CY", "_", "+_", "'", " ", "to", " ", "alic", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Test", " ", "give", " ", "one", " ", "curr", "ency", " ", "unit_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alice_", "._", "currency_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Give", "_", "(_", "bob_", ",_", "com_", ",_", "'", "give", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bob_", "._", "currency_", ",_", "99_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alice_", "._", "currency_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "test", " ", "give", " ", "multiple", " ", "currencies", "_", "\\u\\u\\uNL\\u\\u\\u_", "com_", "=_", "'", "9", "9", "'_", "+_", "config_", "._", "CURREN", "CY", "_", "+_", "'", " ", "to", " ", "alic", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Give", "_", "(_", "bob_", ",_", "com_", ",_", "'", "give", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bob_", "._", "currency_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alice_", "._", "currency_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "test", " ", "give", " ", "more", " ", "than", " ", "bob", " ", "has_", "\\u\\u\\uNL\\u\\u\\u_", "com_", "=_", "'", "1000", "'_", "+_", "config_", "._", "CURREN", "CY", "_", "+_", "'", " ", "to", " ", "alic", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Give", "_", "(_", "bob_", ",_", "com_", ",_", "'", "give", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bob_", "._", "currency_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alice_", "._", "currency_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "General", "Commands_", "(_", "Shi", "ny", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "set\\u", "command_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "shin", "ym", "ud_", "._", "models_", "._", "area_", "import_", "Area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "data_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "models_", "._", "player_", "import_", "Player_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "commands_", "._", "commands_", "import_", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "=_", "Player_", "(_", "(_", "'", "bob", "'_", ",_", "'", "bar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "mode_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "player", "ize_", "(_", "{_", "'", "name", "'_", ":_", "'", "bob", "'_", ",_", "'", "password", "'_", ":_", "'", "por", "k", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "setti", "ng", " ", "e-", "mail_", "\\u\\u\\uNL\\u\\u\\u_", "Set_", "(_", "bob_", ",_", "'", "email", " ", "bob", "@", "bob", ".", "com", "'_", ",_", "'", "set", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "bob", "@", "bob", ".", "com", "'_", ",_", "bob_", "._", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "setti", "ng", " ", "title_", "\\u\\u\\uNL\\u\\u\\u_", "Set_", "(_", "bob_", ",_", "'", "title", " ", "is", " ", "the", " ", "best", " ", "EV", "AR", "'_", ",_", "'", "set", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "is", " ", "the", " ", "best", " ", "EV", "AR", "'_", ",_", "bob_", "._", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "set", " ", "got", "o", "\\u", "appear", " ", "and", " ", "got", "o", "\\u", "disapp", "ear", " ", "(", "bot", "h", " ", "shou", "ld", " ", "fail_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "this", " ", "player", " ", "shou", "ld", "n", "'", "t", " ", "have", " ", "permissi", "ons", ")_", "\\u\\u\\uNL\\u\\u\\u_", "Set_", "(_", "bob_", ",_", "'", "got", "o", "\\u", "appear", " ", "Bob", " ", "pops", " ", "in", " ", "from", " ", "now", "here", ".'_", ",_", "'", "set", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eres", "ult_", "=_", "'", "You", " ", "don", "\\\\'", "t", " ", "have", " ", "the", " ", "permissi", "ons", " ", "to", " ", "set", " ", "tha", "t", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "eres", "ult_", "in_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "out", "q_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Set_", "(_", "bob_", ",_", "'", "got", "o", "\\u", "disapp", "ear", " ", "foo", "'_", ",_", "'", "set", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "eres", "ult_", "in_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bob_", "._", "permissions_", "=_", "bob_", "._", "permissions_", "|_", "config_", "._", "BUILD", "ER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "set", " ", "got", "o", "\\u", "appear", " ", "and", " ", "got", "o", "\\u", "disapp", "ear", " ", "(", "bot", "h", " ", "shou", "ld", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "succe", "ed", " ", "now", " ", "tha", "t", " ", "the", " ", "player", " ", "has", " ", "ade", "quat", "e", " ", "permissi", "ons", ")_", "\\u\\u\\uNL\\u\\u\\u_", "Set_", "(_", "bob_", ",_", "'", "got", "o", "\\u", "appear", " ", "Bob", " ", "pops", " ", "in", " ", "from", " ", "now", "here", ".'_", ",_", "'", "set", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "Bob", " ", "pops", " ", "in", " ", "from", " ", "now", "here", ".'_", ",_", "bob_", "._", "got", "o", "\\u", "appear", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "out", "q_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Set_", "(_", "bob_", ",_", "'", "got", "o", "\\u", "disapp", "ear", " ", "foo", "'_", ",_", "'", "set", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "foo", "'_", ",_", "bob_", "._", "got", "o", "\\u", "disapp", "ear_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "General", "Commands_", "(_", "Shi", "ny", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "got", "o", "\\u", "command_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "shin", "ym", "ud_", "._", "models_", "._", "area_", "import_", "Area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "data_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "models_", "._", "player_", "import_", "Player_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shin", "ym", "ud_", "._", "commands_", "._", "commands_", "import_", "Got", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bla", "rg", "\\u", "area_", "=_", "Area_", "._", "create_", "(_", "{_", "'", "name", "'_", ":_", "'", "bla", "rg", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "area_", "=_", "Area_", "._", "create_", "(_", "{_", "'", "name", "'_", ":_", "'", "foo", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bla", "rg", "\\u", "room_", "=_", "bla", "rg", "\\u", "area_", "._", "new", "\\u", "room_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "room_", "=_", "foo", "\\u", "area_", "._", "new", "\\u", "room_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "=_", "Player_", "(_", "(_", "'", "bob", "'_", ",_", "'", "bar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "mode_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "player", "ize_", "(_", "{_", "'", "name", "'_", ":_", "'", "bob", "'_", ",_", "'", "password", "'_", ":_", "'", "por", "k", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "world_", "._", "player", "\\u", "add_", "(_", "bob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "permissions_", "=_", "bob_", "._", "permissions_", "|_", "config_", "._", "BUILD", "ER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gener", "ic", "\\u", "fail_", "=_", "'", "Type", " ", "\"", "help", " ", "got", "o", "\"", " ", "for", " ", "help", " ", "with", " ", "this", " ", "command", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "fail", " ", "if", " ", "we", " ", "only", " ", "speci", "fy", " ", "a", " ", "room", " ", "number", " ", "whe", "n", " ", "we", " ", "are", "n", "'", "t", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "an", " ", "area", " _", "\\u\\u\\uNL\\u\\u\\u_", "Got", "o_", "(_", "bob_", ",_", "'%", "s", "'_", "%_", "foo", "\\u", "room_", "._", "id_", ",_", "'", "got", "o", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bob_", "._", "location_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "world_", "._", "log_", "._", "debug_", "(_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gener", "ic", "\\u", "fail_", "in_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "fail", " ", "if", " ", "we", " ", "try", " ", "to", " ", "go", " ", "to", " ", "a", " ", "room", " ", "in", " ", "an", " ", "area", " ", "tha", "t", " ", "doe", "sn", "'", "t", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Area", " ", "\"", "food", "\"", " ", "doe", "sn", "\\\\'", "t", " ", "exist", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Got", "o_", "(_", "bob_", ",_", "'", "1", " ", "food", "'_", ",_", "'", "got", "o", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bob_", "._", "location_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "world_", "._", "log_", "._", "debug_", "(_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "message_", "in_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "fail", " ", "if", " ", "we", " ", "try", " ", "to", " ", "go", " ", "to", " ", "a", " ", "room", " ", "tha", "t", " ", "doe", "sn", "'", "t", " ", "exist", " ", "(", "in", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "area", " ", "tha", "t", " ", "doe", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Room", " ", "\"", "400", "5", "\"", " ", "doe", "sn", "\\\\'", "t", " ", "exist", " ", "in", " ", "area", " ", "bla", "rg", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Got", "o_", "(_", "bob_", ",_", "'", "400", "5", " ", "bla", "rg", "'_", ",_", "'", "got", "o", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bob_", "._", "location_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bob_", "._", "world_", "._", "log_", "._", "debug_", "(_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "message_", "in_", "bob_", "._", "out", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "succe", "ed", " ", "in", " ", "goi", "ng", " ", "to", " ", "a", " ", "room", " ", "and", " ", "area", " ", "tha", "t", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "Got", "o_", "(_", "bob_", ",_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "foo", "\\u", "room_", "._", "id_", ",_", "foo", "\\u", "room_", "._", "area_", "._", "name_", ")_", ",_", "'", "got", "o", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bob_", "._", "location_", ",_", "foo", "\\u", "room_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Got", "o_", "(_", "bob_", ",_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "bla", "rg", "\\u", "room_", "._", "id_", ",_", "bla", "rg", "\\u", "room_", "._", "area_", "._", "name_", ")_", ",_", "'", "got", "o", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bob_", "._", "location_", ",_", "bla", "rg", "\\u", "room_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bla", "rg", "\\u", "r2_", "=_", "bla", "rg", "\\u", "area_", "._", "new", "\\u", "room_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Got", "o_", "(_", "bob_", ",_", "'%", "s", "'_", "%_", "(_", "bla", "rg", "\\u", "r2_", "._", "id_", ")_", ",_", "'", "got", "o", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bob_", "._", "location_", ",_", "bla", "rg", "\\u", "r2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "get", " ", "a", " ", "help", " ", "message", " ", "if", " ", "there", " ", "is", " ", "only", " ", "white", " ", "space", " ", "given_", "\\u\\u\\uNL\\u\\u\\u_", "bob_", "._", "out", "q_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Got", "o_", "(_", "bob_", ",_", "'", " ", " ", " ", "'_", ",_", "'", "got", "o", "'_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail_", "=_", "'", "Type", " ", "\"", "help", " ", "got", "o", "\"", " ", "for", " ", "help", " ", "with", " ", "this", " ", "command", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "fail_", "in_", "bob_", "._", "out", "q_", ")_" ]
[ 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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n'''\nfrom google.protobuf import text_format\nimport caffe\nfrom caffe import layers as L\nfrom caffe import params as P\nfrom caffe.proto.caffe_pb2 import NetParameter, LayerParameter\nimport nideep.proto.proto_utils as pu\n\n\n\nif __name__ == '__main__':\n \n src_train = \"/home/kashefy/data/cifar10/cifar10_train_lmdb\"\n src_test = \"/home/kashefy/data/cifar10/cifar10_test_lmdb\"\n n = base_ae(src_train, src_test)\n s = text_format.MessageToString(n)\n #print s\n \n stack(n, 2)\n \n pass", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def stack(net, level):\n \n n = pu.copy_net_params(net)\n \n enc_prev = None\n dec_prev = None\n enc = None\n dec = None\n for l in n.layer:\n if l.name.lower().endswith('encode%03dneuron' % (level-1)):\n enc = pu.copy_msg(l, LayerParameter)\n \n for b in list(enc.bottom):\n l.bottom.remove(b)\n for t in list(l.top):\n l.bottom.append(unicode(t)) # preserve order of layer bottoms, label as bottom has to come last\n \n elif l.name.lower().endswith('decode%03dneuron' % (level-1)):\n dec_prev = l\n dec = pu.copy_msg(l, LayerParameter)\n \n enc.name = 'encode%03dneuron' % level\n dec.name = 'encode%03dneuron' % level\n \n \n return n", "metadata": "root.stack", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def base_ae(src_train, src_test):\n \n n = caffe.NetSpec()\n \n n.data = \\\n L.Data(batch_size=100,\n backend=P.Data.LMDB,\n source=src_train,\n transform_param=dict(scale=0.0039215684),\n ntop=1,\n include=[dict(phase=caffe.TRAIN)]\n )\n \n n.data_test = \\\n L.Data(batch_size=100,backend=P.Data.LMDB,\n source=src_test,\n transform_param=dict(scale=0.0039215684),\n ntop=1,\n include=[dict(phase=caffe.TEST)]\n )\n \n n.flatdata = L.Flatten(n.data)\n \n n.encode001 = \\\n L.InnerProduct(n.data,\n num_output=64,\n param=[dict(lr_mult=1, decay_mult=1),\n dict(lr_mult=1, decay_mult=0)],\n weight_filler=dict(type='gaussian', std=1, sparse=15),\n bias_filler=dict(type='constant', value=0)\n )\n \n n.encode001neuron = L.Sigmoid(n.encode001, in_place=True)\n \n n.decode001 = L.InnerProduct(n.encode001neuron,\n num_output=3072,\n param=[dict(lr_mult=1, decay_mult=1),\n dict(lr_mult=1, decay_mult=0)],\n weight_filler=dict(type='gaussian', std=1, sparse=15),\n bias_filler=dict(type='constant', value=0)\n )\n n.loss_x_entropy = \\\n L.SigmoidCrossEntropyLoss(n.decode001, n.flatdata,\n loss_weight=[1])\n \n n.decode001neuron = L.Sigmoid(n.decode001, in_place=False)\n \n n.loss_l2 = \\\n L.EuclideanLoss(n.decode001neuron, n.flatdata,\n loss_weight=[0])\n\n n_proto = n.to_proto()\n \n # fix data layer for test phase\n for l in n_proto.layer:\n if l.type.lower() == 'data' and \\\n [x.phase for x in l.include] == [caffe.TEST]:\n for t in list(l.top):\n l.top.remove(t)\n t = t.split('_test')[0]\n l.top.append(unicode(t))\n l.name = l.name.split('_test')[0]\n \n return n_proto", "metadata": "root.base_ae", "header": "['module', '___EOS___']", "index": 39 } ]
[ { "span": "from caffe.proto.caffe_pb2 import NetParameter, LayerParameter", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 62 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "Jan", " ", "21", ",", " ", "2016", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "kas", "hef", "y", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "protobuf_", "import_", "text", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "caffe", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "caffe", "_", "import_", "layers_", "as_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "caffe", "_", "import_", "params_", "as_", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "caffe", "_", "._", "proto_", "._", "caffe", "\\u", "pb2_", "import_", "Net", "Parameter_", ",_", "Layer", "Parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nid", "eep", "_", "._", "proto_", "._", "proto", "\\u", "utils_", "as_", "pu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "\\u", "train_", "=_", "\"/", "home", "/", "kas", "hef", "y", "/", "data", "/", "cifar", "10", "/", "cifar", "10", "\\u", "train", "\\u", "lm", "db", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "\\u", "test_", "=_", "\"/", "home", "/", "kas", "hef", "y", "/", "data", "/", "cifar", "10", "/", "cifar", "10", "\\u", "test\\u", "lm", "db", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "base", "\\u", "ae_", "(_", "src", "\\u", "train_", ",_", "src", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "text", "\\u", "format_", "._", "Messag", "e", "To", "String_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stack_", "(_", "n_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "stack_", "(_", "net_", ",_", "level_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "pu_", "._", "copy", "\\u", "net", "\\u", "params_", "(_", "net_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enc", "\\u", "prev_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec", "\\u", "prev_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "l_", "in_", "n_", "._", "layer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "l_", "._", "name_", "._", "lower_", "(_", ")_", "._", "endswith_", "(_", "'", "encode", "%", "03", "dne", "uro", "n", "'_", "%_", "(_", "level_", "-_", "1_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enc_", "=_", "pu_", "._", "copy", "\\u", "msg_", "(_", "l_", ",_", "Layer", "Parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "b_", "in_", "list_", "(_", "enc_", "._", "bottom_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "._", "bottom_", "._", "remove_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "t_", "in_", "list_", "(_", "l_", "._", "top_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "._", "bottom_", "._", "append_", "(_", "unicode_", "(_", "t_", ")_", ")_", "#", " ", "preserve", " ", "order", " ", "of", " ", "layer", " ", "bottom", "s", ",", " ", "label", " ", "as", " ", "bottom", " ", "has", " ", "to", " ", "come", " ", "last_", "\\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_", "l_", "._", "name_", "._", "lower_", "(_", ")_", "._", "endswith_", "(_", "'", "decode", "%", "03", "dne", "uro", "n", "'_", "%_", "(_", "level_", "-_", "1_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dec", "\\u", "prev_", "=_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec_", "=_", "pu_", "._", "copy", "\\u", "msg_", "(_", "l_", ",_", "Layer", "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_", "enc_", "._", "name_", "=_", "'", "encode", "%", "03", "dne", "uro", "n", "'_", "%_", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec_", "._", "name_", "=_", "'", "encode", "%", "03", "dne", "uro", "n", "'_", "%_", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "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_", "def_", "base", "\\u", "ae_", "(_", "src", "\\u", "train_", ",_", "src", "\\u", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "caffe", "_", "._", "Net", "Spec_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "._", "data_", "=_", "L_", "._", "Data_", "(_", "batch", "\\u", "size_", "=_", "100_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "=_", "P_", "._", "Data_", "._", "LM", "DB_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "src", "\\u", "train_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform", "\\u", "param_", "=_", "dict_", "(_", "scale_", "=_", "0.003", "921", "568", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nto", "p_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include_", "=_", "[_", "dict_", "(_", "phase_", "=_", "caffe", "_", "._", "TRAIN_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "._", "data\\u", "test_", "=_", "L_", "._", "Data_", "(_", "batch", "\\u", "size_", "=_", "100_", ",_", "backend_", "=_", "P_", "._", "Data_", "._", "LM", "DB_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "src", "\\u", "test_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform", "\\u", "param_", "=_", "dict_", "(_", "scale_", "=_", "0.003", "921", "568", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nto", "p_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include_", "=_", "[_", "dict_", "(_", "phase_", "=_", "caffe", "_", "._", "TEST_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "._", "flat", "data_", "=_", "L_", "._", "Flatten_", "(_", "n_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "._", "encode", "001_", "=_", "L_", "._", "In", "ner", "Product_", "(_", "n_", "._", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "output_", "=_", "64_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "=_", "[_", "dict_", "(_", "lr", "\\u", "mult_", "=_", "1_", ",_", "deca", "y", "\\u", "mult_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "lr", "\\u", "mult_", "=_", "1_", ",_", "deca", "y", "\\u", "mult_", "=_", "0_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "filler", "_", "=_", "dict_", "(_", "type_", "=_", "'", "gauss", "ian", "'_", ",_", "std_", "=_", "1_", ",_", "sparse_", "=_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "\\u", "filler", "_", "=_", "dict_", "(_", "type_", "=_", "'", "constant", "'_", ",_", "value_", "=_", "0_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "._", "encode", "001", "neuron_", "=_", "L_", "._", "Sigm", "oid_", "(_", "n_", "._", "encode", "001_", ",_", "in", "\\u", "place_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "._", "decode", "001_", "=_", "L_", "._", "In", "ner", "Product_", "(_", "n_", "._", "encode", "001", "neuron_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "output_", "=_", "307", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "=_", "[_", "dict_", "(_", "lr", "\\u", "mult_", "=_", "1_", ",_", "deca", "y", "\\u", "mult_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "lr", "\\u", "mult_", "=_", "1_", ",_", "deca", "y", "\\u", "mult_", "=_", "0_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "filler", "_", "=_", "dict_", "(_", "type_", "=_", "'", "gauss", "ian", "'_", ",_", "std_", "=_", "1_", ",_", "sparse_", "=_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "\\u", "filler", "_", "=_", "dict_", "(_", "type_", "=_", "'", "constant", "'_", ",_", "value_", "=_", "0_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "._", "loss", "\\u", "x", "\\u", "entropy_", "=_", "L_", "._", "Sigm", "oid", "Cross", "Entr", "opy", "Loss_", "(_", "n_", "._", "decode", "001_", ",_", "n_", "._", "flat", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "loss", "\\u", "weight_", "=_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "._", "decode", "001", "neuron_", "=_", "L_", "._", "Sigm", "oid_", "(_", "n_", "._", "decode", "001_", ",_", "in", "\\u", "place_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "._", "loss", "\\u", "l2_", "=_", "L_", "._", "Euc", "lide", "an", "Loss_", "(_", "n_", "._", "decode", "001", "neuron_", ",_", "n_", "._", "flat", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "loss", "\\u", "weight_", "=_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "proto_", "=_", "n_", "._", "to", "\\u", "proto_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fix", " ", "data", " ", "layer", " ", "for", " ", "test", " ", "phase_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "l_", "in_", "n", "\\u", "proto_", "._", "layer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "l_", "._", "type_", "._", "lower_", "(_", ")_", "==_", "'", "data", "'_", "and_", "[_", "x_", "._", "phase_", "for_", "x_", "in_", "l_", "._", "include_", "]_", "==_", "[_", "caffe", "_", "._", "TEST_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "t_", "in_", "list_", "(_", "l_", "._", "top_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "._", "top_", "._", "remove_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "t_", "._", "split_", "(_", "'\\u", "test", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "top_", "._", "append_", "(_", "unicode_", "(_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "l_", "._", "name_", "=_", "l_", "._", "name_", "._", "split_", "(_", "'\\u", "test", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "n", "\\u", "proto_", "\\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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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 ]
Unused import
skoczen/will/will/plugins/productivity/hangout.py
[ { "content": "from will.plugin import WillPlugin\nfrom will.decorators import respond_to, periodic, hear, randomly, route,\\\n rendered_template, require_settings\nfrom will import settings\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HangoutPlugin(WillPlugin):\n", "metadata": "root.HangoutPlugin", "header": "['module', '___EOS___']", "index": 6 }, { "content": " @require_settings(\"HANGOUT_URL\",)\n @respond_to(\"^hangout\")\n def hangout(self, message):\n self.say(\"Hangout: %s\" % settings.HANGOUT_URL, message=message)", "metadata": "root.HangoutPlugin.hangout", "header": "['class', 'HangoutPlugin', '(', 'WillPlugin', ')', ':', '___EOS___']", "index": 8 } ]
[ { "span": "from will.decorators import respond_to, periodic, hear, randomly, route,\\\n rendered_template, require_settings", "start_line": 1, "start_column": 0, "end_line": 2, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "will", "_", "._", "plugin_", "import_", "Wil", "l", "Plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "will", "_", "._", "decorators_", "import_", "respond", "\\u", "to_", ",_", "periodic_", ",_", "hear", "_", ",_", "random", "ly_", ",_", "route_", ",_", "render", "ed", "\\u", "template_", ",_", "require", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "will", "_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Hang", "out", "Plugin_", "(_", "Wil", "l", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Hang", "out", "Plugin_", "(_", "Wil", "l", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "require", "\\u", "settings_", "(_", "\"", "HAN", "GO", "UT\\u", "URL", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "respond", "\\u", "to_", "(_", "\"", "^", "hang", "out", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "hang", "out_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "say_", "(_", "\"", "Hang", "out", ":", " ", "%", "s", "\"_", "%_", "settings_", "._", "HAN", "GO", "UT\\u", "URL_", ",_", "message_", "=_", "message_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
ipython/ipython-py3k/docs/gh-pages.py
[ { "content": "#!/usr/bin/env python\n\"\"\"Script to commit the doc build outputs into the github-pages repo.\n\nUse:\n\n gh-pages.py [tag]\n\nIf no tag is given, the current output of 'git describe' is used. If given,\nthat is how the resulting directory will be named.\n\nIn practice, you should use either actual clean tags from a current build or\nsomething like 'current' as a stable URL for the most current version of the \"\"\"\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\nimport os\nimport re\nimport shutil\nimport sys\nfrom os import chdir as cd\nfrom os.path import join as pjoin\n\nfrom subprocess import Popen, PIPE, CalledProcessError, check_call\n\n#-----------------------------------------------------------------------------\n# Globals\n#-----------------------------------------------------------------------------\n\npages_dir = 'gh-pages'\nhtml_dir = 'build/html'\npdf_dir = 'build/latex'\npages_repo = '[email protected]:ipython/ipython-doc.git'\n\n#-----------------------------------------------------------------------------\n# Functions\n#-----------------------------------------------------------------------------\n\n\n\n\n\n\n\n#-----------------------------------------------------------------------------\n# Script starts\n#-----------------------------------------------------------------------------\nif __name__ == '__main__':\n # The tag can be given as a positional argument\n try:\n tag = sys.argv[1]\n except IndexError:\n try:\n tag = sh2('git describe')\n except CalledProcessError:\n tag = \"dev\" # Fallback\n \n startdir = os.getcwd()\n if not os.path.exists(pages_dir):\n # init the repo\n init_repo(pages_dir)\n else:\n # ensure up-to-date before operating\n cd(pages_dir)\n sh('git checkout gh-pages')\n sh('git pull')\n cd(startdir)\n\n dest = pjoin(pages_dir, tag)\n\n # don't `make html` here, because gh-pages already depends on html in Makefile\n # sh('make html')\n\n # This is pretty unforgiving: we unconditionally nuke the destination\n # directory, and then copy the html tree in there\n shutil.rmtree(dest, ignore_errors=True)\n shutil.copytree(html_dir, dest)\n shutil.copy(pjoin(pdf_dir, 'ipython.pdf'), pjoin(dest, 'ipython.pdf'))\n\n try:\n cd(pages_dir)\n status = sh2('git status | head -1')\n branch = re.match('\\# On branch (.*)$', status).group(1)\n if branch != 'gh-pages':\n e = 'On %r, git branch is %r, MUST be \"gh-pages\"' % (pages_dir,\n branch)\n raise RuntimeError(e)\n\n sh('git add %s' % tag)\n sh('git commit -m\"Updated doc release: %s\"' % tag)\n print()\n print('Most recent 3 commits:')\n sys.stdout.flush()\n sh('git --no-pager log --oneline HEAD~3..')\n finally:\n cd(startdir)\n\n print()\n print('Now verify the build in: %r' % dest)\n print(\"If everything looks good, 'git push'\")\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Script", " ", "to", " ", "commit", " ", "the", " ", "doc", " ", "build", " ", "output", "s", " ", "int", "o", " ", "the", " ", "git", "hub", "-", "page", "s", " ", "repo", ".", "\\", "10", ";", "\\", "10", ";", "Us", "e", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "gh", "-", "page", "s", ".", "py", " ", "[", "tag", "]", "\\", "10", ";", "\\", "10", ";", "If", " ", "no", " ", "tag", " ", "is", " ", "give", "n", ",", " ", "the", " ", "current", " ", "output", " ", "of", " ", "'", "git", " ", "descri", "be", "'", " ", "is", " ", "used", ".", " ", " ", "If", " ", "give", "n", ",", "\\", "10", ";", "tha", "t", " ", "is", " ", "how", " ", "the", " ", "result", "ing", " ", "director", "y", " ", "will", " ", "be", " ", "named", ".", "\\", "10", ";", "\\", "10", ";", "In", " ", "practic", "e", ",", " ", "you", " ", "shou", "ld", " ", "use", " ", "eit", "her", " ", "actual", " ", "clean", " ", "tags", " ", "from", " ", "a", " ", "current", " ", "build", " ", "or", "\\", "10", ";", "somet", "hing", " ", "like", " ", "'", "current", "'", " ", "as", " ", "a", " ", "stable", " ", "URL", " ", "for", " ", "the", " ", "most", " ", "current", " ", "version", " ", "of", " ", "the", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Imports", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "chdir_", "as_", "cd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", "as_", "pjoin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "subprocess_", "import_", "Popen_", ",_", "PIPE_", ",_", "Call", "ed", "Process", "Error_", ",_", "check", "\\u", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Globals_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "page", "s", "\\u", "dir_", "=_", "'", "gh", "-", "page", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "\\u", "dir_", "=_", "'", "build", "/", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdf", "\\u", "dir_", "=_", "'", "build", "/", "late", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "s", "\\u", "repo_", "=_", "'", "git", "@", "git", "hub", ".", "com", ":", "ipython", "/", "ipython", "-", "doc", ".", "git", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Functions_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Script", " ", "starts_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "tag", " ", "can", " ", "be", " ", "give", "n", " ", "as", " ", "a", " ", "positional", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "sh", "2_", "(_", "'", "git", " ", "descri", "be", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Call", "ed", "Process", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "\"", "dev", "\"_", "#", " ", "Fallback", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "startd", "ir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "page", "s", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "init", " ", "the", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "init", "\\u", "repo_", "(_", "page", "s", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ensure", " ", "up", "-", "to", "-", "date", " ", "bef", "ore", " ", "operati", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", "(_", "page", "s", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "(_", "'", "git", " ", "check", "out", " ", "gh", "-", "page", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "(_", "'", "git", " ", "pull", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cd_", "(_", "startd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "=_", "pjoin_", "(_", "page", "s", "\\u", "dir_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "`", "make", " ", "html", "`", " ", "here", ",", " ", "bec", "aus", "e", " ", "gh", "-", "page", "s", " ", "alr", "ead", "y", " ", "depend", "s", " ", "on", " ", "html", " ", "in", " ", "Make", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sh", "('", "make", " ", "html", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "pretty", " ", "unfo", "rgi", "ving", ":", " ", "we", " ", "uncon", "dition", "ally", " ", "nuk", "e", " ", "the", " ", "destination_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "y", ",", " ", "and", " ", "then", " ", "copy", " ", "the", " ", "html", " ", "tree", " ", "in", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "dest_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copytree_", "(_", "html", "\\u", "dir_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "pjoin_", "(_", "pdf", "\\u", "dir_", ",_", "'", "ipython", ".", "pdf", "'_", ")_", ",_", "pjoin_", "(_", "dest_", ",_", "'", "ipython", ".", "pdf", "'_", ")_", ")_", "\\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 ", " _", "cd_", "(_", "page", "s", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "sh", "2_", "(_", "'", "git", " ", "status", " ", "|", " ", "head", " ", "-1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "=_", "re_", "._", "match_", "(_", "'\\\\", "#", " ", "On", " ", "branch", " ", "(.*)", "$'_", ",_", "status_", ")_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "branch_", "!=_", "'", "gh", "-", "page", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "'", "On", " ", "%", "r", ",", " ", "git", " ", "branch", " ", "is", " ", "%", "r", ",", " ", "MUS", "T", " ", "be", " ", "\"", "gh", "-", "page", "s", "\"'_", "%_", "(_", "page", "s", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sh_", "(_", "'", "git", " ", "add", " ", "%", "s", "'_", "%_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "(_", "'", "git", " ", "commit", " ", "-", "m", "\"", "Update", "d", " ", "doc", " ", "release", ":", " ", "%", "s", "\"'_", "%_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Mos", "t", " ", "recent", " ", "3", " ", "commit", "s", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "(_", "'", "git", " ", "--", "no", "-", "pager", " ", "log", " ", "--", "one", "line", " ", "HEAD", "~", "3", "..'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", "(_", "startd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "No", "w", " ", "verify", " ", "the", " ", "build", " ", "in", ":", " ", "%", "r", "'_", "%_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "If", " ", "every", "thing", " ", "look", "s", " ", "good", ",", " ", "'", "git", " ", "push", "'\"_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 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, 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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 ]
Imprecise assert
AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/pagination/tests.py
[ { "content": " def test_page_sequence(self):\n \"\"\"\n Tests that a paginator page acts like a standard sequence.\n \"\"\"\n eleven = 'abcdefghijk'\n page2 = Paginator(eleven, per_page=5, orphans=1).page(2)\n self.assertEqual(len(page2), 6)\n self.assertTrue('k' in page2)\n self.assertFalse('a' in page2)\n self.assertEqual(''.join(page2), 'fghijk')\n self.assertEqual(''.join(reversed(page2)), 'kjihgf')", "metadata": "root.PaginationTests.test_page_sequence", "header": "['class', 'PaginationTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 207 } ]
[ { "span": "self.assertTrue('k' in page2)", "start_line": 214, "start_column": 8, "end_line": 214, "end_column": 37 }, { "span": "self.assertFalse('a' in page2)", "start_line": 215, "start_column": 8, "end_line": 215, "end_column": 38 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Pagination", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "page", "\\u", "sequence_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "tha", "t", " ", "a", " ", "pagina", "tor", " ", "page", " ", "acts", " ", "like", " ", "a", " ", "standard", " ", "sequence", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elev", "en_", "=_", "'", "abcdefg", "hij", "k", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "2_", "=_", "Paginator_", "(_", "elev", "en_", ",_", "per", "\\u", "page_", "=_", "5_", ",_", "orphan", "s_", "=_", "1_", ")_", "._", "page_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "page", "2_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "k", "'_", "in_", "page", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "a", "'_", "in_", "page", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "''_", "._", "join_", "(_", "page", "2_", ")_", ",_", "'", "fg", "hij", "k", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "''_", "._", "join_", "(_", "reversed_", "(_", "page", "2_", ")_", ")_", ",_", "'", "kj", "ih", "gf", "'_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
diefenbach/django-lfs/lfs/core/templatetags/lfs_tags.py
[ { "content": "# python imports\nimport math\nfrom django.forms.forms import BoundField\nimport locale\n\n# django imports\nfrom django import template\nfrom django.conf import settings\nfrom django.core.cache import cache\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.core.urlresolvers import reverse\nfrom django.template import Node, TemplateSyntaxError\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import ugettext_lazy as _\n\n# lfs imports\nimport lfs.catalog.utils\nimport lfs.core.utils\nimport lfs.core.views\nimport lfs.utils.misc\nimport logging\n\nfrom lfs.caching.utils import get_cache_group_id\nfrom lfs.catalog.models import Category\nfrom lfs.catalog.settings import VARIANT\nfrom lfs.catalog.settings import CATEGORY_VARIANT_CHEAPEST_PRICES\nfrom lfs.catalog.settings import SORTING_MAP\nfrom lfs.catalog.models import Product\nfrom lfs.catalog.models import PropertyOption\nfrom lfs.catalog.settings import PRODUCT_TYPE_LOOKUP\nfrom lfs.core.models import Action\nfrom lfs.page.models import Page\nfrom lfs.shipping import utils as shipping_utils\nfrom lfs.manufacturer.models import Manufacturer\n\nlogger = logging.getLogger(__name__)\nregister = template.Library()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nregister.tag('actions', do_actions)\n\n\n\n\nregister.tag('cheapest_variant', do_cheapest_variant)\n\n\n\n\n\n\n\n\nregister.tag('top_level_category', do_top_level_category)\n\n\n\n\nregister.tag('cart_information', do_cart_information)\n\n\n\n\nregister.tag('current_category', do_current_category)\n\n\n\n\nregister.tag('come_from_page', do_come_from_page)\n\n\n# TODO: Move this to shop utils or similar\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nregister.tag('category_product_prices_gross', do_category_product_prices_gross)\n\n\n\n\nregister.tag('category_product_prices_net', do_category_product_prices_net)\n\n\n\n\nregister.tag('category_product_prices', do_category_product_prices)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@register.inclusion_tag('lfs/portlets/category_children.html', takes_context=True)\ndef category_children(context, categories):\n \"\"\"\n \"\"\"\n return {\"categories\": categories}", "metadata": "root.category_children", "header": "['module', '___EOS___']", "index": 39 }, { "content": "@register.inclusion_tag('lfs/shop/google_analytics_tracking.html', takes_context=True)\ndef google_analytics_tracking(context):\n \"\"\"Returns google analytics tracking code which has been entered to the\n shop.\n \"\"\"\n shop = lfs.core.utils.get_default_shop(context.get(\"request\"))\n return {\n \"ga_site_tracking\": shop.ga_site_tracking,\n \"google_analytics_id\": shop.google_analytics_id,\n }", "metadata": "root.google_analytics_tracking", "header": "['module', '___EOS___']", "index": 46 }, { "content": "@register.inclusion_tag('lfs/shop/google_analytics_ecommerce.html', takes_context=True)\ndef google_analytics_ecommerce(context, clear_session=True):\n \"\"\"Returns google analytics e-commerce tracking code. This should be\n displayed on the thank-you page.\n \"\"\"\n request = context.get(\"request\")\n order = request.session.get(\"order\")\n shop = lfs.core.utils.get_default_shop(request)\n\n # The order is removed from the session. It has been added after the order\n # has been payed within the checkout process. See order.utils for more.\n if clear_session and \"order\" in request.session:\n del request.session[\"order\"]\n\n if \"voucher\" in request.session:\n del request.session[\"voucher\"]\n\n return {\n \"request\": request,\n \"order\": order,\n \"shop\": shop,\n \"ga_ecommerce_tracking\": shop.ga_ecommerce_tracking,\n \"google_analytics_id\": shop.google_analytics_id,\n }", "metadata": "root.google_analytics_ecommerce", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def _get_shipping(context, product):\n request = context.get(\"request\")\n if product.is_deliverable() == False:\n return {\n \"deliverable\": False,\n \"delivery_time\": shipping_utils.get_product_delivery_time(request, product)\n }\n else:\n return {\n \"deliverable\": True,\n \"delivery_time\": shipping_utils.get_product_delivery_time(request, product)\n }", "metadata": "root._get_shipping", "header": "['module', '___EOS___']", "index": 84 }, { "content": "@register.inclusion_tag('lfs/shipping/shipping_tag.html', takes_context=True)\ndef shipping(context, variant):\n return _get_shipping(context, variant)", "metadata": "root.shipping", "header": "['module', '___EOS___']", "index": 98 }, { "content": "@register.inclusion_tag('lfs/catalog/sorting.html', takes_context=True)\ndef sorting(context):\n \"\"\"\n \"\"\"\n request = context.get(\"request\")\n sorting = request.session.get(\"sorting\")\n # prepare list of available sort options, sorted by SORTING_MAP_ORDER\n sort_options = []\n for item in SORTING_MAP:\n sort_options.append(item)\n return {\"current\": sorting, \"sort_options\": sort_options}", "metadata": "root.sorting", "header": "['module', '___EOS___']", "index": 103 }, { "content": "@register.inclusion_tag('lfs/catalog/breadcrumbs.html', takes_context=True)\ndef breadcrumbs(context, obj, current_page=''):\n \"\"\"\n \"\"\"\n if isinstance(obj, Category):\n cache_key = \"%s-category-breadcrumbs-%s\" % (settings.CACHE_MIDDLEWARE_KEY_PREFIX, obj.slug)\n objects = cache.get(cache_key)\n if objects is not None:\n return objects\n objects = [current_page] if current_page else []\n while obj is not None:\n objects.insert(0, {\n \"name\": obj.name,\n \"url\": obj.get_absolute_url(),\n })\n obj = obj.parent\n\n result = {\n \"objects\": objects,\n \"STATIC_URL\": context.get(\"STATIC_URL\"),\n }\n cache.set(cache_key, result)\n elif isinstance(obj, Product):\n request = context.get(\"request\")\n objects = [{\n \"name\": obj.get_name(),\n \"url\": obj.get_absolute_url(),\n }]\n # product page may be visited from manufacturer or category\n lm = request.session.get('last_manufacturer')\n if lm and obj.manufacturer == lm:\n objects.insert(0, {\n \"name\": lm.name,\n \"url\": lm.get_absolute_url(),\n })\n objects.insert(0, {\n \"name\": _(u\"Manufacturers\"),\n \"url\": reverse(\"lfs_manufacturers\")})\n else:\n category = obj.get_current_category(request)\n if category:\n while category is not None:\n objects.insert(0, {\n \"name\": category.name,\n \"url\": category.get_absolute_url(),\n })\n category = category.parent\n\n result = {\n \"objects\": objects,\n \"STATIC_URL\": context.get(\"STATIC_URL\"),\n }\n elif isinstance(obj, Page):\n objects = []\n objects.append({\n \"name\": _(u\"Information\"),\n \"url\": reverse(\"lfs_pages\")})\n objects.append({\"name\": obj.title})\n\n result = {\n \"objects\": objects,\n \"STATIC_URL\": context.get(\"STATIC_URL\"),\n }\n elif isinstance(obj, Manufacturer):\n objects = []\n objects.append({\n \"name\": _(u\"Manufacturers\"),\n \"url\": reverse(\"lfs_manufacturers\")})\n objects.append({\"name\": obj.name})\n\n result = {\n \"objects\": objects,\n \"STATIC_URL\": context.get(\"STATIC_URL\"),\n }\n else:\n result = {\n \"objects\": ({\"name\": obj},),\n \"STATIC_URL\": context.get(\"STATIC_URL\"),\n }\n\n return result", "metadata": "root.breadcrumbs", "header": "['module', '___EOS___']", "index": 116 }, { "content": "@register.inclusion_tag('lfs/catalog/product_navigation.html', takes_context=True)\ndef product_navigation(context, product):\n \"\"\"Provides previous and next product links.\n \"\"\"\n request = context.get(\"request\")\n\n try:\n default_sorting = settings.LFS_PRODUCTS_SORTING\n except AttributeError:\n default_sorting = \"effective_price\"\n sorting = request.session.get(\"sorting\", default_sorting)\n if sorting.strip() == '':\n sorting = 'effective_price'\n request.session[\"sorting\"] = sorting\n\n slug = product.slug\n\n # To calculate the position we take only STANDARD_PRODUCT into account.\n # That means if the current product is a VARIANT we switch to its parent\n # product.\n if product.is_variant():\n product = product.parent\n slug = product.slug\n\n # prepare cache key for product_navigation group\n # used to invalidate cache for all product_navigations at once\n pn_cache_key = get_cache_group_id('product_navigation')\n\n # if there is last_manufacturer then product was visited from manufacturer view\n # as category view removes last_manufacturer from the session\n lm = request.session.get('last_manufacturer')\n if lm and product.manufacturer == lm:\n cache_key = \"%s-%s-product-navigation-manufacturer-%s\" % (settings.CACHE_MIDDLEWARE_KEY_PREFIX,\n pn_cache_key,\n slug)\n res = cache.get(cache_key)\n if res and sorting in res:\n return res[sorting]\n\n products = Product.objects.filter(manufacturer=lm)\n else:\n category = product.get_current_category(request)\n if category is None:\n return {\"display\": False}\n else:\n cache_key = \"%s-%s-product-navigation-%s\" % (settings.CACHE_MIDDLEWARE_KEY_PREFIX,\n pn_cache_key,\n slug)\n res = cache.get(cache_key)\n if res and sorting in res:\n return res[sorting]\n\n # First we collect all sub categories. This and using the in operator makes\n # batching more easier\n categories = [category]\n\n if category.show_all_products:\n categories.extend(category.get_all_children())\n\n products = Product.objects.filter(categories__in=categories)\n\n # This is necessary as we display non active products to superusers.\n # So we have to take care for the product navigation too.\n if not request.user.is_superuser:\n products = products.filter(active=True)\n products = products.exclude(sub_type=VARIANT).distinct().order_by(sorting)\n\n product_slugs = list(products.values_list('slug', flat=True))\n product_index = product_slugs.index(slug)\n\n if product_index > 0:\n previous = product_slugs[product_index - 1]\n else:\n previous = None\n\n total = len(product_slugs)\n if product_index < total - 1:\n next_product = product_slugs[product_index + 1]\n else:\n next_product = None\n\n result = {\n \"display\": True,\n \"previous\": previous,\n \"next\": next_product,\n \"current\": product_index + 1,\n \"total\": total,\n \"STATIC_URL\": context.get(\"STATIC_URL\"),\n }\n\n cache.set(cache_key, {'sorting': result})\n\n return result", "metadata": "root.product_navigation", "header": "['module', '___EOS___']", "index": 199 }, { "content": "class ActionsNode(Node):\n \"\"\"\n Node for do_actions.\n \"\"\"\n", "metadata": "root.ActionsNode", "header": "['module', '___EOS___']", "index": 294 }, { "content": " def __init__(self, group_name):\n self.group_name = group_name", "metadata": "root.ActionsNode.__init__", "header": "['class', 'ActionsNode', '(', 'Node', ')', ':', '___EOS___']", "index": 298 }, { "content": " def render(self, context):\n request = context.get(\"request\")\n context[\"actions\"] = Action.objects.filter(active=True, group__name=self.group_name)\n return ''", "metadata": "root.ActionsNode.render", "header": "['class', 'ActionsNode', '(', 'Node', ')', ':', '___EOS___']", "index": 301 }, { "content": "def do_actions(parser, token):\n \"\"\"\n Returns the actions for the group with the given id.\n \"\"\"\n bits = token.contents.split()\n len_bits = len(bits)\n if len_bits != 2:\n raise TemplateSyntaxError(_('%s tag needs group id as argument') % bits[0])\n return ActionsNode(bits[1])", "metadata": "root.do_actions", "header": "['module', '___EOS___']", "index": 307 }, { "content": "class CheapestVariantNode(Node):\n \"\"\"\n Node for do_cheapest_variant.\n \"\"\"\n", "metadata": "root.CheapestVariantNode", "header": "['module', '___EOS___']", "index": 319 }, { "content": " def __init__(self, product_id):\n self.product_id = template.Variable(product_id)", "metadata": "root.CheapestVariantNode.__init__", "header": "['class', 'CheapestVariantNode', '(', 'Node', ')', ':', '___EOS___']", "index": 323 }, { "content": " def render(self, context):\n product_id = self.product_id.resolve(context)\n request = context.get(\"request\")\n cheapest_variant = None\n min_price = None\n for variant in Product.objects.filter(parent__id=product_id):\n price = variant.get_price_gross(request)\n if price == 0:\n continue\n if (min_price is None) or (price < min_price):\n cheapest_variant = variant\n min_price = price\n\n context[\"cheapest_variant\"] = cheapest_variant\n return \"\"", "metadata": "root.CheapestVariantNode.render", "header": "['class', 'CheapestVariantNode', '(', 'Node', ')', ':', '___EOS___']", "index": 326 }, { "content": "def do_cheapest_variant(parser, token):\n \"\"\"\n Returns the cheapest variant for the product with given id.\n \"\"\"\n bits = token.contents.split()\n len_bits = len(bits)\n if len_bits != 2:\n raise TemplateSyntaxError('%s tag needs product id as argument' % bits[0])\n return CheapestVariantNode(bits[1])", "metadata": "root.do_cheapest_variant", "header": "['module', '___EOS___']", "index": 343 }, { "content": "@register.inclusion_tag('lfs/shop/tabs.html', takes_context=True)\ndef tabs(context, obj=None):\n \"\"\"\n \"\"\"\n if obj is None:\n obj = context.get(\"product\") or context.get(\"category\")\n\n request = context.get(\"request\")\n tabs = Action.objects.filter(active=True, group=1)\n if isinstance(obj, (Product, Category)):\n top_category = lfs.catalog.utils.get_current_top_category(request, obj)\n if top_category:\n for tab in tabs:\n if top_category.get_absolute_url().find(tab.link) != -1:\n tab.selected = True\n break\n else:\n for tab in tabs:\n if request.path.find(tab.link) != -1:\n tab.selected = True\n break\n\n return {\n \"tabs\": tabs,\n \"STATIC_URL\": context.get(\"STATIC_URL\"),\n }", "metadata": "root.tabs", "header": "['module', '___EOS___']", "index": 355 }, { "content": "@register.inclusion_tag('lfs/catalog/top_level_categories.html', takes_context=True)\ndef top_level_categories(context):\n \"\"\"Displays the top level categories.\n \"\"\"\n request = context.get(\"request\")\n obj = context.get(\"product\") or context.get(\"category\")\n\n categories = []\n top_category = lfs.catalog.utils.get_current_top_category(request, obj)\n\n for category in Category.objects.filter(parent=None)[:4]:\n\n if top_category:\n current = top_category.id == category.id\n else:\n current = False\n\n categories.append({\n \"url\": category.get_absolute_url(),\n \"name\": category.name,\n \"current\": current,\n })\n\n return {\n \"categories\": categories,\n }", "metadata": "root.top_level_categories", "header": "['module', '___EOS___']", "index": 383 }, { "content": "class TopLevelCategory(Node):\n \"\"\"Calculates the current top level category.\n \"\"\"", "metadata": "root.TopLevelCategory", "header": "['module', '___EOS___']", "index": 411 }, { "content": " def render(self, context):\n request = context.get(\"request\")\n obj = context.get(\"product\") or context.get(\"category\")\n\n top_level_category = lfs.catalog.utils.get_current_top_category(request, obj)\n context[\"top_level_category\"] = top_level_category.name\n return ''", "metadata": "root.TopLevelCategory.render", "header": "['class', 'TopLevelCategory', '(', 'Node', ')', ':', '___EOS___']", "index": 414 }, { "content": "def do_top_level_category(parser, token):\n \"\"\"Calculates the current top level category.\n \"\"\"\n bits = token.contents.split()\n len_bits = len(bits)\n if len_bits != 1:\n raise TemplateSyntaxError(_('%s tag needs no argument') % bits[0])\n\n return TopLevelCategory()", "metadata": "root.do_top_level_category", "header": "['module', '___EOS___']", "index": 423 }, { "content": "class CartInformationNode(Node):\n \"\"\"\n \"\"\"", "metadata": "root.CartInformationNode", "header": "['module', '___EOS___']", "index": 435 }, { "content": " def render(self, context):\n request = context.get(\"request\")\n cart = lfs.cart.utils.get_cart(request)\n if cart is None:\n amount_of_items = 0\n price = 0.0\n else:\n amount_of_items = cart.get_amount_of_items()\n price = cart.get_price_gross(request, total=True)\n\n context[\"cart_amount_of_items\"] = amount_of_items\n context[\"cart_price\"] = price\n return ''", "metadata": "root.CartInformationNode.render", "header": "['class', 'CartInformationNode', '(', 'Node', ')', ':', '___EOS___']", "index": 438 }, { "content": "def do_cart_information(parser, token):\n \"\"\"Calculates cart informations.\n \"\"\"\n bits = token.contents.split()\n len_bits = len(bits)\n if len_bits != 1:\n raise TemplateSyntaxError(_('%s tag needs no argument') % bits[0])\n\n return CartInformationNode()", "metadata": "root.do_cart_information", "header": "['module', '___EOS___']", "index": 453 }, { "content": "class CurrentCategoryNode(Node):\n \"\"\"\n \"\"\"", "metadata": "root.CurrentCategoryNode", "header": "['module', '___EOS___']", "index": 465 }, { "content": " def render(self, context):\n request = context.get(\"request\")\n product = context.get(\"product\")\n\n context[\"current_category\"] = \\\n product.get_current_category(request)\n return ''", "metadata": "root.CurrentCategoryNode.render", "header": "['class', 'CurrentCategoryNode', '(', 'Node', ')', ':', '___EOS___']", "index": 468 }, { "content": "def do_current_category(parser, token):\n \"\"\"Calculates current category.\n \"\"\"\n bits = token.contents.split()\n len_bits = len(bits)\n if len_bits != 2:\n raise TemplateSyntaxError(_('%s tag needs product as argument') % bits[0])\n\n return CurrentCategoryNode()", "metadata": "root.do_current_category", "header": "['module', '___EOS___']", "index": 477 }, { "content": "class ComeFromPageNode(Node):\n \"\"\"\n \"\"\"", "metadata": "root.ComeFromPageNode", "header": "['module', '___EOS___']", "index": 489 }, { "content": " def render(self, context):\n request = context.get(\"request\")\n product = context.get(\"product\")\n\n context[\"come_from_page\"] = \\\n product.get_come_from_page(request)\n return ''", "metadata": "root.ComeFromPageNode.render", "header": "['class', 'ComeFromPageNode', '(', 'Node', ')', ':', '___EOS___']", "index": 492 }, { "content": "def do_come_from_page(parser, token):\n \"\"\"Calculates current manufacturer or category.\n \"\"\"\n bits = token.contents.split()\n len_bits = len(bits)\n if len_bits != 2:\n raise TemplateSyntaxError(_('%s tag needs product as argument') % bits[0])\n\n return ComeFromPageNode()", "metadata": "root.do_come_from_page", "header": "['module', '___EOS___']", "index": 501 }, { "content": "def get_slug_from_request(request):\n \"\"\"Returns the slug of the currently displayed category.\n \"\"\"\n slug = request.path.split(\"/\")[-1]\n try:\n int(slug)\n except ValueError:\n pass\n else:\n slug = request.path.split(\"/\")[-2]\n\n return slug", "metadata": "root.get_slug_from_request", "header": "['module', '___EOS___']", "index": 514 }, { "content": "@register.filter\ndef currency_text(value, request=None, grouping=True):\n \"\"\"\n Returns the currency based on the given locale within settings.LFS_LOCALE\n\n e.g.\n\n import locale\n locale.setlocale(locale.LC_ALL, 'de_CH.UTF-8')\n currency(123456.789) # Fr. 123'456.79\n currency(-123456.789) # Fr. -123'456.79\n \"\"\"\n if locale.getlocale(locale.LC_ALL)[0] is None:\n lfs.core.views.one_time_setup()\n\n if not value:\n value = 0.0\n\n shop = lfs.core.utils.get_default_shop(request)\n try:\n result = locale.currency(value, grouping=grouping, international=shop.use_international_currency_code)\n except ValueError, e:\n result = value\n logger.error(\"currency filter: %s\" % e)\n\n if value < 0:\n # replace the minus symbol if needed\n if result[-1] == '-':\n length = len(locale.nl_langinfo(locale.CRNCYSTR))\n result = '%s-%s' % (result[0:length], result[length:-1])\n return result", "metadata": "root.currency_text", "header": "['module', '___EOS___']", "index": 528 }, { "content": "@register.filter\ndef currency(value, request=None, grouping=True):\n \"\"\"\n Returns the currency based on the given locale within settings.LFS_LOCALE\n\n e.g.\n\n import locale\n locale.setlocale(locale.LC_ALL, 'de_CH.UTF-8')\n currency(123456.789) # <span class=\"money\">Fr. 123'456.79</span>\n currency(-123456.789) # <span class=\"money negative\">Fr. -123'456.79</span>\n \"\"\"\n if locale.getlocale(locale.LC_ALL)[0] is None:\n lfs.core.views.one_time_setup()\n\n if not value:\n value = 0.0\n\n shop = lfs.core.utils.get_default_shop(request)\n try:\n result = locale.currency(value, grouping=grouping, international=shop.use_international_currency_code)\n except ValueError, e:\n result = str(value)\n logger.error(\"currency filter: %s\" % e)\n\n # add css class if value is negative\n negative = False\n if value < 0:\n negative = True\n # replace the minus symbol if needed\n if result[-1] == '-':\n length = len(locale.nl_langinfo(locale.CRNCYSTR))\n result = '%s-%s' % (result[0:length], result[length:-1])\n\n return mark_safe('<span class=\"money%(negative)s\">%(result)s</span>' % {\n 'result': result.strip(),\n 'negative': ' negative' if negative else '',\n })", "metadata": "root.currency", "header": "['module', '___EOS___']", "index": 561 }, { "content": "@register.filter\ndef decimal_l10n(value, digits=2):\n \"\"\"Returns the decimal value of value based on current locale.\n \"\"\"\n try:\n value = float(value)\n except ValueError:\n return value\n\n format_str = \"%%.%sf\" % digits\n return locale.format_string(format_str, value)", "metadata": "root.decimal_l10n", "header": "['module', '___EOS___']", "index": 601 }, { "content": "@register.filter\ndef quantity(quantity):\n \"\"\"Removes the decimal places when they are zero.\n\n Means \"1.0\" is transformed to \"1\", whereas \"1.1\" is not transformed at all.\n \"\"\"\n if str(quantity).find(\".0\") == -1:\n return quantity\n else:\n return int(float(quantity))", "metadata": "root.quantity", "header": "['module', '___EOS___']", "index": 614 }, { "content": "@register.filter\ndef sub_type_name(sub_type, arg=None):\n \"\"\"Returns the sub type name for the sub type with passed sub_type id.\n \"\"\"\n try:\n return PRODUCT_TYPE_LOOKUP[sub_type]\n except KeyError:\n return \"\"", "metadata": "root.sub_type_name", "header": "['module', '___EOS___']", "index": 626 }, { "content": "@register.filter\ndef multiply(score, pixel):\n \"\"\"Returns the result of score * pixel\n \"\"\"\n return score * pixel", "metadata": "root.multiply", "header": "['module', '___EOS___']", "index": 636 }, { "content": "@register.filter\ndef option_name(option_id):\n \"\"\"Returns the option name for option with passed id.\n \"\"\"\n try:\n option_id = int(float(option_id))\n except ValueError:\n pass\n\n try:\n option = PropertyOption.objects.get(pk=option_id)\n except (PropertyOption.DoesNotExist, ValueError):\n return option_id\n else:\n return option.name", "metadata": "root.option_name", "header": "['module', '___EOS___']", "index": 643 }, { "content": "@register.filter\ndef option_name_for_property_value(property_value):\n \"\"\"Returns the value or the option name for passed property_value\n \"\"\"\n if property_value.property.is_select_field:\n try:\n option_id = int(float(property_value.value))\n except ValueError:\n return property_value.value\n\n try:\n option = PropertyOption.objects.get(pk=option_id)\n except (PropertyOption.DoesNotExist, ValueError):\n return option_id\n else:\n return option.name\n\n return property_value.value", "metadata": "root.option_name_for_property_value", "header": "['module', '___EOS___']", "index": 660 }, { "content": "@register.filter\ndef packages(cart_item):\n \"\"\"\n Returns the packages based on product's package unit and cart items\n amount.\n \"\"\"\n packing_unit, packing_unit_unit = cart_item.product.get_packing_info()\n if packing_unit:\n try:\n amount = float(cart_item.amount)\n except ValueError:\n amount = locale.atof(cart_item.amount)\n return int(math.ceil(amount / packing_unit))\n return 0", "metadata": "root.packages", "header": "['module', '___EOS___']", "index": 680 }, { "content": "class CategoryProductPricesGrossNode(Node):\n", "metadata": "root.CategoryProductPricesGrossNode", "header": "['module', '___EOS___']", "index": 696 }, { "content": " def __init__(self, product_id):\n self.product_id = template.Variable(product_id)", "metadata": "root.CategoryProductPricesGrossNode.__init__", "header": "['class', 'CategoryProductPricesGrossNode', '(', 'Node', ')', ':', '___EOS___']", "index": 697 }, { "content": " def render(self, context):\n request = context.get(\"request\")\n\n product_id = self.product_id.resolve(context)\n product = Product.objects.get(pk=product_id)\n\n if product.is_variant():\n parent = product.parent\n else:\n parent = product\n\n if parent.category_variant == CATEGORY_VARIANT_CHEAPEST_PRICES:\n if product.get_for_sale():\n info = parent.get_cheapest_standard_price_gross(request)\n context[\"standard_price\"] = info[\"price\"]\n context[\"standard_price_starting_from\"] = info[\"starting_from\"]\n\n info = parent.get_cheapest_price_gross(request)\n context[\"price\"] = info[\"price\"]\n context[\"price_starting_from\"] = info[\"starting_from\"]\n\n info = parent.get_cheapest_base_price_gross(request)\n context[\"base_price\"] = info[\"price\"]\n context[\"base_price_starting_from\"] = info[\"starting_from\"]\n else:\n if product.get_for_sale():\n context[\"standard_price\"] = product.get_standard_price_gross(request)\n context[\"price\"] = product.get_price_gross(request)\n context[\"price_starting_from\"] = False\n\n context[\"base_price\"] = product.get_base_price_gross(request)\n context[\"base_price_starting_from\"] = False\n\n if product.get_active_packing_unit():\n context[\"base_packing_price\"] = product.get_base_packing_price_gross(request)\n\n return \"\"", "metadata": "root.CategoryProductPricesGrossNode.render", "header": "['class', 'CategoryProductPricesGrossNode', '(', 'Node', ')', ':', '___EOS___']", "index": 700 }, { "content": "def do_category_product_prices_gross(parser, token):\n \"\"\"\n Injects all needed gross prices for the default category products view into\n the context.\n \"\"\"\n bits = token.contents.split()\n if len(bits) != 2:\n raise TemplateSyntaxError('%s tag needs product id as argument' % bits[0])\n return CategoryProductPricesGrossNode(bits[1])", "metadata": "root.do_category_product_prices_gross", "header": "['module', '___EOS___']", "index": 739 }, { "content": "class CategoryProductPricesNetNode(Node):\n", "metadata": "root.CategoryProductPricesNetNode", "header": "['module', '___EOS___']", "index": 751 }, { "content": " def __init__(self, product_id):\n self.product_id = template.Variable(product_id)", "metadata": "root.CategoryProductPricesNetNode.__init__", "header": "['class', 'CategoryProductPricesNetNode', '(', 'Node', ')', ':', '___EOS___']", "index": 752 }, { "content": " def render(self, context):\n request = context.get(\"request\")\n\n product_id = self.product_id.resolve(context)\n product = Product.objects.get(pk=product_id)\n\n if product.is_variant():\n parent = product.parent\n else:\n parent = product\n\n if parent.category_variant == CATEGORY_VARIANT_CHEAPEST_PRICES:\n if product.get_for_sale():\n info = parent.get_cheapest_standard_price_net(request)\n context[\"standard_price\"] = info[\"price\"]\n context[\"standard_price_starting_from\"] = info[\"starting_from\"]\n\n info = parent.get_cheapest_price_net(request)\n context[\"price\"] = info[\"price\"]\n context[\"price_starting_from\"] = info[\"starting_from\"]\n\n info = parent.get_cheapest_base_price_net(request)\n context[\"base_price\"] = info[\"price\"]\n context[\"base_price_starting_from\"] = info[\"starting_from\"]\n else:\n if product.get_for_sale():\n context[\"standard_price\"] = product.get_standard_price_net(request)\n context[\"price\"] = product.get_price_net(request)\n context[\"price_starting_from\"] = False\n\n context[\"base_price\"] = product.get_base_price_net(request)\n context[\"base_price_starting_from\"] = False\n\n if product.get_active_packing_unit():\n context[\"base_packing_price\"] = product.get_base_packing_price_net(request)\n\n return \"\"", "metadata": "root.CategoryProductPricesNetNode.render", "header": "['class', 'CategoryProductPricesNetNode', '(', 'Node', ')', ':', '___EOS___']", "index": 755 }, { "content": "def do_category_product_prices_net(parser, token):\n \"\"\"\n Injects all needed net prices for the default category products view into\n the context.\n \"\"\"\n bits = token.contents.split()\n if len(bits) != 2:\n raise TemplateSyntaxError('%s tag needs product id as argument' % bits[0])\n return CategoryProductPricesNetNode(bits[1])", "metadata": "root.do_category_product_prices_net", "header": "['module', '___EOS___']", "index": 794 }, { "content": "class CategoryProductPricesNode(Node):\n", "metadata": "root.CategoryProductPricesNode", "header": "['module', '___EOS___']", "index": 806 }, { "content": " def __init__(self, product_id):\n self.product_id = template.Variable(product_id)", "metadata": "root.CategoryProductPricesNode.__init__", "header": "['class', 'CategoryProductPricesNode', '(', 'Node', ')', ':', '___EOS___']", "index": 807 }, { "content": " def render(self, context):\n request = context.get(\"request\")\n\n product_id = self.product_id.resolve(context)\n product = Product.objects.get(pk=product_id)\n\n if product.is_variant():\n parent = product.parent\n else:\n parent = product\n\n if parent.category_variant == CATEGORY_VARIANT_CHEAPEST_PRICES:\n if product.get_for_sale():\n info = parent.get_cheapest_standard_price(request)\n context[\"standard_price\"] = info[\"price\"]\n context[\"standard_price_starting_from\"] = info[\"starting_from\"]\n\n info = parent.get_cheapest_price(request)\n context[\"price\"] = info[\"price\"]\n context[\"price_starting_from\"] = info[\"starting_from\"]\n\n info = parent.get_cheapest_base_price(request)\n context[\"base_price\"] = info[\"price\"]\n context[\"base_price_starting_from\"] = info[\"starting_from\"]\n else:\n if product.get_for_sale():\n context[\"standard_price\"] = product.get_standard_price(request)\n context[\"price\"] = product.get_price(request)\n context[\"price_starting_from\"] = False\n\n context[\"base_price\"] = product.get_base_price(request)\n context[\"base_price_starting_from\"] = False\n\n if product.get_active_packing_unit():\n context[\"base_packing_price\"] = product.get_base_packing_price(request)\n\n return \"\"", "metadata": "root.CategoryProductPricesNode.render", "header": "['class', 'CategoryProductPricesNode', '(', 'Node', ')', ':', '___EOS___']", "index": 810 }, { "content": "def do_category_product_prices(parser, token):\n \"\"\"\n Injects all needed stored prices for the default category products view into\n the context.\n \"\"\"\n bits = token.contents.split()\n if len(bits) != 2:\n raise TemplateSyntaxError('%s tag needs product id as argument' % bits[0])\n return CategoryProductPricesNode(bits[1])", "metadata": "root.do_category_product_prices", "header": "['module', '___EOS___']", "index": 849 }, { "content": "@register.filter(name='get_price')\ndef get_price(product, request):\n return product.get_price(request)", "metadata": "root.get_price", "header": "['module', '___EOS___']", "index": 861 }, { "content": "@register.filter(name='get_price_net')\ndef get_price_net(product, request):\n return product.get_price_net(request)", "metadata": "root.get_price_net", "header": "['module', '___EOS___']", "index": 866 }, { "content": "@register.filter(name='get_price_gross')\ndef get_price_gross(product, request):\n return product.get_price_gross(request)", "metadata": "root.get_price_gross", "header": "['module', '___EOS___']", "index": 871 }, { "content": "@register.filter(name='get_standard_price')\ndef get_standard_price(product, request):\n return product.get_standard_price(request)", "metadata": "root.get_standard_price", "header": "['module', '___EOS___']", "index": 876 }, { "content": "@register.filter(name='get_standard_price_net')\ndef get_standard_price_net(product, request):\n return product.get_standard_price_net(request)", "metadata": "root.get_standard_price_net", "header": "['module', '___EOS___']", "index": 881 }, { "content": "@register.filter(name='get_standard_price_gross')\ndef get_standard_price_gross(product, request):\n return product.get_standard_price_gross(request)", "metadata": "root.get_standard_price_gross", "header": "['module', '___EOS___']", "index": 886 }, { "content": "@register.filter(name='get_for_sale_price')\ndef get_for_sale_price(product, request):\n return product.get_for_sale_price(request)", "metadata": "root.get_for_sale_price", "header": "['module', '___EOS___']", "index": 891 }, { "content": "@register.filter(name='get_for_sale_price_net')\ndef get_for_sale_price_net(product, request):\n return product.get_for_sale_price_net(request)", "metadata": "root.get_for_sale_price_net", "header": "['module', '___EOS___']", "index": 896 }, { "content": "@register.filter(name='get_for_sale_price_gross')\ndef get_for_sale_price_gross(product, request):\n return product.get_for_sale_price_gross(request)", "metadata": "root.get_for_sale_price_gross", "header": "['module', '___EOS___']", "index": 901 }, { "content": "@register.filter(name='get_base_price')\ndef get_base_price(product, request):\n return product.get_base_price(request)", "metadata": "root.get_base_price", "header": "['module', '___EOS___']", "index": 906 }, { "content": "@register.filter(name='get_base_price_net')\ndef get_base_price_net(product, request):\n return product.get_base_price_net(request)", "metadata": "root.get_base_price_net", "header": "['module', '___EOS___']", "index": 911 }, { "content": "@register.filter(name='get_base_price_gross')\ndef get_base_price_gross(product, request):\n return product.get_base_price_gross(request)", "metadata": "root.get_base_price_gross", "header": "['module', '___EOS___']", "index": 916 }, { "content": "@register.filter(name='get_base_packing_price')\ndef get_base_packing_price(product, request):\n return product.get_base_packing_price(request)", "metadata": "root.get_base_packing_price", "header": "['module', '___EOS___']", "index": 921 }, { "content": "@register.filter(name='get_base_packing_price_net')\ndef get_base_packing_price_net(product, request):\n return product.get_base_packing_price_net(request)", "metadata": "root.get_base_packing_price_net", "header": "['module', '___EOS___']", "index": 926 }, { "content": "@register.filter(name='get_base_packing_price_gross')\ndef get_base_packing_price_gross(product, request):\n return product.get_base_packing_price_gross(request)", "metadata": "root.get_base_packing_price_gross", "header": "['module', '___EOS___']", "index": 931 }, { "content": "@register.inclusion_tag('lfs/shop/lfs_form.html', takes_context=True)\ndef lfs_form(context, form):\n \"\"\" Render form using common form template.\n It is also possible to pass list of fields\n or single field to this tag.\n \"\"\"\n if isinstance(form, BoundField):\n form = [form]\n context['lfs_form'] = form\n context['lfs_form_is_form'] = hasattr(form, 'non_field_errors')\n return context", "metadata": "root.lfs_form", "header": "['module', '___EOS___']", "index": 936 }, { "content": "@register.filter(name='get_pay_link', is_safe=True)\ndef get_pay_link(order, request=None, force_paid=False):\n \"\"\" Only return pay link for not paid orders unless force_paid=True\n \"\"\"\n if force_paid or order.can_be_paid():\n return order.get_pay_link(request)\n return ''", "metadata": "root.get_pay_link", "header": "['module', '___EOS___']", "index": 949 }, { "content": "@register.simple_tag(takes_context=True)\ndef render_address(context, address, address_type):\n request = context.get('request')\n return mark_safe(address.as_html(request, type=address_type))", "metadata": "root.render_address", "header": "['module', '___EOS___']", "index": 958 }, { "content": "@register.filter\ndef clean_amount(amount, product):\n return product.get_clean_quantity(amount)", "metadata": "root.clean_amount", "header": "['module', '___EOS___']", "index": 964 } ]
[ { "span": "from django.core.exceptions import ObjectDoesNotExist", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 53 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "python", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "forms_", "import_", "Bound", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "locale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "django", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "cache_", "import_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Object", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Node_", ",_", "Templa", "te", "Syntax", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "safe", "string_", "import_", "mark", "\\u", "safe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lf", "s", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "lf", "s_", "._", "catalog_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lf", "s_", "._", "core_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lf", "s_", "._", "core_", "._", "views_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lf", "s_", "._", "utils_", "._", "misc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lf", "s_", "._", "caching", "_", "._", "utils_", "import_", "get", "\\u", "cache", "\\u", "group", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "catalog_", "._", "models_", "import_", "Category_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "catalog_", "._", "settings_", "import_", "VARIAN", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "catalog_", "._", "settings_", "import_", "CATEGORY", "\\u", "VARIAN", "T", "\\u", "CHE", "AP", "EST", "\\u", "PRIC", "ES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "catalog_", "._", "settings_", "import_", "SORT", "ING", "\\u", "MAP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "catalog_", "._", "models_", "import_", "Product_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "catalog_", "._", "models_", "import_", "Proper", "ty", "Option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "catalog_", "._", "settings_", "import_", "PRODUCT", "\\u", "TYPE", "\\u", "LOOKUP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "core_", "._", "models_", "import_", "Action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "page_", "._", "models_", "import_", "Page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "shipping", "_", "import_", "utils_", "as_", "shipping", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lf", "s_", "._", "manufacturer_", "._", "models_", "import_", "Manufacturer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "=_", "template_", "._", "Library_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "register_", "._", "tag_", "(_", "'", "action", "s", "'_", ",_", "do", "\\u", "actions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "register_", "._", "tag_", "(_", "'", "che", "ape", "st", "\\u", "variant", "'_", ",_", "do", "\\u", "che", "ape", "st", "\\u", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "register_", "._", "tag_", "(_", "'", "top", "\\u", "level", "\\u", "category", "'_", ",_", "do", "\\u", "top", "\\u", "level", "\\u", "category_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "register_", "._", "tag_", "(_", "'", "cart", "\\u", "informati", "on", "'_", ",_", "do", "\\u", "cart", "\\u", "information_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "register_", "._", "tag_", "(_", "'", "current", "\\u", "category", "'_", ",_", "do", "\\u", "current", "\\u", "category_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "register_", "._", "tag_", "(_", "'", "come", "\\u", "from", "\\u", "page", "'_", ",_", "do", "\\u", "come", "\\u", "from", "\\u", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Move", " ", "this", " ", "to", " ", "shop", " ", "util", "s", " ", "or", " ", "similar_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "register_", "._", "tag_", "(_", "'", "category", "\\u", "product", "\\u", "price", "s", "\\u", "gross", "'_", ",_", "do", "\\u", "category", "\\u", "product", "\\u", "price", "s", "\\u", "gross", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "register_", "._", "tag_", "(_", "'", "category", "\\u", "product", "\\u", "price", "s", "\\u", "net", "'_", ",_", "do", "\\u", "category", "\\u", "product", "\\u", "price", "s", "\\u", "net_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "register_", "._", "tag_", "(_", "'", "category", "\\u", "product", "\\u", "price", "s", "'_", ",_", "do", "\\u", "category", "\\u", "product", "\\u", "prices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "._", "inclusion", "\\u", "tag_", "(_", "'", "lf", "s", "/", "port", "lets", "/", "category", "\\u", "child", "ren", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "category", "\\u", "children_", "(_", "context_", ",_", "categories_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "categor", "ies", "\"_", ":_", "categories_", "}_", "\\u\\u\\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_", "._", "inclusion", "\\u", "tag_", "(_", "'", "lf", "s", "/", "shop", "/", "google", "\\u", "analytics", "\\u", "track", "ing", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "google", "\\u", "analytics", "\\u", "tracking_", "(_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "google", " ", "analytics", " ", "track", "ing", " ", "code", " ", "whi", "ch", " ", "has", " ", "bee", "n", " ", "enter", "ed", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "shop", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shop", "_", "=_", "lf", "s_", "._", "core_", "._", "utils_", "._", "get", "\\u", "default", "\\u", "shop", "_", "(_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ga", "\\u", "site", "\\u", "track", "ing", "\"_", ":_", "shop", "_", "._", "ga", "\\u", "site", "\\u", "tracking_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "google", "\\u", "analytics", "\\u", "id", "\"_", ":_", "shop", "_", "._", "google", "\\u", "analytics", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "lf", "s", "/", "shop", "/", "google", "\\u", "analytics", "\\u", "ecom", "merc", "e", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "google", "\\u", "analytics", "\\u", "ecom", "merc", "e_", "(_", "context_", ",_", "clear", "\\u", "session_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "google", " ", "analytics", " ", "e-", "commerc", "e", " ", "track", "ing", " ", "code", ".", " ", "Thi", "s", " ", "shou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "displaye", "d", " ", "on", " ", "the", " ", "than", "k", "-", "you", " ", "page", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "request_", "._", "session_", "._", "get_", "(_", "\"", "order", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shop", "_", "=_", "lf", "s_", "._", "core_", "._", "utils_", "._", "get", "\\u", "default", "\\u", "shop", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "order", " ", "is", " ", "remove", "d", " ", "from", " ", "the", " ", "session", ".", " ", "It", " ", "has", " ", "bee", "n", " ", "adde", "d", " ", "after", " ", "the", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", " ", "bee", "n", " ", "paye", "d", " ", "within", " ", "the", " ", "check", "out", " ", "process", ".", " ", "See", " ", "order", ".", "util", "s", " ", "for", " ", "more", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "clear", "\\u", "session_", "and_", "\"", "order", "\"_", "in_", "request_", "._", "session_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "request_", "._", "session_", "[_", "\"", "order", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "voucher", "\"_", "in_", "request_", "._", "session_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "request_", "._", "session_", "[_", "\"", "voucher", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "request", "\"_", ":_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "order", "\"_", ":_", "order_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "shop", "\"_", ":_", "shop", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ga", "\\u", "ecom", "merc", "e\\u", "track", "ing", "\"_", ":_", "shop", "_", "._", "ga", "\\u", "ecom", "merc", "e\\u", "tracking_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "google", "\\u", "analytics", "\\u", "id", "\"_", ":_", "shop", "_", "._", "google", "\\u", "analytics", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "shipping", "_", "(_", "context_", ",_", "product_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "product_", "._", "is", "\\u", "deliver", "able_", "(_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "deliver", "able", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "delivery", "\\u", "time", "\"_", ":_", "shipping", "\\u", "utils_", "._", "get", "\\u", "product", "\\u", "delivery", "\\u", "time_", "(_", "request_", ",_", "product_", ")_", "\\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_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "deliver", "able", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "delivery", "\\u", "time", "\"_", ":_", "shipping", "\\u", "utils_", "._", "get", "\\u", "product", "\\u", "delivery", "\\u", "time_", "(_", "request_", ",_", "product_", ")_", "\\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_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "lf", "s", "/", "shipping", "/", "shipping", "\\u", "tag", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "shipping", "_", "(_", "context_", ",_", "variant_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "get", "\\u", "shipping", "_", "(_", "context_", ",_", "variant_", ")_", "\\u\\u\\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_", "._", "inclusion", "\\u", "tag_", "(_", "'", "lf", "s", "/", "catal", "og", "/", "sorting", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sorting", "_", "(_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sorting", "_", "=_", "request_", "._", "session_", "._", "get_", "(_", "\"", "sorting", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prepar", "e", " ", "list", " ", "of", " ", "avail", "able", " ", "sort", " ", "options", ",", " ", "sorte", "d", " ", "by", " ", "SORT", "ING", "\\u", "MAP", "\\u", "ORDER_", "\\u\\u\\uNL\\u\\u\\u_", "sort", "\\u", "options_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "SORT", "ING", "\\u", "MAP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sort", "\\u", "options_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\"", "current", "\"_", ":_", "sorting", "_", ",_", "\"", "sort", "\\u", "options", "\"_", ":_", "sort", "\\u", "options_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "lf", "s", "/", "catal", "og", "/", "breadcrumb", "s", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "breadcrumb", "s_", "(_", "context_", ",_", "obj_", ",_", "current", "\\u", "page_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", ",_", "Category_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache", "\\u", "key_", "=_", "\"%", "s", "-", "category", "-", "breadcrumb", "s", "-%", "s", "\"_", "%_", "(_", "settings_", "._", "CACHE", "\\u", "MIDDLE", "WARE", "\\u", "KEY", "\\u", "PREFIX_", ",_", "obj_", "._", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "=_", "cache_", "._", "get_", "(_", "cache", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "objects_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "objects_", "=_", "[_", "current", "\\u", "page_", "]_", "if_", "current", "\\u", "page_", "else_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "obj_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "objects_", "._", "insert_", "(_", "0_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "obj_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "obj_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "obj_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "objects_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STATI", "C", "\\u", "URL", "\"_", ":_", "context_", "._", "get_", "(_", "\"", "STATI", "C", "\\u", "URL", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "._", "set_", "(_", "cache", "\\u", "key_", ",_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "obj_", ",_", "Product_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "obj_", "._", "get", "\\u", "name_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "obj_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "product", " ", "page", " ", "may", " ", "be", " ", "visit", "ed", " ", "from", " ", "manufactur", "er", " ", "or", " ", "category_", "\\u\\u\\uNL\\u\\u\\u_", "lm_", "=_", "request_", "._", "session_", "._", "get_", "(_", "'", "last", "\\u", "manufactur", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lm_", "and_", "obj_", "._", "manufacturer_", "==_", "lm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "objects_", "._", "insert_", "(_", "0_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "lm_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "lm_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "insert_", "(_", "0_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\\u_", "(_", "u", "\"", "Manufacturer", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "reverse_", "(_", "\"", "lf", "s", "\\u", "manufactur", "ers", "\"_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "category_", "=_", "obj_", "._", "get", "\\u", "current", "\\u", "category_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "category_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "category_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "objects_", "._", "insert_", "(_", "0_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "category_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "category_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category_", "=_", "category_", "._", "parent_", "\\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_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "objects_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STATI", "C", "\\u", "URL", "\"_", ":_", "context_", "._", "get_", "(_", "\"", "STATI", "C", "\\u", "URL", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "obj_", ",_", "Page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "objects_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\\u_", "(_", "u", "\"", "Information", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "reverse_", "(_", "\"", "lf", "s", "\\u", "page", "s", "\"_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "append_", "(_", "{_", "\"", "name", "\"_", ":_", "obj_", "._", "title_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "objects_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STATI", "C", "\\u", "URL", "\"_", ":_", "context_", "._", "get_", "(_", "\"", "STATI", "C", "\\u", "URL", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "obj_", ",_", "Manufacturer", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "objects_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\\u_", "(_", "u", "\"", "Manufacturer", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "reverse_", "(_", "\"", "lf", "s", "\\u", "manufactur", "ers", "\"_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "append_", "(_", "{_", "\"", "name", "\"_", ":_", "obj_", "._", "name_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "objects_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STATI", "C", "\\u", "URL", "\"_", ":_", "context_", "._", "get_", "(_", "\"", "STATI", "C", "\\u", "URL", "\"_", ")_", ",_", "\\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_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "(_", "{_", "\"", "name", "\"_", ":_", "obj_", "}_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STATI", "C", "\\u", "URL", "\"_", ":_", "context_", "._", "get_", "(_", "\"", "STATI", "C", "\\u", "URL", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "lf", "s", "/", "catal", "og", "/", "product", "\\u", "navigation", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "product", "\\u", "navigation", "_", "(_", "context_", ",_", "product_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ides", " ", "previ", "ous", " ", "and", " ", "next", " ", "product", " ", "link", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\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 ", " _", "default", "\\u", "sorting", "_", "=_", "settings_", "._", "LF", "S", "\\u", "PRODUCT", "S", "\\u", "SORT", "ING_", "\\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 ", " _", "default", "\\u", "sorting", "_", "=_", "\"", "effective", "\\u", "price", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sorting", "_", "=_", "request_", "._", "session_", "._", "get_", "(_", "\"", "sorting", "\"_", ",_", "default", "\\u", "sorting", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sorting", "_", "._", "strip_", "(_", ")_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sorting", "_", "=_", "'", "effective", "\\u", "price", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "[_", "\"", "sorting", "\"_", "]_", "=_", "sorting", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slug_", "=_", "product_", "._", "slug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "calcul", "ate", " ", "the", " ", "position", " ", "we", " ", "take", " ", "only", " ", "STANDARD", "\\u", "PRODUCT", " ", "int", "o", " ", "account", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tha", "t", " ", "means", " ", "if", " ", "the", " ", "current", " ", "product", " ", "is", " ", "a", " ", "VARIAN", "T", " ", "we", " ", "switch", " ", "to", " ", "its", " ", "parent_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "product", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "product_", "._", "is", "\\u", "variant_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "product_", "=_", "product_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slug_", "=_", "product_", "._", "slug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prepar", "e", " ", "cache", " ", "key", " ", "for", " ", "product", "\\u", "navigation", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "used", " ", "to", " ", "invalidate", " ", "cache", " ", "for", " ", "all", " ", "product", "\\u", "navigation", "s", " ", "at", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pn", "\\u", "cache", "\\u", "key_", "=_", "get", "\\u", "cache", "\\u", "group", "\\u", "id_", "(_", "'", "product", "\\u", "navigation", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "is", " ", "last", "\\u", "manufactur", "er", " ", "then", " ", "product", " ", "was", " ", "visit", "ed", " ", "from", " ", "manufactur", "er", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "category", " ", "view", " ", "remove", "s", " ", "last", "\\u", "manufactur", "er", " ", "from", " ", "the", " ", "session_", "\\u\\u\\uNL\\u\\u\\u_", "lm_", "=_", "request_", "._", "session_", "._", "get_", "(_", "'", "last", "\\u", "manufactur", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lm_", "and_", "product_", "._", "manufacturer_", "==_", "lm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache", "\\u", "key_", "=_", "\"%", "s", "-%", "s", "-", "product", "-", "navigation", "-", "manufactur", "er", "-%", "s", "\"_", "%_", "(_", "settings_", "._", "CACHE", "\\u", "MIDDLE", "WARE", "\\u", "KEY", "\\u", "PREFIX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pn", "\\u", "cache", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "cache_", "._", "get_", "(_", "cache", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res_", "and_", "sorting", "_", "in_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "[_", "sorting", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "products_", "=_", "Product_", "._", "objects_", "._", "filter_", "(_", "manufacturer_", "=_", "lm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "category_", "=_", "product_", "._", "get", "\\u", "current", "\\u", "category_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "category_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\"", "display", "\"_", ":_", "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 ", " _", "cache", "\\u", "key_", "=_", "\"%", "s", "-%", "s", "-", "product", "-", "navigation", "-%", "s", "\"_", "%_", "(_", "settings_", "._", "CACHE", "\\u", "MIDDLE", "WARE", "\\u", "KEY", "\\u", "PREFIX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pn", "\\u", "cache", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "cache_", "._", "get_", "(_", "cache", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res_", "and_", "sorting", "_", "in_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "[_", "sorting", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "we", " ", "collect", " ", "all", " ", "sub", " ", "categor", "ies", ".", " ", "Thi", "s", " ", "and", " ", "usi", "ng", " ", "the", " ", "in", " ", "opera", "tor", " ", "make", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "batch", "ing", " ", "more", " ", "easi", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "categories_", "=_", "[_", "category_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "category_", "._", "show", "\\u", "all", "\\u", "products_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "categories_", "._", "extend_", "(_", "category_", "._", "get", "\\u", "all", "\\u", "children_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "products_", "=_", "Product_", "._", "objects_", "._", "filter_", "(_", "categor", "ies", "\\u\\u", "in_", "=_", "categories_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "necessar", "y", " ", "as", " ", "we", " ", "display", " ", "non", " ", "active", " ", "products", " ", "to", " ", "super", "users", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "we", " ", "have", " ", "to", " ", "take", " ", "care", " ", "for", " ", "the", " ", "product", " ", "navigation", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "request_", "._", "user_", "._", "is", "\\u", "superuser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "products_", "=_", "products_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "products_", "=_", "products_", "._", "exclude_", "(_", "sub\\u", "type_", "=_", "VARIAN", "T_", ")_", "._", "distinct_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "sorting", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "product", "\\u", "slug", "s_", "=_", "list_", "(_", "products_", "._", "values", "\\u", "list_", "(_", "'", "slug", "'_", ",_", "flat_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product", "\\u", "index_", "=_", "product", "\\u", "slug", "s_", "._", "index_", "(_", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "product", "\\u", "index_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "previous_", "=_", "product", "\\u", "slug", "s_", "[_", "product", "\\u", "index_", "-_", "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 ", " _", "previous_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total_", "=_", "len_", "(_", "product", "\\u", "slug", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "product", "\\u", "index_", "<_", "total_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "product_", "=_", "product", "\\u", "slug", "s_", "[_", "product", "\\u", "index_", "+_", "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 ", " _", "next", "\\u", "product_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "display", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "previ", "ous", "\"_", ":_", "previous_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "next", "\"_", ":_", "next", "\\u", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "current", "\"_", ":_", "product", "\\u", "index_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "\"_", ":_", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STATI", "C", "\\u", "URL", "\"_", ":_", "context_", "._", "get_", "(_", "\"", "STATI", "C", "\\u", "URL", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "._", "set_", "(_", "cache", "\\u", "key_", ",_", "{_", "'", "sorting", "'_", ":_", "result_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Action", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Node", " ", "for", " ", "do", "\\u", "action", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Action", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "group", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "group", "\\u", "name_", "=_", "group", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Action", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "action", "s", "\"_", "]_", "=_", "Action_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ",_", "group", "\\u\\u", "name_", "=_", "self_", "._", "group", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "actions_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "action", "s", " ", "for", " ", "the", " ", "group", " ", "with", " ", "the", " ", "give", "n", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "\\u", "bits_", "=_", "len_", "(_", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len", "\\u", "bits_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u_", "(_", "'%", "s", " ", "tag", " ", "need", "s", " ", "group", " ", "id", " ", "as", " ", "argu", "ment", "'_", ")_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Action", "s", "Node_", "(_", "bits_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Che", "ape", "st", "Varia", "nt", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Node", " ", "for", " ", "do", "\\u", "che", "ape", "st", "\\u", "variant", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Che", "ape", "st", "Varia", "nt", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "product", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "product", "\\u", "id_", "=_", "template_", "._", "Variable_", "(_", "product", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Che", "ape", "st", "Varia", "nt", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "product", "\\u", "id_", "=_", "self_", "._", "product", "\\u", "id_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "che", "ape", "st", "\\u", "variant_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "price_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "variant_", "in_", "Product_", "._", "objects_", "._", "filter_", "(_", "parent", "\\u\\u", "id_", "=_", "product", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "price_", "=_", "variant_", "._", "get", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "price_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "min", "\\u", "price_", "is_", "None_", ")_", "or_", "(_", "price_", "<_", "min", "\\u", "price_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "che", "ape", "st", "\\u", "variant_", "=_", "variant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "price_", "=_", "price_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "\"", "che", "ape", "st", "\\u", "variant", "\"_", "]_", "=_", "che", "ape", "st", "\\u", "variant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "che", "ape", "st", "\\u", "variant_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "che", "ape", "st", " ", "variant", " ", "for", " ", "the", " ", "product", " ", "with", " ", "give", "n", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "\\u", "bits_", "=_", "len_", "(_", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len", "\\u", "bits_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "s", " ", "tag", " ", "need", "s", " ", "product", " ", "id", " ", "as", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Che", "ape", "st", "Varia", "nt", "Node_", "(_", "bits_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "lf", "s", "/", "shop", "/", "tabs", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "tabs_", "(_", "context_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "context_", "._", "get_", "(_", "\"", "product", "\"_", ")_", "or_", "context_", "._", "get_", "(_", "\"", "category", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tabs_", "=_", "Action_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ",_", "group_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", ",_", "(_", "Product_", ",_", "Category_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top", "\\u", "category_", "=_", "lf", "s_", "._", "catalog_", "._", "utils_", "._", "get", "\\u", "current", "\\u", "top", "\\u", "category_", "(_", "request_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "top", "\\u", "category_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tab_", "in_", "tabs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "top", "\\u", "category_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", "._", "find_", "(_", "tab_", "._", "link_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tab_", "._", "selected_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tab_", "in_", "tabs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "path_", "._", "find_", "(_", "tab_", "._", "link_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tab_", "._", "selected_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tabs", "\"_", ":_", "tabs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STATI", "C", "\\u", "URL", "\"_", ":_", "context_", "._", "get_", "(_", "\"", "STATI", "C", "\\u", "URL", "\"_", ")_", ",_", "\\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_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "lf", "s", "/", "catal", "og", "/", "top", "\\u", "level", "\\u", "categor", "ies", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "top", "\\u", "level", "\\u", "categories_", "(_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Display", "s", " ", "the", " ", "top", " ", "level", " ", "categor", "ies", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "context_", "._", "get_", "(_", "\"", "product", "\"_", ")_", "or_", "context_", "._", "get_", "(_", "\"", "category", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "categories_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "\\u", "category_", "=_", "lf", "s_", "._", "catalog_", "._", "utils_", "._", "get", "\\u", "current", "\\u", "top", "\\u", "category_", "(_", "request_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "category_", "in_", "Category_", "._", "objects_", "._", "filter_", "(_", "parent_", "=_", "None_", ")_", "[_", ":_", "4_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "top", "\\u", "category_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current_", "=_", "top", "\\u", "category_", "._", "id_", "==_", "category_", "._", "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 ", " _", "current_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "categories_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "category_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "category_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "current", "\"_", ":_", "current_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "categor", "ies", "\"_", ":_", "categories_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Top", "Leve", "l", "Category_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calculat", "es", " ", "the", " ", "current", " ", "top", " ", "level", " ", "category", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Top", "Leve", "l", "Category_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "context_", "._", "get_", "(_", "\"", "product", "\"_", ")_", "or_", "context_", "._", "get_", "(_", "\"", "category", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top", "\\u", "level", "\\u", "category_", "=_", "lf", "s_", "._", "catalog_", "._", "utils_", "._", "get", "\\u", "current", "\\u", "top", "\\u", "category_", "(_", "request_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "top", "\\u", "level", "\\u", "category", "\"_", "]_", "=_", "top", "\\u", "level", "\\u", "category_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "top", "\\u", "level", "\\u", "category_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calculat", "es", " ", "the", " ", "current", " ", "top", " ", "level", " ", "category", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "\\u", "bits_", "=_", "len_", "(_", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len", "\\u", "bits_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u_", "(_", "'%", "s", " ", "tag", " ", "need", "s", " ", "no", " ", "argu", "ment", "'_", ")_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Top", "Leve", "l", "Category_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cart", "Information", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cart", "Information", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cart_", "=_", "lf", "s_", "._", "cart_", "._", "utils_", "._", "get", "\\u", "cart_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cart_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "amo", "unt", "\\u", "of", "\\u", "items_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "price_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "amo", "unt", "\\u", "of", "\\u", "items_", "=_", "cart_", "._", "get", "\\u", "amo", "unt", "\\u", "of", "\\u", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "price_", "=_", "cart_", "._", "get", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ",_", "total_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "\"", "cart", "\\u", "amo", "unt", "\\u", "of", "\\u", "items", "\"_", "]_", "=_", "amo", "unt", "\\u", "of", "\\u", "items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "cart", "\\u", "price", "\"_", "]_", "=_", "price_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "cart", "\\u", "information_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calculat", "es", " ", "cart", " ", "informations", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "\\u", "bits_", "=_", "len_", "(_", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len", "\\u", "bits_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u_", "(_", "'%", "s", " ", "tag", " ", "need", "s", " ", "no", " ", "argu", "ment", "'_", ")_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Cart", "Information", "Node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Curr", "ent", "Cate", "gory", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Curr", "ent", "Cate", "gory", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product_", "=_", "context_", "._", "get_", "(_", "\"", "product", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "[_", "\"", "current", "\\u", "category", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "current", "\\u", "category_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "current", "\\u", "category_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calculat", "es", " ", "current", " ", "category", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "\\u", "bits_", "=_", "len_", "(_", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len", "\\u", "bits_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u_", "(_", "'%", "s", " ", "tag", " ", "need", "s", " ", "product", " ", "as", " ", "argu", "ment", "'_", ")_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Curr", "ent", "Cate", "gory", "Node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Come", "Fro", "m", "Page", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Come", "Fro", "m", "Page", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product_", "=_", "context_", "._", "get_", "(_", "\"", "product", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "[_", "\"", "come", "\\u", "from", "\\u", "page", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "come", "\\u", "from", "\\u", "page_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "come", "\\u", "from", "\\u", "page_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calculat", "es", " ", "current", " ", "manufactur", "er", " ", "or", " ", "category", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "\\u", "bits_", "=_", "len_", "(_", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len", "\\u", "bits_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u_", "(_", "'%", "s", " ", "tag", " ", "need", "s", " ", "product", " ", "as", " ", "argu", "ment", "'_", ")_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Come", "Fro", "m", "Page", "Node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "slug", "\\u", "from", "\\u", "request_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "slug", " ", "of", " ", "the", " ", "currentl", "y", " ", "displaye", "d", " ", "category", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slug_", "=_", "request_", "._", "path_", "._", "split_", "(_", "\"/\"_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "int_", "(_", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slug_", "=_", "request_", "._", "path_", "._", "split_", "(_", "\"/\"_", ")_", "[_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "slug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "curr", "ency", "\\u", "text_", "(_", "value_", ",_", "request_", "=_", "None_", ",_", "grouping_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "curr", "ency", " ", "based", " ", "on", " ", "the", " ", "give", "n", " ", "locale", " ", "within", " ", "settings", ".", "LF", "S", "\\u", "LOCALE", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "locale", "\\", "10", ";", " ", " ", " ", " ", "locale", ".", "setlocal", "e", "(", "locale", ".", "LC", "\\u", "ALL", ",", " ", "'", "de", "\\u", "CH", ".", "UT", "F", "-", "8", "')", "\\", "10", ";", " ", " ", " ", " ", "curr", "ency", "(", "12345", "6.7", "89", ")", " ", " ", "#", " ", "Fr", ".", " ", "123", "'", "456", ".7", "9", "\\", "10", ";", " ", " ", " ", " ", "curr", "ency", "(-", "12345", "6.7", "89", ")", " ", "#", " ", "Fr", ".", " ", "-1", "23", "'", "456", ".7", "9", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "locale_", "._", "getl", "ocal", "e_", "(_", "locale_", "._", "LC", "\\u", "ALL_", ")_", "[_", "0_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lf", "s_", "._", "core_", "._", "views_", "._", "one", "\\u", "time", "\\u", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shop", "_", "=_", "lf", "s_", "._", "core_", "._", "utils_", "._", "get", "\\u", "default", "\\u", "shop", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "locale_", "._", "currency_", "(_", "value_", ",_", "grouping_", "=_", "grouping_", ",_", "international", "_", "=_", "shop", "_", "._", "use", "\\u", "international", "\\u", "curr", "ency", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "error_", "(_", "\"", "curr", "ency", " ", "filter", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replace", " ", "the", " ", "minu", "s", " ", "symbol", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result_", "[_", "-_", "1_", "]_", "==_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "=_", "len_", "(_", "locale_", "._", "nl", "\\u", "lang", "info_", "(_", "locale_", "._", "CR", "NCY", "STR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "'%", "s", "-%", "s", "'_", "%_", "(_", "result_", "[_", "0_", ":_", "length_", "]_", ",_", "result_", "[_", "length_", ":_", "-_", "1_", "]_", ")_", "\\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]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "currency_", "(_", "value_", ",_", "request_", "=_", "None_", ",_", "grouping_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "curr", "ency", " ", "based", " ", "on", " ", "the", " ", "give", "n", " ", "locale", " ", "within", " ", "settings", ".", "LF", "S", "\\u", "LOCALE", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "locale", "\\", "10", ";", " ", " ", " ", " ", "locale", ".", "setlocal", "e", "(", "locale", ".", "LC", "\\u", "ALL", ",", " ", "'", "de", "\\u", "CH", ".", "UT", "F", "-", "8", "')", "\\", "10", ";", " ", " ", " ", " ", "curr", "ency", "(", "12345", "6.7", "89", ")", " ", " ", "#", " ", "<", "span", " ", "class", "=\"", "money", "\">", "Fr", ".", " ", "123", "'", "456", ".7", "9", "</", "span", ">", "\\", "10", ";", " ", " ", " ", " ", "curr", "ency", "(-", "12345", "6.7", "89", ")", " ", "#", " ", "<", "span", " ", "class", "=\"", "money", " ", "negati", "ve", "\">", "Fr", ".", " ", "-1", "23", "'", "456", ".7", "9", "</", "span", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "locale_", "._", "getl", "ocal", "e_", "(_", "locale_", "._", "LC", "\\u", "ALL_", ")_", "[_", "0_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lf", "s_", "._", "core_", "._", "views_", "._", "one", "\\u", "time", "\\u", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shop", "_", "=_", "lf", "s_", "._", "core_", "._", "utils_", "._", "get", "\\u", "default", "\\u", "shop", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "locale_", "._", "currency_", "(_", "value_", ",_", "grouping_", "=_", "grouping_", ",_", "international", "_", "=_", "shop", "_", "._", "use", "\\u", "international", "\\u", "curr", "ency", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "error_", "(_", "\"", "curr", "ency", " ", "filter", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "css", " ", "class", " ", "if", " ", "value", " ", "is", " ", "negative_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "negative_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "negative_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replace", " ", "the", " ", "minu", "s", " ", "symbol", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "result_", "[_", "-_", "1_", "]_", "==_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "=_", "len_", "(_", "locale_", "._", "nl", "\\u", "lang", "info_", "(_", "locale_", "._", "CR", "NCY", "STR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "'%", "s", "-%", "s", "'_", "%_", "(_", "result_", "[_", "0_", ":_", "length_", "]_", ",_", "result_", "[_", "length_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mark", "\\u", "safe_", "(_", "'<", "span", " ", "class", "=\"", "money", "%", "(", "negati", "ve", ")", "s", "\">", "%", "(", "result", ")", "s", "</", "span", ">'_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "result_", "._", "strip_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "negati", "ve", "'_", ":_", "'", " ", "negati", "ve", "'_", "if_", "negative_", "else_", "''_", ",_", "\\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_", "@_", "register_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decima", "l\\u", "l10", "n_", "(_", "value_", ",_", "digits_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "decima", "l", " ", "value", " ", "of", " ", "value", " ", "based", " ", "on", " ", "current", " ", "locale", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "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 ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "format\\u", "str_", "=_", "\"%%", ".", "%", "sf", "\"_", "%_", "digits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "locale_", "._", "format\\u", "string_", "(_", "format\\u", "str_", ",_", "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_", "@_", "register_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "quantity_", "(_", "quantity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", "s", " ", "the", " ", "decima", "l", " ", "place", "s", " ", "whe", "n", " ", "the", "y", " ", "are", " ", "zero", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Means", " ", "\"", "1.0", "\"", " ", "is", " ", "transforme", "d", " ", "to", " ", "\"", "1", "\",", " ", "where", "as", " ", "\"", "1.1", "\"", " ", "is", " ", "not", " ", "transforme", "d", " ", "at", " ", "all", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "str_", "(_", "quantity_", ")_", "._", "find_", "(_", "\".", "0", "\"_", ")_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "quantity_", "\\u\\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_", "int_", "(_", "float_", "(_", "quantity_", ")_", ")_", "\\u\\u\\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_", "@_", "register_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sub\\u", "type", "\\u", "name_", "(_", "sub\\u", "type_", ",_", "arg_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "sub", " ", "type", " ", "name", " ", "for", " ", "the", " ", "sub", " ", "type", " ", "with", " ", "pass", "ed", " ", "sub\\u", "type", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "PRODUCT", "\\u", "TYPE", "\\u", "LOOKUP", "_", "[_", "sub\\u", "type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[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_", "@_", "register_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "multiply_", "(_", "score_", ",_", "pixel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "result", " ", "of", " ", "score", " ", "*", " ", "pixel", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "score_", "*_", "pixel_", "\\u\\u\\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_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "option", "\\u", "name_", "(_", "option", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "option", " ", "name", " ", "for", " ", "option", " ", "with", " ", "pass", "ed", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option", "\\u", "id_", "=_", "int_", "(_", "float_", "(_", "option", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "Proper", "ty", "Option_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "option", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Proper", "ty", "Option_", "._", "Do", "es", "Not", "Exist_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "option", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "option_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "option", "\\u", "name", "\\u", "for", "\\u", "property", "\\u", "value_", "(_", "property", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "value", " ", "or", " ", "the", " ", "option", " ", "name", " ", "for", " ", "pass", "ed", " ", "property", "\\u", "value", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "property", "\\u", "value_", "._", "property_", "._", "is", "\\u", "select", "\\u", "field_", ":_", "\\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 ", " _", "option", "\\u", "id_", "=_", "int_", "(_", "float_", "(_", "property", "\\u", "value_", "._", "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 ", " _", "return_", "property", "\\u", "value_", "._", "value_", "\\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 ", " _", "option_", "=_", "Proper", "ty", "Option_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "option", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Proper", "ty", "Option_", "._", "Do", "es", "Not", "Exist_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "option", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "option_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "property", "\\u", "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_", "@_", "register_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "packages_", "(_", "cart", "\\u", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "package", "s", " ", "based", " ", "on", " ", "product", "'", "s", " ", "package", " ", "unit", " ", "and", " ", "cart", " ", "items", "\\", "10", ";", " ", " ", " ", " ", "amo", "unt", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "packing", "\\u", "unit_", ",_", "packing", "\\u", "unit", "\\u", "unit_", "=_", "cart", "\\u", "item_", "._", "product_", "._", "get", "\\u", "packing", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "packing", "\\u", "unit_", ":_", "\\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 ", " _", "amount_", "=_", "float_", "(_", "cart", "\\u", "item_", "._", "amount_", ")_", "\\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 ", " _", "amount_", "=_", "locale_", "._", "ato", "f_", "(_", "cart", "\\u", "item_", "._", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "int_", "(_", "math_", "._", "ceil_", "(_", "amount_", "/_", "packing", "\\u", "unit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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_", "class_", "Cate", "gory", "Product", "Price", "s", "Gro", "ss", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cate", "gory", "Product", "Price", "s", "Gro", "ss", "Node_", "(_", "Node_", ")_", ":_", "\\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_", ",_", "product", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "product", "\\u", "id_", "=_", "template_", "._", "Variable_", "(_", "product", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cate", "gory", "Product", "Price", "s", "Gro", "ss", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "product", "\\u", "id_", "=_", "self_", "._", "product", "\\u", "id_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product_", "=_", "Product_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "product", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "product_", "._", "is", "\\u", "variant_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "product_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "product_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parent_", "._", "category", "\\u", "variant_", "==_", "CATEGORY", "\\u", "VARIAN", "T", "\\u", "CHE", "AP", "EST", "\\u", "PRIC", "ES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "product_", "._", "get", "\\u", "for", "\\u", "sale_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "parent_", "._", "get", "\\u", "che", "ape", "st", "\\u", "standard", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "standard", "\\u", "price", "\"_", "]_", "=_", "info_", "[_", "\"", "price", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "standard", "\\u", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "info_", "[_", "\"", "startin", "g", "\\u", "from", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "=_", "parent_", "._", "get", "\\u", "che", "ape", "st", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "price", "\"_", "]_", "=_", "info_", "[_", "\"", "price", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "info_", "[_", "\"", "startin", "g", "\\u", "from", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "=_", "parent_", "._", "get", "\\u", "che", "ape", "st", "\\u", "base", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\"_", "]_", "=_", "info_", "[_", "\"", "price", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "info_", "[_", "\"", "startin", "g", "\\u", "from", "\"_", "]_", "\\u\\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_", "product_", "._", "get", "\\u", "for", "\\u", "sale_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "\"", "standard", "\\u", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "standard", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "\"", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "base", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "product_", "._", "get", "\\u", "active", "\\u", "packing", "\\u", "unit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "\"", "base", "\\u", "packing", "\\u", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "base", "\\u", "packing", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "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_", "do", "\\u", "category", "\\u", "product", "\\u", "price", "s", "\\u", "gross", "_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Inject", "s", " ", "all", " ", "need", "ed", " ", "gross", " ", "price", "s", " ", "for", " ", "the", " ", "default", " ", "category", " ", "products", " ", "view", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "context", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "bits_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "s", " ", "tag", " ", "need", "s", " ", "product", " ", "id", " ", "as", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Cate", "gory", "Product", "Price", "s", "Gro", "ss", "Node_", "(_", "bits_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cate", "gory", "Product", "Price", "s", "Net", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cate", "gory", "Product", "Price", "s", "Net", "Node_", "(_", "Node_", ")_", ":_", "\\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_", ",_", "product", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "product", "\\u", "id_", "=_", "template_", "._", "Variable_", "(_", "product", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cate", "gory", "Product", "Price", "s", "Net", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "product", "\\u", "id_", "=_", "self_", "._", "product", "\\u", "id_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product_", "=_", "Product_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "product", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "product_", "._", "is", "\\u", "variant_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "product_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "product_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parent_", "._", "category", "\\u", "variant_", "==_", "CATEGORY", "\\u", "VARIAN", "T", "\\u", "CHE", "AP", "EST", "\\u", "PRIC", "ES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "product_", "._", "get", "\\u", "for", "\\u", "sale_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "parent_", "._", "get", "\\u", "che", "ape", "st", "\\u", "standard", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "standard", "\\u", "price", "\"_", "]_", "=_", "info_", "[_", "\"", "price", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "standard", "\\u", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "info_", "[_", "\"", "startin", "g", "\\u", "from", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "=_", "parent_", "._", "get", "\\u", "che", "ape", "st", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "price", "\"_", "]_", "=_", "info_", "[_", "\"", "price", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "info_", "[_", "\"", "startin", "g", "\\u", "from", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "=_", "parent_", "._", "get", "\\u", "che", "ape", "st", "\\u", "base", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\"_", "]_", "=_", "info_", "[_", "\"", "price", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "info_", "[_", "\"", "startin", "g", "\\u", "from", "\"_", "]_", "\\u\\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_", "product_", "._", "get", "\\u", "for", "\\u", "sale_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "\"", "standard", "\\u", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "standard", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "\"", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "base", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "product_", "._", "get", "\\u", "active", "\\u", "packing", "\\u", "unit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "\"", "base", "\\u", "packing", "\\u", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "base", "\\u", "packing", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "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_", "do", "\\u", "category", "\\u", "product", "\\u", "price", "s", "\\u", "net_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Inject", "s", " ", "all", " ", "need", "ed", " ", "net", " ", "price", "s", " ", "for", " ", "the", " ", "default", " ", "category", " ", "products", " ", "view", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "context", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "bits_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "s", " ", "tag", " ", "need", "s", " ", "product", " ", "id", " ", "as", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Cate", "gory", "Product", "Price", "s", "Net", "Node_", "(_", "bits_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cate", "gory", "Product", "Price", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cate", "gory", "Product", "Price", "s", "Node_", "(_", "Node_", ")_", ":_", "\\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_", ",_", "product", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "product", "\\u", "id_", "=_", "template_", "._", "Variable_", "(_", "product", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cate", "gory", "Product", "Price", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "product", "\\u", "id_", "=_", "self_", "._", "product", "\\u", "id_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product_", "=_", "Product_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "product", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "product_", "._", "is", "\\u", "variant_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "product_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "product_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parent_", "._", "category", "\\u", "variant_", "==_", "CATEGORY", "\\u", "VARIAN", "T", "\\u", "CHE", "AP", "EST", "\\u", "PRIC", "ES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "product_", "._", "get", "\\u", "for", "\\u", "sale_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "parent_", "._", "get", "\\u", "che", "ape", "st", "\\u", "standard", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "standard", "\\u", "price", "\"_", "]_", "=_", "info_", "[_", "\"", "price", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "standard", "\\u", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "info_", "[_", "\"", "startin", "g", "\\u", "from", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "=_", "parent_", "._", "get", "\\u", "che", "ape", "st", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "price", "\"_", "]_", "=_", "info_", "[_", "\"", "price", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "info_", "[_", "\"", "startin", "g", "\\u", "from", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "=_", "parent_", "._", "get", "\\u", "che", "ape", "st", "\\u", "base", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\"_", "]_", "=_", "info_", "[_", "\"", "price", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "info_", "[_", "\"", "startin", "g", "\\u", "from", "\"_", "]_", "\\u\\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_", "product_", "._", "get", "\\u", "for", "\\u", "sale_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "\"", "standard", "\\u", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "standard", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "\"", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "base", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "base", "\\u", "price", "\\u", "startin", "g", "\\u", "from", "\"_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "product_", "._", "get", "\\u", "active", "\\u", "packing", "\\u", "unit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "\"", "base", "\\u", "packing", "\\u", "price", "\"_", "]_", "=_", "product_", "._", "get", "\\u", "base", "\\u", "packing", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "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_", "do", "\\u", "category", "\\u", "product", "\\u", "prices_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Inject", "s", " ", "all", " ", "need", "ed", " ", "store", "d", " ", "price", "s", " ", "for", " ", "the", " ", "default", " ", "category", " ", "products", " ", "view", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "context", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "=_", "token_", "._", "contents_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "bits_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "s", " ", "tag", " ", "need", "s", " ", "product", " ", "id", " ", "as", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Cate", "gory", "Product", "Price", "s", "Node_", "(_", "bits_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "register_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "price", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "price_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "price", "\\u", "net", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "price", "\\u", "net_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "price", "\\u", "gross", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "price", "\\u", "gross", "_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "standard", "\\u", "price", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "standard", "\\u", "price_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "standard", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "standard", "\\u", "price", "\\u", "net", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "standard", "\\u", "price", "\\u", "net_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "standard", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "standard", "\\u", "price", "\\u", "gross", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "standard", "\\u", "price", "\\u", "gross", "_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "standard", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "for", "\\u", "sal", "e\\u", "price", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "for", "\\u", "sal", "e\\u", "price_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "for", "\\u", "sal", "e\\u", "price_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "for", "\\u", "sal", "e\\u", "price", "\\u", "net", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "for", "\\u", "sal", "e\\u", "price", "\\u", "net_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "for", "\\u", "sal", "e\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "for", "\\u", "sal", "e\\u", "price", "\\u", "gross", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "for", "\\u", "sal", "e\\u", "price", "\\u", "gross", "_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "for", "\\u", "sal", "e\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "base", "\\u", "price", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "base", "\\u", "price_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "base", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "base", "\\u", "price", "\\u", "net", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "base", "\\u", "price", "\\u", "net_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "base", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "base", "\\u", "price", "\\u", "gross", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "base", "\\u", "price", "\\u", "gross", "_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "base", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "base", "\\u", "packing", "\\u", "price", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "base", "\\u", "packing", "\\u", "price_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "base", "\\u", "packing", "\\u", "price_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "base", "\\u", "packing", "\\u", "price", "\\u", "net", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "base", "\\u", "packing", "\\u", "price", "\\u", "net_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "base", "\\u", "packing", "\\u", "price", "\\u", "net_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "base", "\\u", "packing", "\\u", "price", "\\u", "gross", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "base", "\\u", "packing", "\\u", "price", "\\u", "gross", "_", "(_", "product_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "base", "\\u", "packing", "\\u", "price", "\\u", "gross", "_", "(_", "request_", ")_", "\\u\\u\\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_", "._", "inclusion", "\\u", "tag_", "(_", "'", "lf", "s", "/", "shop", "/", "lf", "s", "\\u", "form", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "lf", "s", "\\u", "form_", "(_", "context_", ",_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Render", " ", "form", " ", "usi", "ng", " ", "common", " ", "form", " ", "template", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "als", "o", " ", "possib", "le", " ", "to", " ", "pass", " ", "list", " ", "of", " ", "fields", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "single", " ", "field", " ", "to", " ", "this", " ", "tag", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "form_", ",_", "Bound", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "[_", "form_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "'", "lf", "s", "\\u", "form", "'_", "]_", "=_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "lf", "s", "\\u", "form", "\\u", "is", "\\u", "form", "'_", "]_", "=_", "hasattr_", "(_", "form_", ",_", "'", "non", "\\u", "field", "\\u", "error", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "filter_", "(_", "name_", "=_", "'", "get", "\\u", "pay", "\\u", "link", "'_", ",_", "is", "\\u", "safe_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "pay", "\\u", "link_", "(_", "order_", ",_", "request_", "=_", "None_", ",_", "force", "\\u", "paid", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "On", "ly", " ", "return", " ", "pay", " ", "link", " ", "for", " ", "not", " ", "paid", " ", "order", "s", " ", "unl", "ess", " ", "force", "\\u", "paid", "=", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "force", "\\u", "paid", "_", "or_", "order_", "._", "can", "\\u", "be", "\\u", "paid", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "order_", "._", "get", "\\u", "pay", "\\u", "link_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "simple", "\\u", "tag_", "(_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "render", "\\u", "address_", "(_", "context_", ",_", "address_", ",_", "address", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "._", "get_", "(_", "'", "request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mark", "\\u", "safe_", "(_", "address_", "._", "as", "\\u", "html_", "(_", "request_", ",_", "type_", "=_", "address", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "clean", "\\u", "amount_", "(_", "amount_", ",_", "product_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "product_", "._", "get", "\\u", "clean", "\\u", "quantity_", "(_", "amount_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
goshippo/shippo-python-client/shippo/test/test_transaction.py
[ { "content": " def test_list_all(self):\n transaction_list = shippo.Transaction.all()\n self.assertTrue('count' in transaction_list)\n self.assertTrue('results' in transaction_list)", "metadata": "root.TransactionTests.test_list_all", "header": "['class', 'TransactionTests', '(', 'ShippoTestCase', ')', ':', '___EOS___']", "index": 59 } ]
[ { "span": "self.assertTrue('count' in transaction_list)", "start_line": 61, "start_column": 8, "end_line": 61, "end_column": 52 }, { "span": "self.assertTrue('results' in transaction_list)", "start_line": 62, "start_column": 8, "end_line": 62, "end_column": 54 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Transa", "ction", "Tests_", "(_", "Ship", "po", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transaction", "\\u", "list_", "=_", "ship", "po_", "._", "Transaction_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "count", "'_", "in_", "transaction", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "results", "'_", "in_", "transaction", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
An assert statement has a side-effect
ionelmc/pytest-benchmark/tests/test_storage.py
[ { "content": "@freeze_time(\"2015-08-15T00:04:18.687119\")\ndef test_save_with_name(sess, tmpdir, monkeypatch):\n monkeypatch.setattr(plugin, '__version__', '2.5.0')\n sess.save = 'foobar'\n sess.autosave = True\n sess.json = None\n sess.save_data = False\n sess.storage.path = Path(str(tmpdir))\n sess.handle_saving()\n files = list(Path(str(tmpdir)).rglob('*.json'))\n assert len(files) == 1\n assert json.load(files[0].open('rU')) == SAVE_DATA", "metadata": "root.test_save_with_name", "header": "['module', '___EOS___']", "index": 338 }, { "content": "@freeze_time(\"2015-08-15T00:04:18.687119\")\ndef test_save_no_name(sess, tmpdir, monkeypatch):\n monkeypatch.setattr(plugin, '__version__', '2.5.0')\n sess.save = True\n sess.autosave = True\n sess.json = None\n sess.save_data = False\n sess.storage.path = Path(str(tmpdir))\n sess.handle_saving()\n files = list(Path(str(tmpdir)).rglob('*.json'))\n assert len(files) == 1\n assert json.load(files[0].open('rU')) == SAVE_DATA", "metadata": "root.test_save_no_name", "header": "['module', '___EOS___']", "index": 352 }, { "content": "@freeze_time(\"2015-08-15T00:04:18.687119\")\ndef test_save_with_error(sess, tmpdir, monkeypatch):\n monkeypatch.setattr(plugin, '__version__', '2.5.0')\n sess.save = True\n sess.autosave = True\n sess.json = None\n sess.save_data = False\n sess.storage.path = Path(str(tmpdir))\n for bench in sess.benchmarks:\n bench.has_error = True\n sess.handle_saving()\n files = list(Path(str(tmpdir)).rglob('*.json'))\n assert len(files) == 1\n assert json.load(files[0].open('rU')) == {\n 'benchmarks': [],\n 'commit_info': {'foo': 'bar'},\n 'datetime': '2015-08-15T00:04:18.687119',\n 'machine_info': {'foo': 'bar'},\n 'version': '2.5.0'\n }", "metadata": "root.test_save_with_error", "header": "['module', '___EOS___']", "index": 366 }, { "content": "@freeze_time(\"2015-08-15T00:04:18.687119\")\ndef test_autosave(sess, tmpdir, monkeypatch):\n monkeypatch.setattr(plugin, '__version__', '2.5.0')\n sess.save = False\n sess.autosave = True\n sess.json = None\n sess.save_data = False\n sess.storage.path = Path(str(tmpdir))\n sess.handle_saving()\n files = list(Path(str(tmpdir)).rglob('*.json'))\n assert len(files) == 1\n assert json.load(files[0].open('rU')) == SAVE_DATA", "metadata": "root.test_autosave", "header": "['module', '___EOS___']", "index": 388 } ]
[ { "span": "assert json.load(files[0].open('rU')) == SAVE_DATA", "start_line": 349, "start_column": 4, "end_line": 349, "end_column": 54 }, { "span": "assert json.load(files[0].open('rU')) == SAVE_DATA", "start_line": 363, "start_column": 4, "end_line": 363, "end_column": 54 }, { "span": "assert json.load(files[0].open('rU')) == {\n 'benchmarks': [],\n 'commit_info': {'foo': 'bar'},\n 'datetime': '2015-08-15T00:04:18.687119',\n 'machine_info': {'foo': 'bar'},\n 'version': '2.5.0'\n }", "start_line": 379, "start_column": 4, "end_line": 385, "end_column": 5 }, { "span": "assert json.load(files[0].open('rU')) == SAVE_DATA", "start_line": 399, "start_column": 4, "end_line": 399, "end_column": 54 } ]
[]
1
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "freez", "e\\u", "time_", "(_", "\"", "201", "5", "-0", "8", "-1", "5", "T", "00", ":", "04", ":", "18.", "687", "119", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "save", "\\u", "with", "\\u", "name_", "(_", "sess_", ",_", "tmpdir_", ",_", "monkeypatch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "monkeypatch_", "._", "setattr_", "(_", "plugin_", ",_", "'\\u", "\\u", "version", "\\u\\u'_", ",_", "'", "2.5", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "save_", "=_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "autosa", "ve_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "json_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "save", "\\u", "data_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "storage_", "._", "path_", "=_", "Path_", "(_", "str_", "(_", "tmpdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "handle", "\\u", "saving", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "list_", "(_", "Path_", "(_", "str_", "(_", "tmpdir_", ")_", ")_", "._", "rg", "lob", "_", "(_", "'*", ".", "json", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "files_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "json_", "._", "load_", "(_", "files_", "[_", "0_", "]_", "._", "open_", "(_", "'", "r", "U", "'_", ")_", ")_", "==_", "SAVE", "\\u", "DATA_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "freez", "e\\u", "time_", "(_", "\"", "201", "5", "-0", "8", "-1", "5", "T", "00", ":", "04", ":", "18.", "687", "119", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "save", "\\u", "no", "\\u", "name_", "(_", "sess_", ",_", "tmpdir_", ",_", "monkeypatch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "monkeypatch_", "._", "setattr_", "(_", "plugin_", ",_", "'\\u", "\\u", "version", "\\u\\u'_", ",_", "'", "2.5", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "save_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "autosa", "ve_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "json_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "save", "\\u", "data_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "storage_", "._", "path_", "=_", "Path_", "(_", "str_", "(_", "tmpdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "handle", "\\u", "saving", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "list_", "(_", "Path_", "(_", "str_", "(_", "tmpdir_", ")_", ")_", "._", "rg", "lob", "_", "(_", "'*", ".", "json", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "files_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "json_", "._", "load_", "(_", "files_", "[_", "0_", "]_", "._", "open_", "(_", "'", "r", "U", "'_", ")_", ")_", "==_", "SAVE", "\\u", "DATA_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "freez", "e\\u", "time_", "(_", "\"", "201", "5", "-0", "8", "-1", "5", "T", "00", ":", "04", ":", "18.", "687", "119", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "save", "\\u", "with", "\\u", "error_", "(_", "sess_", ",_", "tmpdir_", ",_", "monkeypatch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "monkeypatch_", "._", "setattr_", "(_", "plugin_", ",_", "'\\u", "\\u", "version", "\\u\\u'_", ",_", "'", "2.5", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "save_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "autosa", "ve_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "json_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "save", "\\u", "data_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "storage_", "._", "path_", "=_", "Path_", "(_", "str_", "(_", "tmpdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "bench_", "in_", "sess_", "._", "benchmarks", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bench_", "._", "has", "\\u", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sess_", "._", "handle", "\\u", "saving", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "list_", "(_", "Path_", "(_", "str_", "(_", "tmpdir_", ")_", ")_", "._", "rg", "lob", "_", "(_", "'*", ".", "json", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "files_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "json_", "._", "load_", "(_", "files_", "[_", "0_", "]_", "._", "open_", "(_", "'", "r", "U", "'_", ")_", ")_", "==_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "benchmarks", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "commit", "\\u", "info", "'_", ":_", "{_", "'", "foo", "'_", ":_", "'", "bar", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "datetime", "'_", ":_", "'", "201", "5", "-0", "8", "-1", "5", "T", "00", ":", "04", ":", "18.", "687", "119", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "machine", "\\u", "info", "'_", ":_", "{_", "'", "foo", "'_", ":_", "'", "bar", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "'", "2.5", ".0", "'_", "\\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_", "@_", "freez", "e\\u", "time_", "(_", "\"", "201", "5", "-0", "8", "-1", "5", "T", "00", ":", "04", ":", "18.", "687", "119", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "autosa", "ve_", "(_", "sess_", ",_", "tmpdir_", ",_", "monkeypatch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "monkeypatch_", "._", "setattr_", "(_", "plugin_", ",_", "'\\u", "\\u", "version", "\\u\\u'_", ",_", "'", "2.5", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "save_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "autosa", "ve_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "json_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "save", "\\u", "data_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "storage_", "._", "path_", "=_", "Path_", "(_", "str_", "(_", "tmpdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "handle", "\\u", "saving", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "list_", "(_", "Path_", "(_", "str_", "(_", "tmpdir_", ")_", ")_", "._", "rg", "lob", "_", "(_", "'*", ".", "json", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "files_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "json_", "._", "load_", "(_", "files_", "[_", "0_", "]_", "._", "open_", "(_", "'", "r", "U", "'_", ")_", ")_", "==_", "SAVE", "\\u", "DATA_" ]
[ 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,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\n if (\n # I've been asked to listen to my own messages\n self.some_listeners_include_me\n # or we're in a 1 on 1 chat and I didn't send it\n or (msg['type'] in ('chat', 'normal') and self.real_sender_jid(msg) != self.me.jid)\n # we're in group chat and I didn't send it\n or (msg[\"type\"] == \"groupchat\" and msg['mucnick'] != self.nick)\n ):\n body = msg[\"body\"].strip()\n\n sent_directly_to_me = False\n # If it's sent directly to me, strip off \"@will\" from the start.\n if body[:len(self.handle) + 1].lower() == (\"@%s\" % self.handle).lower():\n body = body[len(self.handle) + 1:].strip()\n msg[\"body\"] = body\n\n sent_directly_to_me = True\n\n # Make the message object a bit friendlier\n msg.room = self.get_room_from_message(msg)\n msg.sender = self.get_user_from_message(msg)\n\n for l in self.message_listeners:\n search_matches = l[\"regex\"].search(body)\n if (\n search_matches # The search regex matches and\n # It's not from me, or this search includes me, and\n and (msg['mucnick'] != self.nick or l[\"include_me\"])\n # I'm mentioned, or this is an overheard, or we're in a 1-1\n and (msg['type'] in ('chat', 'normal') or not l[\"direct_mentions_only\"] or\n self.handle_regex.search(body) or sent_directly_to_me)\n # It's from admins only and sender is an admin, or it's not from admins only\n and ((l['admin_only'] and self.message_is_from_admin(msg)) or (not l['admin_only']))\n # It's available only to the members of one or more ACLs, or no ACL in use\n and ((len(l['acl']) > 0 and self.message_is_allowed(msg, l['acl'])) or (len(l['acl']) == 0))\n ):\n try:\n thread_args = [msg, ] + l[\"args\"]\n\n def fn(listener, args, kwargs):\n try:\n listener[\"fn\"](*args, **kwargs)\n except:\n content = \"I ran into trouble running %s.%s:\\n\\n%s\" % (\n listener[\"class_name\"],\n listener[\"function_name\"],\n traceback.format_exc(),\n )\n\n if msg is None or msg[\"type\"] == \"groupchat\":\n if msg.sender and \"nick\" in msg.sender:\n content = \"@%s %s\" % (msg.sender[\"nick\"], content)\n self.send_room_message(msg.room[\"room_id\"], content, color=\"red\")\n elif msg['type'] in ('chat', 'normal'):\n self.send_direct_message(msg.sender[\"hipchat_id\"], content)\n\n thread = threading.Thread(target=fn, args=(l, thread_args, search_matches.groupdict()))\n thread.start()\n except:\n logging.critical(\n \"Error running %s. \\n\\n%s\\nContinuing...\\n\" % (\n l[\"function_name\"],\n traceback.format_exc()\n )\n )", "metadata": "root.WillXMPPClientMixin._handle_message_listeners", "header": "['class', 'WillXMPPClientMixin', '(', 'ClientXMPP', ',', 'RosterMixin', ',', 'RoomMixin', ',', 'HipChatMixin', ')', ':', '___EOS___']", "index": 127 } ]
[ { "span": "except:", "start_line": 170, "start_column": 32, "end_line": 170, "end_column": 39 }, { "span": "except:", "start_line": 186, "start_column": 24, "end_line": 186, "end_column": 31 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Wil", "l", "XMPP", "Client", "Mixin_", "(_", "Client", "XMPP", "_", ",_", "Ros", "ter", "Mixin_", ",_", "Room", "Mixin_", ",_", "Hi", "p", "Cha", "t", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "message", "\\u", "listeners_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", "'", "ve", " ", "bee", "n", " ", "ask", "ed", " ", "to", " ", "listen", " ", "to", " ", "my", " ", "own", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "some", "\\u", "listeners", "\\u", "include", "\\u", "me_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "we", "'", "re", " ", "in", " ", "a", " ", "1", " ", "on", " ", "1", " ", "chat", " ", "and", " ", "I", " ", "did", "n", "'", "t", " ", "send", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "(_", "msg_", "[_", "'", "type", "'_", "]_", "in_", "(_", "'", "chat", "'_", ",_", "'", "normal", "'_", ")_", "and_", "self_", "._", "real", "\\u", "sender", "\\u", "jid_", "(_", "msg_", ")_", "!=_", "self_", "._", "me_", "._", "jid_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "in", " ", "group", " ", "chat", " ", "and", " ", "I", " ", "did", "n", "'", "t", " ", "send", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "(_", "msg_", "[_", "\"", "type", "\"_", "]_", "==_", "\"", "group", "chat", "\"_", "and_", "msg_", "[_", "'", "muc", "nick", "'_", "]_", "!=_", "self_", "._", "nick_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "msg_", "[_", "\"", "body", "\"_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sent", "\\u", "direct", "ly", "\\u", "to", "\\u", "me_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "it", "'", "s", " ", "sent", " ", "direct", "ly", " ", "to", " ", "me", ",", " ", "strip", " ", "off", " ", "\"@", "will", "\"", " ", "from", " ", "the", " ", "start", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "body_", "[_", ":_", "len_", "(_", "self_", "._", "handle_", ")_", "+_", "1_", "]_", "._", "lower_", "(_", ")_", "==_", "(_", "\"@", "%", "s", "\"_", "%_", "self_", "._", "handle_", ")_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "body_", "=_", "body_", "[_", "len_", "(_", "self_", "._", "handle_", ")_", "+_", "1_", ":_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "[_", "\"", "body", "\"_", "]_", "=_", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sent", "\\u", "direct", "ly", "\\u", "to", "\\u", "me_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "the", " ", "message", " ", "object", " ", "a", " ", "bit", " ", "frie", "ndl", "ier_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "._", "room_", "=_", "self_", "._", "get", "\\u", "room", "\\u", "from", "\\u", "message_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "sender_", "=_", "self_", "._", "get", "\\u", "user", "\\u", "from", "\\u", "message_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "l_", "in_", "self_", "._", "message", "\\u", "listeners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "search", "\\u", "matches_", "=_", "l_", "[_", "\"", "regex", "\"_", "]_", "._", "search_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "matches_", "#", " ", "The", " ", "search", " ", "regex", " ", "matche", "s", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "not", " ", "from", " ", "me", ",", " ", "or", " ", "this", " ", "search", " ", "include", "s", " ", "me", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "msg_", "[_", "'", "muc", "nick", "'_", "]_", "!=_", "self_", "._", "nick_", "or_", "l_", "[_", "\"", "include", "\\u", "me", "\"_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", "'", "m", " ", "mentioned", ",", " ", "or", " ", "this", " ", "is", " ", "an", " ", "over", "hear", "d", ",", " ", "or", " ", "we", "'", "re", " ", "in", " ", "a", " ", "1", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "msg_", "[_", "'", "type", "'_", "]_", "in_", "(_", "'", "chat", "'_", ",_", "'", "normal", "'_", ")_", "or_", "not_", "l_", "[_", "\"", "direct", "\\u", "mentions", "\\u", "only", "\"_", "]_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "handle", "\\u", "regex_", "._", "search_", "(_", "body_", ")_", "or_", "sent", "\\u", "direct", "ly", "\\u", "to", "\\u", "me_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "from", " ", "admin", "s", " ", "only", " ", "and", " ", "sender", " ", "is", " ", "an", " ", "admin", ",", " ", "or", " ", "it", "'", "s", " ", "not", " ", "from", " ", "admin", "s", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "(_", "l_", "[_", "'", "admin", "\\u", "only", "'_", "]_", "and_", "self_", "._", "message", "\\u", "is", "\\u", "from", "\\u", "admin_", "(_", "msg_", ")_", ")_", "or_", "(_", "not_", "l_", "[_", "'", "admin", "\\u", "only", "'_", "]_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "avail", "able", " ", "only", " ", "to", " ", "the", " ", "member", "s", " ", "of", " ", "one", " ", "or", " ", "more", " ", "ACL", "s", ",", " ", "or", " ", "no", " ", "ACL", " ", "in", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "(_", "len_", "(_", "l_", "[_", "'", "acl", "'_", "]_", ")_", ">_", "0_", "and_", "self_", "._", "message", "\\u", "is", "\\u", "allowed_", "(_", "msg_", ",_", "l_", "[_", "'", "acl", "'_", "]_", ")_", ")_", "or_", "(_", "len_", "(_", "l_", "[_", "'", "acl", "'_", "]_", ")_", "==_", "0_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "thread", "\\u", "args_", "=_", "[_", "msg_", ",_", "]_", "+_", "l_", "[_", "\"", "args", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn_", "(_", "listener_", ",_", "args_", ",_", "kwargs_", ")_", ":_", "\\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 ", " ", " _", "listener_", "[_", "\"", "fn", "\"_", "]_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "=_", "\"", "I", " ", "ran", " ", "int", "o", " ", "trouble", " ", "runn", "ing", " ", "%", "s", ".", "%", "s", ":\\\\", "n", "\\\\", "n", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "listener_", "[_", "\"", "class", "\\u", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "listener_", "[_", "\"", "function", "\\u", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "msg_", "is_", "None_", "or_", "msg_", "[_", "\"", "type", "\"_", "]_", "==_", "\"", "group", "chat", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "if_", "msg_", "._", "sender_", "and_", "\"", "nick", "\"_", "in_", "msg_", "._", "sender_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "content_", "=_", "\"@", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "msg_", "._", "sender_", "[_", "\"", "nick", "\"_", "]_", ",_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "send", "\\u", "room", "\\u", "message_", "(_", "msg_", "._", "room_", "[_", "\"", "room", "\\u", "id", "\"_", "]_", ",_", "content_", ",_", "color_", "=_", "\"", "red", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "[_", "'", "type", "'_", "]_", "in_", "(_", "'", "chat", "'_", ",_", "'", "normal", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "self_", "._", "send", "\\u", "direct", "\\u", "message_", "(_", "msg_", "._", "sender_", "[_", "\"", "hip", "chat", "\\u", "id", "\"_", "]_", ",_", "content_", ")_", "\\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_", "thread_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "fn_", ",_", "args_", "=_", "(_", "l_", ",_", "thread", "\\u", "args_", ",_", "search", "\\u", "matches_", "._", "groupdict_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logging_", "._", "critical_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Error", " ", "runn", "ing", " ", "%", "s", ".", " ", " ", "\\\\", "n", "\\\\", "n", "%", "s", "\\\\", "n", "Continu", "ing", "...", "\\\\", "n", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "l_", "[_", "\"", "function", "\\u", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
aldebaran/qibuild/python/qisrc/test/test_qisrc_push.py
[ { "content": "def test_not_under_code_review_ask_user(qisrc_action, git_server, interact):\n foo_repo = git_server.create_repo(\"foo.git\")\n qisrc_action(\"init\", git_server.manifest_url)\n git_worktree = TestGitWorkTree()\n foo_proj = git_worktree.get_git_project(\"foo\")\n foo_git = TestGit(foo_proj.path)\n foo_git.commit_file(\"a.txt\", \"a\")\n interact.answers = [False, True]\n qisrc_action(\"push\", \"--project\", \"foo\")\n _, sha1 = foo_git.call(\"log\", \"-1\", \"--pretty=%H\", raises=False)\n (_, remote) = foo_git.call(\"ls-remote\", \"origin\", \"master\", raises=False)\n assert remote != \"%s\\trefs/heads/master\" % sha1\n qisrc_action(\"push\", \"--project\", \"foo\")\n (_, remote) = foo_git.call(\"ls-remote\", \"origin\", \"master\", raises=False)\n assert remote == \"%s\\trefs/heads/master\" % sha1", "metadata": "root.test_not_under_code_review_ask_user", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def test_not_under_code_review_with_no_review(qisrc_action, git_server):\n foo_repo = git_server.create_repo(\"foo.git\")\n qisrc_action(\"init\", git_server.manifest_url)\n git_worktree = TestGitWorkTree()\n foo_proj = git_worktree.get_git_project(\"foo\")\n foo_git = TestGit(foo_proj.path)\n foo_git.commit_file(\"a.txt\", \"a\")\n qisrc_action(\"push\", \"--no-review\", \"--project\", \"foo\")\n _, sha1 = foo_git.call(\"log\", \"-1\", \"--pretty=%H\", raises=False)\n (_, remote) = foo_git.call(\"ls-remote\", \"origin\", \"master\", raises=False)\n assert remote == \"%s\\trefs/heads/master\" % sha1", "metadata": "root.test_not_under_code_review_with_no_review", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def test_using_dash_y(qisrc_action, git_server):\n foo_repo = git_server.create_repo(\"foo.git\")\n qisrc_action(\"init\", git_server.manifest_url)\n git_worktree = TestGitWorkTree()\n foo_proj = git_worktree.get_git_project(\"foo\")\n foo_git = TestGit(foo_proj.path)\n foo_git.commit_file(\"a.txt\", \"a\")\n qisrc_action(\"push\", \"--project\", \"foo\", \"-y\")\n _, sha1 = foo_git.call(\"log\", \"-1\", \"--pretty=%H\", raises=False)\n (_, remote) = foo_git.call(\"ls-remote\", \"origin\", \"master\", raises=False)\n assert remote == \"%s\\trefs/heads/master\" % sha1", "metadata": "root.test_using_dash_y", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def test_publish_changes(qisrc_action, git_server):\n foo_repo = git_server.create_repo(\"foo.git\", review=True)\n qisrc_action(\"init\", git_server.manifest_url)\n git_worktree = TestGitWorkTree()\n foo_proj = git_worktree.get_git_project(\"foo\")\n foo_git = TestGit(foo_proj.path)\n foo_git.commit_file(\"a.txt\", \"a\")\n qisrc_action(\"push\", \"--project\", \"foo\")\n _, sha1 = foo_git.call(\"log\", \"-1\", \"--pretty=%H\", raises=False)\n (_, remote) = foo_git.call(\"ls-remote\", \"gerrit\", \"refs/for/master\", raises=False)\n assert remote == \"%s\\trefs/for/master\" % sha1", "metadata": "root.test_publish_changes", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def test_publish_drafts(qisrc_action, git_server):\n foo_repo = git_server.create_repo(\"foo.git\", review=True)\n qisrc_action(\"init\", git_server.manifest_url)\n git_worktree = TestGitWorkTree()\n foo_proj = git_worktree.get_git_project(\"foo\")\n foo_git = TestGit(foo_proj.path)\n foo_git.commit_file(\"a.txt\", \"a\")\n qisrc_action(\"push\", \"--project\", \"foo\", \"--draft\")\n _, sha1 = foo_git.call(\"log\", \"-1\", \"--pretty=%H\", raises=False)\n (_, remote) = foo_git.call(\"ls-remote\", \"gerrit\", \"refs/drafts/master\", raises=False)\n assert remote == \"%s\\trefs/drafts/master\" % sha1", "metadata": "root.test_publish_drafts", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def test_using_carbon_copy(qisrc_action, git_server):\n foo_repo = git_server.create_repo(\"foo.git\", review=True)\n qisrc_action(\"init\", git_server.manifest_url)\n git_worktree = TestGitWorkTree()\n foo_proj = git_worktree.get_git_project(\"foo\")\n foo_git = TestGit(foo_proj.path)\n # Need to fetch gerrit remote at least once for gerrit/master to exist\n foo_git.fetch(\"--all\")\n foo_git.commit_file(\"a.txt\", \"a\")\n with mock.patch.object(qisys.command, \"call\") as mocked_call:\n qisrc_action(\"push\", \"--project\", \"foo\", \"--cc\", \"jdoe\")\n set_reviewers_args = mocked_call.call_args_list[2][0][0][7]\n assert \"jdoe\" in set_reviewers_args", "metadata": "root.test_using_carbon_copy", "header": "['module', '___EOS___']", "index": 76 }, { "content": "def test_alert_maintainers(qisrc_action, git_server):\n foo_repo = git_server.create_repo(\"foo.git\", review=True)\n qiproject_xml = \"\"\"\\\n<project format=\"3\">\n <maintainer email=\"[email protected]\">John Doe</maintainer>\n</project>\"\"\"\n git_server.push_file(\"foo.git\", \"qiproject.xml\", qiproject_xml)\n qisrc_action(\"init\", git_server.manifest_url)\n git_worktree = TestGitWorkTree()\n foo_proj = git_worktree.get_git_project(\"foo\")\n foo_git = TestGit(foo_proj.path)\n # Need to fetch gerrit remote at least once for gerrit/master to exist\n foo_git.fetch(\"--all\")\n foo_git.commit_file(\"a.txt\", \"a\")\n with mock.patch.object(qisys.command, \"call\") as mocked_call:\n qisrc_action(\"push\", \"--project\", \"foo\")\n set_reviewers_args = mocked_call.call_args_list[-1][0][0][-1] # Last argument of last command\n assert \"jdoe\" in set_reviewers_args\n assert not \"@company.com\" in set_reviewers_args", "metadata": "root.test_alert_maintainers", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def test_pushing_from_perso_branch(qisrc_action, git_server):\n foo_repo = git_server.create_repo(\"foo.git\", review=True)\n qisrc_action(\"init\", git_server.manifest_url)\n git_worktree = TestGitWorkTree()\n foo_proj = git_worktree.get_git_project(\"foo\")\n foo_git = TestGit(foo_proj.path)\n foo_git.checkout(\"-b\", \"perso\")\n foo_git.commit_file(\"a.txt\", \"a\")\n qisrc_action(\"push\", \"--project\", \"foo\", \"master\")\n _, sha1 = foo_git.call(\"log\", \"-1\", \"--pretty=%H\", raises=False)\n (_, remote) = foo_git.call(\"ls-remote\", \"gerrit\", \"refs/for/master\", raises=False)\n assert remote == \"%s\\trefs/for/master\" % sha1", "metadata": "root.test_pushing_from_perso_branch", "header": "['module', '___EOS___']", "index": 121 }, { "content": "def test_pushing_custom_ref(qisrc_action, git_server):\n foo_repo = git_server.create_repo(\"foo.git\", review=True)\n qisrc_action(\"init\", git_server.manifest_url)\n git_worktree = TestGitWorkTree()\n foo_proj = git_worktree.get_git_project(\"foo\")\n foo_git = TestGit(foo_proj.path)\n foo_git.checkout(\"-b\", \"perso\")\n foo_git.commit_file(\"a.txt\", \"a\")\n _, sha1 = foo_git.call(\"log\", \"-1\", \"--pretty=%H\", raises=False)\n foo_git.commit_file(\"b.txt\", \"b\")\n qisrc_action(\"push\", \"--project\", \"foo\", \"HEAD~1:master\")\n (_, remote) = foo_git.call(\"ls-remote\", \"gerrit\", \"refs/for/master\", raises=False)\n assert remote == \"%s\\trefs/for/master\" % sha1", "metadata": "root.test_pushing_custom_ref", "header": "['module', '___EOS___']", "index": 134 }, { "content": "def test_orphaned_project(qisrc_action, git_server, record_messages):\n foo_repo = git_server.create_repo(\"foo.git\", review=True)\n qiproject_xml = \"\"\"\\\n<project version=\"3\">\n <maintainer>ORPHANED</maintainer>\n</project>\"\"\"\n git_server.push_file(\"foo.git\", \"qiproject.xml\", qiproject_xml)\n\n qisrc_action(\"init\", git_server.manifest_url)\n git_worktree = TestGitWorkTree()\n foo_proj = git_worktree.get_git_project(\"foo\")\n foo_git = TestGit(foo_proj.path)\n\n # Need to fetch gerrit remote at least once for gerrit/master to exist\n foo_git.fetch(\"--all\")\n foo_git.commit_file(\"a.txt\", \"a\")\n record_messages.reset()\n qisrc_action(\"push\", \"--project\", \"foo\")\n assert record_messages.find(\"Project is orphaned\")", "metadata": "root.test_orphaned_project", "header": "['module', '___EOS___']", "index": 148 } ]
[ { "span": "foo_repo ", "start_line": 13, "start_column": 4, "end_line": 13, "end_column": 12 }, { "span": "foo_repo ", "start_line": 29, "start_column": 4, "end_line": 29, "end_column": 12 }, { "span": "foo_repo ", "start_line": 41, "start_column": 4, "end_line": 41, "end_column": 12 }, { "span": "foo_repo ", "start_line": 53, "start_column": 4, "end_line": 53, "end_column": 12 }, { "span": "foo_repo ", "start_line": 65, "start_column": 4, "end_line": 65, "end_column": 12 }, { "span": "foo_repo ", "start_line": 77, "start_column": 4, "end_line": 77, "end_column": 12 }, { "span": "foo_repo ", "start_line": 91, "start_column": 4, "end_line": 91, "end_column": 12 }, { "span": "foo_repo ", "start_line": 122, "start_column": 4, "end_line": 122, "end_column": 12 }, { "span": "foo_repo ", "start_line": 135, "start_column": 4, "end_line": 135, "end_column": 12 }, { "span": "foo_repo ", "start_line": 149, "start_column": 4, "end_line": 149, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "not", "\\u", "under", "\\u", "code", "\\u", "review", "\\u", "ask", "\\u", "user_", "(_", "qi", "src", "\\u", "action_", ",_", "git", "\\u", "server_", ",_", "interact", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo", "\\u", "repo_", "=_", "git", "\\u", "server_", "._", "create", "\\u", "repo_", "(_", "\"", "foo", ".", "git", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "init", "\"_", ",_", "git", "\\u", "server_", "._", "manifest", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "Test", "Git", "Work", "Tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "proj_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "git", "\\u", "project_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "=_", "Test", "Git", "_", "(_", "foo", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "a", ".", "txt", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interact", "_", "._", "answers_", "=_", "[_", "False_", ",_", "True_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "sha1_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "log", "\"_", ",_", "\"-", "1", "\"_", ",_", "\"--", "pretty", "=", "%", "H", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u_", ",_", "remote_", ")_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "ls", "-", "remote", "\"_", ",_", "\"", "orig", "in", "\"_", ",_", "\"", "master", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "remote_", "!=_", "\"%", "s", "\\\\", "tre", "fs", "/", "head", "s", "/", "master", "\"_", "%_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u_", ",_", "remote_", ")_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "ls", "-", "remote", "\"_", ",_", "\"", "orig", "in", "\"_", ",_", "\"", "master", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "remote_", "==_", "\"%", "s", "\\\\", "tre", "fs", "/", "head", "s", "/", "master", "\"_", "%_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "not", "\\u", "under", "\\u", "code", "\\u", "review", "\\u", "with", "\\u", "no", "\\u", "review_", "(_", "qi", "src", "\\u", "action_", ",_", "git", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo", "\\u", "repo_", "=_", "git", "\\u", "server_", "._", "create", "\\u", "repo_", "(_", "\"", "foo", ".", "git", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "init", "\"_", ",_", "git", "\\u", "server_", "._", "manifest", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "Test", "Git", "Work", "Tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "proj_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "git", "\\u", "project_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "=_", "Test", "Git", "_", "(_", "foo", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "a", ".", "txt", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "no", "-", "review", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "sha1_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "log", "\"_", ",_", "\"-", "1", "\"_", ",_", "\"--", "pretty", "=", "%", "H", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u_", ",_", "remote_", ")_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "ls", "-", "remote", "\"_", ",_", "\"", "orig", "in", "\"_", ",_", "\"", "master", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "remote_", "==_", "\"%", "s", "\\\\", "tre", "fs", "/", "head", "s", "/", "master", "\"_", "%_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "usi", "ng", "\\u", "dash", "\\u", "y_", "(_", "qi", "src", "\\u", "action_", ",_", "git", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo", "\\u", "repo_", "=_", "git", "\\u", "server_", "._", "create", "\\u", "repo_", "(_", "\"", "foo", ".", "git", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "init", "\"_", ",_", "git", "\\u", "server_", "._", "manifest", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "Test", "Git", "Work", "Tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "proj_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "git", "\\u", "project_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "=_", "Test", "Git", "_", "(_", "foo", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "a", ".", "txt", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ",_", "\"-", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "sha1_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "log", "\"_", ",_", "\"-", "1", "\"_", ",_", "\"--", "pretty", "=", "%", "H", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u_", ",_", "remote_", ")_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "ls", "-", "remote", "\"_", ",_", "\"", "orig", "in", "\"_", ",_", "\"", "master", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "remote_", "==_", "\"%", "s", "\\\\", "tre", "fs", "/", "head", "s", "/", "master", "\"_", "%_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "publi", "sh", "\\u", "changes_", "(_", "qi", "src", "\\u", "action_", ",_", "git", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo", "\\u", "repo_", "=_", "git", "\\u", "server_", "._", "create", "\\u", "repo_", "(_", "\"", "foo", ".", "git", "\"_", ",_", "review_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "init", "\"_", ",_", "git", "\\u", "server_", "._", "manifest", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "Test", "Git", "Work", "Tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "proj_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "git", "\\u", "project_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "=_", "Test", "Git", "_", "(_", "foo", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "a", ".", "txt", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "sha1_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "log", "\"_", ",_", "\"-", "1", "\"_", ",_", "\"--", "pretty", "=", "%", "H", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u_", ",_", "remote_", ")_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "ls", "-", "remote", "\"_", ",_", "\"", "gerrit", "\"_", ",_", "\"", "refs", "/", "for", "/", "master", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "remote_", "==_", "\"%", "s", "\\\\", "tre", "fs", "/", "for", "/", "master", "\"_", "%_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "publi", "sh", "\\u", "draft", "s_", "(_", "qi", "src", "\\u", "action_", ",_", "git", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo", "\\u", "repo_", "=_", "git", "\\u", "server_", "._", "create", "\\u", "repo_", "(_", "\"", "foo", ".", "git", "\"_", ",_", "review_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "init", "\"_", ",_", "git", "\\u", "server_", "._", "manifest", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "Test", "Git", "Work", "Tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "proj_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "git", "\\u", "project_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "=_", "Test", "Git", "_", "(_", "foo", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "a", ".", "txt", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ",_", "\"--", "draft", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "sha1_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "log", "\"_", ",_", "\"-", "1", "\"_", ",_", "\"--", "pretty", "=", "%", "H", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u_", ",_", "remote_", ")_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "ls", "-", "remote", "\"_", ",_", "\"", "gerrit", "\"_", ",_", "\"", "refs", "/", "draft", "s", "/", "master", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "remote_", "==_", "\"%", "s", "\\\\", "tre", "fs", "/", "draft", "s", "/", "master", "\"_", "%_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "usi", "ng", "\\u", "carbon", "\\u", "copy_", "(_", "qi", "src", "\\u", "action_", ",_", "git", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo", "\\u", "repo_", "=_", "git", "\\u", "server_", "._", "create", "\\u", "repo_", "(_", "\"", "foo", ".", "git", "\"_", ",_", "review_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "init", "\"_", ",_", "git", "\\u", "server_", "._", "manifest", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "Test", "Git", "Work", "Tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "proj_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "git", "\\u", "project_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "=_", "Test", "Git", "_", "(_", "foo", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "fetch", " ", "gerrit", " ", "remote", " ", "at", " ", "leas", "t", " ", "onc", "e", " ", "for", " ", "gerrit", "/", "master", " ", "to", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "foo", "\\u", "git_", "._", "fetch_", "(_", "\"--", "all", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "a", ".", "txt", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "._", "object_", "(_", "qi", "sys_", "._", "command_", ",_", "\"", "call", "\"_", ")_", "as_", "mocked", "\\u", "call_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ",_", "\"--", "cc", "\"_", ",_", "\"", "jd", "oe", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "set\\u", "reviewer", "s", "\\u", "args_", "=_", "mocked", "\\u", "call_", "._", "call", "\\u", "args", "\\u", "list_", "[_", "2_", "]_", "[_", "0_", "]_", "[_", "0_", "]_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "jd", "oe", "\"_", "in_", "set\\u", "reviewer", "s", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alert", "\\u", "maintainer", "s_", "(_", "qi", "src", "\\u", "action_", ",_", "git", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo", "\\u", "repo_", "=_", "git", "\\u", "server_", "._", "create", "\\u", "repo_", "(_", "\"", "foo", ".", "git", "\"_", ",_", "review_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "project", "\\u", "xml_", "=_", "\"\"\"", "\\\\", "\\", "10", ";<", "project", " ", "format", "=\"", "3", "\">", "\\", "10", ";", " ", " ", "<", "maintainer", " ", "email", "=\"", "jd", "oe", "@", "compan", "y", ".", "com", "\">", "Joh", "n", " ", "Do", "e", "</", "maintainer", ">", "\\", "10", ";<", "/", "project", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "server_", "._", "push", "\\u", "file_", "(_", "\"", "foo", ".", "git", "\"_", ",_", "\"", "qi", "project", ".", "xml", "\"_", ",_", "qi", "project", "\\u", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "init", "\"_", ",_", "git", "\\u", "server_", "._", "manifest", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "Test", "Git", "Work", "Tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "proj_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "git", "\\u", "project_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "=_", "Test", "Git", "_", "(_", "foo", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "fetch", " ", "gerrit", " ", "remote", " ", "at", " ", "leas", "t", " ", "onc", "e", " ", "for", " ", "gerrit", "/", "master", " ", "to", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "foo", "\\u", "git_", "._", "fetch_", "(_", "\"--", "all", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "a", ".", "txt", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "._", "object_", "(_", "qi", "sys_", "._", "command_", ",_", "\"", "call", "\"_", ")_", "as_", "mocked", "\\u", "call_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "set\\u", "reviewer", "s", "\\u", "args_", "=_", "mocked", "\\u", "call_", "._", "call", "\\u", "args", "\\u", "list_", "[_", "-_", "1_", "]_", "[_", "0_", "]_", "[_", "0_", "]_", "[_", "-_", "1_", "]_", "#", " ", "Las", "t", " ", "argu", "ment", " ", "of", " ", "last", " ", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "jd", "oe", "\"_", "in_", "set\\u", "reviewer", "s", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "\"@", "compan", "y", ".", "com", "\"_", "in_", "set\\u", "reviewer", "s", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "push", "ing", "\\u", "from", "\\u", "pers", "o", "\\u", "branch_", "(_", "qi", "src", "\\u", "action_", ",_", "git", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo", "\\u", "repo_", "=_", "git", "\\u", "server_", "._", "create", "\\u", "repo_", "(_", "\"", "foo", ".", "git", "\"_", ",_", "review_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "init", "\"_", ",_", "git", "\\u", "server_", "._", "manifest", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "Test", "Git", "Work", "Tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "proj_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "git", "\\u", "project_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "=_", "Test", "Git", "_", "(_", "foo", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "checkout_", "(_", "\"-", "b", "\"_", ",_", "\"", "pers", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "a", ".", "txt", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ",_", "\"", "master", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "sha1_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "log", "\"_", ",_", "\"-", "1", "\"_", ",_", "\"--", "pretty", "=", "%", "H", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u_", ",_", "remote_", ")_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "ls", "-", "remote", "\"_", ",_", "\"", "gerrit", "\"_", ",_", "\"", "refs", "/", "for", "/", "master", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "remote_", "==_", "\"%", "s", "\\\\", "tre", "fs", "/", "for", "/", "master", "\"_", "%_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "push", "ing", "\\u", "custom", "\\u", "ref_", "(_", "qi", "src", "\\u", "action_", ",_", "git", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo", "\\u", "repo_", "=_", "git", "\\u", "server_", "._", "create", "\\u", "repo_", "(_", "\"", "foo", ".", "git", "\"_", ",_", "review_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "init", "\"_", ",_", "git", "\\u", "server_", "._", "manifest", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "Test", "Git", "Work", "Tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "proj_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "git", "\\u", "project_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "=_", "Test", "Git", "_", "(_", "foo", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "checkout_", "(_", "\"-", "b", "\"_", ",_", "\"", "pers", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "a", ".", "txt", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "sha1_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "log", "\"_", ",_", "\"-", "1", "\"_", ",_", "\"--", "pretty", "=", "%", "H", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "b", ".", "txt", "\"_", ",_", "\"", "b", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ",_", "\"", "HEAD", "~", "1", ":", "master", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u_", ",_", "remote_", ")_", "=_", "foo", "\\u", "git_", "._", "call_", "(_", "\"", "ls", "-", "remote", "\"_", ",_", "\"", "gerrit", "\"_", ",_", "\"", "refs", "/", "for", "/", "master", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "remote_", "==_", "\"%", "s", "\\\\", "tre", "fs", "/", "for", "/", "master", "\"_", "%_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "orphan", "ed", "\\u", "project_", "(_", "qi", "src", "\\u", "action_", ",_", "git", "\\u", "server_", ",_", "record", "\\u", "messages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo", "\\u", "repo_", "=_", "git", "\\u", "server_", "._", "create", "\\u", "repo_", "(_", "\"", "foo", ".", "git", "\"_", ",_", "review_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "project", "\\u", "xml_", "=_", "\"\"\"", "\\\\", "\\", "10", ";<", "project", " ", "version", "=\"", "3", "\">", "\\", "10", ";", " ", " ", "<", "maintainer", ">", "OR", "PHA", "NED", "</", "maintainer", ">", "\\", "10", ";<", "/", "project", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "server_", "._", "push", "\\u", "file_", "(_", "\"", "foo", ".", "git", "\"_", ",_", "\"", "qi", "project", ".", "xml", "\"_", ",_", "qi", "project", "\\u", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "init", "\"_", ",_", "git", "\\u", "server_", "._", "manifest", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "Test", "Git", "Work", "Tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "proj_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "git", "\\u", "project_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "=_", "Test", "Git", "_", "(_", "foo", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "fetch", " ", "gerrit", " ", "remote", " ", "at", " ", "leas", "t", " ", "onc", "e", " ", "for", " ", "gerrit", "/", "master", " ", "to", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "foo", "\\u", "git_", "._", "fetch_", "(_", "\"--", "all", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "git_", "._", "commit", "\\u", "file_", "(_", "\"", "a", ".", "txt", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "\\u", "messages_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "src", "\\u", "action_", "(_", "\"", "push", "\"_", ",_", "\"--", "project", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "record", "\\u", "messages_", "._", "find_", "(_", "\"", "Project", " ", "is", " ", "orphan", "ed", "\"_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Imprecise assert
gbeced/pyalgotrade/testcases/returns_analyzer_test.py
[ { "content": " def testBuyAndSellWin(self):\n posTracker = returns.PositionTracker(broker.IntegerTraits())\n posTracker.buy(1, 10)\n self.assertEqual(posTracker.getAvgPrice(), 10)\n posTracker.sell(1, 11)\n self.assertEqual(posTracker.getAvgPrice(), 0)\n self.assertEqual(posTracker.getPnL(), 1)\n self.assertTrue(posTracker.getReturn() == 0.1)", "metadata": "root.PosTrackerTestCase.testBuyAndSellWin", "header": "['class', 'PosTrackerTestCase', '(', 'common', '.', 'TestCase', ')', ':', '___EOS___']", "index": 90 }, { "content": " def testOneBarReturn(self):\n initialCash = 1000\n barFeed = yahoofeed.Feed()\n barFeed.setBarFilter(csvfeed.DateRangeFilter(datetime.datetime(2001, 12, 07), datetime.datetime(2001, 12, 07)))\n barFeed.addBarsFromCSV(AnalyzerTestCase.TestInstrument, common.get_data_file_path(\"orcl-2001-yahoofinance.csv\"))\n strat = strategy_test.TestStrategy(barFeed, initialCash)\n\n # 2001-12-07,15.74,15.95,15.55,15.91,42463200,15.56\n # Manually place the orders to get them filled on the first (and only) bar.\n order = strat.getBroker().createMarketOrder(broker.Order.Action.BUY, AnalyzerTestCase.TestInstrument, 1, False) # Open: 15.74\n strat.getBroker().submitOrder(order)\n order = strat.getBroker().createMarketOrder(broker.Order.Action.SELL, AnalyzerTestCase.TestInstrument, 1, True) # Close: 15.91\n strat.getBroker().submitOrder(order)\n\n stratAnalyzer = returns.Returns()\n strat.attachAnalyzer(stratAnalyzer)\n strat.run()\n self.assertTrue(strat.getBroker().getCash() == initialCash + (15.91 - 15.74))\n\n finalValue = 1000 - 15.74 + 15.91\n rets = (finalValue - initialCash) / float(initialCash)\n self.assertEqual(stratAnalyzer.getReturns()[-1], rets)", "metadata": "root.AnalyzerTestCase.testOneBarReturn", "header": "['class', 'AnalyzerTestCase', '(', 'common', '.', 'TestCase', ')', ':', '___EOS___']", "index": 275 }, { "content": " def testTwoBarReturns_OpenOpen(self):\n initialCash = 15.61\n barFeed = yahoofeed.Feed()\n barFeed.setBarFilter(csvfeed.DateRangeFilter(datetime.datetime(2001, 12, 06), datetime.datetime(2001, 12, 07)))\n barFeed.addBarsFromCSV(AnalyzerTestCase.TestInstrument, common.get_data_file_path(\"orcl-2001-yahoofinance.csv\"))\n strat = strategy_test.TestStrategy(barFeed, initialCash)\n\n # 2001-12-06,15.61,16.03,15.50,15.90,66944900,15.55\n # 2001-12-07,15.74,15.95,15.55,15.91,42463200,15.56\n # Manually place the entry order, to get it filled on the first bar.\n order = strat.getBroker().createMarketOrder(broker.Order.Action.BUY, AnalyzerTestCase.TestInstrument, 1, False) # Open: 15.61\n strat.getBroker().submitOrder(order)\n strat.addOrder(datetime.datetime(2001, 12, 06), strat.getBroker().createMarketOrder, broker.Order.Action.SELL, AnalyzerTestCase.TestInstrument, 1, False) # Open: 15.74\n\n stratAnalyzer = returns.Returns()\n strat.attachAnalyzer(stratAnalyzer)\n strat.run()\n self.assertTrue(strat.getBroker().getCash() == initialCash + (15.74 - 15.61))\n # First day returns: Open vs Close\n self.assertTrue(stratAnalyzer.getReturns()[0] == (15.90 - 15.61) / 15.61)\n # Second day returns: Open vs Prev. day's close\n self.assertTrue(stratAnalyzer.getReturns()[1] == (15.74 - 15.90) / 15.90)", "metadata": "root.AnalyzerTestCase.testTwoBarReturns_OpenOpen", "header": "['class', 'AnalyzerTestCase', '(', 'common', '.', 'TestCase', ')', ':', '___EOS___']", "index": 298 }, { "content": " def testTwoBarReturns_OpenClose(self):\n initialCash = 15.61\n barFeed = yahoofeed.Feed()\n barFeed.setBarFilter(csvfeed.DateRangeFilter(datetime.datetime(2001, 12, 06), datetime.datetime(2001, 12, 07)))\n barFeed.addBarsFromCSV(AnalyzerTestCase.TestInstrument, common.get_data_file_path(\"orcl-2001-yahoofinance.csv\"))\n strat = strategy_test.TestStrategy(barFeed, initialCash)\n\n # 2001-12-06,15.61,16.03,15.50,15.90,66944900,15.55\n # 2001-12-07,15.74,15.95,15.55,15.91,42463200,15.56\n # Manually place the entry order, to get it filled on the first bar.\n order = strat.getBroker().createMarketOrder(broker.Order.Action.BUY, AnalyzerTestCase.TestInstrument, 1, False) # Open: 15.61\n strat.getBroker().submitOrder(order)\n strat.addOrder(datetime.datetime(2001, 12, 06), strat.getBroker().createMarketOrder, broker.Order.Action.SELL, AnalyzerTestCase.TestInstrument, 1, True) # Close: 15.91\n\n stratAnalyzer = returns.Returns()\n strat.attachAnalyzer(stratAnalyzer)\n strat.run()\n self.assertTrue(strat.getBroker().getCash() == initialCash + (15.91 - 15.61))\n # First day returns: Open vs Close\n self.assertTrue(stratAnalyzer.getReturns()[0] == (15.90 - 15.61) / 15.61)\n # Second day returns: Close vs Prev. day's close\n self.assertTrue(stratAnalyzer.getReturns()[1] == (15.91 - 15.90) / 15.90)", "metadata": "root.AnalyzerTestCase.testTwoBarReturns_OpenClose", "header": "['class', 'AnalyzerTestCase', '(', 'common', '.', 'TestCase', ')', ':', '___EOS___']", "index": 321 }, { "content": " def testTwoBarReturns_CloseOpen(self):\n initialCash = 15.9\n barFeed = yahoofeed.Feed()\n barFeed.setBarFilter(csvfeed.DateRangeFilter(datetime.datetime(2001, 12, 06), datetime.datetime(2001, 12, 07)))\n barFeed.addBarsFromCSV(AnalyzerTestCase.TestInstrument, common.get_data_file_path(\"orcl-2001-yahoofinance.csv\"))\n strat = strategy_test.TestStrategy(barFeed, initialCash)\n\n # 2001-12-06,15.61,16.03,15.50,15.90,66944900,15.55\n # 2001-12-07,15.74,15.95,15.55,15.91,42463200,15.56\n # Manually place the entry order, to get it filled on the first bar.\n order = strat.getBroker().createMarketOrder(broker.Order.Action.BUY, AnalyzerTestCase.TestInstrument, 1, True) # Close: 15.90\n strat.getBroker().submitOrder(order)\n strat.addOrder(datetime.datetime(2001, 12, 06), strat.getBroker().createMarketOrder, broker.Order.Action.SELL, AnalyzerTestCase.TestInstrument, 1, False) # Open: 15.74\n\n stratAnalyzer = returns.Returns()\n strat.attachAnalyzer(stratAnalyzer)\n strat.run()\n self.assertTrue(strat.getBroker().getCash() == initialCash + (15.74 - 15.90))\n # First day returns: 0\n self.assertTrue(stratAnalyzer.getReturns()[0] == 0)\n # Second day returns: Open vs Prev. day's close\n self.assertTrue(stratAnalyzer.getReturns()[1] == (15.74 - 15.90) / 15.90)", "metadata": "root.AnalyzerTestCase.testTwoBarReturns_CloseOpen", "header": "['class', 'AnalyzerTestCase', '(', 'common', '.', 'TestCase', ')', ':', '___EOS___']", "index": 344 }, { "content": " def testTwoBarReturns_CloseClose(self):\n initialCash = 15.90\n barFeed = yahoofeed.Feed()\n barFeed.setBarFilter(csvfeed.DateRangeFilter(datetime.datetime(2001, 12, 06), datetime.datetime(2001, 12, 07)))\n barFeed.addBarsFromCSV(AnalyzerTestCase.TestInstrument, common.get_data_file_path(\"orcl-2001-yahoofinance.csv\"))\n strat = strategy_test.TestStrategy(barFeed, initialCash)\n\n # 2001-12-06,15.61,16.03,15.50,15.90,66944900,15.55\n # 2001-12-07,15.74,15.95,15.55,15.91,42463200,15.56\n # Manually place the entry order, to get it filled on the first bar.\n order = strat.getBroker().createMarketOrder(broker.Order.Action.BUY, AnalyzerTestCase.TestInstrument, 1, True) # Close: 15.90\n strat.getBroker().submitOrder(order)\n strat.addOrder(datetime.datetime(2001, 12, 06), strat.getBroker().createMarketOrder, broker.Order.Action.SELL, AnalyzerTestCase.TestInstrument, 1, True) # Close: 15.91\n\n stratAnalyzer = returns.Returns()\n strat.attachAnalyzer(stratAnalyzer)\n strat.run()\n self.assertTrue(strat.getBroker().getCash() == initialCash + (15.91 - 15.90))\n # First day returns: 0\n self.assertTrue(stratAnalyzer.getReturns()[0] == 0)\n # Second day returns: Open vs Prev. day's close\n self.assertTrue(stratAnalyzer.getReturns()[1] == (15.91 - 15.90) / 15.90)", "metadata": "root.AnalyzerTestCase.testTwoBarReturns_CloseClose", "header": "['class', 'AnalyzerTestCase', '(', 'common', '.', 'TestCase', ')', ':', '___EOS___']", "index": 367 }, { "content": " def testCumulativeReturn(self):\n initialCash = 33.06\n barFeed = yahoofeed.Feed()\n barFeed.addBarsFromCSV(AnalyzerTestCase.TestInstrument, common.get_data_file_path(\"orcl-2001-yahoofinance.csv\"))\n strat = position_test.TestStrategy(barFeed, AnalyzerTestCase.TestInstrument, initialCash)\n\n strat.addPosEntry(datetime.datetime(2001, 1, 12), strat.enterLong, AnalyzerTestCase.TestInstrument, 1) # 33.06\n strat.addPosExitMarket(datetime.datetime(2001, 11, 27)) # 14.32\n\n stratAnalyzer = returns.Returns()\n strat.attachAnalyzer(stratAnalyzer)\n strat.run()\n self.assertTrue(round(strat.getBroker().getCash(), 2) == round(initialCash + (14.32 - 33.06), 2))\n self.assertTrue(round(33.06 * (1 + stratAnalyzer.getCumulativeReturns()[-1]), 2) == 14.32)", "metadata": "root.AnalyzerTestCase.testCumulativeReturn", "header": "['class', 'AnalyzerTestCase', '(', 'common', '.', 'TestCase', ')', ':', '___EOS___']", "index": 390 } ]
[ { "span": "self.assertTrue(posTracker.getReturn() == 0.1)", "start_line": 97, "start_column": 8, "end_line": 97, "end_column": 54 }, { "span": "self.assertTrue(strat.getBroker().getCash() == initialCash + (15.91 - 15.74))", "start_line": 292, "start_column": 8, "end_line": 292, "end_column": 85 }, { "span": "self.assertTrue(strat.getBroker().getCash() == initialCash + (15.74 - 15.61))", "start_line": 315, "start_column": 8, "end_line": 315, "end_column": 85 }, { "span": "self.assertTrue(stratAnalyzer.getReturns()[0] == (15.90 - 15.61) / 15.61)", "start_line": 317, "start_column": 8, "end_line": 317, "end_column": 81 }, { "span": "self.assertTrue(stratAnalyzer.getReturns()[1] == (15.74 - 15.90) / 15.90)", "start_line": 319, "start_column": 8, "end_line": 319, "end_column": 81 }, { "span": "self.assertTrue(strat.getBroker().getCash() == initialCash + (15.91 - 15.61))", "start_line": 338, "start_column": 8, "end_line": 338, "end_column": 85 }, { "span": "self.assertTrue(stratAnalyzer.getReturns()[0] == (15.90 - 15.61) / 15.61)", "start_line": 340, "start_column": 8, "end_line": 340, "end_column": 81 }, { "span": "self.assertTrue(stratAnalyzer.getReturns()[1] == (15.91 - 15.90) / 15.90)", "start_line": 342, "start_column": 8, "end_line": 342, "end_column": 81 }, { "span": "self.assertTrue(strat.getBroker().getCash() == initialCash + (15.74 - 15.90))", "start_line": 361, "start_column": 8, "end_line": 361, "end_column": 85 }, { "span": "self.assertTrue(stratAnalyzer.getReturns()[0] == 0)", "start_line": 363, "start_column": 8, "end_line": 363, "end_column": 59 }, { "span": "self.assertTrue(stratAnalyzer.getReturns()[1] == (15.74 - 15.90) / 15.90)", "start_line": 365, "start_column": 8, "end_line": 365, "end_column": 81 }, { "span": "self.assertTrue(strat.getBroker().getCash() == initialCash + (15.91 - 15.90))", "start_line": 384, "start_column": 8, "end_line": 384, "end_column": 85 }, { "span": "self.assertTrue(stratAnalyzer.getReturns()[0] == 0)", "start_line": 386, "start_column": 8, "end_line": 386, "end_column": 59 }, { "span": "self.assertTrue(stratAnalyzer.getReturns()[1] == (15.91 - 15.90) / 15.90)", "start_line": 388, "start_column": 8, "end_line": 388, "end_column": 81 }, { "span": "self.assertTrue(round(strat.getBroker().getCash(), 2) == round(initialCash + (14.32 - 33.06), 2))", "start_line": 402, "start_column": 8, "end_line": 402, "end_column": 105 }, { "span": "self.assertTrue(round(33.06 * (1 + stratAnalyzer.getCumulativeReturns()[-1]), 2) == 14.32)", "start_line": 403, "start_column": 8, "end_line": 403, "end_column": 98 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Pos", "Track", "er", "Test", "Case_", "(_", "common_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Bu", "y", "And", "Sell", "Win_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos", "Tracker_", "=_", "returns_", "._", "Position", "Tracker_", "(_", "broker_", "._", "Integer", "Trait", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos", "Tracker_", "._", "buy", "_", "(_", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pos", "Tracker_", "._", "get", "Av", "g", "Price_", "(_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos", "Tracker_", "._", "sell", "_", "(_", "1_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pos", "Tracker_", "._", "get", "Av", "g", "Price_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pos", "Tracker_", "._", "get", "Pn", "L_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "pos", "Tracker_", "._", "get", "Return_", "(_", ")_", "==_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Analy", "zer", "Test", "Case_", "(_", "common_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test", "One", "Bar", "Return_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "Cas", "h_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "=_", "ya", "hoo", "feed_", "._", "Feed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "set", "Bar", "Filter_", "(_", "csv", "feed_", "._", "Date", "Range", "Filter_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "7_", ")_", ",_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "7_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "add", "Bar", "s", "Fro", "m", "CSV_", "(_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "common_", "._", "get", "\\u", "data\\u", "file", "\\u", "path_", "(_", "\"", "orc", "l", "-", "200", "1", "-", "ya", "hoo", "finance", ".", "csv", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "=_", "strat", "eg", "y", "\\u", "test_", "._", "Test", "Strategy_", "(_", "bar", "Feed_", ",_", "initial", "Cas", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "7", ",", "15.", "7", "4", ",", "15.", "9", "5", ",", "15.", "5", "5", ",", "15.", "9", "1", ",", "424", "632", "00", ",", "15.", "56_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Manu", "ally", " ", "place", " ", "the", " ", "order", "s", " ", "to", " ", "get", " ", "them", " ", "filled", " ", "on", " ", "the", " ", "first", " ", "(", "and", " ", "only", ")", " ", "bar", "._", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "create", "Market", "Order_", "(_", "broker_", "._", "Order_", "._", "Action_", "._", "BU", "Y_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ",_", "False_", ")_", "#", " ", "Open", ":", " ", "15.", "74_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "submit", "Order_", "(_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "create", "Market", "Order_", "(_", "broker_", "._", "Order_", "._", "Action_", "._", "SEL", "L_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ",_", "True_", ")_", "#", " ", "Clos", "e", ":", " ", "15.", "91_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "submit", "Order_", "(_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strat", "Analyzer_", "=_", "returns_", "._", "Return", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "attach", "Analyzer_", "(_", "strat", "Analyzer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "get", "Cas", "h_", "(_", ")_", "==_", "initial", "Cas", "h_", "+_", "(_", "15.", "91_", "-_", "15.", "74_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "final", "Value_", "=_", "1000_", "-_", "15.", "74_", "+_", "15.", "91_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rets", "_", "=_", "(_", "final", "Value_", "-_", "initial", "Cas", "h_", ")_", "/_", "float_", "(_", "initial", "Cas", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "strat", "Analyzer_", "._", "get", "Return", "s_", "(_", ")_", "[_", "-_", "1_", "]_", ",_", "rets", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Analy", "zer", "Test", "Case_", "(_", "common_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Tw", "o", "Bar", "Return", "s", "\\u", "Open", "Open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "Cas", "h_", "=_", "15.", "61_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "=_", "ya", "hoo", "feed_", "._", "Feed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "set", "Bar", "Filter_", "(_", "csv", "feed_", "._", "Date", "Range", "Filter_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "6_", ")_", ",_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "7_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "add", "Bar", "s", "Fro", "m", "CSV_", "(_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "common_", "._", "get", "\\u", "data\\u", "file", "\\u", "path_", "(_", "\"", "orc", "l", "-", "200", "1", "-", "ya", "hoo", "finance", ".", "csv", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "=_", "strat", "eg", "y", "\\u", "test_", "._", "Test", "Strategy_", "(_", "bar", "Feed_", ",_", "initial", "Cas", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "6", ",", "15.", "6", "1", ",", "16.", "03", ",", "15.", "50", ",", "15.", "90", ",", "669", "449", "00", ",", "15.", "55_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "7", ",", "15.", "7", "4", ",", "15.", "9", "5", ",", "15.", "5", "5", ",", "15.", "9", "1", ",", "424", "632", "00", ",", "15.", "56_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Manu", "ally", " ", "place", " ", "the", " ", "entry", " ", "order", ",", " ", "to", " ", "get", " ", "it", " ", "filled", " ", "on", " ", "the", " ", "first", " ", "bar", "._", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "create", "Market", "Order_", "(_", "broker_", "._", "Order_", "._", "Action_", "._", "BU", "Y_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ",_", "False_", ")_", "#", " ", "Open", ":", " ", "15.", "61_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "submit", "Order_", "(_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "add", "Order_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "6_", ")_", ",_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "create", "Market", "Order_", ",_", "broker_", "._", "Order_", "._", "Action_", "._", "SEL", "L_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ",_", "False_", ")_", "#", " ", "Open", ":", " ", "15.", "74_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strat", "Analyzer_", "=_", "returns_", "._", "Return", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "attach", "Analyzer_", "(_", "strat", "Analyzer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "get", "Cas", "h_", "(_", ")_", "==_", "initial", "Cas", "h_", "+_", "(_", "15.", "74_", "-_", "15.", "61_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "day", " ", "return", "s", ":", " ", "Open", " ", "vs", " ", "Close_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "Analyzer_", "._", "get", "Return", "s_", "(_", ")_", "[_", "0_", "]_", "==_", "(_", "15.", "90_", "-_", "15.", "61_", ")_", "/_", "15.", "61_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Second", " ", "day", " ", "return", "s", ":", " ", "Open", " ", "vs", " ", "Prev", ".", " ", "day", "'", "s", " ", "close_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "Analyzer_", "._", "get", "Return", "s_", "(_", ")_", "[_", "1_", "]_", "==_", "(_", "15.", "74_", "-_", "15.", "90_", ")_", "/_", "15.", "90_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Analy", "zer", "Test", "Case_", "(_", "common_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Tw", "o", "Bar", "Return", "s", "\\u", "Open", "Close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "Cas", "h_", "=_", "15.", "61_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "=_", "ya", "hoo", "feed_", "._", "Feed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "set", "Bar", "Filter_", "(_", "csv", "feed_", "._", "Date", "Range", "Filter_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "6_", ")_", ",_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "7_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "add", "Bar", "s", "Fro", "m", "CSV_", "(_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "common_", "._", "get", "\\u", "data\\u", "file", "\\u", "path_", "(_", "\"", "orc", "l", "-", "200", "1", "-", "ya", "hoo", "finance", ".", "csv", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "=_", "strat", "eg", "y", "\\u", "test_", "._", "Test", "Strategy_", "(_", "bar", "Feed_", ",_", "initial", "Cas", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "6", ",", "15.", "6", "1", ",", "16.", "03", ",", "15.", "50", ",", "15.", "90", ",", "669", "449", "00", ",", "15.", "55_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "7", ",", "15.", "7", "4", ",", "15.", "9", "5", ",", "15.", "5", "5", ",", "15.", "9", "1", ",", "424", "632", "00", ",", "15.", "56_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Manu", "ally", " ", "place", " ", "the", " ", "entry", " ", "order", ",", " ", "to", " ", "get", " ", "it", " ", "filled", " ", "on", " ", "the", " ", "first", " ", "bar", "._", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "create", "Market", "Order_", "(_", "broker_", "._", "Order_", "._", "Action_", "._", "BU", "Y_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ",_", "False_", ")_", "#", " ", "Open", ":", " ", "15.", "61_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "submit", "Order_", "(_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "add", "Order_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "6_", ")_", ",_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "create", "Market", "Order_", ",_", "broker_", "._", "Order_", "._", "Action_", "._", "SEL", "L_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ",_", "True_", ")_", "#", " ", "Clos", "e", ":", " ", "15.", "91_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strat", "Analyzer_", "=_", "returns_", "._", "Return", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "attach", "Analyzer_", "(_", "strat", "Analyzer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "get", "Cas", "h_", "(_", ")_", "==_", "initial", "Cas", "h_", "+_", "(_", "15.", "91_", "-_", "15.", "61_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "day", " ", "return", "s", ":", " ", "Open", " ", "vs", " ", "Close_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "Analyzer_", "._", "get", "Return", "s_", "(_", ")_", "[_", "0_", "]_", "==_", "(_", "15.", "90_", "-_", "15.", "61_", ")_", "/_", "15.", "61_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Second", " ", "day", " ", "return", "s", ":", " ", "Clos", "e", " ", "vs", " ", "Prev", ".", " ", "day", "'", "s", " ", "close_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "Analyzer_", "._", "get", "Return", "s_", "(_", ")_", "[_", "1_", "]_", "==_", "(_", "15.", "91_", "-_", "15.", "90_", ")_", "/_", "15.", "90_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Analy", "zer", "Test", "Case_", "(_", "common_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Tw", "o", "Bar", "Return", "s", "\\u", "Clos", "e", "Open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "Cas", "h_", "=_", "15.", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "=_", "ya", "hoo", "feed_", "._", "Feed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "set", "Bar", "Filter_", "(_", "csv", "feed_", "._", "Date", "Range", "Filter_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "6_", ")_", ",_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "7_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "add", "Bar", "s", "Fro", "m", "CSV_", "(_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "common_", "._", "get", "\\u", "data\\u", "file", "\\u", "path_", "(_", "\"", "orc", "l", "-", "200", "1", "-", "ya", "hoo", "finance", ".", "csv", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "=_", "strat", "eg", "y", "\\u", "test_", "._", "Test", "Strategy_", "(_", "bar", "Feed_", ",_", "initial", "Cas", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "6", ",", "15.", "6", "1", ",", "16.", "03", ",", "15.", "50", ",", "15.", "90", ",", "669", "449", "00", ",", "15.", "55_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "7", ",", "15.", "7", "4", ",", "15.", "9", "5", ",", "15.", "5", "5", ",", "15.", "9", "1", ",", "424", "632", "00", ",", "15.", "56_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Manu", "ally", " ", "place", " ", "the", " ", "entry", " ", "order", ",", " ", "to", " ", "get", " ", "it", " ", "filled", " ", "on", " ", "the", " ", "first", " ", "bar", "._", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "create", "Market", "Order_", "(_", "broker_", "._", "Order_", "._", "Action_", "._", "BU", "Y_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ",_", "True_", ")_", "#", " ", "Clos", "e", ":", " ", "15.", "90_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "submit", "Order_", "(_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "add", "Order_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "6_", ")_", ",_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "create", "Market", "Order_", ",_", "broker_", "._", "Order_", "._", "Action_", "._", "SEL", "L_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ",_", "False_", ")_", "#", " ", "Open", ":", " ", "15.", "74_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strat", "Analyzer_", "=_", "returns_", "._", "Return", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "attach", "Analyzer_", "(_", "strat", "Analyzer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "get", "Cas", "h_", "(_", ")_", "==_", "initial", "Cas", "h_", "+_", "(_", "15.", "74_", "-_", "15.", "90_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "day", " ", "return", "s", ":", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "Analyzer_", "._", "get", "Return", "s_", "(_", ")_", "[_", "0_", "]_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Second", " ", "day", " ", "return", "s", ":", " ", "Open", " ", "vs", " ", "Prev", ".", " ", "day", "'", "s", " ", "close_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "Analyzer_", "._", "get", "Return", "s_", "(_", ")_", "[_", "1_", "]_", "==_", "(_", "15.", "74_", "-_", "15.", "90_", ")_", "/_", "15.", "90_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Analy", "zer", "Test", "Case_", "(_", "common_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Tw", "o", "Bar", "Return", "s", "\\u", "Clos", "e", "Close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "Cas", "h_", "=_", "15.", "90_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "=_", "ya", "hoo", "feed_", "._", "Feed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "set", "Bar", "Filter_", "(_", "csv", "feed_", "._", "Date", "Range", "Filter_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "6_", ")_", ",_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "7_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "add", "Bar", "s", "Fro", "m", "CSV_", "(_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "common_", "._", "get", "\\u", "data\\u", "file", "\\u", "path_", "(_", "\"", "orc", "l", "-", "200", "1", "-", "ya", "hoo", "finance", ".", "csv", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "=_", "strat", "eg", "y", "\\u", "test_", "._", "Test", "Strategy_", "(_", "bar", "Feed_", ",_", "initial", "Cas", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "6", ",", "15.", "6", "1", ",", "16.", "03", ",", "15.", "50", ",", "15.", "90", ",", "669", "449", "00", ",", "15.", "55_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "7", ",", "15.", "7", "4", ",", "15.", "9", "5", ",", "15.", "5", "5", ",", "15.", "9", "1", ",", "424", "632", "00", ",", "15.", "56_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Manu", "ally", " ", "place", " ", "the", " ", "entry", " ", "order", ",", " ", "to", " ", "get", " ", "it", " ", "filled", " ", "on", " ", "the", " ", "first", " ", "bar", "._", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "create", "Market", "Order_", "(_", "broker_", "._", "Order_", "._", "Action_", "._", "BU", "Y_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ",_", "True_", ")_", "#", " ", "Clos", "e", ":", " ", "15.", "90_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "submit", "Order_", "(_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "add", "Order_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "12_", ",_", "0_", "6_", ")_", ",_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "create", "Market", "Order_", ",_", "broker_", "._", "Order_", "._", "Action_", "._", "SEL", "L_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ",_", "True_", ")_", "#", " ", "Clos", "e", ":", " ", "15.", "91_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strat", "Analyzer_", "=_", "returns_", "._", "Return", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "attach", "Analyzer_", "(_", "strat", "Analyzer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "get", "Cas", "h_", "(_", ")_", "==_", "initial", "Cas", "h_", "+_", "(_", "15.", "91_", "-_", "15.", "90_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "day", " ", "return", "s", ":", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "Analyzer_", "._", "get", "Return", "s_", "(_", ")_", "[_", "0_", "]_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Second", " ", "day", " ", "return", "s", ":", " ", "Open", " ", "vs", " ", "Prev", ".", " ", "day", "'", "s", " ", "close_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "strat", "Analyzer_", "._", "get", "Return", "s_", "(_", ")_", "[_", "1_", "]_", "==_", "(_", "15.", "91_", "-_", "15.", "90_", ")_", "/_", "15.", "90_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Analy", "zer", "Test", "Case_", "(_", "common_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Cum", "ulati", "ve", "Return_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "Cas", "h_", "=_", "33.", "06_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "=_", "ya", "hoo", "feed_", "._", "Feed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar", "Feed_", "._", "add", "Bar", "s", "Fro", "m", "CSV_", "(_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "common_", "._", "get", "\\u", "data\\u", "file", "\\u", "path_", "(_", "\"", "orc", "l", "-", "200", "1", "-", "ya", "hoo", "finance", ".", "csv", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "=_", "position", "\\u", "test_", "._", "Test", "Strategy_", "(_", "bar", "Feed_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "initial", "Cas", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strat", "_", "._", "add", "Pos", "Entry_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "1_", ",_", "12_", ")_", ",_", "strat", "_", "._", "enter", "Long_", ",_", "Analy", "zer", "Test", "Case_", "._", "Test", "Instrument_", ",_", "1_", ")_", "#", " ", "33.", "06_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "add", "Pos", "Exi", "t", "Market", "_", "(_", "datetime_", "._", "datetime_", "(_", "2001_", ",_", "11_", ",_", "27_", ")_", ")_", "#", " ", "14.", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strat", "Analyzer_", "=_", "returns_", "._", "Return", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "attach", "Analyzer_", "(_", "strat", "Analyzer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strat", "_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "round_", "(_", "strat", "_", "._", "get", "Broker", "_", "(_", ")_", "._", "get", "Cas", "h_", "(_", ")_", ",_", "2_", ")_", "==_", "round_", "(_", "initial", "Cas", "h_", "+_", "(_", "14.", "32_", "-_", "33.", "06_", ")_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "round_", "(_", "33.", "06_", "*_", "(_", "1_", "+_", "strat", "Analyzer_", "._", "get", "Cum", "ulati", "ve", "Return", "s_", "(_", ")_", "[_", "-_", "1_", "]_", ")_", ",_", "2_", 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
algorhythms/HackerRankAlgorithms/Cutting boards.py
[ { "content": "\"\"\"\nlice gives a wooden board composed of M X N wooden square pieces to Bob and asks him to find the minimal cost of\nbreaking the board into square wooden pieces. Bob can cut the board along horizontal and vertical lines, and each cut\ndivides the board in smaller parts. Each cut has a cost depending on whether the cut is made along a horizontal or a\nvertical line.\n\nLet us denote the costs of cutting it along consecutive vertical lines with x1, x2, ..., xn-1, and the cost of cutting\nit along horizontal lines with y1, y2, ..., ym-1. If a cut (of cost c) is made and it passes through n segments, then\ntotal cost of this cut will be n*c.\n\nThe cost of cutting the whole board into single squares is the sum of the cost of successive cuts used to cut the whole\nboard into square wooden pieces of size 1x1. Bob should compute the minimal cost of breaking the whole wooden board into\nsquares of size 1x1.\n\nBob needs your help to find the minimal cost. Can you help Bob with this challenge?\n\nInput Format\nA single integer in the first line T, stating the number of test cases. T testcases follow.\nFor each test case, the first line contains two positive integers M and N separated by a single space. In the next line,\nthere are integers y1, y2, ..., ym-1, separated by spaces. Following them are integers x1, x2, ..., xn-1, separated by\nspaces.\n\"\"\"\nMOD = 10 ** 9 + 7\n__author__ = 'Danyang'\n\n\n\n\n\n\nif __name__ == \"__main__\":\n import sys\n\n f = open(\"1.in\", \"r\")\n # f = sys.stdin\n testcases = int(f.readline().strip())\n\n for t in xrange(testcases):\n # construct cipher\n M, N = map(int, f.readline().strip().split(\" \"))\n Y = map(int, f.readline().strip().split(\" \"))\n X = map(int, f.readline().strip().split(\" \"))\n cipher = [M, N, Y, X]\n # solve\n s = \"%s\\n\" % (Solution().solve(cipher))\n print s,\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Cost(object):\n", "metadata": "root.Cost", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def __init__(self):\n self.cost = 0", "metadata": "root.Cost.__init__", "header": "['class', 'Cost', '(', 'object', ')', ':', '___EOS___']", "index": 27 }, { "content": " def __iadd__(self, other):\n self.cost = (self.cost + other % MOD) % MOD\n return self", "metadata": "root.Cost.__iadd__", "header": "['class', 'Cost', '(', 'object', ')', ':', '___EOS___']", "index": 30 }, { "content": "class Solution(object):", "metadata": "root.Solution", "header": "['module', '___EOS___']", "index": 35 }, { "content": " def solve(self, cipher):\n \"\"\"\n Greedy approach\n\n Fixed #6 - #11 Wrong Answer due to Cost class\n :param cipher: the cipher\n \"\"\"\n M, N, Y, X = cipher\n\n y = list(Y)\n x = list(X)\n\n y.sort()\n x.sort()\n cost = Cost()\n while x and y:\n x_max = x[-1]\n y_max = y[-1]\n if x_max > y_max:\n cost += x.pop() * (M - len(y))\n elif y_max > x_max:\n cost += y.pop() * (N - len(x))\n else:\n if sum(x) > sum(y):\n cost += x.pop() * (M - len(y))\n else:\n cost += y.pop() * (N - len(x))\n while x:\n cost += x.pop() * (M - len(y))\n while y:\n cost += y.pop() * (N - len(x))\n return cost.cost", "metadata": "root.Solution.solve", "header": "['class', 'Solution', '(', 'object', ')', ':', '___EOS___']", "index": 36 } ]
[ { "span": "import sys", "start_line": 71, "start_column": 4, "end_line": 71, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "lice", " ", "give", "s", " ", "a", " ", "wood", "en", " ", "board", " ", "compose", "d", " ", "of", " ", "M", " ", "X", " ", "N", " ", "wood", "en", " ", "square", " ", "piece", "s", " ", "to", " ", "Bob", " ", "and", " ", "asks", " ", "him", " ", "to", " ", "find", " ", "the", " ", "minima", "l", " ", "cost", " ", "of", "\\", "10", ";", "break", "ing", " ", "the", " ", "board", " ", "int", "o", " ", "square", " ", "wood", "en", " ", "piece", "s", ".", " ", "Bob", " ", "can", " ", "cut", " ", "the", " ", "board", " ", "along", " ", "horizon", "tal", " ", "and", " ", "vertical", " ", "lines", ",", " ", "and", " ", "each", " ", "cut", "\\", "10", ";", "divide", "s", " ", "the", " ", "board", " ", "in", " ", "small", "er", " ", "part", "s", ".", " ", "Ea", "ch", " ", "cut", " ", "has", " ", "a", " ", "cost", " ", "depend", "ing", " ", "on", " ", "whe", "ther", " ", "the", " ", "cut", " ", "is", " ", "made", " ", "along", " ", "a", " ", "horizon", "tal", " ", "or", " ", "a", "\\", "10", ";", "vertical", " ", "line", ".", "\\", "10", ";", "\\", "10", ";", "Let", " ", "us", " ", "denote", " ", "the", " ", "cost", "s", " ", "of", " ", "cutt", "ing", " ", "it", " ", "along", " ", "consec", "uti", "ve", " ", "vertical", " ", "lines", " ", "with", " ", "x1", ",", " ", "x2", ",", " ", "...", ",", " ", "xn", "-1", ",", " ", "and", " ", "the", " ", "cost", " ", "of", " ", "cutt", "ing", "\\", "10", ";", "it", " ", "along", " ", "horizon", "tal", " ", "lines", " ", "with", " ", "y1", ",", " ", "y2", ",", " ", "...", ",", " ", "ym", "-1", ".", " ", "If", " ", "a", " ", "cut", " ", "(", "of", " ", "cost", " ", "c", ")", " ", "is", " ", "made", " ", "and", " ", "it", " ", "pass", "es", " ", "through", " ", "n", " ", "segments", ",", " ", "then", "\\", "10", ";", "total", " ", "cost", " ", "of", " ", "this", " ", "cut", " ", "will", " ", "be", " ", "n", "*", "c", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "cost", " ", "of", " ", "cutt", "ing", " ", "the", " ", "whole", " ", "board", " ", "int", "o", " ", "single", " ", "square", "s", " ", "is", " ", "the", " ", "sum", " ", "of", " ", "the", " ", "cost", " ", "of", " ", "success", "ive", " ", "cuts", " ", "used", " ", "to", " ", "cut", " ", "the", " ", "whole", "\\", "10", ";", "board", " ", "int", "o", " ", "square", " ", "wood", "en", " ", "piece", "s", " ", "of", " ", "size", " ", "1x", "1", ".", " ", "Bob", " ", "shou", "ld", " ", "compute", " ", "the", " ", "minima", "l", " ", "cost", " ", "of", " ", "break", "ing", " ", "the", " ", "whole", " ", "wood", "en", " ", "board", " ", "int", "o", "\\", "10", ";", "square", "s", " ", "of", " ", "size", " ", "1x", "1", ".", "\\", "10", ";", "\\", "10", ";", "Bob", " ", "need", "s", " ", "your", " ", "help", " ", "to", " ", "find", " ", "the", " ", "minima", "l", " ", "cost", ".", " ", "Can", " ", "you", " ", "help", " ", "Bob", " ", "with", " ", "this", " ", "chall", "enge", "?", "\\", "10", ";", "\\", "10", ";", "Inp", "ut", " ", "Format", "\\", "10", ";", "A", " ", "single", " ", "integ", "er", " ", "in", " ", "the", " ", "first", " ", "line", " ", "T", ",", " ", "stati", "ng", " ", "the", " ", "number", " ", "of", " ", "test", " ", "case", "s", ".", " ", "T", " ", "testcases", " ", "follow", ".", "\\", "10", ";", "For", " ", "each", " ", "test", " ", "case", ",", " ", "the", " ", "first", " ", "line", " ", "contain", "s", " ", "two", " ", "posit", "ive", " ", "integ", "ers", " ", "M", " ", "and", " ", "N", " ", "separate", "d", " ", "by", " ", "a", " ", "single", " ", "space", ".", " ", "In", " ", "the", " ", "next", " ", "line", ",", "\\", "10", ";", "there", " ", "are", " ", "integ", "ers", " ", "y1", ",", " ", "y2", ",", " ", "...", ",", " ", "ym", "-1", ",", " ", "separate", "d", " ", "by", " ", "space", "s", ".", " ", "Follow", "ing", " ", "them", " ", "are", " ", "integ", "ers", " ", "x1", ",", " ", "x2", ",", " ", "...", ",", " ", "xn", "-1", ",", " ", "separate", "d", " ", "by", "\\", "10", ";", "space", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MOD", "_", "=_", "10_", "**_", "9_", "+_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Dan", "yan", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "\"", "1", ".", "in", "\"_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "f", " ", "=", " ", "sys", ".", "stdin_", "\\u\\u\\uNL\\u\\u\\u_", "testcases", "_", "=_", "int_", "(_", "f_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "xrange_", "(_", "testcases", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "construct", " ", "cipher_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", ",_", "N_", "=_", "map_", "(_", "int_", ",_", "f_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "\"", " ", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "map_", "(_", "int_", ",_", "f_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "\"", " ", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "map_", "(_", "int_", ",_", "f_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "\"", " ", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cipher_", "=_", "[_", "M_", ",_", "N_", ",_", "Y_", ",_", "X_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "solve_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "\"%", "s", "\\\\", "n", "\"_", "%_", "(_", "Solution_", "(_", ")_", "._", "solve_", "(_", "cipher_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "s_", ",_", "\\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_", "Cost_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cost_", "(_", "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_", "._", "cost_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cost_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iad", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cost_", "=_", "(_", "self_", "._", "cost_", "+_", "other_", "%_", "MOD", "_", ")_", "%_", "MOD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Solution_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solution_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "solve_", "(_", "self_", ",_", "cipher_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Gree", "dy", " ", "appro", "ach", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Fix", "ed", " ", "#", "6", " ", "-", " ", "#", "11", " ", "Wro", "ng", " ", "Answer", " ", "due", " ", "to", " ", "Cost", " ", "class", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cipher", ":", " ", "the", " ", "cipher", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", ",_", "N_", ",_", "Y_", ",_", "X_", "=_", "cipher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "list_", "(_", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "list_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cost_", "=_", "Cost_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "x_", "and_", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "max_", "=_", "x_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "max_", "=_", "y_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x", "\\u", "max_", ">_", "y", "\\u", "max_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cost_", "+=_", "x_", "._", "pop_", "(_", ")_", "*_", "(_", "M_", "-_", "len_", "(_", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "max_", ">_", "x", "\\u", "max_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cost_", "+=_", "y_", "._", "pop_", "(_", ")_", "*_", "(_", "N_", "-_", "len_", "(_", "x_", ")_", ")_", "\\u\\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_", "sum_", "(_", "x_", ")_", ">_", "sum_", "(_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cost_", "+=_", "x_", "._", "pop_", "(_", ")_", "*_", "(_", "M_", "-_", "len_", "(_", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cost_", "+=_", "y_", "._", "pop_", "(_", ")_", "*_", "(_", "N_", "-_", "len_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cost_", "+=_", "x_", "._", "pop_", "(_", ")_", "*_", "(_", "M_", "-_", "len_", "(_", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Signature mismatch in overriding method
mikeorr/WebHelpers2/unfinished/lazy_tags.py
[ { "content": "class Tag(list):\n \"\"\"Lazily-rendered tag.\n\n You can set my HTML attributes and content incrementally and pass me to a\n template. Call ``str`` on me to render the HTML.\n\n Instance attributes:\n\n * **attrs**: Dict of HTML attributes.\n * **content**: List of content items.\n * **nl**: If true, render a newline after the opening tag, after each\n content item, and after the closing tag. Default is false.\n can force newlines by setting the class attribute **nl** to true.\n\n Class attributes:\n\n * **render_if_empty**: This affects what happens if the tag has no content.\n If true (default), render it as normal. If false, suppress the tag and\n render the empty string instead.\n * **nl**: Default value for ``self.nl``.\n \"\"\"\n render_if_empty = True\n nl = False\n\n\n\n\n __str__ = __html__", "metadata": "root.Tag", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def __init__(self, name, *content, **attrs):\n \"\"\"Constructor.\n\n * **name**: The tag name.\n * **\\*content**: Initial content.\n * **\\*\\*attrs**: Initial HTML attributes.\n \"\"\"\n super(Tag, self).__init__()\n self.name = name\n self.attrs = attrs\n self.content = list(content)", "metadata": "root.Tag.__init__", "header": "['class', 'Tag', '(', 'list', ')', ':', '___EOS___']", "index": 28 }, { "content": " def child(self, child):\n \"\"\"Append an item to the content.\n \n Equivalent to ``self.content.append()``.\n \"\"\"\n self.content.append(child)", "metadata": "root.Tag.child", "header": "['class', 'Tag', '(', 'list', ')', ':', '___EOS___']", "index": 40 }, { "content": " def __html__(self):\n if not (self.content or self.render_if_empty):\n return HTML.EMPTY\n return HTML.tag(self.name, _nl=self.nl, *self.content, **self.attrs)", "metadata": "root.Tag.__html__", "header": "['class', 'Tag', '(', 'list', ')', ':', '___EOS___']", "index": 47 }, { "content": "class UL(Tag):\n name = \"ul\"\n nl = True\n render_if_empty = False\n\n", "metadata": "root.UL", "header": "['module', '___EOS___']", "index": 55 }, { "content": " def __init__(self, **attrs):\n super(UL, self).__init__(self.name, **attrs)", "metadata": "root.UL.__init__", "header": "['class', 'UL', '(', 'Tag', ')', ':', '___EOS___']", "index": 60 }, { "content": " def item(self, item, **attrs):\n \"\"\"Add a list item.\n\n I wrap the item in an <li> tag and append it to the content.\n Keyword args become <li> attributes.\n \"\"\"\n item = self.__class__(\"li\", item, **attrs)\n self.content.append(item)", "metadata": "root.UL.item", "header": "['class', 'UL', '(', 'Tag', ')', ':', '___EOS___']", "index": 63 }, { "content": "class DL(UL):\n name = \"DL\"\n", "metadata": "root.DL", "header": "['module', '___EOS___']", "index": 77 }, { "content": " def item(self, term, definition):\n \"\"\"Append a definition item.\n\n * **term**: The term.\n * **definition**: The definition.\n\n I wrap the term in a <dt> and the definition in a <dd>, and append them\n to the list content.\n\n Keyword attributes are not currently allowed because it's unclear\n which tag they should apply to.\n \"\"\"\n dt = self.__class__(\"dt\", term)\n dd = self.__class__(\"dd\", definition)\n self.content.append(dt)\n self.content.append(dd)", "metadata": "root.DL.item", "header": "['class', 'DL', '(', 'UL', ')', ':', '___EOS___']", "index": 80 } ]
[ { "span": "def item(self, term, definition):", "start_line": 80, "start_column": 4, "end_line": 80, "end_column": 37 } ]
[ { "span": "def item(self, item, **attrs):", "start_line": 63, "start_column": 4, "end_line": 63, "end_column": 34 } ]
1
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Tag_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "La", "zil", "y", "-", "render", "ed", " ", "tag", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "set", " ", "my", " ", "HTM", "L", " ", "attribute", "s", " ", "and", " ", "content", " ", "incremental", "ly", " ", "and", " ", "pass", " ", "me", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "template", ".", " ", " ", "Call", " ", "``", "str", "``", " ", "on", " ", "me", " ", "to", " ", "render", " ", "the", " ", "HTM", "L", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Insta", "nce", " ", "attribute", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "**", "attr", "s", "**", ":", " ", "Dict", " ", "of", " ", "HTM", "L", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "**", "content", "**", ":", " ", "List", " ", "of", " ", "content", " ", "items", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "**", "nl", "**", ":", " ", "If", " ", "true", ",", " ", "render", " ", "a", " ", "newline", " ", "after", " ", "the", " ", "opening", " ", "tag", ",", " ", "after", " ", "each", "\\", "10", ";", " ", " ", "content", " ", "item", ",", " ", "and", " ", "after", " ", "the", " ", "clos", "ing", " ", "tag", ".", " ", "Default", " ", "is", " ", "fal", "se", ".", "\\", "10", ";", " ", " ", "can", " ", "force", " ", "newline", "s", " ", "by", " ", "setti", "ng", " ", "the", " ", "class", " ", "attribute", " ", "**", "nl", "**", " ", "to", " ", "true", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "attribute", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "**", "render", "\\u", "if", "\\u", "empty", "**", ":", " ", "Thi", "s", " ", "affect", "s", " ", "what", " ", "happ", "ens", " ", "if", " ", "the", " ", "tag", " ", "has", " ", "no", " ", "content", ".", "\\", "10", ";", " ", " ", "If", " ", "true", " ", "(", "default", "),", " ", "render", " ", "it", " ", "as", " ", "normal", ".", " ", "If", " ", "fal", "se", ",", " ", "suppress", " ", "the", " ", "tag", " ", "and", "\\", "10", ";", " ", " ", "render", " ", "the", " ", "empty", " ", "string", " ", "inst", "ead", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "**", "nl", "**", ":", " ", "Default", " ", "value", " ", "for", " ", "``", "self", ".", "nl", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "render", "\\u", "if", "\\u", "empty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nl_", "=_", "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\\uDEDENT\\u\\u\\u_", "\\u\\u", "str\\u\\u_", "=_", "\\u\\u", "html", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tag_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "*_", "content_", ",_", "**_", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "**", "name", "**", ":", " ", "The", " ", "tag", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "**", "\\\\*", "content", "**", ":", " ", "Initial", " ", "content", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "**", "\\\\*", "\\\\*", "attr", "s", "**", ":", " ", "Initial", " ", "HTM", "L", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Tag_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "attrs_", "=_", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content_", "=_", "list_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tag_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "child_", "(_", "self_", ",_", "child_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Append", " ", "an", " ", "item", " ", "to", " ", "the", " ", "content", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Equivalent", " ", "to", " ", "``", "self", ".", "content", ".", "append", "()``", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content_", "._", "append_", "(_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tag_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "html", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "(_", "self_", "._", "content_", "or_", "self_", "._", "render", "\\u", "if", "\\u", "empty_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "HTML_", "._", "EMPTY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "HTML_", "._", "tag_", "(_", "self_", "._", "name_", ",_", "\\u", "nl_", "=_", "self_", "._", "nl_", ",_", "*_", "self_", "._", "content_", ",_", "**_", "self_", "._", "attrs_", ")_", "\\u\\u\\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_", "UL", "_", "(_", "Tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"", "ul", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nl_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "render", "\\u", "if", "\\u", "empty_", "=_", "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_", "[SEP]_", "class_", "UL", "_", "(_", "Tag_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "UL", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", "._", "name_", ",_", "**_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UL", "_", "(_", "Tag_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item_", "(_", "self_", ",_", "item_", ",_", "**_", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "a", " ", "list", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "I", " ", "wrap", " ", "the", " ", "item", " ", "in", " ", "an", " ", "<", "li", ">", " ", "tag", " ", "and", " ", "append", " ", "it", " ", "to", " ", "the", " ", "content", ".", "\\", "10", ";", " ", " ", " ", " ", "Key", "word", " ", "args", " ", "bec", "ome", " ", "<", "li", ">", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "\"", "li", "\"_", ",_", "item_", ",_", "**_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\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_", "DL_", "(_", "UL", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"", "DL", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "DL_", "(_", "UL", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "item_", "(_", "self_", ",_", "term_", ",_", "definition_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Append", " ", "a", " ", "definit", "ion", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "**", "term", "**", ":", " ", "The", " ", "term", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "**", "definit", "ion", "**", ":", " ", "The", " ", "definit", "ion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "I", " ", "wrap", " ", "the", " ", "term", " ", "in", " ", "a", " ", "<", "dt", ">", " ", "and", " ", "the", " ", "definit", "ion", " ", "in", " ", "a", " ", "<", "dd", ">", ",", " ", "and", " ", "append", " ", "them", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "list", " ", "content", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Key", "word", " ", "attribute", "s", " ", "are", " ", "not", " ", "currentl", "y", " ", "allow", "ed", " ", "bec", "aus", "e", " ", "it", "'", "s", " ", "uncl", "ear", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "tag", " ", "the", "y", " ", "shou", "ld", " ", "appl", "y", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "\"", "dt", "\"_", ",_", "term_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dd_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "\"", "dd", "\"_", ",_", "definition_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content_", "._", "append_", "(_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content_", "._", "append_", "(_", "dd_", ")_" ]
[ 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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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 ]
Unused import
OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/assembly.py
[ { "content": "\"\"\" Class definition for Assembly. \"\"\"\n\n\n#public symbols\n__all__ = ['Assembly', 'set_as_top']\n\nfrom fnmatch import fnmatch\nimport re\nimport sys\nimport traceback\nfrom itertools import chain\n\nfrom numpy import ndarray\n\n# pylint: disable=E0611,F0401\nimport networkx as nx\nfrom networkx.algorithms.components import strongly_connected_components\nfrom networkx.algorithms.dag import is_directed_acyclic_graph\n\nfrom openmdao.main.mpiwrap import MPI\n\nfrom openmdao.main.exceptions import NoFlatError\nfrom openmdao.main.interfaces import implements, IAssembly, IDriver, \\\n IComponent, IContainer, \\\n ICaseRecorder, IHasParameters\nfrom openmdao.main.mp_support import has_interface\nfrom openmdao.main.container import _copydict\nfrom openmdao.main.component import Component, Container\nfrom openmdao.main.variable import Variable\nfrom openmdao.main.vartree import VariableTree\nfrom openmdao.main.datatypes.api import List, Slot, Bool, VarTree\nfrom openmdao.main.driver import Driver\nfrom openmdao.main.rbac import rbac\nfrom openmdao.main.mp_support import is_instance\nfrom openmdao.main.printexpr import eliminate_expr_ws\nfrom openmdao.main.expreval import ExprEvaluator, ConnectedExprEvaluator\nfrom openmdao.main.pseudocomp import PseudoComponent, UnitConversionPComp\nfrom openmdao.main.array_helpers import is_differentiable_var, get_val_and_index, \\\n get_flattened_index, \\\n get_var_shape, flattened_size\nfrom openmdao.main.depgraph import DependencyGraph, all_comps, \\\n list_driver_connections, \\\n simple_node_iter, \\\n is_boundary_node\nfrom openmdao.main.systems import SimpleSystem, SerialSystem, ParamSystem, \\\n _create_simple_sys, OpaqueSystem\nfrom openmdao.main.mpiwrap import to_idx_array\n\nfrom openmdao.util.graph import list_deriv_vars, base_var, fix_single_tuple\nfrom openmdao.util.log import logger\nfrom openmdao.util.debug import strict_chk_config\nfrom openmdao.util.typegroups import real_types\nfrom openmdao.units import PhysicalQuantity\n\nfrom openmdao.util.graphplot import _clean_graph\nfrom networkx.readwrite import json_graph\nimport json\n\n\n_iodict = {'out': 'output', 'in': 'input'}\n\n_missing = object()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def set_as_top(cont, first_only=False):\n \"\"\"Specifies that the given Container is the top of a Container hierarchy.\n If first_only is True, then only set it as a top if a global\n top doesn't already exist.\n \"\"\"\n cont.cpath_updated()\n return cont", "metadata": "root.set_as_top", "header": "['module', '___EOS___']", "index": 63 }, { "content": "class PassthroughTrait(Variable):\n \"\"\"A trait that can use another trait for validation, but otherwise is\n just a trait that lives on an Assembly boundary and can be connected\n to other traits within the Assembly.\n \"\"\"\n", "metadata": "root.PassthroughTrait", "header": "['module', '___EOS___']", "index": 72 }, { "content": " def validate(self, obj, name, value):\n \"\"\"Validation for the PassThroughTrait.\"\"\"\n if self.validation_trait:\n return self.validation_trait.validate(obj, name, value)\n return value", "metadata": "root.PassthroughTrait.validate", "header": "['class', 'PassthroughTrait', '(', 'Variable', ')', ':', '___EOS___']", "index": 78 }, { "content": "class PassthroughProperty(Variable):\n \"\"\"Replacement for PassthroughTrait when the target is a proxy/property\n trait. PassthroughTrait would get a core dump while pickling.\n \"\"\"\n\n", "metadata": "root.PassthroughProperty", "header": "['module', '___EOS___']", "index": 85 }, { "content": " def __init__(self, target_trait, **metadata):\n self._trait = target_trait\n self._vals = {}\n super(PassthroughProperty, self).__init__(**metadata)", "metadata": "root.PassthroughProperty.__init__", "header": "['class', 'PassthroughProperty', '(', 'Variable', ')', ':', '___EOS___']", "index": 89 }, { "content": " def get(self, obj, name):\n v = self._vals.get(obj, _missing)\n if v is not _missing:\n return v.get(name, self._trait.default_value)\n else:\n return self._trait.default_value", "metadata": "root.PassthroughProperty.get", "header": "['class', 'PassthroughProperty', '(', 'Variable', ')', ':', '___EOS___']", "index": 94 }, { "content": " def set(self, obj, name, value):\n if obj not in self._vals:\n self._vals[obj] = {}\n old = self.get(obj, name)\n if value != old:\n self._vals[obj][name] = self._trait.validate(obj, name, value)\n obj.trait_property_changed(name, old, value)", "metadata": "root.PassthroughProperty.set", "header": "['class', 'PassthroughProperty', '(', 'Variable', ')', ':', '___EOS___']", "index": 101 }, { "content": "class RecordingOptions(VariableTree):\n \"\"\"Container for options that control case recording. \"\"\"\n\n save_problem_formulation = Bool(True, desc='Save problem formulation '\n '(parameters, constraints, etc.)')\n\n includes = List(['*'], desc='Patterns for variables to include in recording')\n\n excludes = List([], desc='Patterns for variables to exclude from recording '\n '(processed after includes')", "metadata": "root.RecordingOptions", "header": "['module', '___EOS___']", "index": 110 }, { "content": "class Assembly(Component):\n \"\"\"This is a container of Components. It understands how to connect inputs\n and outputs between its children. When executed, it runs the top level\n Driver called 'driver'.\n \"\"\"\n\n implements(IAssembly)\n\n driver = Slot(IDriver, allow_none=True,\n desc=\"The top level Driver that manages execution of \"\n \"this Assembly.\")\n\n recorders = List(Slot(ICaseRecorder, required=False),\n desc='Case recorders for iteration data'\n ' (only valid at top level).')\n\n recording_options = VarTree(RecordingOptions(), iotype='in',\n framework_var=True, deriv_ignore=True,\n desc='Case recording options (only valid at top level).')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Assembly", "header": "['module', '___EOS___']", "index": 122 }, { "content": " def __init__(self):\n\n super(Assembly, self).__init__()\n\n self._pseudo_count = 0 # counter for naming pseudocomps\n self._pre_driver = None\n self._derivs_required = False\n self._unexecuted = []\n self._var_meta = {}\n\n # a list of (srcexpr, destexpr)\n self._connections = []\n\n # data dependency graph. Includes edges for data\n # connections as well as for all driver parameters and\n # constraints/objectives. This is the starting graph for\n # all later transformations.\n self._depgraph = None\n\n # this is created from _depgraph. All _depgraph variable connections\n # are collapsed into single nodes\n self._reduced_graph = None\n\n # default Driver executes its workflow once\n self.add('driver', Driver())\n\n # Assemblies automatically figure out their own derivatives, so\n # any boundary vars that are unconnected should be zero.\n self.missing_deriv_policy = 'assume_zero'\n\n self.add('recording_options', RecordingOptions())", "metadata": "root.Assembly.__init__", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 142 }, { "content": " @property\n def _top_driver(self):\n if self._pre_driver:\n return self._pre_driver\n return self.driver", "metadata": "root.Assembly._top_driver", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 174 }, { "content": " @rbac(('owner', 'user'))\n def set_itername(self, itername, seqno=0):\n \"\"\"\n Set current 'iteration coordinates'. Overrides :class:`Component`\n to propagate to driver, and optionally set the initial count in the\n driver's workflow. Setting the initial count is typically done by\n :class:`CaseIterDriverBase` on a remote top level assembly.\n\n itername: string\n Iteration coordinates.\n\n seqno: int\n Initial execution count for driver's workflow.\n \"\"\"\n super(Assembly, self).set_itername(itername)\n self._top_driver.set_itername(itername)\n if seqno:\n self._top_driver.workflow.set_initial_count(seqno)", "metadata": "root.Assembly.set_itername", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 180 }, { "content": " def find_referring_connections(self, name):\n \"\"\"Returns a list of connections where the given name is referred\n to either in the source or the destination.\n \"\"\"\n return [(u.text,v.text) for u,v in self._connections\n if u.refers_to(name) or v.refers_to(name)]", "metadata": "root.Assembly.find_referring_connections", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 199 }, { "content": " def find_in_workflows(self, name):\n \"\"\"Returns a list of tuples of the form (workflow, index) for all\n workflows in the scope of this Assembly that contain the given\n component name.\n \"\"\"\n wflows = []\n for item in self.list_containers():\n if item != name:\n obj = self.get(item)\n if isinstance(obj, Driver) and name in obj.workflow._explicit_names:\n wflows.append((obj.workflow, obj.workflow._explicit_names.index(name)))\n return wflows", "metadata": "root.Assembly.find_in_workflows", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 206 }, { "content": " def rename(self, oldname, newname):\n \"\"\"Renames a child of this object from oldname to newname.\"\"\"\n self.config_changed()\n\n self._check_rename(oldname, newname)\n\n # components may have old name in their workflows/objectives/params/constraints,\n # so give them a chance to update\n for comp in self.get_comps():\n comp.name_changed(oldname, newname)\n\n for u,v in self._connections:\n u.name_changed(oldname, newname)\n v.name_changed(oldname, newname)\n\n obj = self.get(oldname)\n obj.name = newname\n self.add(newname, obj)\n\n # this just removes from traits dicts, but doesn't remove from\n # workflows, etc.\n self.remove_trait(oldname)", "metadata": "root.Assembly.rename", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 219 }, { "content": " def replace(self, target_name, newobj):\n \"\"\"Replace one object with another, attempting to mimic the\n inputs and connections of the replaced object as much as possible.\n \"\"\"\n tobj = getattr(self, target_name)\n\n if not tobj:\n self.add(target_name, newobj)\n return\n\n # Save existing driver references.\n refs = {}\n if has_interface(tobj, IComponent):\n for cname in self.list_containers():\n obj = getattr(self, cname)\n if obj is not tobj and has_interface(obj, IDriver):\n refs[cname] = obj.get_references(target_name)\n\n if hasattr(newobj, 'mimic'):\n try:\n # this should copy inputs, delegates and set name\n newobj.mimic(tobj)\n except Exception:\n self.reraise_exception(\"Couldn't replace '%s' of type %s with\"\n \" type %s\"\n % (target_name, type(tobj).__name__,\n type(newobj).__name__), sys.exc_info())\n\n conns = self.find_referring_connections(target_name)\n wflows = self.find_in_workflows(target_name)\n\n # Assemblies sometimes create inputs and outputs in their configure()\n # function, so call it early if possible\n if self._call_cpath_updated is False and isinstance(obj, Container):\n newobj.parent = self\n newobj.name = target_name\n newobj.cpath_updated()\n\n # check that all connected vars exist in the new object\n req_vars = set([u.split('.', 1)[1].split('[', 1)[0]\n for u, v in conns if u.startswith(target_name+'.')])\n req_vars.update([v.split('.', 1)[1].split('[', 1)[0]\n for u, v in conns if v.startswith(target_name+'.')])\n missing = [v for v in req_vars if not newobj.contains(v)]\n if missing:\n self._logger.warning(\"the following variables are connected to \"\n \"other components but are missing in \"\n \"the replacement object: %s\" % missing)\n\n # remove expr connections\n for u, v in conns:\n self.disconnect(u, v)\n\n # remove any existing connections to replacement object\n if has_interface(newobj, IComponent):\n self.disconnect(newobj.name)\n\n self.add(target_name, newobj) # this will remove the old object\n # and any connections to it\n\n # recreate old connections\n for u, v in conns:\n try:\n # don't recreate the connection unless we can resolve both ends\n self.get(u)\n self.get(v)\n self.connect(u, v)\n except Exception as err:\n self._logger.warning(\"Couldn't connect '%s' to '%s': %s\",\n u, v, err)\n\n # Restore driver references.\n for dname, _refs in refs.items():\n drv = getattr(self, dname)\n drv.remove_references(target_name)\n drv.restore_references(_refs)\n\n # add new object (if it's a Component) to any\n # workflows where target was\n if has_interface(newobj, IComponent):\n for wflow, idx in wflows:\n wflow.add(target_name, idx)", "metadata": "root.Assembly.replace", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 242 }, { "content": " def remove(self, name):\n \"\"\"Remove the named container object from this assembly\n and remove it from its workflow(s) if it's a Component\n or pseudo component.\n \"\"\"\n obj = getattr(self, name)\n if has_interface(obj, IComponent) or isinstance(obj, PseudoComponent):\n for cname in self.list_containers():\n cobj = getattr(self, cname)\n if isinstance(cobj, Driver) and cobj is not obj:\n cobj.remove_references(name)\n self.disconnect(name)\n elif name in self.list_inputs() or name in self.list_outputs():\n self.disconnect(name)\n\n return super(Assembly, self).remove(name)", "metadata": "root.Assembly.remove", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 325 }, { "content": " def create_passthrough(self, pathname, alias=None):\n \"\"\"Creates a PassthroughTrait that uses the trait indicated by\n pathname for validation, adds it to self, and creates a connection\n between the two. If alias is *None,* the name of the alias trait will\n be the last entry in its pathname. The trait specified by pathname\n must exist.\n \"\"\"\n parts = pathname.split('.')\n if alias:\n newname = alias\n else:\n newname = parts[-1]\n\n if newname in self.__dict__:\n self.raise_exception(\"'%s' already exists\" % newname, KeyError)\n if len(parts) < 2:\n self.raise_exception('destination of passthrough must be a dotted'\n ' path', NameError)\n comp = self\n for part in parts[:-1]:\n try:\n comp = getattr(comp, part)\n except AttributeError:\n trait = None\n break\n else:\n trait = comp.get_trait(parts[-1])\n iotype = comp.get_iotype(parts[-1])\n\n if trait:\n ttype = trait.trait_type\n if ttype is None:\n ttype = trait\n else:\n if not self.contains(pathname):\n self.raise_exception(\"the variable named '%s' can't be found\" %\n pathname, KeyError)\n iotype = self.get_metadata(pathname, 'iotype')\n\n if trait is not None and not trait.validate:\n # no validate function, so just don't use trait for validation\n trait = None\n\n metadata = self.get_metadata(pathname)\n metadata['target'] = pathname\n metadata['default_value'] = trait.trait_type.default_value\n # PassthroughTrait to a trait with get/set methods causes a core dump\n # in Traits (at least through 3.6) while pickling.\n if \"validation_trait\" in metadata:\n if metadata['validation_trait'].get is None:\n newtrait = PassthroughTrait(**metadata)\n else:\n newtrait = PassthroughProperty(metadata['validation_trait'],\n **metadata)\n elif trait and ttype.get:\n newtrait = PassthroughProperty(ttype, **metadata)\n else:\n newtrait = PassthroughTrait(validation_trait=trait, **metadata)\n self.add_trait(newname, newtrait)\n\n # Copy trait value according to 'copy' attribute in the trait\n val = self.get(pathname)\n\n ttype = trait.trait_type\n if ttype.copy:\n # Variable trees need to point to a new parent.\n # Also, let's not deepcopy the outside universe\n if isinstance(val, Container):\n val_copy = val.copy()\n val_copy.parent = self\n val = val_copy\n val.name = newname\n else:\n val = _copydict[ttype.copy](val)\n\n setattr(self, newname, val)\n\n try:\n if iotype == 'in':\n self.connect(newname, pathname)\n else:\n self.connect(pathname, newname)\n except RuntimeError:\n info = sys.exc_info()\n self.remove(newname)\n raise info[0], info[1], info[2]\n\n return newtrait", "metadata": "root.Assembly.create_passthrough", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 342 }, { "content": " def _find_unexecuted_comps(self):\n self._unexecuted = []\n self._pre_driver = None\n cgraph = self._depgraph.component_graph()\n wfcomps = set([c.name for c in self.driver.iteration_set()])\n wfcomps.add('driver')\n diff = set(cgraph.nodes()) - wfcomps\n self._pre_driver = None\n if diff:\n out_edges = nx.edge_boundary(cgraph, diff)\n pre = [u for u, v in out_edges]\n self._unexecuted = list(diff - set(pre))\n\n if pre:\n ## If there are upstream comps that are not in any workflow,\n ## create a hidden top level driver called _pre_driver. That\n ## driver will be executed once per execution of the Assembly.\n\n # can't call add here for _pre_driver because that calls\n # config_changed...\n self._pre_driver = Driver()\n self._pre_driver.parent = self\n pre.append('driver') # run the normal top driver after running the 'pre' comps\n self._pre_driver.workflow.add(pre)\n self._pre_driver.name = '_pre_driver'\n self._pre_driver._iter_set = set(pre)\n self._pre_driver._full_iter_set = self.driver._full_iter_set.union(pre)\n self._depgraph.add_node('_pre_driver', comp=True, driver=True)", "metadata": "root.Assembly._find_unexecuted_comps", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 431 }, { "content": " @rbac(('owner', 'user'))\n def collect_metadata(self):\n # store metadata (size, etc.) for all relevant vars\n self._get_all_var_metadata(self._reduced_graph)\n for comp in self.get_comps():\n if has_interface(comp, IAssembly):\n comp.collect_metadata()", "metadata": "root.Assembly.collect_metadata", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 460 }, { "content": " @rbac(('owner', 'user'))\n def check_config(self, strict=False):\n \"\"\"\n Verify that this component and all of its children are properly\n configured to execute. This function is called prior the first\n component execution. If strict is True, any warning or error\n should raise an exception.\n\n If you override this function to do checks specific to your class,\n you must call this function.\n \"\"\"\n\n super(Assembly, self).check_config(strict=strict)\n try:\n self._check_input_collisions(self._depgraph)\n self._check_unset_req_vars()\n self._check_unexecuted_comps(strict)\n except:\n info = sys.exc_info()\n self._new_config = True\n raise info[0], info[1], info[2]", "metadata": "root.Assembly.check_config", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 468 }, { "content": " def _check_input_collisions(self, graph):\n dests = set([v for u, v in graph.list_connections() if\n 'drv_conn_ext' not in graph[u][v] and\n 'drv_conn' not in graph[u][v]])\n allbases = set([base_var(graph, v) for v in dests])\n unconnected_bases = allbases - dests\n connected_bases = allbases - unconnected_bases\n\n collisions = []\n for drv in chain([self._top_driver],\n self._top_driver.subdrivers(recurse=True)):\n if has_interface(drv, IHasParameters):\n for target in drv.list_param_targets():\n tbase = base_var(graph, target)\n if target == tbase: # target is a base var\n if target in allbases:\n collisions.append(\"%s in %s\"\n % (target, drv.get_pathname()))\n else: # target is a sub var\n if target in dests or tbase in connected_bases:\n collisions.append(\"%s in %s\"\n % (target, drv.get_pathname()))\n\n if collisions:\n self.raise_exception(\"The following parameters collide with\"\n \" connected inputs: %s\" % ','.join(collisions),\n RuntimeError)", "metadata": "root.Assembly._check_input_collisions", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 490 }, { "content": " def _check_unexecuted_comps(self, strict):\n if strict_chk_config(strict):\n errfunct = self.raise_exception\n else:\n errfunct = self._logger.warning\n\n if self._pre_driver:\n msg = \"The following components are not in any workflow but \" \\\n \"are needed by other workflows\"\n if not strict_chk_config(strict):\n msg += \", so they will be executed once per execution of \" \\\n \"this Assembly\"\n\n pre = self._pre_driver._iter_set - set(['driver'])\n msg += \": %s\" % list(sorted(pre))\n errfunct(msg)\n\n if self._unexecuted:\n errfunct(\"The following components are not in any workflow\"\n \" and WILL NOT EXECUTE: %s\" % list(self._unexecuted))", "metadata": "root.Assembly._check_unexecuted_comps", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 518 }, { "content": " def _check_unset_req_vars(self):\n \"\"\"Find 'required' variables that have not been set.\"\"\"\n graph = self._depgraph\n for name in chain(all_comps(graph),\n graph.get_boundary_inputs(),\n graph.get_boundary_outputs()):\n obj = getattr(self, name)\n if has_interface(obj, IContainer):\n for vname in obj.get_req_default(self.trait(name).required):\n # each var must be connected, otherwise value will not\n # be set to a non-default value\n base = base_var(graph, vname)\n indeg = graph.in_degree(base)\n io = graph.node[base]['iotype']\n if (io == 'in' and indeg < 1) or \\\n (io == 'state' and indeg < 2):\n self.raise_exception(\"required variable '%s' was\"\n \" not set\" % vname, RuntimeError)", "metadata": "root.Assembly._check_unset_req_vars", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 539 }, { "content": " def _check_connect(self, src, dest):\n \"\"\"Check validity of connecting a source expression to a destination\n expression.\n \"\"\"\n\n destexpr = ConnectedExprEvaluator(dest, self, is_dest=True)\n srcexpr = ConnectedExprEvaluator(src, self,\n getter='get_attr_w_copy')\n\n srccomps = srcexpr.get_referenced_compnames()\n destcomps = list(destexpr.get_referenced_compnames())\n\n if destcomps and destcomps[0] in srccomps:\n raise RuntimeError(\"'%s' and '%s' refer to the same component.\"\n % (src, dest))\n\n return srcexpr, destexpr", "metadata": "root.Assembly._check_connect", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 558 }, { "content": " @rbac(('owner', 'user'))\n def connect(self, src, dest):\n \"\"\"Connect one source variable or expression to one or more\n destination variables.\n\n src: str\n Source expression string.\n\n dest: str or list(str)\n Destination variable string(s).\n \"\"\"\n src = eliminate_expr_ws(src)\n\n if isinstance(dest, basestring):\n dest = (dest,)\n for dst in dest:\n dst = eliminate_expr_ws(dst)\n self._connect(src, dst)", "metadata": "root.Assembly.connect", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 576 }, { "content": " def _connect(self, src, dest):\n \"\"\"Handle one connection destination. This should only be called via\n the connect() function, never directly.\n \"\"\"\n try:\n try:\n srcexpr, destexpr = self._check_connect(src, dest)\n\n self._connections.append((srcexpr, destexpr))\n\n destval = destexpr.evaluate()\n if isinstance(destval, ndarray) and destval.size == 0:\n destexpr.set(srcexpr.evaluate(), self)\n\n self._check_dest(srcexpr, destexpr)\n\n except AttributeError as err:\n exc_type, value, traceback = sys.exc_info()\n\n invalid_vars = srcexpr.get_unresolved() + destexpr.get_unresolved()\n parts = invalid_vars[0].rsplit('.', 1)\n\n parent = repr(self.name) if self.name else 'top level assembly'\n vname = repr(parts[0])\n\n if len(parts) > 1:\n parent = repr(parts[0])\n vname = repr(parts[1])\n\n msg = \"{parent} has no variable {vname}\"\n msg = msg.format(parent=parent, vname=vname)\n\n raise exc_type, exc_type(msg), traceback\n except:\n info = sys.exc_info()\n self.reraise_exception(\"Can't connect '%s' to '%s': \" %\n (src, dest), info)\n\n self.config_changed()", "metadata": "root.Assembly._connect", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 595 }, { "content": " def _check_dest(self, srcexpr, destexpr):\n \"\"\"Attempt to validate a connection\"\"\"\n srcvars = srcexpr.get_referenced_varpaths(copy=False)\n destvar = destexpr.get_referenced_varpaths().pop()\n destcompname, destcomp, destvarname = _split_varpath(self, destvar)\n desttrait = None\n srccomp = None\n\n if not isinstance(destcomp, PseudoComponent) and \\\n not destvar.startswith('parent.') and not len(srcvars) > 1:\n for srcvar in srcvars:\n if not srcvar.startswith('parent.'):\n srccompname, srccomp, srcvarname = _split_varpath(self, srcvar)\n if not isinstance(srccomp, PseudoComponent):\n src_io = 'in' if srccomp is self else 'out'\n srccomp.get_dyn_trait(srcvarname, src_io)\n if desttrait is None:\n dest_io = 'out' if destcomp is self else 'in'\n desttrait = destcomp.get_dyn_trait(destvarname, dest_io)\n\n if not isinstance(srccomp, PseudoComponent) and \\\n desttrait is not None:\n # punt if dest is not just a simple var name.\n # validity will still be checked at execution time\n if destvar == destexpr.text:\n ttype = desttrait.trait_type\n if not ttype:\n ttype = desttrait\n srcval = srcexpr.evaluate()\n if ttype.validate:\n ttype.validate(destcomp, destvarname, srcval)\n else:\n # no validate function on destination trait. Most likely\n # it's a property trait. No way to validate without\n # unknown side effects. Have to wait until later\n # when data actually gets passed via the connection.\n pass", "metadata": "root.Assembly._check_dest", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 635 }, { "content": " @rbac(('owner', 'user'))\n def disconnect(self, varpath, varpath2=None):\n \"\"\"If varpath2 is supplied, remove the connection between varpath and\n varpath2. Otherwise, if varpath is the name of a trait, remove all\n connections to/from varpath in the current scope. If varpath is the\n name of a Component, remove all connections from all of its inputs\n and outputs.\n \"\"\"\n try:\n if varpath2 is None:\n to_remove = [(u,v) for u,v in self._connections\n if u.refers_to(varpath) or v.refers_to(varpath)\n or u.text==varpath.strip()\n or v.text==varpath.strip()]\n else:\n to_remove = [(u,v) for u,v in self._connections\n if u.text==varpath.strip()\n and v.text==varpath2.strip()]\n self._connections = [tup for tup in self._connections\n if tup not in to_remove]\n finally:\n self.config_changed(update_parent=False)", "metadata": "root.Assembly.disconnect", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 673 }, { "content": " def config_changed(self, update_parent=True):\n \"\"\"Call this whenever the configuration of this Component changes,\n for example, children are added or removed, connections are made\n or removed, etc.\n \"\"\"\n super(Assembly, self).config_changed(update_parent)\n\n # drivers must tell workflows that config has changed because\n # dependencies may have changed\n for name in self.list_containers():\n cont = getattr(self, name)\n if isinstance(cont, Driver):\n cont.config_changed(update_parent=False)\n\n self._pre_driver = None\n self._system = None", "metadata": "root.Assembly.config_changed", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 696 }, { "content": " def _set_failed(self, path, value):\n parts = path.split('.', 1)\n if len(parts) > 1:\n obj = getattr(self, parts[0])\n if isinstance(obj, PseudoComponent):\n obj.set(parts[1], value)", "metadata": "root.Assembly._set_failed", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 713 }, { "content": " def execute(self):\n \"\"\"Runs driver and updates our boundary variables.\"\"\"\n for system in self._system.local_subsystems():\n system.pre_run()\n self._system.run(self.itername, case_uuid=self._case_uuid)\n\n # Need to copy to scope any direct bdry to bdry connections\n dconns = [c[1] for c in self.list_connections() \\\n if c[0].split('[')[0].split('.')[0] in self.list_inputs() \\\n and c[1].split('[')[0].split('.')[0] in self.list_outputs()]\n self._system.vec['u'].set_to_scope(self, vnames=dconns)", "metadata": "root.Assembly.execute", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 720 }, { "content": " def configure_recording(self, recording_options=None):\n \"\"\"Called at start of top-level run to configure case recording.\n Returns set of paths for changing inputs.\"\"\"\n if self.parent is None:\n if self.recorders:\n recording_options = self.recording_options\n for recorder in self.recorders:\n recorder.startup()\n else:\n recording_options = None\n\n if recording_options:\n includes = recording_options.includes\n excludes = recording_options.excludes\n save_problem_formulation = recording_options.save_problem_formulation\n else:\n includes = excludes = save_problem_formulation = None\n\n # Determine (changing) inputs and outputs to record\n inputs = set()\n constants = {}\n for name in self.list_containers():\n obj = getattr(self, name)\n if has_interface(obj, IDriver, IAssembly):\n inps, consts = obj.configure_recording(recording_options)\n inputs.update(inps)\n constants.update(consts)\n\n # If nothing to record, return after configuring workflows.\n if not save_problem_formulation and not includes:\n return (inputs, constants)\n\n # Locate top level assembly.\n top = self\n while top.parent:\n top = top.parent\n prefix_drop = len(top.name)+1 if top.name else 0\n\n # Determine constant inputs.\n objs = [self]\n objs.extend(getattr(self, name) for name in self.list_containers())\n for obj in objs:\n if has_interface(obj, IComponent):\n prefix = obj.get_pathname()[prefix_drop:]\n if prefix:\n prefix += '.'\n\n in_names = obj.list_inputs()\n if obj.parent is not None:\n conn = obj.parent.connected_inputs(obj.name)\n for name in conn:\n obj_name, _, in_name = name.partition('.')\n if in_name in in_names:\n in_names.remove(in_name)\n\n for name in in_names:\n path = prefix+name\n if path in inputs:\n continue # Changing input.\n\n record_constant = False\n for pattern in includes:\n if fnmatch(path, pattern):\n record_constant = True\n\n if record_constant:\n for pattern in excludes:\n if fnmatch(path, pattern):\n record_constant = False\n\n if record_constant:\n val = getattr(obj, name)\n if isinstance(val, VariableTree):\n for path, val in _expand_tree(path, val):\n constants[path] = val\n else:\n constants[path] = val\n\n # Record constant inputs.\n if self.parent is None:\n for recorder in self.recorders:\n recorder.record_constants(constants)\n\n return (inputs, constants)", "metadata": "root.Assembly.configure_recording", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 732 }, { "content": " def record_configuration(self):\n \"\"\" record model configuration without running the model\n \"\"\"\n top = self\n while top.parent:\n top = top.parent\n top._setup()\n self.configure_recording()\n for recorder in self.recorders:\n recorder.close()", "metadata": "root.Assembly.record_configuration", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 817 }, { "content": " @rbac(('owner', 'user'))\n def connected_inputs(self, name):\n \"\"\"Helper for :meth:`configure_recording`.\"\"\"\n return self._depgraph.list_inputs(name, connected=True)", "metadata": "root.Assembly.connected_inputs", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 828 }, { "content": " def stop(self):\n \"\"\"Stop the calculation.\"\"\"\n self._top_driver.stop()", "metadata": "root.Assembly.stop", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 833 }, { "content": " @rbac(('owner', 'user'))\n def child_config_changed(self, child, adding=True, removing=True):\n \"\"\"A child has changed its input lists and/or output lists,\n so we need to update the graph.\n \"\"\"\n self.config_changed()", "metadata": "root.Assembly.child_config_changed", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 837 }, { "content": " def list_connections(self): #, show_passthrough=True,\n #visible_only=False,\n #show_expressions=False):\n \"\"\"Return a list of tuples of the form (outvarname, invarname).\n \"\"\"\n return [(u.text, v.text) for u,v in self._connections]", "metadata": "root.Assembly.list_connections", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 844 }, { "content": " def check_gradient(self, name=None, inputs=None, outputs=None,\n stream=sys.stdout, mode='auto',\n fd_form='forward', fd_step=1.0e-6,\n fd_step_type='absolute'):\n\n \"\"\"Compare the OpenMDAO-calculated gradient with one calculated\n by straight finite-difference. This provides the user with a way\n to validate his derivative functions (apply_deriv and provideJ.)\n\n name: (optional) str\n If provided, specifies the name of a Driver or Component to\n calculate the gradient for. If name specifies a Driver,\n the inputs used to calculate the gradient will be generated\n from the parameters of the Driver, and the outputs will be\n generated from the constraints and objectives of the Driver.\n If name specifies a Component, the inputs and outputs of that\n Component will be used to calculate the gradient.\n\n inputs: (optional) iter of str or None\n Names of input variables. The calculated gradient will be\n the matrix of values of the output variables with respect\n to these input variables. If no value is provided for inputs,\n they will be determined based on the 'name' argument.\n If the inputs are not specified and name is not specified,\n then they will be generated from the parameters of\n the object named 'driver'.\n\n outputs: (optional) iter of str or None\n Names of output variables. The calculated gradient will be\n the matrix of values of these output variables with respect\n to the input variables. If no value is provided for outputs,\n they will be determined based on the 'name' argument.\n If the outputs are not specified and name is not specified,\n then they will be generated from the objectives and constraints\n of the object named 'driver'.\n\n stream: (optional) file-like object, str, or None\n Where to write to, default stdout. If a string is supplied,\n that is used as a filename. If None, no output is written.\n\n mode: (optional) str or None\n Set to 'forward' for forward mode, 'adjoint' for adjoint mode,\n or 'auto' to let OpenMDAO determine the correct mode.\n Defaults to 'auto'.\n\n fd_form: str\n Finite difference mode. Valid choices are 'forward', 'adjoint' ,\n 'central'. Default is 'forward'\n\n fd_step: float\n Default step_size for finite difference. Default is 1.0e-6.\n\n fd_step_type: str\n Finite difference step type. Set to 'absolute' or 'relative'.\n Default is 'absolute'.\n\n Returns the finite difference gradient, the OpenMDAO-calculated\n gradient, a list of the gradient names, and a list of suspect\n inputs/outputs.\n \"\"\"\n driver = self.driver\n obj = None\n\n # tuples cause problems.\n if inputs:\n inputs = list(inputs)\n if outputs:\n outputs = list(outputs)\n\n if inputs and outputs:\n if name:\n logger.warning(\"The 'inputs' and 'outputs' args were specified\"\n \" to check_gradient, so the 'name' arg (%s) is\"\n \" ignored.\", name)\n elif not name:\n # we're missing either inputs or outputs, so we need a name\n name = 'driver'\n\n if name:\n obj = getattr(self, name, None)\n if obj is None:\n self.raise_exception(\"Can't find object named '%s'.\" % name)\n if has_interface(obj, IDriver):\n driver = obj\n\n # fill in missing inputs or outputs using the object specified by 'name'\n if not inputs:\n if has_interface(obj, IDriver):\n pass # driver.check_gradient can pull inputs from driver\n elif has_interface(obj, IAssembly):\n inputs = ['.'.join((obj.name, inp))\n for inp in obj.list_inputs()\n if is_differentiable_var(inp, obj)]\n inputs = sorted(inputs)\n elif has_interface(obj, IComponent):\n inputs = ['.'.join((obj.name, inp))\n for inp in list_deriv_vars(obj)[0]]\n inputs = sorted(inputs)\n else:\n self.raise_exception(\"Can't find any inputs for generating\"\n \" gradient.\")\n if not outputs:\n if has_interface(obj, IDriver):\n pass # driver.check_gradient can pull outputs from driver\n elif has_interface(obj, IAssembly):\n outputs = ['.'.join((obj.name, out))\n for out in obj.list_outputs()\n if is_differentiable_var(out, obj)]\n outputs = sorted(outputs)\n elif has_interface(obj, IComponent):\n outputs = ['.'.join((obj.name, outp))\n for outp in list_deriv_vars(obj)[1]]\n outputs = sorted(outputs)\n else:\n self.raise_exception(\"Can't find any outputs for generating\"\n \" gradient.\")\n\n if not has_interface(obj, IDriver) and (not inputs or not outputs):\n msg = 'Component %s has no analytic derivatives.' % obj.name\n self.raise_exception(msg)\n\n base_fd_form = driver.gradient_options.fd_form\n base_fd_step = driver.gradient_options.fd_step\n base_fd_step_type = driver.gradient_options.fd_step_type\n\n driver.gradient_options.fd_form = fd_form\n driver.gradient_options.fd_step = fd_step\n driver.gradient_options.fd_step_type = fd_step_type\n\n try:\n result = driver.check_gradient(inputs=inputs,\n outputs=outputs,\n stream=stream,\n mode=mode)\n finally:\n driver.gradient_options.fd_form = base_fd_form\n driver.gradient_options.fd_step = base_fd_step\n driver.gradient_options.fd_step_type = base_fd_step_type\n\n return result", "metadata": "root.Assembly.check_gradient", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 851 }, { "content": " @rbac(('owner', 'user'))\n def new_pseudo_name(self):\n name = \"_pseudo_%d\" % self._pseudo_count\n self._pseudo_count += 1\n return name", "metadata": "root.Assembly.new_pseudo_name", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 992 }, { "content": " def get_graph(self, components_only=False, format='json'):\n ''' returns cleaned up graph data in the selected format\n\n components_only: (optional) boolean\n if True, only components will be included in the graph\n otherwise the full dependency graph will be returned\n\n format: (optional) string\n json - returns serialized graph data in JSON format\n svg - returns scalable vector graphics rendition of graph\n '''\n if components_only:\n graph = self._depgraph.component_graph()\n else:\n graph = _clean_graph(self._depgraph)\n\n if format.lower() == 'json':\n graph_data = json_graph.node_link_data(graph)\n return json.dumps(graph_data)\n elif format.lower() == 'svg':\n agraph = nx.to_agraph(graph)\n return agraph.draw(format='svg', prog='dot')\n else:\n self.raise_exception(\"'%s' is not a supported graph data format\" % format)", "metadata": "root.Assembly.get_graph", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 998 }, { "content": " def _repr_svg_(self):\n \"\"\" Returns an SVG representation of this Assembly's dependency graph\n (if pygraphviz is not available, returns an empty string)\n \"\"\"\n try:\n import pygraphviz\n return self.get_graph(components_only=True, format='svg')\n except ImportError:\n return ''", "metadata": "root.Assembly._repr_svg_", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1023 }, { "content": " def list_components(self):\n ''' List the components in the assembly.\n '''\n return [name for name in self.list_containers()\n if isinstance(self.get(name), Component)]", "metadata": "root.Assembly.list_components", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1033 }, { "content": " def get_comps(self):\n \"\"\"Returns a list of all of objects contained in this\n Assembly implementing the IComponent interface.\n \"\"\"\n return set([c for _,c in self.items()\n if has_interface(c, IComponent)])", "metadata": "root.Assembly.get_comps", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1039 }, { "content": " @rbac(('owner', 'user'))\n def setup_systems(self):\n rgraph = self._reduced_graph\n\n # create systems for all simple components\n for node, data in rgraph.nodes_iter(data=True):\n if 'comp' in data:\n data['system'] = _create_simple_sys(self, rgraph, node)\n\n self._top_driver.setup_systems()\n\n # copy the reduced graph\n rgraph = rgraph.subgraph(rgraph.nodes_iter())\n\n rgraph.collapse_subdrivers([], [self._top_driver])\n\n drvname = self._top_driver.name\n\n if len(rgraph) > 1:\n self._system = SerialSystem(self, rgraph, rgraph.component_graph(),\n self.name+'._inner_asm')\n # see if there's a driver cycle (happens when driver has params and\n # constraints/objectives that are boundary vars.)\n # FIXME: if we modify the graph to have to/from edges between a driver and\n # all of its workflow comps, then use strongly connected components to\n # determine full iteration sets, this will never happen.\n for strong in strongly_connected_components(rgraph):\n if drvname in strong:\n if len(strong) > 1:\n # break driver input edge\n for p in rgraph.predecessors(drvname):\n if p in strong:\n rgraph.remove_edge(p, drvname)\n if is_directed_acyclic_graph(rgraph):\n break\n break\n self._system.set_ordering(nx.topological_sort(rgraph), {})\n else:\n # TODO: if top driver has no params/constraints, possibly\n # remove driver system entirely and just go directly to workflow\n # system...\n self._system = rgraph.node[self._top_driver.name]['system']\n\n for name in self._unexecuted:\n comp = getattr(self, name)\n if has_interface(comp, IDriver) or has_interface(comp, IAssembly):\n comp.setup_systems()", "metadata": "root.Assembly.setup_systems", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1046 }, { "content": " @rbac(('owner', 'user'))\n def get_req_cpus(self):\n \"\"\"Return requested_cpus\"\"\"\n return self._top_driver.get_req_cpus()", "metadata": "root.Assembly.get_req_cpus", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1094 }, { "content": " def setup_communicators(self, comm):\n self.mpi.comm = comm\n self._system.setup_communicators(comm)", "metadata": "root.Assembly.setup_communicators", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1099 }, { "content": " def setup_variables(self):\n self._system.setup_variables()", "metadata": "root.Assembly.setup_variables", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1103 }, { "content": " def setup_sizes(self):\n \"\"\"Calculate the local sizes of all relevant variables\n and share those across all processes in the communicator.\n \"\"\"\n # find all local systems\n sys_stack = [self._system]\n loc_comps = []\n\n while sys_stack:\n system = sys_stack.pop()\n loc_comps.extend([s.name for s in system.simple_subsystems()\n if s._comp is not None])\n sys_stack.extend(system.local_subsystems())\n if isinstance(system, OpaqueSystem):\n sys_stack.append(system._inner_system)\n\n loc_comps = set(loc_comps)\n loc_comps.add(None)\n\n # loop over all component inputs and boundary outputs and\n # set them to their sources so that they'll be sized properly\n for node, data in self._reduced_graph.nodes_iter(data=True):\n if 'comp' not in data:\n src = node[0]\n scomp = src.split('.', 1)[0] if '.' in src else None\n dist_src = False\n ssys = None\n if scomp and scomp in self._reduced_graph:\n ssys = self._reduced_graph.node[scomp]['system']\n\n sval, idx = get_val_and_index(self, src)\n if isinstance(sval, ndarray):\n dests = node[1]\n for dest in dests:\n dcomp = dest.split('.',1)[0] if '.' in dest else None\n if dcomp in loc_comps:\n if dcomp:\n dsys = self._reduced_graph.node[dcomp]['system']\n # don't overwrite inputs if they have distrib_idxs declared, because those\n # determine the size\n if dsys.is_distrib_var(node):\n continue\n elif ssys and ssys.is_distrib_var(node):\n continue\n dval, didx = get_val_and_index(self, dest)\n if isinstance(dval, ndarray):\n if sval.shape != dval.shape:\n self.set(dest, sval)\n\n # this will calculate sizes for all subsystems\n self._system.setup_sizes()", "metadata": "root.Assembly.setup_sizes", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1106 }, { "content": " def setup_vectors(self, arrays=None):\n \"\"\"Creates vector wrapper objects to manage local and\n distributed vectors need to solve the distributed system.\n \"\"\"\n self._system.setup_vectors(None)", "metadata": "root.Assembly.setup_vectors", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1158 }, { "content": " def setup_scatters(self):\n self._system.setup_scatters()", "metadata": "root.Assembly.setup_scatters", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1164 }, { "content": " def _needs_pseudo(self, srcexpr, destexpr):\n \"\"\"Return a non-None pseudo_type if srcexpr and destexpr require a\n pseudocomp to be created.\n \"\"\"\n srcrefs = list(srcexpr.refs())\n if srcrefs and srcrefs[0] != srcexpr.text:\n # expression is more than just a simple variable reference,\n # so we need a pseudocomp\n return 'multi_var_expr'\n\n destmeta = destexpr.get_metadata('units')\n srcmeta = srcexpr.get_metadata('units')\n\n # compare using get_unit_name() to account for unit aliases\n if srcmeta:\n srcunit = srcmeta[0][1]\n if srcunit:\n srcunit = PhysicalQuantity(1., srcunit).unit\n else:\n srcunit = None\n\n if destmeta:\n destunit = destmeta[0][1]\n if destunit:\n destunit = PhysicalQuantity(1., destunit).unit\n else:\n destunit = None\n\n if destunit and srcunit:\n if destunit.powers != srcunit.powers or \\\n destunit.factor != srcunit.factor or \\\n destunit.offset != srcunit.offset:\n return 'units'\n\n return None", "metadata": "root.Assembly._needs_pseudo", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1167 }, { "content": " def setup_depgraph(self, dgraph=None):\n # create our depgraph\n self._depgraph = DependencyGraph()\n\n # add all of the components and their var nodes, and any of\n # our own variables as boundary var nodes.\n for name in self.list_inputs():\n self._depgraph.add_boundary_var(self, name,\n iotype='in')\n\n for name in self.list_outputs():\n self._depgraph.add_boundary_var(self, name,\n iotype='out')\n\n for cname in self.list_containers():\n obj = getattr(self, cname)\n if cname not in self._depgraph and has_interface(obj, IComponent):\n self._depgraph.add_component(cname, obj)\n\n # add our connections to the graph. Some connections, e.g.,\n # connections with unit conversions and connections involving\n # multivariable source expressions, will require the creation of\n # PseudoComponents. These must also be represented in the graph.\n for srcexpr, destexpr in self._connections:\n src = srcexpr.text\n dest = destexpr.text\n try:\n pcomp_type = self._needs_pseudo(srcexpr, destexpr)\n if pcomp_type:\n if pcomp_type == 'units':\n pseudocomp = UnitConversionPComp(self, srcexpr, destexpr,\n pseudo_type=pcomp_type)\n else:\n pseudocomp = PseudoComponent(self, srcexpr, destexpr,\n pseudo_type=pcomp_type)\n pseudocomp.activate(self)\n else:\n pseudocomp = None\n self._depgraph.check_connect(src, dest)\n dcomps = destexpr.get_referenced_compnames()\n scomps = srcexpr.get_referenced_compnames()\n for dname in dcomps:\n if dname in scomps:\n raise RuntimeError(\"Both refer to the same component.\")\n for cname in chain(dcomps, scomps):\n comp = getattr(self, cname)\n if has_interface(comp, IComponent):\n comp.config_changed(update_parent=False)\n\n for vname in chain(srcexpr.get_referenced_varpaths(copy=False),\n destexpr.get_referenced_varpaths(copy=False)):\n if not self.contains(vname):\n raise AttributeError(\"Can't find '%s'\" % vname)\n\n self._depgraph.connect(self, src, dest)\n except:\n self.reraise_exception(\"Can't connect '%s' to '%s': \" %\n (src, dest), sys.exc_info())\n\n # add connections for params, constraints, etc.\n for cname in self.list_containers():\n obj = getattr(self, cname)\n if hasattr(obj, 'get_parameters'):\n for param in obj.get_parameters().values():\n self._depgraph.add_param(obj.name, tuple(param.targets))\n\n if hasattr(obj, 'get_constraints'):\n for constraint in obj.get_constraints().values():\n constraint.activate(obj)\n\n if hasattr(obj, 'get_2sided_constraints'):\n for constraint in obj.get_2sided_constraints().values():\n constraint.activate(obj)\n\n if hasattr(obj, 'get_objectives'):\n for objective in obj.get_objectives().values():\n objective.activate(obj)\n\n if hasattr(obj, 'get_responses'):\n for res in obj.get_responses().values():\n res.activate(obj)\n\n for comp in self.get_comps():\n if has_interface(comp, IDriver) or has_interface(comp, IAssembly):\n comp.setup_depgraph(self._depgraph)", "metadata": "root.Assembly.setup_depgraph", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1203 }, { "content": " def setup_reduced_graph(self, inputs=None, outputs=None, drvname=None):\n \"\"\"Create the graph we need to do the breakdown of the model\n into Systems.\n \"\"\"\n dgraph = self._depgraph.subgraph(self._depgraph.nodes_iter())\n\n # keep all states\n # FIXME: I think this should only keep states of comps that are directly relevant...\n keep = set([n for n,d in dgraph.nodes_iter(data=True)\n if d.get('iotype')=='state'])\n #if d.get('iotype') in ('state','residual')])\n\n if self.parent is not None:\n self._derivs_required = self.parent._derivs_required\n else:\n self._derivs_required = False\n\n # figure out the relevant subgraph based on given inputs and outputs\n if not (inputs is None and outputs is None):\n self._derivs_required = True\n\n dsrcs, ddests = self._top_driver.get_expr_var_depends(recurse=True)\n keep.add(self._top_driver.name)\n keep.update([c.name for c in self._top_driver.iteration_set()])\n\n # keep any connected boundary vars\n for u,v in dgraph.list_connections():\n if is_boundary_node(dgraph, u):\n keep.add(u)\n if is_boundary_node(dgraph, v):\n keep.add(v)\n\n if inputs is None:\n inputs = list(ddests)\n else:\n # fix any single tuples\n inputs = [fix_single_tuple(i) for i in inputs]\n\n # identify any broadcast inputs\n ins = []\n for inp in inputs:\n if isinstance(inp, basestring):\n keep.add(inp)\n ins.append(inp)\n else:\n keep.update(inp)\n ins.append(inp[0])\n inputs = ins\n\n if outputs is None:\n outputs = dsrcs\n\n dgraph = dgraph._explode_vartrees(self)\n\n skip = False\n # add any variables requested that don't exist in the graph\n for inp in inputs:\n if not hasattr(self, inp.split('.')[0].split('[')[0]):\n skip = True\n break\n if inp not in dgraph:\n base = base_var(dgraph, inp)\n for n in chain(dgraph.successors(base), dgraph.predecessors(base)):\n if base_var(dgraph, n) != base:\n keep.add(base)\n dgraph.add_connected_subvar(inp)\n\n for out in outputs:\n if not hasattr(self, out.split('.',1)[0].split('[')[0]):\n skip = True\n break\n if out not in dgraph:\n base = base_var(dgraph, out)\n for n in chain(dgraph.successors(base), dgraph.predecessors(base)):\n if base_var(dgraph, n) != base:\n keep.add(base)\n dgraph.add_connected_subvar(out)\n\n if not skip:\n dgraph = dgraph.relevant_subgraph(inputs, outputs, keep)\n\n dgraph._remove_vartrees(self)\n\n keep.update(inputs)\n keep.update(outputs)\n\n dgraph._fix_state_connections(self)\n\n dgraph._connect_subvars_to_comps()\n\n # collapse all connections into single nodes.\n collapsed_graph = dgraph.collapse_connections()\n collapsed_graph.fix_duplicate_dests()\n collapsed_graph._consolidate_srcs()\n collapsed_graph.vars2tuples(dgraph)\n\n self.name2collapsed = collapsed_graph.map_collapsed_nodes()\n\n # add VarSystems for boundary vars\n for node, data in collapsed_graph.nodes_iter(data=True):\n if 'boundary' in data and collapsed_graph.degree(node) > 0:\n if data.get('iotype') == 'in' and collapsed_graph.in_degree(node) == 0: # input boundary node\n collapsed_graph.add_node(node[0].split('[',1)[0], comp='invar')\n collapsed_graph.add_edge(node[0].split('[',1)[0], node)\n elif data.get('iotype') == 'out': # output bndry node\n collapsed_graph.add_node(node[1][0].split('[',1)[0], comp='outvar')\n collapsed_graph.add_edge(node, node[1][0].split('[',1)[0])\n\n # translate kept nodes to collapsed form\n coll_keep = set([self.name2collapsed.get(k,k) for k in keep])\n\n # remove all vars that don't connect components\n collapsed_graph.prune(coll_keep)\n\n collapsed_graph.fix_dangling_vars(self)\n\n if drvname:\n for node in collapsed_graph:\n if collapsed_graph.in_degree(node) > 1 and isinstance(node, tuple):\n for pred in collapsed_graph.predecessors(node):\n if pred != drvname:\n collapsed_graph.remove_edge(pred, node)\n if collapsed_graph.in_degree(node) == 1:\n break\n\n self._reduced_graph = collapsed_graph\n\n for comp in self.get_comps():\n if has_interface(comp, IDriver) and comp.requires_derivs():\n self._derivs_required = True\n if has_interface(comp, IAssembly):\n comp.setup_reduced_graph(inputs=_get_scoped_inputs(comp, dgraph, inputs),\n outputs=_get_scoped_outputs(comp, dgraph, outputs))", "metadata": "root.Assembly.setup_reduced_graph", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1289 }, { "content": " def compute_ordering(self, graph):\n \"\"\"Given a component graph, each driver can determine its iteration\n set and the ordering of its workflow. Each Assembly has its own\n component graph, so the passed in graph is ignored.\n \"\"\"\n compgraph = self._depgraph.component_graph()\n self._top_driver.compute_ordering(compgraph)\n for comp in self.get_comps():\n if has_interface(comp, IAssembly):\n comp.compute_ordering(None)", "metadata": "root.Assembly.compute_ordering", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1423 }, { "content": " def compute_itersets(self, graph):\n \"\"\"Determine the iteration sets for all drivers.\"\"\"\n compgraph = self._depgraph.component_graph()\n self.driver.compute_itersets(compgraph)\n\n # this call may create a new top level driver for components\n # that need to execute once before the normal top level\n # driver executes.\n self._find_unexecuted_comps()\n\n for comp in self.get_comps():\n if has_interface(comp, IAssembly):\n comp.compute_itersets(None)", "metadata": "root.Assembly.compute_itersets", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1434 }, { "content": " def _get_var_info(self, node):\n \"\"\"Collect any variable metadata from the\n model here.\n \"\"\"\n info = { 'size': 0 }\n\n base = None\n noflat = False\n\n if isinstance(node, tuple):\n # use the name of the src\n name = node[0]\n for n in simple_node_iter(node):\n if self.get_metadata(n.split('[',1)[0], 'noflat'):\n noflat = True\n break\n else:\n name = node\n\n parts = name.split('.',1)\n if len(parts) > 1:\n cname, vname = parts\n child = getattr(self, cname)\n else:\n cname, vname = '', name\n child = self\n\n try:\n # TODO: add checking of local_size metadata...\n val, idx = get_val_and_index(child, vname)\n\n if isinstance(val, real_types):\n info['scalar'] = True\n\n if hasattr(val, 'shape'):\n info['shape'] = val.shape\n\n if '[' in vname: # array index into basevar\n base = vname.split('[',1)[0]\n flat_idx = to_idx_array(get_flattened_index(idx,\n get_var_shape(base, child),\n cvt_to_slice=False))\n else:\n base = None\n flat_idx = None\n\n info['size'] = flattened_size(vname, val, scope=child)\n if flat_idx is not None:\n info['flat_idx'] = flat_idx\n\n except NoFlatError:\n info['noflat'] = True\n\n if base is not None:\n if cname:\n bname = '.'.join((cname, base))\n else:\n bname = base\n info['basevar'] = bname\n\n # get any other metadata we want\n meta = child.get_metadata(vname)\n for mname in ['deriv_ignore']:\n if meta.get(mname) is not None:\n info[mname] = meta\n\n if noflat:\n info['noflat'] = True\n\n return info", "metadata": "root.Assembly._get_var_info", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1448 }, { "content": " def _get_all_var_metadata(self, graph):\n \"\"\"Collect size, shape, etc. info for all variables referenced\n in the graph. This info can then be used by all subsystems\n contained in this Assembly.\n \"\"\"\n varmeta = self._var_meta\n for node, data in graph.nodes_iter(data=True):\n if node not in varmeta and 'comp' not in data:\n meta = self._get_var_info(node)\n self._update_varmeta(node, meta)\n\n # there are cases where a component will return names from\n # its list_deriv_vars that are not found in the graph, so add them\n # all here just in case\n for node, data in graph.nodes_iter(data=True):\n if 'comp' in data and '.' not in node:\n try:\n comp = getattr(self, node)\n ins, outs = comp.list_deriv_vars()\n except AttributeError:\n continue\n for name in chain(ins, outs):\n name = '.'.join((node, name))\n if name not in varmeta:\n varmeta[name] = self._get_var_info(name)", "metadata": "root.Assembly._get_all_var_metadata", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1519 }, { "content": " def _update_varmeta(self, node, meta):\n self._var_meta[node] = meta\n for name in simple_node_iter(node):\n self._var_meta[name] = meta", "metadata": "root.Assembly._update_varmeta", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1545 }, { "content": " def get_var_print_ranks(self):\n \"\"\"Collect info from all processes indicating what variables\n are local to that process, and record the lowest rank where\n a given variable is local. Distributed variables will need\n to record all of their active ranks, since each rank will\n contain different data. This info is used for parallel case\n recording in order to avoid saving redundant data.\n \"\"\"\n self.print_ranks = print_ranks = {}\n\n if MPI is None or not self._system.is_active():\n return\n\n # first, get all of our local vars\n ourvars = self.get_all_local_vars()\n\n # now distribute this information across all ranks\n allvars = self.mpi.comm.allgather(ourvars)\n\n # now loop over all vars in each rank and record the\n # rank. Go in reverse so the lowest rank written will\n # be the last. If a var name is a tuple, that indicates\n # it's a distributed var, so all ranks will be recorded\n for rank in range(self.mpi.comm.size-1, -1, -1):\n for v in allvars[rank]:\n if isinstance(v, tuple): # it's a distributed var\n print_ranks.setdefault(v, []).append(rank)\n else:\n print_ranks[v] = (rank,)\n\n # for any connected vars, the rank of a destination is changed\n # to match the rank of its source\n cnames = [self.name2collapsed.get(n,n) for n in print_ranks]\n for cname in cnames:\n if isinstance(cname, tuple):\n src = cname[0]\n for dest in cname[1]:\n print_ranks[dest] = print_ranks[src]", "metadata": "root.Assembly.get_var_print_ranks", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1550 }, { "content": " def get_all_local_vars(self):\n \"\"\"Return the set of all variables in this Assembly and any\n of its children that are local to the current MPI process.\n \"\"\"\n all_locs = set()\n all_locs.update(self.list_inputs())\n all_locs.update(self.list_outputs())\n\n for s in [self._system] + list(self._system.local_subsystems(recurse=True)):\n if isinstance(s, SimpleSystem):\n try:\n obj = self.get(s.name)\n except:\n continue\n if has_interface(obj, IAssembly):\n all_locs.update(['.'.join([obj.name, n])\n for n in obj.get_all_local_vars()])\n elif has_interface(obj, IComponent):\n lvars = ['.'.join([obj.name, n])\n for n in obj.list_inputs() +\n obj.list_outputs()]\n for i, v in enumerate(lvars):\n if v in s.distrib_idxs:\n lvars[i] = (v,) # wrap in tuple to indicate its a distrib var\n all_locs.update(lvars)\n\n elif isinstance(s, ParamSystem):\n all_locs.add(s.name)\n\n return all_locs", "metadata": "root.Assembly.get_all_local_vars", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1589 }, { "content": " def setup_init(self):\n \"\"\"This is for any last minute configuration (like with\n ArchitectureAssembly). Components' setup_init methods\n are NOT called in execution order because that isn't\n known at this point.\n \"\"\"\n self.cpath_updated()\n\n self._var_meta = {}\n self._pre_driver = None\n self._unexecuted = []\n\n self._provideJ_bounds = None\n self._system = None\n self._derivs_required = False\n\n # get rid of any leftover pseudocomps from last time\n for name in self.__dict__.keys():\n if name.startswith('_pseudo_'):\n obj = getattr(self, name)\n if isinstance(obj, PseudoComponent):\n self.remove(name)\n\n for comp in self.get_comps():\n comp.setup_init()", "metadata": "root.Assembly.setup_init", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1620 }, { "content": " def init_var_sizes(self):\n self._top_driver.init_var_sizes()", "metadata": "root.Assembly.init_var_sizes", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1646 }, { "content": " def post_setup(self):\n for comp in self.get_comps():\n comp.post_setup()\n\n if self._system.is_active():\n self._system.vec['u'].set_from_scope(self)", "metadata": "root.Assembly.post_setup", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1649 }, { "content": " def _setup(self, inputs=None, outputs=None, drvname=None):\n \"\"\"This is called automatically on the top level Assembly\n prior to execution. It will also be called if\n calc_gradient is called with input or output lists that\n differ from the lists of parameters or objectives/constraints\n that are inherent to the model.\n \"\"\"\n # only perform full setup if we're the top Assembly\n if self.parent:\n return\n\n if MPI:\n MPI.COMM_WORLD.Set_errhandler(MPI.ERRORS_ARE_FATAL)\n comm = MPI.COMM_WORLD\n else:\n comm = None\n\n try:\n self.setup_init()\n\n self.setup_depgraph()\n self.compute_itersets(None)\n self.compute_ordering(None)\n\n self.init_var_sizes()\n\n self.setup_reduced_graph(inputs=inputs, outputs=outputs,\n drvname=drvname)\n self.setup_systems()\n\n self.check_config()\n\n # if MPI.COMM_WORLD.rank == 0:\n # from openmdao.util.dotgraph import plot_system_tree, plot_graph\n # plot_system_tree(self._system,'sys.pdf')\n # plot_graph(self._reduced_graph, 'red.pdf')\n\n # communicators are distributed and dist idxs are gathered from comps here\n self.setup_communicators(comm)\n\n self.collect_metadata()\n\n self.get_var_print_ranks()\n\n self.setup_variables()\n self.setup_sizes()\n self.setup_vectors()\n self.setup_scatters()\n\n except Exception as err:\n exc = sys.exc_info()\n sys.stdout.flush()\n sys.stderr.flush()\n raise exc[0], exc[1], exc[2]\n\n self.post_setup()", "metadata": "root.Assembly._setup", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1656 }, { "content": "def dump_iteration_tree(obj, f=sys.stdout, full=True, tabsize=4, derivs=False):\n \"\"\"Returns a text version of the iteration tree\n of an OpenMDAO object. The tree shows which are being\n iterated over by which drivers.\n\n If full is True, show pseudocomponents as well.\n If derivs is True, include derivative input/output\n information.\n \"\"\"\n def _dump_iteration_tree(obj, f, tablevel):\n tab = ' ' * tablevel\n if is_instance(obj, Driver):\n f.write(\"%s%s\\n\" % (tab, obj.name))\n if derivs:\n raise NotImplementedError(\"dumping of derivative inputs/outputs not supported yet.\")\n # f.write(\"%s*deriv inputs: %s\\n\"\n # % (' '*(tablevel+tabsize+2), inputs))\n # f.write(\"%s*deriv outputs: %s\\n\"\n # % (' '*(tablevel+tabsize+2), outputs))\n names = set(obj.workflow._explicit_names)\n for cname in obj._ordering:\n comp = getattr(obj.parent, cname)\n if not full and comp.name not in names:\n continue\n if is_instance(comp, Driver) or is_instance(comp, Assembly):\n _dump_iteration_tree(comp, f, tablevel + tabsize)\n elif is_instance(comp, PseudoComponent):\n f.write(\"%s%s (%s)\\n\" %\n (' ' * (tablevel+tabsize), comp.name, comp._orig_expr))\n else:\n f.write(\"%s%s\\n\" % (' ' * (tablevel+tabsize), comp.name))\n elif is_instance(obj, Assembly):\n f.write(\"%s%s\\n\" % (tab, obj.name))\n _dump_iteration_tree(obj.driver, f, tablevel + tabsize)\n\n _dump_iteration_tree(obj, f, 0)", "metadata": "root.dump_iteration_tree", "header": "['module', '___EOS___']", "index": 1714 }, { "content": "def _get_scoped_inputs(comp, g, explicit_ins):\n \"\"\"Return a list of input varnames scoped to the given name.\"\"\"\n cnamedot = comp.name + '.'\n inputs = set()\n if explicit_ins is None:\n explicit_ins = ()\n\n for u,v in g.list_connections():\n if v.startswith(cnamedot):\n inputs.add(v)\n\n inputs.update([n for n in explicit_ins if n.startswith(cnamedot)])\n\n if not inputs:\n return None\n\n return [n.split('.',1)[1] for n in inputs]", "metadata": "root._get_scoped_inputs", "header": "['module', '___EOS___']", "index": 1751 }, { "content": "def _get_scoped_outputs(comp, g, explicit_outs):\n \"\"\"Return a list of output varnames scoped to the given name.\"\"\"\n cnamedot = comp.name + '.'\n outputs = set()\n if explicit_outs is None:\n explicit_outs = ()\n\n for u,v in g.list_connections():\n if u.startswith(cnamedot):\n outputs.add(u)\n\n outputs.update([n for n in explicit_outs if n.startswith(cnamedot)])\n\n if not outputs:\n return None\n\n return [n.split('.',1)[1] for n in outputs]", "metadata": "root._get_scoped_outputs", "header": "['module', '___EOS___']", "index": 1769 }, { "content": "def _split_varpath(cont, path):\n \"\"\"Return a tuple of compname,component,varname given a path\n name of the form 'compname.varname'. If the name is of the form\n 'varname', then compname will be None and comp is cont.\n \"\"\"\n try:\n compname, varname = path.split('.', 1)\n except ValueError:\n return (None, cont, path)\n\n t = cont.get_trait(compname)\n if t and t.iotype:\n return (None, cont, path)\n return (compname, getattr(cont, compname), varname)", "metadata": "root._split_varpath", "header": "['module', '___EOS___']", "index": 1787 }, { "content": "def _expand_tree(path, tree):\n \"\"\"Return list of ``(path, value)`` with :class:`VariableTree`\n expanded.\"\"\"\n path += '.'\n result = []\n for name, val in tree._items(set()):\n if isinstance(val, VariableTree):\n result.extend(_expand_tree(path+name, val))\n else:\n result.append((path+name, val))\n return result", "metadata": "root._expand_tree", "header": "['module', '___EOS___']", "index": 1802 } ]
[ { "span": "import re", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 9 }, { "span": "import traceback", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 16 }, { "span": "from openmdao.main.expreval import ExprEvaluator, ConnectedExprEvaluator", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 72 }, { "span": "from openmdao.main.depgraph import DependencyGraph, all_comps, \\\n list_driver_connections, \\\n simple_node_iter, \\\n is_boundary_node", "start_line": 40, "start_column": 0, "end_line": 43, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", " ", "Class", " ", "definit", "ion", " ", "for", " ", "Asse", "mbly", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "public", " ", "symbols_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Asse", "mbly", "'_", ",_", "'", "set\\u", "as", "\\u", "top", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fnmatch_", "import_", "fnmatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "chain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "import_", "ndarray_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "E0", "611", ",", "F0", "401_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "networkx_", "as_", "nx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "networkx_", "._", "algorithms_", "._", "components_", "import_", "strong", "ly", "\\u", "connect", "ed", "\\u", "components_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "networkx_", "._", "algorithms_", "._", "dag_", "import_", "is", "\\u", "direct", "ed", "\\u", "ac", "yc", "lic", "\\u", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "mpi", "wrap_", "import_", "MPI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "exceptions_", "import_", "No", "Flat", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "interfaces_", "import_", "implements_", ",_", "IA", "sse", "mbly", "_", ",_", "ID", "river", "_", ",_", "IC", "omp", "one", "nt_", ",_", "IC", "onta", "iner", "_", ",_", "IC", "ase", "Recorder", "_", ",_", "IH", "as", "Parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "mp", "\\u", "support_", "import_", "has", "\\u", "interface_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "container_", "import_", "\\u", "copy", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "component_", "import_", "Component_", ",_", "Container_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "variable_", "import_", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "vart", "ree_", "import_", "Varia", "ble", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "datatypes_", "._", "api_", "import_", "List_", ",_", "Slot_", ",_", "Bool_", ",_", "Var", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "driver_", "import_", "Driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "rbac", "_", "import_", "rbac", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "mp", "\\u", "support_", "import_", "is", "\\u", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "print", "expr_", "import_", "eliminat", "e\\u", "expr", "\\u", "ws_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "expr", "eval_", "import_", "Exp", "r", "Evaluator_", ",_", "Connect", "ed", "Exp", "r", "Evaluator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "pseudo", "comp_", "import_", "Pse", "udo", "Component_", ",_", "Unit", "Conversion", "PC", "omp", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "array", "\\u", "helpers_", "import_", "is", "\\u", "different", "iable", "\\u", "var_", ",_", "get", "\\u", "val", "\\u", "and", "\\u", "index_", ",_", "get", "\\u", "flattened", "\\u", "index_", ",_", "get", "\\u", "var", "\\u", "shape_", ",_", "flattened", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "dep", "graph_", "import_", "Dependenc", "y", "Graph_", ",_", "all", "\\u", "comps_", ",_", "list", "\\u", "driver", "\\u", "connections_", ",_", "simple", "\\u", "node", "\\u", "iter_", ",_", "is", "\\u", "bound", "ary", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "systems_", "import_", "Simple", "System_", ",_", "Ser", "ial", "System_", ",_", "Param", "System_", ",_", "\\u", "create", "\\u", "simple", "\\u", "sys_", ",_", "Opa", "que", "System_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "mpi", "wrap_", "import_", "to", "\\u", "idx", "\\u", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "util_", "._", "graph_", "import_", "list", "\\u", "deriv", "\\u", "vars_", ",_", "base", "\\u", "var_", ",_", "fix", "\\u", "single", "\\u", "tuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "util_", "._", "log_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "util_", "._", "debug_", "import_", "strict", "\\u", "chk", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "util_", "._", "type", "groups_", "import_", "real", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "units_", "import_", "Phys", "ical", "Quantity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "util_", "._", "graph", "plot_", "import_", "\\u", "clean", "\\u", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "networkx_", "._", "read", "write_", "import_", "json", "\\u", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "io", "dict_", "=_", "{_", "'", "out", "'_", ":_", "'", "output", "'_", ",_", "'", "in", "'_", ":_", "'", "input", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "missing_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "as", "\\u", "top_", "(_", "cont_", ",_", "first", "\\u", "only_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Specifie", "s", " ", "tha", "t", " ", "the", " ", "give", "n", " ", "Containe", "r", " ", "is", " ", "the", " ", "top", " ", "of", " ", "a", " ", "Containe", "r", " ", "hier", "arch", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "first", "\\u", "only", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "only", " ", "set", " ", "it", " ", "as", " ", "a", " ", "top", " ", "if", " ", "a", " ", "global", "\\", "10", ";", " ", " ", " ", " ", "top", " ", "doe", "sn", "'", "t", " ", "alr", "ead", "y", " ", "exist", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cont_", "._", "cpa", "th", "\\u", "updated_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cont_", "\\u\\u\\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_", "Pass", "through", "Trait", "_", "(_", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "tra", "it", " ", "tha", "t", " ", "can", " ", "use", " ", "anot", "her", " ", "tra", "it", " ", "for", " ", "validation", ",", " ", "but", " ", "other", "wis", "e", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "just", " ", "a", " ", "tra", "it", " ", "tha", "t", " ", "lives", " ", "on", " ", "an", " ", "Asse", "mbly", " ", "bound", "ary", " ", "and", " ", "can", " ", "be", " ", "connect", "ed", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "other", " ", "traits", " ", "within", " ", "the", " ", "Asse", "mbly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Pass", "through", "Trait", "_", "(_", "Variable_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "obj_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validat", "ion", " ", "for", " ", "the", " ", "Pass", "Through", "Trait", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "validation", "\\u", "trait_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "validation", "\\u", "trait_", "._", "validate_", "(_", "obj_", ",_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Pass", "through", "Property_", "(_", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Replace", "ment", " ", "for", " ", "Pass", "through", "Trait", " ", "whe", "n", " ", "the", " ", "target", " ", "is", " ", "a", " ", "proxy", "/", "property", "\\", "10", ";", " ", " ", " ", " ", "tra", "it", ".", " ", "Pass", "through", "Trait", " ", "wou", "ld", " ", "get", " ", "a", " ", "core", " ", "dump", " ", "whi", "le", " ", "pick", "ling", ".", "\\", "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_", "Pass", "through", "Property_", "(_", "Variable_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "target", "\\u", "trait_", ",_", "**_", "metadata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "trait_", "=_", "target", "\\u", "trait_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vals_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Pass", "through", "Property_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pass", "through", "Property_", "(_", "Variable_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "obj_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "self_", "._", "\\u", "vals_", "._", "get_", "(_", "obj_", ",_", "\\u", "missing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "is_", "not_", "\\u", "missing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "v_", "._", "get_", "(_", "name_", ",_", "self_", "._", "\\u", "trait_", "._", "default", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "trait_", "._", "default", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pass", "through", "Property_", "(_", "Variable_", ")_", ":_", "\\u\\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_", "(_", "self_", ",_", "obj_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "not_", "in_", "self_", "._", "\\u", "vals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vals_", "[_", "obj_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old_", "=_", "self_", "._", "get_", "(_", "obj_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "!=_", "old_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vals_", "[_", "obj_", "]_", "[_", "name_", "]_", "=_", "self_", "._", "\\u", "trait_", "._", "validate_", "(_", "obj_", ",_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "tra", "it", "\\u", "property", "\\u", "changed_", "(_", "name_", ",_", "old_", ",_", "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_", "Record", "ing", "Options_", "(_", "Varia", "ble", "Tree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Containe", "r", " ", "for", " ", "options", " ", "tha", "t", " ", "control", " ", "case", " ", "record", "ing", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "save", "\\u", "problem", "\\u", "formula", "tion_", "=_", "Bool_", "(_", "True_", ",_", "desc_", "=_", "'", "Save", " ", "problem", " ", "formula", "tion", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "parameter", "s", ",", " ", "constraint", "s", ",", " ", "etc", ".)", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "includes_", "=_", "List_", "(_", "[_", "'*'_", "]_", ",_", "desc_", "=_", "'", "Patterns", " ", "for", " ", "variab", "les", " ", "to", " ", "include", " ", "in", " ", "record", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "excludes_", "=_", "List_", "(_", "[_", "]_", ",_", "desc_", "=_", "'", "Patterns", " ", "for", " ", "variab", "les", " ", "to", " ", "exclu", "de", " ", "from", " ", "record", "ing", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "process", "ed", " ", "after", " ", "include", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "is", " ", "a", " ", "container", " ", "of", " ", "Compo", "nent", "s", ".", " ", "It", " ", "underst", "ands", " ", "how", " ", "to", " ", "connect", " ", "inputs", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "output", "s", " ", "bet", "ween", " ", "its", " ", "child", "ren", ".", " ", " ", "Whe", "n", " ", "executed", ",", " ", "it", " ", "runs", " ", "the", " ", "top", " ", "level", "\\", "10", ";", " ", " ", " ", " ", "Drive", "r", " ", "call", "ed", " ", "'", "driver", "'.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "implements_", "(_", "IA", "sse", "mbly", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "=_", "Slot_", "(_", "ID", "river", "_", ",_", "allow", "\\u", "none_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "\"", "The", " ", "top", " ", "level", " ", "Drive", "r", " ", "tha", "t", " ", "manage", "s", " ", "executi", "on", " ", "of", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "this", " ", "Asse", "mbly", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "recorde", "rs_", "=_", "List_", "(_", "Slot_", "(_", "IC", "ase", "Recorder", "_", ",_", "required_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "'", "Case", " ", "recorde", "rs", " ", "for", " ", "iterati", "on", " ", "data", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "(", "only", " ", "valid", " ", "at", " ", "top", " ", "level", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "record", "ing", "\\u", "options_", "=_", "Var", "Tree_", "(_", "Record", "ing", "Options_", "(_", ")_", ",_", "iot", "ype_", "=_", "'", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "work", "\\u", "var_", "=_", "True_", ",_", "deriv", "\\u", "ignore_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "'", "Case", " ", "record", "ing", " ", "options", " ", "(", "only", " ", "valid", " ", "at", " ", "top", " ", "level", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Asse", "mbly", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "pseudo", "\\u", "count_", "=_", "0_", "#", " ", "counter", " ", "for", " ", "nami", "ng", " ", "pseudo", "comps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pre", "\\u", "driver_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "deriv", "s", "\\u", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "une", "xec", "ute", "d_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "var", "\\u", "meta_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "of", " ", "(", "src", "expr", ",", " ", "dest", "expr", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "connections_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "data", " ", "dependen", "cy", " ", "graph", ".", " ", "Includes", " ", "edge", "s", " ", "for", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connections", " ", "as", " ", "well", " ", "as", " ", "for", " ", "all", " ", "driver", " ", "parameter", "s", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "constraint", "s", "/", "objectives", ".", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "startin", "g", " ", "graph", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "late", "r", " ", "transformation", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "dep", "graph_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "created", " ", "from", " ", "\\u", "dep", "graph", ".", " ", "All", " ", "\\u", "dep", "graph", " ", "variab", "le", " ", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "collapsed", " ", "int", "o", " ", "single", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "reduce", "d\\u", "graph_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "Drive", "r", " ", "execute", "s", " ", "its", " ", "workf", "low", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Driver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Asse", "mbl", "ies", " ", "automati", "call", "y", " ", "figure", " ", "out", " ", "thei", "r", " ", "own", " ", "derivatives", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", " ", "bound", "ary", " ", "vars", " ", "tha", "t", " ", "are", " ", "uncon", "nect", "ed", " ", "shou", "ld", " ", "be", " ", "zero", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "missi", "ng", "\\u", "deriv", "\\u", "policy_", "=_", "'", "assume", "\\u", "zero", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add_", "(_", "'", "record", "ing", "\\u", "options", "'_", ",_", "Record", "ing", "Options_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "top", "\\u", "driver_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "pre", "\\u", "driver_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "pre", "\\u", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set\\u", "iter", "name_", "(_", "self_", ",_", "iter", "name_", ",_", "seqn", "o_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "current", " ", "'", "iterati", "on", " ", "coordinate", "s", "'.", " ", "Override", "s", " ", ":", "class", ":`", "Compo", "nent", "`", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "propagate", " ", "to", " ", "driver", ",", " ", "and", " ", "option", "ally", " ", "set", " ", "the", " ", "initial", " ", "count", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "driver", "'", "s", " ", "workf", "low", ".", " ", "Sett", "ing", " ", "the", " ", "initial", " ", "count", " ", "is", " ", "typical", "ly", " ", "don", "e", " ", "by", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", "Case", "It", "er", "Drive", "r", "Base", "`", " ", "on", " ", "a", " ", "remote", " ", "top", " ", "level", " ", "assem", "bly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "iter", "name", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Iterat", "ion", " ", "coordinate", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "seqn", "o", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Initial", " ", "executi", "on", " ", "count", " ", "for", " ", "driver", "'", "s", " ", "workf", "low", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Asse", "mbly", "_", ",_", "self_", ")_", "._", "set\\u", "iter", "name_", "(_", "iter", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "set\\u", "iter", "name_", "(_", "iter", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "seqn", "o_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "workflow_", "._", "set\\u", "initial", "\\u", "count_", "(_", "seqn", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "refer", "ring", "\\u", "connections_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "connections", " ", "where", " ", "the", " ", "give", "n", " ", "name", " ", "is", " ", "referred", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "eit", "her", " ", "in", " ", "the", " ", "source", " ", "or", " ", "the", " ", "destinat", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "(_", "u_", "._", "text_", ",_", "v_", "._", "text_", ")_", "for_", "u_", ",_", "v_", "in_", "self_", "._", "\\u", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "u_", "._", "refer", "s", "\\u", "to_", "(_", "name_", ")_", "or_", "v_", "._", "refer", "s", "\\u", "to_", "(_", "name_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "in", "\\u", "workflows_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", " ", "of", " ", "the", " ", "form", " ", "(", "workf", "low", ",", " ", "index", ")", " ", "for", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "workf", "lows", " ", "in", " ", "the", " ", "scope", " ", "of", " ", "this", " ", "Asse", "mbly", " ", "tha", "t", " ", "contain", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "component", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "lows", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "!=_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "get_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", ",_", "Driver_", ")_", "and_", "name_", "in_", "obj_", "._", "workflow_", "._", "\\u", "explicit", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "wf", "lows", "_", "._", "append_", "(_", "(_", "obj_", "._", "workflow_", ",_", "obj_", "._", "workflow_", "._", "\\u", "explicit", "\\u", "names_", "._", "index_", "(_", "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_", "return_", "wf", "lows", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rename_", "(_", "self_", ",_", "oldn", "ame_", ",_", "newname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Rename", "s", " ", "a", " ", "child", " ", "of", " ", "this", " ", "object", " ", "from", " ", "oldn", "ame", " ", "to", " ", "newn", "ame", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "rename_", "(_", "oldn", "ame_", ",_", "newname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "component", "s", " ", "may", " ", "have", " ", "old", " ", "name", " ", "in", " ", "thei", "r", " ", "workf", "lows", "/", "objectives", "/", "params", "/", "constraint", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "give", " ", "them", " ", "a", " ", "chan", "ce", " ", "to", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "comp_", "in_", "self_", "._", "get", "\\u", "comps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "name", "\\u", "changed_", "(_", "oldn", "ame_", ",_", "newname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "u_", ",_", "v_", "in_", "self_", "._", "\\u", "connections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u_", "._", "name", "\\u", "changed_", "(_", "oldn", "ame_", ",_", "newname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "._", "name", "\\u", "changed_", "(_", "oldn", "ame_", ",_", "newname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "=_", "self_", "._", "get_", "(_", "oldn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "name_", "=_", "newname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add_", "(_", "newname_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "just", " ", "remove", "s", " ", "from", " ", "traits", " ", "dict", "s", ",", " ", "but", " ", "doe", "sn", "'", "t", " ", "remove", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "workf", "lows", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "remove", "\\u", "trait_", "(_", "oldn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace_", "(_", "self_", ",_", "target", "\\u", "name_", ",_", "newo", "bj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Replace", " ", "one", " ", "object", " ", "with", " ", "anot", "her", ",", " ", "atte", "mpt", "ing", " ", "to", " ", "mimic", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "inputs", " ", "and", " ", "connections", " ", "of", " ", "the", " ", "replaced", " ", "object", " ", "as", " ", "muc", "h", " ", "as", " ", "possib", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tob", "j_", "=_", "getattr_", "(_", "self_", ",_", "target", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "tob", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add_", "(_", "target", "\\u", "name_", ",_", "newo", "bj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "exist", "ing", " ", "driver", " ", "reference", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "refs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "tob", "j_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cname_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "self_", ",_", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "not_", "tob", "j_", "and_", "has", "\\u", "interface_", "(_", "obj_", ",_", "ID", "river", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "refs_", "[_", "cname_", "]_", "=_", "obj_", "._", "get", "\\u", "references_", "(_", "target", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "newo", "bj_", ",_", "'", "mimic", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "copy", " ", "inputs", ",", " ", "delegate", "s", " ", "and", " ", "set", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newo", "bj_", "._", "mimic", "_", "(_", "tob", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "reraise", "\\u", "exception_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "replace", " ", "'%", "s", "'", " ", "of", " ", "type", " ", "%", "s", " ", "with", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "type", " ", "%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "target", "\\u", "name_", ",_", "type_", "(_", "tob", "j_", ")_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "newo", "bj_", ")_", "._", "\\u\\u", "name\\u\\u_", ")_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conns_", "=_", "self_", "._", "find", "\\u", "refer", "ring", "\\u", "connections_", "(_", "target", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "lows", "_", "=_", "self_", "._", "find", "\\u", "in", "\\u", "workflows_", "(_", "target", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Asse", "mbl", "ies", " ", "somet", "imes", " ", "create", " ", "inputs", " ", "and", " ", "output", "s", " ", "in", " ", "thei", "r", " ", "configur", "e", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", ",", " ", "so", " ", "call", " ", "it", " ", "ear", "ly", " ", "if", " ", "possible_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "call", "\\u", "cpa", "th", "\\u", "updated_", "is_", "False_", "and_", "isinstance_", "(_", "obj_", ",_", "Container_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newo", "bj_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newo", "bj_", "._", "name_", "=_", "target", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newo", "bj_", "._", "cpa", "th", "\\u", "updated_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "all", " ", "connect", "ed", " ", "vars", " ", "exist", " ", "in", " ", "the", " ", "new", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req", "\\u", "vars_", "=_", "set_", "(_", "[_", "u_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "'['_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "u_", ",_", "v_", "in_", "conns_", "if_", "u_", "._", "startswith_", "(_", "target", "\\u", "name_", "+_", "'.'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req", "\\u", "vars_", "._", "update_", "(_", "[_", "v_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "'['_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "u_", ",_", "v_", "in_", "conns_", "if_", "v_", "._", "startswith_", "(_", "target", "\\u", "name_", "+_", "'.'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "missing_", "=_", "[_", "v_", "for_", "v_", "in_", "req", "\\u", "vars_", "if_", "not_", "newo", "bj_", "._", "contains_", "(_", "v_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "missing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "warning_", "(_", "\"", "the", " ", "follow", "ing", " ", "variab", "les", " ", "are", " ", "connect", "ed", " ", "to", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "other", " ", "component", "s", " ", "but", " ", "are", " ", "missi", "ng", " ", "in", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "the", " ", "replace", "ment", " ", "object", ":", " ", "%", "s", "\"_", "%_", "missing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "expr", " ", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "u_", ",_", "v_", "in_", "conns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "disconnect_", "(_", "u_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "any", " ", "exist", "ing", " ", "connections", " ", "to", " ", "replace", "ment", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "newo", "bj_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "disconnect_", "(_", "newo", "bj_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add_", "(_", "target", "\\u", "name_", ",_", "newo", "bj_", ")_", "#", " ", "this", " ", "will", " ", "remove", " ", "the", " ", "old", " ", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "and", " ", "any", " ", "connections", " ", "to", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recreate", " ", "old", " ", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "u_", ",_", "v_", "in_", "conns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "recreate", " ", "the", " ", "connecti", "on", " ", "unl", "ess", " ", "we", " ", "can", " ", "resolve", " ", "bot", "h", " ", "ends_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get_", "(_", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "get_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connect_", "(_", "u_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "warning_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "connect", " ", "'%", "s", "'", " ", "to", " ", "'%", "s", "':", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u_", ",_", "v_", ",_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Restor", "e", " ", "driver", " ", "reference", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "dname_", ",_", "\\u", "refs_", "in_", "refs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drv_", "=_", "getattr_", "(_", "self_", ",_", "dname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drv_", "._", "remove", "\\u", "references_", "(_", "target", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drv_", "._", "restore", "\\u", "references_", "(_", "\\u", "refs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "new", " ", "object", " ", "(", "if", " ", "it", "'", "s", " ", "a", " ", "Compo", "nent", ")", " ", "to", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "workf", "lows", " ", "where", " ", "target", " ", "was", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "newo", "bj_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "wf", "low_", ",_", "idx_", "in_", "wf", "lows", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wf", "low_", "._", "add_", "(_", "target", "\\u", "name_", ",_", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", " ", "the", " ", "named", " ", "container", " ", "object", " ", "from", " ", "this", " ", "assem", "bly", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "remove", " ", "it", " ", "from", " ", "its", " ", "workf", "low", "(", "s", ")", " ", "if", " ", "it", "'", "s", " ", "a", " ", "Compo", "nent", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "pseudo", " ", "component", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "getattr_", "(_", "self_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IC", "omp", "one", "nt_", ")_", "or_", "isinstance_", "(_", "obj_", ",_", "Pse", "udo", "Component_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cname_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cobj", "_", "=_", "getattr_", "(_", "self_", ",_", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "cobj", "_", ",_", "Driver_", ")_", "and_", "cobj", "_", "is_", "not_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cobj", "_", "._", "remove", "\\u", "references_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "disconnect_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "in_", "self_", "._", "list", "\\u", "inputs_", "(_", ")_", "or_", "name_", "in_", "self_", "._", "list", "\\u", "outputs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "disconnect_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Asse", "mbly", "_", ",_", "self_", ")_", "._", "remove_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "passthrough", "_", "(_", "self_", ",_", "pathname_", ",_", "alias_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "Pass", "through", "Trait", " ", "tha", "t", " ", "use", "s", " ", "the", " ", "tra", "it", " ", "indicat", "ed", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "path", "name", " ", "for", " ", "validation", ",", " ", "adds", " ", "it", " ", "to", " ", "self", ",", " ", "and", " ", "create", "s", " ", "a", " ", "connecti", "on", "\\", "10", ";", " ", " ", " ", " ", "bet", "ween", " ", "the", " ", "two", ".", " ", "If", " ", "alias", " ", "is", " ", "*", "Non", "e", ",*", " ", "the", " ", "name", " ", "of", " ", "the", " ", "alias", " ", "tra", "it", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "the", " ", "last", " ", "entry", " ", "in", " ", "its", " ", "path", "name", ".", " ", "The", " ", "tra", "it", " ", "specified", " ", "by", " ", "path", "name", "\\", "10", ";", " ", " ", " ", " ", "must", " ", "exist", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parts_", "=_", "pathname_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "alias_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newname_", "=_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newname_", "=_", "parts_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "newname_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "raise", "\\u", "exception_", "(_", "\"'", "%", "s", "'", " ", "alr", "ead", "y", " ", "exist", "s", "\"_", "%_", "newname_", ",_", "Key", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "raise", "\\u", "exception_", "(_", "'", "destinat", "ion", " ", "of", " ", "passthrough", " ", "must", " ", "be", " ", "a", " ", "dot", "ted", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "path", "'_", ",_", "Name", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "comp_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "part_", "in_", "parts_", "[_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "=_", "getattr_", "(_", "comp_", ",_", "part_", ")_", "\\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 ", " _", "trait_", "=_", "None_", "\\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 ", " _", "trait_", "=_", "comp_", "._", "get", "\\u", "trait_", "(_", "parts_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iot", "ype_", "=_", "comp_", "._", "get", "\\u", "iot", "ype_", "(_", "parts_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "trait_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ttype_", "=_", "trait_", "._", "tra", "it", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ttype_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ttype_", "=_", "trait_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "contains_", "(_", "pathname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "raise", "\\u", "exception_", "(_", "\"", "the", " ", "variab", "le", " ", "named", " ", "'%", "s", "'", " ", "can", "'", "t", " ", "be", " ", "found", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "pathname_", ",_", "Key", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iot", "ype_", "=_", "self_", "._", "get", "\\u", "metadata_", "(_", "pathname_", ",_", "'", "iot", "ype", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "trait_", "is_", "not_", "None_", "and_", "not_", "trait_", "._", "validate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "validat", "e", " ", "function", ",", " ", "so", " ", "just", " ", "don", "'", "t", " ", "use", " ", "tra", "it", " ", "for", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trait_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata_", "=_", "self_", "._", "get", "\\u", "metadata_", "(_", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "[_", "'", "target", "'_", "]_", "=_", "pathname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "[_", "'", "default", "\\u", "value", "'_", "]_", "=_", "trait_", "._", "tra", "it", "\\u", "type_", "._", "default", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pass", "through", "Trait", " ", "to", " ", "a", " ", "tra", "it", " ", "with", " ", "get", "/", "set", " ", "method", "s", " ", "caus", "es", " ", "a", " ", "core", " ", "dump_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "Trait", "s", " ", "(", "at", " ", "leas", "t", " ", "through", " ", "3.6", ")", " ", "whi", "le", " ", "pick", "ling", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "validation", "\\u", "tra", "it", "\"_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "metadata_", "[_", "'", "validation", "\\u", "tra", "it", "'_", "]_", "._", "get_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newt", "rai", "t_", "=_", "Pass", "through", "Trait", "_", "(_", "**_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newt", "rai", "t_", "=_", "Pass", "through", "Property_", "(_", "metadata_", "[_", "'", "validation", "\\u", "tra", "it", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "trait_", "and_", "ttype_", "._", "get_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newt", "rai", "t_", "=_", "Pass", "through", "Property_", "(_", "ttype_", ",_", "**_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newt", "rai", "t_", "=_", "Pass", "through", "Trait", "_", "(_", "validation", "\\u", "trait_", "=_", "trait_", ",_", "**_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add", "\\u", "trait_", "(_", "newname_", ",_", "newt", "rai", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "tra", "it", " ", "value", " ", "according", " ", "to", " ", "'", "copy", "'", " ", "attribute", " ", "in", " ", "the", " ", "trait_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "=_", "self_", "._", "get_", "(_", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ttype_", "=_", "trait_", "._", "tra", "it", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ttype_", "._", "copy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Varia", "ble", " ", "trees", " ", "need", " ", "to", " ", "point", " ", "to", " ", "a", " ", "new", " ", "parent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "so", ",", " ", "let", "'", "s", " ", "not", " ", "deepc", "opy", " ", "the", " ", "outsi", "de", " ", "universe_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "val_", ",_", "Container_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val", "\\u", "copy_", "=_", "val_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val", "\\u", "copy_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "val", "\\u", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "name_", "=_", "newname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "\\u", "copy", "dict_", "[_", "ttype_", "._", "copy_", "]_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "newname_", ",_", "val_", ")_", "\\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_", "iot", "ype_", "==_", "'", "in", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "connect_", "(_", "newname_", ",_", "pathname_", ")_", "\\u\\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_", "._", "connect_", "(_", "pathname_", ",_", "newname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "remove_", "(_", "newname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "info_", "[_", "0_", "]_", ",_", "info_", "[_", "1_", "]_", ",_", "info_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "newt", "rai", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "\\u", "une", "xec", "ute", "d\\u", "comps_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "une", "xec", "ute", "d_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pre", "\\u", "driver_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cg", "raph_", "=_", "self_", "._", "\\u", "dep", "graph_", "._", "component", "\\u", "graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "comps_", "=_", "set_", "(_", "[_", "c_", "._", "name_", "for_", "c_", "in_", "self_", "._", "driver_", "._", "iterati", "on", "\\u", "set_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "comps_", "._", "add_", "(_", "'", "driver", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff_", "=_", "set_", "(_", "cg", "raph_", "._", "nodes_", "(_", ")_", ")_", "-_", "wf", "comps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pre", "\\u", "driver_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "diff_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "\\u", "edges_", "=_", "nx_", "._", "edge", "\\u", "boundary_", "(_", "cg", "raph_", ",_", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pre_", "=_", "[_", "u_", "for_", "u_", ",_", "v_", "in_", "out", "\\u", "edges_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "une", "xec", "ute", "d_", "=_", "list_", "(_", "diff_", "-_", "set_", "(_", "pre_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pre_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "If", " ", "there", " ", "are", " ", "ups", "tream", " ", "comps", " ", "tha", "t", " ", "are", " ", "not", " ", "in", " ", "any", " ", "workf", "low", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "create", " ", "a", " ", "hidden", " ", "top", " ", "level", " ", "driver", " ", "call", "ed", " ", "\\u", "pre", "\\u", "driver", ".", " ", "That_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "driver", " ", "will", " ", "be", " ", "executed", " ", "onc", "e", " ", "per", " ", "executi", "on", " ", "of", " ", "the", " ", "Asse", "mbly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", "'", "t", " ", "call", " ", "add", " ", "here", " ", "for", " ", "\\u", "pre", "\\u", "driver", " ", "bec", "aus", "e", " ", "tha", "t", " ", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "config", "\\u", "change", "d", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "pre", "\\u", "driver_", "=_", "Driver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pre", "\\u", "driver_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pre_", "._", "append_", "(_", "'", "driver", "'_", ")_", "#", " ", "run", " ", "the", " ", "normal", " ", "top", " ", "driver", " ", "after", " ", "runn", "ing", " ", "the", " ", "'", "pre", "'", " ", "comps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pre", "\\u", "driver_", "._", "workflow_", "._", "add_", "(_", "pre_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pre", "\\u", "driver_", "._", "name_", "=_", "'\\u", "pre", "\\u", "driver", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pre", "\\u", "driver_", "._", "\\u", "iter", "\\u", "set_", "=_", "set_", "(_", "pre_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pre", "\\u", "driver_", "._", "\\u", "full", "\\u", "iter", "\\u", "set_", "=_", "self_", "._", "driver_", "._", "\\u", "full", "\\u", "iter", "\\u", "set_", "._", "union_", "(_", "pre_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dep", "graph_", "._", "add", "\\u", "node_", "(_", "'\\u", "pre", "\\u", "driver", "'_", ",_", "comp_", "=_", "True_", ",_", "driver_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "collect", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "metadata", " ", "(", "size", ",", " ", "etc", ".)", " ", "for", " ", "all", " ", "rele", "van", "t", " ", "vars_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "get", "\\u", "all", "\\u", "var", "\\u", "metadata_", "(_", "self_", "._", "\\u", "reduce", "d\\u", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "comp_", "in_", "self_", "._", "get", "\\u", "comps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "interface_", "(_", "comp_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "collect", "\\u", "metadata_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "config_", "(_", "self_", ",_", "strict_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Verify", " ", "tha", "t", " ", "this", " ", "component", " ", "and", " ", "all", " ", "of", " ", "its", " ", "child", "ren", " ", "are", " ", "proper", "ly", "\\", "10", ";", " ", " ", " ", " ", "configur", "ed", " ", "to", " ", "execute", ".", " ", "Thi", "s", " ", "function", " ", "is", " ", "call", "ed", " ", "prior", " ", "the", " ", "first", "\\", "10", ";", " ", " ", " ", " ", "component", " ", "executi", "on", ".", " ", " ", "If", " ", "strict", " ", "is", " ", "Tru", "e", ",", " ", "any", " ", "warn", "ing", " ", "or", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "raise", " ", "an", " ", "exception", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "override", " ", "this", " ", "function", " ", "to", " ", "do", " ", "checks", " ", "specific", " ", "to", " ", "your", " ", "class", ",", "\\", "10", ";", " ", " ", " ", " ", "you", " ", "must", " ", "call", " ", "this", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Asse", "mbly", "_", ",_", "self_", ")_", "._", "check", "\\u", "config_", "(_", "strict_", "=_", "strict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "input", "\\u", "collisions", "_", "(_", "self_", "._", "\\u", "dep", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "unse", "t", "\\u", "req", "\\u", "vars_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "une", "xec", "ute", "d\\u", "comps_", "(_", "strict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "new", "\\u", "config_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "info_", "[_", "0_", "]_", ",_", "info_", "[_", "1_", "]_", ",_", "info_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "input", "\\u", "collisions", "_", "(_", "self_", ",_", "graph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "s_", "=_", "set_", "(_", "[_", "v_", "for_", "u_", ",_", "v_", "in_", "graph_", "._", "list", "\\u", "connections_", "(_", ")_", "if_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drv", "\\u", "conn", "\\u", "ext", "'_", "not_", "in_", "graph_", "[_", "u_", "]_", "[_", "v_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drv", "\\u", "conn", "'_", "not_", "in_", "graph_", "[_", "u_", "]_", "[_", "v_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "bases_", "=_", "set_", "(_", "[_", "base", "\\u", "var_", "(_", "graph_", ",_", "v_", ")_", "for_", "v_", "in_", "dest", "s_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uncon", "nect", "ed", "\\u", "bases_", "=_", "all", "bases_", "-_", "dest", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect", "ed", "\\u", "bases_", "=_", "all", "bases_", "-_", "uncon", "nect", "ed", "\\u", "bases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "collisions", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "drv_", "in_", "chain_", "(_", "[_", "self_", "._", "\\u", "top", "\\u", "driver_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "subd", "river", "s_", "(_", "recurse_", "=_", "True_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "interface_", "(_", "drv_", ",_", "IH", "as", "Parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "target_", "in_", "drv_", "._", "list", "\\u", "param", "\\u", "targets_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tba", "se_", "=_", "base", "\\u", "var_", "(_", "graph_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target_", "==_", "tba", "se_", ":_", "#", " ", "target", " ", "is", " ", "a", " ", "base", " ", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "target_", "in_", "all", "bases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "collisions", "_", "._", "append_", "(_", "\"%", "s", " ", "in", " ", "%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "target_", ",_", "drv_", "._", "get", "\\u", "pathname_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "target", " ", "is", " ", "a", " ", "sub", " ", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "target_", "in_", "dest", "s_", "or_", "tba", "se_", "in_", "connect", "ed", "\\u", "bases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "collisions", "_", "._", "append_", "(_", "\"%", "s", " ", "in", " ", "%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "target_", ",_", "drv_", "._", "get", "\\u", "pathname_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "collisions", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "raise", "\\u", "exception_", "(_", "\"", "The", " ", "follow", "ing", " ", "parameter", "s", " ", "collide", " ", "with", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "connect", "ed", " ", "inputs", ":", " ", "%", "s", "\"_", "%_", "','_", "._", "join_", "(_", "collisions", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Run", "time", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "une", "xec", "ute", "d\\u", "comps_", "(_", "self_", ",_", "strict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "strict", "\\u", "chk", "\\u", "config_", "(_", "strict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "funct", "_", "=_", "self_", "._", "raise", "\\u", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "funct", "_", "=_", "self_", "._", "\\u", "logger_", "._", "warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "pre", "\\u", "driver_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "The", " ", "follow", "ing", " ", "component", "s", " ", "are", " ", "not", " ", "in", " ", "any", " ", "workf", "low", " ", "but", " ", "\"_", "\"", "are", " ", "need", "ed", " ", "by", " ", "other", " ", "workf", "lows", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "strict", "\\u", "chk", "\\u", "config_", "(_", "strict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "+=_", "\",", " ", "so", " ", "the", "y", " ", "will", " ", "be", " ", "executed", " ", "onc", "e", " ", "per", " ", "executi", "on", " ", "of", " ", "\"_", "\"", "this", " ", "Asse", "mbly", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pre_", "=_", "self_", "._", "\\u", "pre", "\\u", "driver_", "._", "\\u", "iter", "\\u", "set_", "-_", "set_", "(_", "[_", "'", "driver", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "\":", " ", "%", "s", "\"_", "%_", "list_", "(_", "sorted_", "(_", "pre_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "funct", "_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "une", "xec", "ute", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "funct", "_", "(_", "\"", "The", " ", "follow", "ing", " ", "component", "s", " ", "are", " ", "not", " ", "in", " ", "any", " ", "workf", "low", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "and", " ", "WIL", "L", " ", "NOT", " ", "EXECUTE", ":", " ", "%", "s", "\"_", "%_", "list_", "(_", "self_", "._", "\\u", "une", "xec", "ute", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "unse", "t", "\\u", "req", "\\u", "vars_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "'", "require", "d", "'", " ", "variab", "les", " ", "tha", "t", " ", "have", " ", "not", " ", "bee", "n", " ", "set", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "self_", "._", "\\u", "dep", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "chain_", "(_", "all", "\\u", "comps_", "(_", "graph_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "get", "\\u", "bound", "ary", "\\u", "inputs_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "get", "\\u", "bound", "ary", "\\u", "outputs_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "self_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IC", "onta", "iner", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "vname_", "in_", "obj_", "._", "get", "\\u", "req", "\\u", "default_", "(_", "self_", "._", "trait_", "(_", "name_", ")_", "._", "required_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "each", " ", "var", " ", "must", " ", "be", " ", "connect", "ed", ",", " ", "other", "wis", "e", " ", "value", " ", "will", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "set", " ", "to", " ", "a", " ", "non", "-", "default", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "base_", "=_", "base", "\\u", "var_", "(_", "graph_", ",_", "vname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inde", "g_", "=_", "graph_", "._", "in", "\\u", "degree_", "(_", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io_", "=_", "graph_", "._", "node_", "[_", "base_", "]_", "[_", "'", "iot", "ype", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "io_", "==_", "'", "in", "'_", "and_", "inde", "g_", "<_", "1_", ")_", "or_", "(_", "io_", "==_", "'", "state", "'_", "and_", "inde", "g_", "<_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "raise", "\\u", "exception_", "(_", "\"", "require", "d", " ", "variab", "le", " ", "'%", "s", "'", " ", "was", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "not", " ", "set", "\"_", "%_", "vname_", ",_", "Run", "time", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "connect_", "(_", "self_", ",_", "src_", ",_", "dest_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "valid", "it", "y", " ", "of", " ", "connecti", "ng", " ", "a", " ", "source", " ", "express", "ion", " ", "to", " ", "a", " ", "destinat", "ion", "\\", "10", ";", " ", " ", " ", " ", "express", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "expr_", "=_", "Connect", "ed", "Exp", "r", "Evaluator_", "(_", "dest_", ",_", "self_", ",_", "is", "\\u", "dest_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "expr_", "=_", "Connect", "ed", "Exp", "r", "Evaluator_", "(_", "src_", ",_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "getter_", "=_", "'", "get", "\\u", "attr", "\\u", "w", "\\u", "copy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "src", "comps_", "=_", "src", "expr_", "._", "get", "\\u", "referenced", "\\u", "comp", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "comps_", "=_", "list_", "(_", "dest", "expr_", "._", "get", "\\u", "referenced", "\\u", "comp", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dest", "comps_", "and_", "dest", "comps_", "[_", "0_", "]_", "in_", "src", "comps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"'", "%", "s", "'", " ", "and", " ", "'%", "s", "'", " ", "refer", " ", "to", " ", "the", " ", "same", " ", "component", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "src_", ",_", "dest_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "src", "expr_", ",_", "dest", "expr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "connect_", "(_", "self_", ",_", "src_", ",_", "dest_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Connect", " ", "one", " ", "source", " ", "variab", "le", " ", "or", " ", "express", "ion", " ", "to", " ", "one", " ", "or", " ", "more", "\\", "10", ";", " ", " ", " ", " ", "destinat", "ion", " ", "variab", "les", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "src", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Sou", "rce", " ", "express", "ion", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dest", ":", " ", "str", " ", "or", " ", "list", "(", "str", ")", "\\", "10", ";", " ", " ", " ", " ", "Dest", "ination", " ", "variab", "le", " ", "string", "(", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "eliminat", "e\\u", "expr", "\\u", "ws_", "(_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "dest_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest_", "=_", "(_", "dest_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "dst_", "in_", "dest_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst_", "=_", "eliminat", "e\\u", "expr", "\\u", "ws_", "(_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "connect_", "(_", "src_", ",_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "connect_", "(_", "self_", ",_", "src_", ",_", "dest_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", " ", "one", " ", "connecti", "on", " ", "destinat", "ion", ".", " ", "Thi", "s", " ", "shou", "ld", " ", "only", " ", "be", " ", "call", "ed", " ", "via", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "connect", "()", " ", "function", ",", " ", "neve", "r", " ", "direct", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "expr_", ",_", "dest", "expr_", "=_", "self_", "._", "\\u", "check", "\\u", "connect_", "(_", "src_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "connections_", "._", "append_", "(_", "(_", "src", "expr_", ",_", "dest", "expr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "val_", "=_", "dest", "expr_", "._", "evaluate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "dest", "val_", ",_", "ndarray_", ")_", "and_", "dest", "val_", "._", "size_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dest", "expr_", "._", "set_", "(_", "src", "expr_", "._", "evaluate_", "(_", ")_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "dest_", "(_", "src", "expr_", ",_", "dest", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "type_", ",_", "value_", ",_", "traceback_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invalid", "\\u", "vars_", "=_", "src", "expr_", "._", "get", "\\u", "unresolv", "ed_", "(_", ")_", "+_", "dest", "expr_", "._", "get", "\\u", "unresolv", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parts_", "=_", "invalid", "\\u", "vars_", "[_", "0_", "]_", "._", "rsplit_", "(_", "'.'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "repr_", "(_", "self_", "._", "name_", ")_", "if_", "self_", "._", "name_", "else_", "'", "top", " ", "level", " ", "assem", "bly", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vname_", "=_", "repr_", "(_", "parts_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "parent_", "=_", "repr_", "(_", "parts_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vname_", "=_", "repr_", "(_", "parts_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "\"{", "parent", "}", " ", "has", " ", "no", " ", "variab", "le", " ", "{", "vn", "ame", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "msg_", "._", "format_", "(_", "parent_", "=_", "parent_", ",_", "vname_", "=_", "vname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "exc", "\\u", "type_", ",_", "exc", "\\u", "type_", "(_", "msg_", ")_", ",_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reraise", "\\u", "exception_", "(_", "\"", "Can", "'", "t", " ", "connect", " ", "'%", "s", "'", " ", "to", " ", "'%", "s", "':", " ", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "src_", ",_", "dest_", ")_", ",_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "config", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "dest_", "(_", "self_", ",_", "src", "expr_", ",_", "dest", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Atte", "mpt", " ", "to", " ", "validat", "e", " ", "a", " ", "connecti", "on", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "vars_", "=_", "src", "expr_", "._", "get", "\\u", "referenced", "\\u", "var", "paths_", "(_", "copy_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "var_", "=_", "dest", "expr_", "._", "get", "\\u", "referenced", "\\u", "var", "paths_", "(_", ")_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "comp", "name_", ",_", "dest", "comp_", ",_", "dest", "varname_", "=_", "\\u", "split", "\\u", "var", "path_", "(_", "self_", ",_", "dest", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "trait_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "comp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "dest", "comp_", ",_", "Pse", "udo", "Component_", ")_", "and_", "not_", "dest", "var_", "._", "startswith_", "(_", "'", "parent", ".'_", ")_", "and_", "not_", "len_", "(_", "src", "vars_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "src", "var_", "in_", "src", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "src", "var_", "._", "startswith_", "(_", "'", "parent", ".'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "src", "comp", "name_", ",_", "src", "comp_", ",_", "src", "varname_", "=_", "\\u", "split", "\\u", "var", "path_", "(_", "self_", ",_", "src", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "src", "comp_", ",_", "Pse", "udo", "Component_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "src", "\\u", "io_", "=_", "'", "in", "'_", "if_", "src", "comp_", "is_", "self_", "else_", "'", "out", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "comp_", "._", "get", "\\u", "dyn", "\\u", "trait_", "(_", "src", "varname_", ",_", "src", "\\u", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dest", "trait_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dest", "\\u", "io_", "=_", "'", "out", "'_", "if_", "dest", "comp_", "is_", "self_", "else_", "'", "in", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "trait_", "=_", "dest", "comp_", "._", "get", "\\u", "dyn", "\\u", "trait_", "(_", "dest", "varname_", ",_", "dest", "\\u", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "src", "comp_", ",_", "Pse", "udo", "Component_", ")_", "and_", "dest", "trait_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "punt", " ", "if", " ", "dest", " ", "is", " ", "not", " ", "just", " ", "a", " ", "simple", " ", "var", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "valid", "it", "y", " ", "will", " ", "still", " ", "be", " ", "checke", "d", " ", "at", " ", "executi", "on", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "dest", "var_", "==_", "dest", "expr_", "._", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ttype_", "=_", "dest", "trait_", "._", "tra", "it", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ttype_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ttype_", "=_", "dest", "trait_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src", "val_", "=_", "src", "expr_", "._", "evaluate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ttype_", "._", "validate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ttype_", "._", "validate_", "(_", "dest", "comp_", ",_", "dest", "varname_", ",_", "src", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "validat", "e", " ", "function", " ", "on", " ", "destinat", "ion", " ", "tra", "it", ".", " ", "Mos", "t", " ", "like", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "a", " ", "property", " ", "tra", "it", ".", " ", " ", "No", " ", "way", " ", "to", " ", "validat", "e", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unknown", " ", "side", " ", "effect", "s", ".", " ", "Ha", "ve", " ", "to", " ", "wait", " ", "unti", "l", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "data", " ", "actual", "ly", " ", "gets", " ", "pass", "ed", " ", "via", " ", "the", " ", "connecti", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "disconnect_", "(_", "self_", ",_", "var", "path_", ",_", "var", "path2_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "If", " ", "var", "path", "2", " ", "is", " ", "supplie", "d", ",", " ", "remove", " ", "the", " ", "connecti", "on", " ", "bet", "ween", " ", "var", "path", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "var", "path", "2", ".", " ", "Ot", "her", "wis", "e", ",", " ", "if", " ", "var", "path", " ", "is", " ", "the", " ", "name", " ", "of", " ", "a", " ", "tra", "it", ",", " ", "remove", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "connections", " ", "to", "/", "from", " ", "var", "path", " ", "in", " ", "the", " ", "current", " ", "scope", ".", " ", "If", " ", "var", "path", " ", "is", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "name", " ", "of", " ", "a", " ", "Compo", "nent", ",", " ", "remove", " ", "all", " ", "connections", " ", "from", " ", "all", " ", "of", " ", "its", " ", "inputs", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "output", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var", "path2_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "remove_", "=_", "[_", "(_", "u_", ",_", "v_", ")_", "for_", "u_", ",_", "v_", "in_", "self_", "._", "\\u", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "u_", "._", "refer", "s", "\\u", "to_", "(_", "var", "path_", ")_", "or_", "v_", "._", "refer", "s", "\\u", "to_", "(_", "var", "path_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "u_", "._", "text_", "==_", "var", "path_", "._", "strip_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "v_", "._", "text_", "==_", "var", "path_", "._", "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 ", " _", "to", "\\u", "remove_", "=_", "[_", "(_", "u_", ",_", "v_", ")_", "for_", "u_", ",_", "v_", "in_", "self_", "._", "\\u", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "u_", "._", "text_", "==_", "var", "path_", "._", "strip_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "v_", "._", "text_", "==_", "var", "path2_", "._", "strip_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "connections_", "=_", "[_", "tup_", "for_", "tup_", "in_", "self_", "._", "\\u", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tup_", "not_", "in_", "to", "\\u", "remove_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config", "\\u", "changed_", "(_", "update", "\\u", "parent_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "config", "\\u", "changed_", "(_", "self_", ",_", "update", "\\u", "parent_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", " ", "this", " ", "whe", "neve", "r", " ", "the", " ", "configura", "tion", " ", "of", " ", "this", " ", "Compo", "nent", " ", "change", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "example", ",", " ", "child", "ren", " ", "are", " ", "adde", "d", " ", "or", " ", "remove", "d", ",", " ", "connections", " ", "are", " ", "made", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "remove", "d", ",", " ", "etc", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Asse", "mbly", "_", ",_", "self_", ")_", "._", "config", "\\u", "changed_", "(_", "update", "\\u", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "driver", "s", " ", "must", " ", "tell", " ", "workf", "lows", " ", "tha", "t", " ", "config", " ", "has", " ", "change", "d", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dependen", "cies", " ", "may", " ", "have", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cont_", "=_", "getattr_", "(_", "self_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "cont_", ",_", "Driver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cont_", "._", "config", "\\u", "changed_", "(_", "update", "\\u", "parent_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "pre", "\\u", "driver_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "system_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "failed_", "(_", "self_", ",_", "path_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "path_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "self_", ",_", "parts_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", ",_", "Pse", "udo", "Component_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "set_", "(_", "parts_", "[_", "1_", "]_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", "s", " ", "driver", " ", "and", " ", "update", "s", " ", "our", " ", "bound", "ary", " ", "variab", "les", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "system_", "in_", "self_", "._", "\\u", "system_", "._", "local", "\\u", "subsystem", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "._", "pre", "\\u", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "system_", "._", "run_", "(_", "self_", "._", "iter", "name_", ",_", "case", "\\u", "uuid_", "=_", "self_", "._", "\\u", "case", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "copy", " ", "to", " ", "scope", " ", "any", " ", "direct", " ", "bd", "ry", " ", "to", " ", "bd", "ry", " ", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "dco", "nn", "s_", "=_", "[_", "c_", "[_", "1_", "]_", "for_", "c_", "in_", "self_", "._", "list", "\\u", "connections_", "(_", ")_", "if_", "c_", "[_", "0_", "]_", "._", "split_", "(_", "'['_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "in_", "self_", "._", "list", "\\u", "inputs_", "(_", ")_", "and_", "c_", "[_", "1_", "]_", "._", "split_", "(_", "'['_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "in_", "self_", "._", "list", "\\u", "outputs_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "system_", "._", "vec_", "[_", "'", "u", "'_", "]_", "._", "set\\u", "to", "\\u", "scope_", "(_", "self_", ",_", "vn", "ames_", "=_", "dco", "nn", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "configur", "e\\u", "recording_", "(_", "self_", ",_", "record", "ing", "\\u", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "at", " ", "start", " ", "of", " ", "top", "-", "level", " ", "run", " ", "to", " ", "configur", "e", " ", "case", " ", "record", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "set", " ", "of", " ", "path", "s", " ", "for", " ", "chang", "ing", " ", "inputs", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "parent_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "recorde", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "ing", "\\u", "options_", "=_", "self_", "._", "record", "ing", "\\u", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "recorder_", "in_", "self_", "._", "recorde", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "recorder_", "._", "startup_", "(_", ")_", "\\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 ", " _", "record", "ing", "\\u", "options_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "record", "ing", "\\u", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "includes_", "=_", "record", "ing", "\\u", "options_", "._", "includes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "excludes_", "=_", "record", "ing", "\\u", "options_", "._", "excludes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "problem", "\\u", "formula", "tion_", "=_", "record", "ing", "\\u", "options_", "._", "save", "\\u", "problem", "\\u", "formula", "tion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "includes_", "=_", "excludes_", "=_", "save", "\\u", "problem", "\\u", "formula", "tion_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "(", "chang", "ing", ")", " ", "inputs", " ", "and", " ", "output", "s", " ", "to", " ", "record_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inputs_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constants_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "self_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "obj_", ",_", "ID", "river", "_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inp", "s_", ",_", "consts_", "=_", "obj_", "._", "configur", "e\\u", "recording_", "(_", "record", "ing", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inputs_", "._", "update_", "(_", "inp", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constants_", "._", "update_", "(_", "consts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", "hing", " ", "to", " ", "record", ",", " ", "return", " ", "after", " ", "configur", "ing", " ", "workf", "lows", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "save", "\\u", "problem", "\\u", "formula", "tion_", "and_", "not_", "includes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "inputs_", ",_", "constants_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Locat", "e", " ", "top", " ", "level", " ", "assem", "bly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "top_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "top_", "._", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "top_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prefix", "\\u", "drop_", "=_", "len_", "(_", "top_", "._", "name_", ")_", "+_", "1_", "if_", "top_", "._", "name_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "constant", " ", "inputs", "._", "\\u\\u\\uNL\\u\\u\\u_", "objs_", "=_", "[_", "self_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objs_", "._", "extend_", "(_", "getattr_", "(_", "self_", ",_", "name_", ")_", "for_", "name_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "objs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "obj_", "._", "get", "\\u", "pathname_", "(_", ")_", "[_", "prefix", "\\u", "drop_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prefix_", "+=_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "\\u", "names_", "=_", "obj_", "._", "list", "\\u", "inputs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "parent_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "conn_", "=_", "obj_", "._", "parent_", "._", "connect", "ed", "\\u", "inputs_", "(_", "obj_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "obj", "\\u", "name_", ",_", "\\u_", ",_", "in", "\\u", "name_", "=_", "name_", "._", "partition_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "in", "\\u", "name_", "in_", "in", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "in", "\\u", "names_", "._", "remove_", "(_", "in", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "in", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "path_", "=_", "prefix_", "+_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", "in_", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "#", " ", "Chang", "ing", " ", "input", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "record", "\\u", "constant_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pattern_", "in_", "includes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "fnmatch_", "(_", "path_", ",_", "pattern_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "record", "\\u", "constant_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "record", "\\u", "constant_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "pattern_", "in_", "excludes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "fnmatch_", "(_", "path_", ",_", "pattern_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "record", "\\u", "constant_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "record", "\\u", "constant_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "=_", "getattr_", "(_", "obj_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "val_", ",_", "Varia", "ble", "Tree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "path_", ",_", "val_", "in_", "\\u", "expand", "\\u", "tree_", "(_", "path_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "constants_", "[_", "path_", "]_", "=_", "val_", "\\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 ", " ", " _", "constants_", "[_", "path_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Record", " ", "constant", " ", "inputs", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "recorder_", "in_", "self_", "._", "recorde", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recorder_", "._", "record", "\\u", "constants_", "(_", "constants_", ")_", "\\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_", "(_", "inputs_", ",_", "constants_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "record", "\\u", "configuration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "record", " ", "model", " ", "configura", "tion", " ", "with", "out", " ", "runn", "ing", " ", "the", " ", "model", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "top_", "._", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "top_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "top_", "._", "\\u", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "configur", "e\\u", "recording_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "recorder_", "in_", "self_", "._", "recorde", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recorder_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "connect", "ed", "\\u", "inputs_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "for", " ", ":", "meth", ":`", "configur", "e\\u", "record", "ing", "`.\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "dep", "graph_", "._", "list", "\\u", "inputs_", "(_", "name_", ",_", "connected_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sto", "p", " ", "the", " ", "calculati", "on", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "child", "\\u", "config", "\\u", "changed_", "(_", "self_", ",_", "child_", ",_", "addin", "g_", "=_", "True_", ",_", "remo", "ving", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "child", " ", "has", " ", "change", "d", " ", "its", " ", "input", " ", "lists", " ", "and", "/", "or", " ", "output", " ", "lists", ",", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "we", " ", "need", " ", "to", " ", "update", " ", "the", " ", "graph", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "\\u", "connections_", "(_", "self_", ")_", ":_", "#", ",", " ", "show", "\\u", "passthrough", "=", "Tru", "e", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "visi", "ble", "\\u", "only", "=", "Fal", "se", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "express", "ion", "s", "=", "Fal", "se", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", " ", "of", " ", "the", " ", "form", " ", "(", "out", "varname", ",", " ", "inva", "rnam", "e", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "(_", "u_", "._", "text_", ",_", "v_", "._", "text_", ")_", "for_", "u_", ",_", "v_", "in_", "self_", "._", "\\u", "connections_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "gradient_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "inputs_", "=_", "None_", ",_", "outputs_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stream_", "=_", "sys_", "._", "stdout_", ",_", "mode_", "=_", "'", "auto", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fd", "\\u", "form_", "=_", "'", "forward", "'_", ",_", "fd", "\\u", "step_", "=_", "1.0e-", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fd", "\\u", "step", "\\u", "type_", "=_", "'", "abs", "olute", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compare", " ", "the", " ", "Open", "MD", "AO", "-", "calculated", " ", "gradi", "ent", " ", "with", " ", "one", " ", "calculated", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "straight", " ", "finite", "-", "difference", ".", " ", "Thi", "s", " ", "provide", "s", " ", "the", " ", "user", " ", "with", " ", "a", " ", "way", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "validat", "e", " ", "his", " ", "deriv", "ative", " ", "function", "s", " ", "(", "appl", "y", "\\u", "deriv", " ", "and", " ", "provide", "J", ".)", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "name", ":", " ", "(", "option", "al", ")", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "provided", ",", " ", "speci", "fie", "s", " ", "the", " ", "name", " ", "of", " ", "a", " ", "Drive", "r", " ", "or", " ", "Compo", "nent", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "calcul", "ate", " ", "the", " ", "gradi", "ent", " ", "for", ".", " ", " ", "If", " ", "name", " ", "speci", "fie", "s", " ", "a", " ", "Drive", "r", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "inputs", " ", "used", " ", "to", " ", "calcul", "ate", " ", "the", " ", "gradi", "ent", " ", "will", " ", "be", " ", "generat", "ed", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "the", " ", "parameter", "s", " ", "of", " ", "the", " ", "Drive", "r", ",", " ", "and", " ", "the", " ", "output", "s", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "generat", "ed", " ", "from", " ", "the", " ", "constraint", "s", " ", "and", " ", "objectives", " ", "of", " ", "the", " ", "Drive", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "name", " ", "speci", "fie", "s", " ", "a", " ", "Compo", "nent", ",", " ", "the", " ", "inputs", " ", "and", " ", "output", "s", " ", "of", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "Compo", "nent", " ", "will", " ", "be", " ", "used", " ", "to", " ", "calcul", "ate", " ", "the", " ", "gradi", "ent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "inputs", ":", " ", "(", "option", "al", ")", " ", "iter", " ", "of", " ", "str", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Names", " ", "of", " ", "input", " ", "variab", "les", ".", " ", "The", " ", "calculated", " ", "gradi", "ent", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "matrix", " ", "of", " ", "values", " ", "of", " ", "the", " ", "output", " ", "variab", "les", " ", "with", " ", "respec", "t", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "these", " ", "input", " ", "variab", "les", ".", " ", "If", " ", "no", " ", "value", " ", "is", " ", "provided", " ", "for", " ", "inputs", ",", "\\", "10", ";", " ", " ", " ", " ", "the", "y", " ", "will", " ", "be", " ", "dete", "rmin", "ed", " ", "based", " ", "on", " ", "the", " ", "'", "name", "'", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "inputs", " ", "are", " ", "not", " ", "specified", " ", "and", " ", "name", " ", "is", " ", "not", " ", "specified", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "the", "y", " ", "will", " ", "be", " ", "generat", "ed", " ", "from", " ", "the", " ", "parameter", "s", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "object", " ", "named", " ", "'", "driver", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "output", "s", ":", " ", "(", "option", "al", ")", " ", "iter", " ", "of", " ", "str", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Names", " ", "of", " ", "output", " ", "variab", "les", ".", " ", "The", " ", "calculated", " ", "gradi", "ent", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "matrix", " ", "of", " ", "values", " ", "of", " ", "these", " ", "output", " ", "variab", "les", " ", "with", " ", "respec", "t", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "input", " ", "variab", "les", ".", " ", "If", " ", "no", " ", "value", " ", "is", " ", "provided", " ", "for", " ", "output", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "the", "y", " ", "will", " ", "be", " ", "dete", "rmin", "ed", " ", "based", " ", "on", " ", "the", " ", "'", "name", "'", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "output", "s", " ", "are", " ", "not", " ", "specified", " ", "and", " ", "name", " ", "is", " ", "not", " ", "specified", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "the", "y", " ", "will", " ", "be", " ", "generat", "ed", " ", "from", " ", "the", " ", "objectives", " ", "and", " ", "constraint", "s", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "object", " ", "named", " ", "'", "driver", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "stream", ":", " ", "(", "option", "al", ")", " ", "file", "-", "like", " ", "object", ",", " ", "str", ",", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Whe", "re", " ", "to", " ", "write", " ", "to", ",", " ", "default", " ", "stdout", ".", " ", "If", " ", "a", " ", "string", " ", "is", " ", "supplie", "d", ",", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "is", " ", "used", " ", "as", " ", "a", " ", "filename", ".", " ", "If", " ", "Non", "e", ",", " ", "no", " ", "output", " ", "is", " ", "writt", "en", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "mode", ":", " ", "(", "option", "al", ")", " ", "str", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "to", " ", "'", "forward", "'", " ", "for", " ", "forward", " ", "mode", ",", " ", "'", "adjoint", "'", " ", "for", " ", "adjoint", " ", "mode", ",", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "'", "auto", "'", " ", "to", " ", "let", " ", "Open", "MD", "AO", " ", "dete", "rmin", "e", " ", "the", " ", "correct", " ", "mode", ".", "\\", "10", ";", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "'", "auto", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "form", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Fini", "te", " ", "difference", " ", "mode", ".", " ", "Valid", " ", "choice", "s", " ", "are", " ", "'", "forward", "',", " ", "'", "adjoint", "'", " ", ",", "\\", "10", ";", " ", " ", " ", " ", "'", "central", "'.", " ", "Default", " ", "is", " ", "'", "forward", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "step", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "step", "\\u", "size", " ", "for", " ", "finite", " ", "difference", ".", " ", "Default", " ", "is", " ", "1.0e-", "6", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "fd", "\\u", "step", "\\u", "type", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Fini", "te", " ", "difference", " ", "step", " ", "type", ".", " ", "Set", " ", "to", " ", "'", "abs", "olute", "'", " ", "or", " ", "'", "relative", "'.", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "is", " ", "'", "abs", "olute", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "finite", " ", "difference", " ", "gradi", "ent", ",", " ", "the", " ", "Open", "MD", "AO", "-", "calculated", "\\", "10", ";", " ", " ", " ", " ", "gradi", "ent", ",", " ", "a", " ", "list", " ", "of", " ", "the", " ", "gradi", "ent", " ", "names", ",", " ", "and", " ", "a", " ", "list", " ", "of", " ", "suspe", "ct", "\\", "10", ";", " ", " ", " ", " ", "inputs", "/", "output", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver_", "=_", "self_", "._", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tuple", "s", " ", "caus", "e", " ", "problem", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inputs_", "=_", "list_", "(_", "inputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "outputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outputs_", "=_", "list_", "(_", "outputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "inputs_", "and_", "outputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "The", " ", "'", "inputs", "'", " ", "and", " ", "'", "output", "s", "'", " ", "args", " ", "wer", "e", " ", "specified", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "check", "\\u", "gradi", "ent", ",", " ", "so", " ", "the", " ", "'", "name", "'", " ", "arg", " ", "(%", "s", ")", " ", "is", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "ignore", "d", ".\"_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "missi", "ng", " ", "eit", "her", " ", "inputs", " ", "or", " ", "output", "s", ",", " ", "so", " ", "we", " ", "need", " ", "a", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "driver", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "self_", ",_", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "raise", "\\u", "exception_", "(_", "\"", "Can", "'", "t", " ", "find", " ", "object", " ", "named", " ", "'%", "s", "'.\"_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "obj_", ",_", "ID", "river", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "driver_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fill", " ", "in", " ", "missi", "ng", " ", "inputs", " ", "or", " ", "output", "s", " ", "usi", "ng", " ", "the", " ", "object", " ", "specified", " ", "by", " ", "'", "name", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "interface_", "(_", "obj_", ",_", "ID", "river", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "driver", ".", "check", "\\u", "gradi", "ent", " ", "can", " ", "pull", " ", "inputs", " ", "from", " ", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inputs_", "=_", "[_", "'.'_", "._", "join_", "(_", "(_", "obj_", "._", "name_", ",_", "inp_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "inp_", "in_", "obj_", "._", "list", "\\u", "inputs_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "different", "iable", "\\u", "var_", "(_", "inp_", ",_", "obj_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inputs_", "=_", "sorted_", "(_", "inputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inputs_", "=_", "[_", "'.'_", "._", "join_", "(_", "(_", "obj_", "._", "name_", ",_", "inp_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "inp_", "in_", "list", "\\u", "deriv", "\\u", "vars_", "(_", "obj_", ")_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inputs_", "=_", "sorted_", "(_", "inputs_", ")_", "\\u\\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_", "._", "raise", "\\u", "exception_", "(_", "\"", "Can", "'", "t", " ", "find", " ", "any", " ", "inputs", " ", "for", " ", "generat", "ing", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "gradi", "ent", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "outputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "interface_", "(_", "obj_", ",_", "ID", "river", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "driver", ".", "check", "\\u", "gradi", "ent", " ", "can", " ", "pull", " ", "output", "s", " ", "from", " ", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outputs_", "=_", "[_", "'.'_", "._", "join_", "(_", "(_", "obj_", "._", "name_", ",_", "out_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "out_", "in_", "obj_", "._", "list", "\\u", "outputs_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "different", "iable", "\\u", "var_", "(_", "out_", ",_", "obj_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outputs_", "=_", "sorted_", "(_", "outputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outputs_", "=_", "[_", "'.'_", "._", "join_", "(_", "(_", "obj_", "._", "name_", ",_", "outp_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "outp_", "in_", "list", "\\u", "deriv", "\\u", "vars_", "(_", "obj_", ")_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outputs_", "=_", "sorted_", "(_", "outputs_", ")_", "\\u\\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_", "._", "raise", "\\u", "exception_", "(_", "\"", "Can", "'", "t", " ", "find", " ", "any", " ", "output", "s", " ", "for", " ", "generat", "ing", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "gradi", "ent", ".\"_", ")_", "\\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_", "has", "\\u", "interface_", "(_", "obj_", ",_", "ID", "river", "_", ")_", "and_", "(_", "not_", "inputs_", "or_", "not_", "outputs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "Compo", "nent", " ", "%", "s", " ", "has", " ", "no", " ", "analytic", " ", "derivatives", ".'_", "%_", "obj_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raise", "\\u", "exception_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "base", "\\u", "fd", "\\u", "form_", "=_", "driver_", "._", "gradi", "ent", "\\u", "options_", "._", "fd", "\\u", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "fd", "\\u", "step_", "=_", "driver_", "._", "gradi", "ent", "\\u", "options_", "._", "fd", "\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "fd", "\\u", "step", "\\u", "type_", "=_", "driver_", "._", "gradi", "ent", "\\u", "options_", "._", "fd", "\\u", "step", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "._", "gradi", "ent", "\\u", "options_", "._", "fd", "\\u", "form_", "=_", "fd", "\\u", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver_", "._", "gradi", "ent", "\\u", "options_", "._", "fd", "\\u", "step_", "=_", "fd", "\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver_", "._", "gradi", "ent", "\\u", "options_", "._", "fd", "\\u", "step", "\\u", "type_", "=_", "fd", "\\u", "step", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "driver_", "._", "check", "\\u", "gradient_", "(_", "inputs_", "=_", "inputs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "outputs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stream_", "=_", "stream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "driver_", "._", "gradi", "ent", "\\u", "options_", "._", "fd", "\\u", "form_", "=_", "base", "\\u", "fd", "\\u", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver_", "._", "gradi", "ent", "\\u", "options_", "._", "fd", "\\u", "step_", "=_", "base", "\\u", "fd", "\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver_", "._", "gradi", "ent", "\\u", "options_", "._", "fd", "\\u", "step", "\\u", "type_", "=_", "base", "\\u", "fd", "\\u", "step", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "new", "\\u", "pseudo", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"\\u", "pseudo", "\\u", "%", "d", "\"_", "%_", "self_", "._", "\\u", "pseudo", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pseudo", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "graph_", "(_", "self_", ",_", "component", "s", "\\u", "only_", "=_", "False_", ",_", "format_", "=_", "'", "json", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "return", "s", " ", "clean", "ed", " ", "up", " ", "graph", " ", "data", " ", "in", " ", "the", " ", "selecte", "d", " ", "format", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "component", "s", "\\u", "only", ":", " ", "(", "option", "al", ")", " ", "boolean", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "Tru", "e", ",", " ", "only", " ", "component", "s", " ", "will", " ", "be", " ", "include", "d", " ", "in", " ", "the", " ", "graph", "\\", "10", ";", " ", " ", " ", " ", "other", "wis", "e", " ", "the", " ", "full", " ", "dependen", "cy", " ", "graph", " ", "will", " ", "be", " ", "return", "ed", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "format", ":", " ", "(", "option", "al", ")", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "json", " ", "-", " ", "return", "s", " ", "serialize", "d", " ", "graph", " ", "data", " ", "in", " ", "JSO", "N", " ", "format", "\\", "10", ";", " ", " ", " ", " ", "svg", " ", " ", "-", " ", "return", "s", " ", "scala", "ble", " ", "vector", " ", "graphic", "s", " ", "rend", "ition", " ", "of", " ", "graph", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "component", "s", "\\u", "only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "=_", "self_", "._", "\\u", "dep", "graph_", "._", "component", "\\u", "graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "=_", "\\u", "clean", "\\u", "graph_", "(_", "self_", "._", "\\u", "dep", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "format_", "._", "lower_", "(_", ")_", "==_", "'", "json", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph", "\\u", "data_", "=_", "json", "\\u", "graph_", "._", "node", "\\u", "link", "\\u", "data_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "dumps_", "(_", "graph", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "format_", "._", "lower_", "(_", ")_", "==_", "'", "svg", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "agr", "aph", "_", "=_", "nx_", "._", "to", "\\u", "agr", "aph", "_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "agr", "aph", "_", "._", "draw_", "(_", "format_", "=_", "'", "svg", "'_", ",_", "prog_", "=_", "'", "dot", "'_", ")_", "\\u\\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_", "._", "raise", "\\u", "exception_", "(_", "\"'", "%", "s", "'", " ", "is", " ", "not", " ", "a", " ", "support", "ed", " ", "graph", " ", "data", " ", "format", "\"_", "%_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "repr", "\\u", "svg", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "an", " ", "SV", "G", " ", "represent", "ation", " ", "of", " ", "this", " ", "Asse", "mbly", "'", "s", " ", "dependen", "cy", " ", "graph", "\\", "10", ";", " ", " ", " ", " ", "(", "if", " ", "pyg", "raph", "viz", " ", "is", " ", "not", " ", "avail", "able", ",", " ", "return", "s", " ", "an", " ", "empty", " ", "string", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pyg", "raph", "viz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get", "\\u", "graph_", "(_", "component", "s", "\\u", "only_", "=_", "True_", ",_", "format_", "=_", "'", "svg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "\\u", "components_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "List", " ", "the", " ", "component", "s", " ", "in", " ", "the", " ", "assem", "bly", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "name_", "for_", "name_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "self_", "._", "get_", "(_", "name_", ")_", ",_", "Component_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "comps_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "all", " ", "of", " ", "object", "s", " ", "contain", "ed", " ", "in", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "Asse", "mbly", " ", "implement", "ing", " ", "the", " ", "IC", "omp", "one", "nt", " ", "interface", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "set_", "(_", "[_", "c_", "for_", "\\u_", ",_", "c_", "in_", "self_", "._", "items_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "c_", ",_", "IC", "omp", "one", "nt_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "systems_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rg", "raph_", "=_", "self_", "._", "\\u", "reduce", "d\\u", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "system", "s", " ", "for", " ", "all", " ", "simple", " ", "components_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", ",_", "data_", "in_", "rg", "raph_", "._", "nodes", "\\u", "iter_", "(_", "data_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "comp", "'_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "system", "'_", "]_", "=_", "\\u", "create", "\\u", "simple", "\\u", "sys_", "(_", "self_", ",_", "rg", "raph_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "setup", "\\u", "systems_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copy", " ", "the", " ", "reduce", "d", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "rg", "raph_", "=_", "rg", "raph_", "._", "subgraph_", "(_", "rg", "raph_", "._", "nodes", "\\u", "iter_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rg", "raph_", "._", "collapse", "\\u", "subd", "river", "s_", "(_", "[_", "]_", ",_", "[_", "self_", "._", "\\u", "top", "\\u", "driver_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drv", "name_", "=_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "rg", "raph_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "system_", "=_", "Ser", "ial", "System_", "(_", "self_", ",_", "rg", "raph_", ",_", "rg", "raph_", "._", "component", "\\u", "graph_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "name_", "+_", "'.", "\\u", "inner", "\\u", "asm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "if", " ", "there", "'", "s", " ", "a", " ", "driver", " ", "cycle", " ", "(", "happ", "ens", " ", "whe", "n", " ", "driver", " ", "has", " ", "params", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "constraint", "s", "/", "objectives", " ", "tha", "t", " ", "are", " ", "bound", "ary", " ", "vars", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "if", " ", "we", " ", "modif", "y", " ", "the", " ", "graph", " ", "to", " ", "have", " ", "to", "/", "from", " ", "edge", "s", " ", "bet", "ween", " ", "a", " ", "driver", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "of", " ", "its", " ", "workf", "low", " ", "comps", ",", " ", "then", " ", "use", " ", "strong", "ly", " ", "connect", "ed", " ", "component", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "full", " ", "iterati", "on", " ", "sets", ",", " ", "this", " ", "will", " ", "neve", "r", " ", "happ", "en", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "strong", "_", "in_", "strong", "ly", "\\u", "connect", "ed", "\\u", "components_", "(_", "rg", "raph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "drv", "name_", "in_", "strong", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "len_", "(_", "strong", "_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "break", " ", "driver", " ", "input", " ", "edge_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "p_", "in_", "rg", "raph_", "._", "predecessor", "s_", "(_", "drv", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "p_", "in_", "strong", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rg", "raph_", "._", "remove", "\\u", "edge_", "(_", "p_", ",_", "drv", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "direct", "ed", "\\u", "ac", "yc", "lic", "\\u", "graph_", "(_", "rg", "raph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "system_", "._", "set\\u", "ordering_", "(_", "nx_", "._", "topologi", "cal", "\\u", "sort_", "(_", "rg", "raph_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "if", " ", "top", " ", "driver", " ", "has", " ", "no", " ", "params", "/", "constraint", "s", ",", " ", "possib", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "driver", " ", "system", " ", "entire", "ly", " ", "and", " ", "just", " ", "go", " ", "direct", "ly", " ", "to", " ", "workflow_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "system", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "system_", "=_", "rg", "raph_", "._", "node_", "[_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "name_", "]_", "[_", "'", "system", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "\\u", "une", "xec", "ute", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "=_", "getattr_", "(_", "self_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "comp_", ",_", "ID", "river", "_", ")_", "or_", "has", "\\u", "interface_", "(_", "comp_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "setup", "\\u", "systems_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rbac", "_", "(_", "(_", "'", "owner", "'_", ",_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "req", "\\u", "cpus_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "request", "ed", "\\u", "cpus", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "get", "\\u", "req", "\\u", "cpus_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "communicator", "s_", "(_", "self_", ",_", "comm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mpi_", "._", "comm_", "=_", "comm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "system_", "._", "setup", "\\u", "communicator", "s_", "(_", "comm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "variables_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "system_", "._", "setup", "\\u", "variables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "sizes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calculat", "e", " ", "the", " ", "local", " ", "size", "s", " ", "of", " ", "all", " ", "rele", "van", "t", " ", "variab", "les", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "share", " ", "tho", "se", " ", "acro", "ss", " ", "all", " ", "process", "es", " ", "in", " ", "the", " ", "communicator", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "all", " ", "local", " ", "systems_", "\\u\\u\\uNL\\u\\u\\u_", "sys", "\\u", "stack_", "=_", "[_", "self_", "._", "\\u", "system_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "comps_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "sys", "\\u", "stack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "=_", "sys", "\\u", "stack_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "comps_", "._", "extend_", "(_", "[_", "s_", "._", "name_", "for_", "s_", "in_", "system_", "._", "simple", "\\u", "subsystem", "s_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "s_", "._", "\\u", "comp_", "is_", "not_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys", "\\u", "stack_", "._", "extend_", "(_", "system_", "._", "local", "\\u", "subsystem", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "system_", ",_", "Opa", "que", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys", "\\u", "stack_", "._", "append_", "(_", "system_", "._", "\\u", "inner", "\\u", "system_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc", "\\u", "comps_", "=_", "set_", "(_", "loc", "\\u", "comps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "comps_", "._", "add_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "loop", " ", "over", " ", "all", " ", "component", " ", "inputs", " ", "and", " ", "bound", "ary", " ", "output", "s", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "them", " ", "to", " ", "thei", "r", " ", "source", "s", " ", "so", " ", "tha", "t", " ", "the", "y", "'", "ll", " ", "be", " ", "sized", " ", "proper", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", ",_", "data_", "in_", "self_", "._", "\\u", "reduce", "d\\u", "graph_", "._", "nodes", "\\u", "iter_", "(_", "data_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "comp", "'_", "not_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "node_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sco", "mp_", "=_", "src_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "[_", "0_", "]_", "if_", "'.'_", "in_", "src_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist", "\\u", "src_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssy", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sco", "mp_", "and_", "sco", "mp_", "in_", "self_", "._", "\\u", "reduce", "d\\u", "graph_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ssy", "s_", "=_", "self_", "._", "\\u", "reduce", "d\\u", "graph_", "._", "node_", "[_", "sco", "mp_", "]_", "[_", "'", "system", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sval", "_", ",_", "idx_", "=_", "get", "\\u", "val", "\\u", "and", "\\u", "index_", "(_", "self_", ",_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "sval", "_", ",_", "ndarray_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dest", "s_", "=_", "node_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dest_", "in_", "dest", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dco", "mp_", "=_", "dest_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "[_", "0_", "]_", "if_", "'.'_", "in_", "dest_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dco", "mp_", "in_", "loc", "\\u", "comps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "dco", "mp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ds", "ys_", "=_", "self_", "._", "\\u", "reduce", "d\\u", "graph_", "._", "node_", "[_", "dco", "mp_", "]_", "[_", "'", "system", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "overwrit", "e", " ", "inputs", " ", "if", " ", "the", "y", " ", "have", " ", "distri", "b", "\\u", "idx", "s", " ", "declared", ",", " ", "bec", "aus", "e", " ", "tho", "se_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "the", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ds", "ys_", "._", "is", "\\u", "distri", "b", "\\u", "var_", "(_", "node_", ")_", ":_", "\\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_", "elif_", "ssy", "s_", "and_", "ssy", "s_", "._", "is", "\\u", "distri", "b", "\\u", "var_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dva", "l_", ",_", "did", "x_", "=_", "get", "\\u", "val", "\\u", "and", "\\u", "index_", "(_", "self_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "dva", "l_", ",_", "ndarray_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "sval", "_", "._", "shape_", "!=_", "dva", "l_", "._", "shape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "set_", "(_", "dest_", ",_", "sval", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "will", " ", "calcul", "ate", " ", "size", "s", " ", "for", " ", "all", " ", "subsystem", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "system_", "._", "setup", "\\u", "sizes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "vectors_", "(_", "self_", ",_", "arrays_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "vector", " ", "wrapp", "er", " ", "object", "s", " ", "to", " ", "manage", " ", "local", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "distributed", " ", "vector", "s", " ", "need", " ", "to", " ", "solve", " ", "the", " ", "distributed", " ", "system", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "system_", "._", "setup", "\\u", "vectors_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "scatter", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "system_", "._", "setup", "\\u", "scatter", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "need", "s", "\\u", "pseudo", "_", "(_", "self_", ",_", "src", "expr_", ",_", "dest", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "non", "-", "Non", "e", " ", "pseudo", "\\u", "type", " ", "if", " ", "src", "expr", " ", "and", " ", "dest", "expr", " ", "require", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "pseudo", "comp", " ", "to", " ", "be", " ", "created", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "refs_", "=_", "list_", "(_", "src", "expr_", "._", "refs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "src", "refs_", "and_", "src", "refs_", "[_", "0_", "]_", "!=_", "src", "expr_", "._", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "express", "ion", " ", "is", " ", "more", " ", "than", " ", "just", " ", "a", " ", "simple", " ", "variab", "le", " ", "reference", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "we", " ", "need", " ", "a", " ", "pseudo", "comp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "multi", "\\u", "var", "\\u", "expr", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest", "meta_", "=_", "dest", "expr_", "._", "get", "\\u", "metadata_", "(_", "'", "unit", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "meta_", "=_", "src", "expr_", "._", "get", "\\u", "metadata_", "(_", "'", "unit", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compare", " ", "usi", "ng", " ", "get", "\\u", "unit", "\\u", "name", "()", " ", "to", " ", "account", " ", "for", " ", "unit", " ", "aliases_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "src", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "unit_", "=_", "src", "meta_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "src", "unit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "unit_", "=_", "Phys", "ical", "Quantity_", "(_", "1._", ",_", "src", "unit_", ")_", "._", "unit_", "\\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 ", " _", "src", "unit_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dest", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "unit_", "=_", "dest", "meta_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dest", "unit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "unit_", "=_", "Phys", "ical", "Quantity_", "(_", "1._", ",_", "dest", "unit_", ")_", "._", "unit_", "\\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 ", " _", "dest", "unit_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dest", "unit_", "and_", "src", "unit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dest", "unit_", "._", "powers", "_", "!=_", "src", "unit_", "._", "powers", "_", "or_", "dest", "unit_", "._", "factor_", "!=_", "src", "unit_", "._", "factor_", "or_", "dest", "unit_", "._", "offset_", "!=_", "src", "unit_", "._", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "unit", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "dep", "graph_", "(_", "self_", ",_", "dgr", "aph", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "our", " ", "dep", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dep", "graph_", "=_", "Dependenc", "y", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "all", " ", "of", " ", "the", " ", "component", "s", " ", "and", " ", "thei", "r", " ", "var", " ", "nodes", ",", " ", "and", " ", "any", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "our", " ", "own", " ", "variab", "les", " ", "as", " ", "bound", "ary", " ", "var", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "list", "\\u", "inputs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dep", "graph_", "._", "add", "\\u", "bound", "ary", "\\u", "var_", "(_", "self_", ",_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iot", "ype_", "=_", "'", "in", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "list", "\\u", "outputs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dep", "graph_", "._", "add", "\\u", "bound", "ary", "\\u", "var_", "(_", "self_", ",_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iot", "ype_", "=_", "'", "out", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cname_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "self_", ",_", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cname_", "not_", "in_", "self_", "._", "\\u", "dep", "graph_", "and_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dep", "graph_", "._", "add", "\\u", "component_", "(_", "cname_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "our", " ", "connections", " ", "to", " ", "the", " ", "graph", ".", " ", " ", "Some", " ", "connections", ",", " ", "e", ".", "g", ".,", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connections", " ", "with", " ", "unit", " ", "conversions", " ", "and", " ", "connections", " ", "involv", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "multiv", "aria", "ble", " ", "source", " ", "express", "ion", "s", ",", " ", "will", " ", "require", " ", "the", " ", "creati", "on", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pse", "udo", "Compo", "nent", "s", ".", " ", " ", "The", "se", " ", "must", " ", "als", "o", " ", "be", " ", "represent", "ed", " ", "in", " ", "the", " ", "graph", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "src", "expr_", ",_", "dest", "expr_", "in_", "self_", "._", "\\u", "connections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "src", "expr_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "dest", "expr_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pco", "mp", "\\u", "type_", "=_", "self_", "._", "\\u", "need", "s", "\\u", "pseudo", "_", "(_", "src", "expr_", ",_", "dest", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pco", "mp", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "pco", "mp", "\\u", "type_", "==_", "'", "unit", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pseudo", "comp_", "=_", "Unit", "Conversion", "PC", "omp", "_", "(_", "self_", ",_", "src", "expr_", ",_", "dest", "expr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pseudo", "\\u", "type_", "=_", "pco", "mp", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pseudo", "comp_", "=_", "Pse", "udo", "Component_", "(_", "self_", ",_", "src", "expr_", ",_", "dest", "expr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pseudo", "\\u", "type_", "=_", "pco", "mp", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pseudo", "comp_", "._", "activate_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pseudo", "comp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dep", "graph_", "._", "check", "\\u", "connect_", "(_", "src_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dco", "mps_", "=_", "dest", "expr_", "._", "get", "\\u", "referenced", "\\u", "comp", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sco", "mps_", "=_", "src", "expr_", "._", "get", "\\u", "referenced", "\\u", "comp", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dname_", "in_", "dco", "mps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "dname_", "in_", "sco", "mps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Bot", "h", " ", "refer", " ", "to", " ", "the", " ", "same", " ", "component", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cname_", "in_", "chain_", "(_", "dco", "mps_", ",_", "sco", "mps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "comp_", "=_", "getattr_", "(_", "self_", ",_", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "comp_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "comp_", "._", "config", "\\u", "changed_", "(_", "update", "\\u", "parent_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "vname_", "in_", "chain_", "(_", "src", "expr_", "._", "get", "\\u", "referenced", "\\u", "var", "paths_", "(_", "copy_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "expr_", "._", "get", "\\u", "referenced", "\\u", "var", "paths_", "(_", "copy_", "=_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "self_", "._", "contains_", "(_", "vname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Attribute", "Error_", "(_", "\"", "Can", "'", "t", " ", "find", " ", "'%", "s", "'\"_", "%_", "vname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "dep", "graph_", "._", "connect_", "(_", "self_", ",_", "src_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "reraise", "\\u", "exception_", "(_", "\"", "Can", "'", "t", " ", "connect", " ", "'%", "s", "'", " ", "to", " ", "'%", "s", "':", " ", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "src_", ",_", "dest_", ")_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "connections", " ", "for", " ", "params", ",", " ", "constraint", "s", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cname_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "self_", ",_", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "'", "get", "\\u", "parameter", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "param_", "in_", "obj_", "._", "get", "\\u", "parameters_", "(_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "dep", "graph_", "._", "add", "\\u", "param_", "(_", "obj_", "._", "name_", ",_", "tuple_", "(_", "param_", "._", "targets_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "'", "get", "\\u", "constraint", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "constraint_", "in_", "obj_", "._", "get", "\\u", "constraints_", "(_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "constraint_", "._", "activate_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "'", "get", "\\u", "2s", "ide", "d\\u", "constraint", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "constraint_", "in_", "obj_", "._", "get", "\\u", "2s", "ide", "d\\u", "constraints_", "(_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "constraint_", "._", "activate_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "'", "get", "\\u", "objectives", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "objective_", "in_", "obj_", "._", "get", "\\u", "objectives", "_", "(_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "objective_", "._", "activate_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "'", "get", "\\u", "response", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "res_", "in_", "obj_", "._", "get", "\\u", "responses_", "(_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res_", "._", "activate_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "comp_", "in_", "self_", "._", "get", "\\u", "comps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "interface_", "(_", "comp_", ",_", "ID", "river", "_", ")_", "or_", "has", "\\u", "interface_", "(_", "comp_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "setup", "\\u", "dep", "graph_", "(_", "self_", "._", "\\u", "dep", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "reduce", "d\\u", "graph_", "(_", "self_", ",_", "inputs_", "=_", "None_", ",_", "outputs_", "=_", "None_", ",_", "drv", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "the", " ", "graph", " ", "we", " ", "need", " ", "to", " ", "do", " ", "the", " ", "breakdown", " ", "of", " ", "the", " ", "model", "\\", "10", ";", " ", " ", " ", " ", "int", "o", " ", "System", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dgr", "aph", "_", "=_", "self_", "._", "\\u", "dep", "graph_", "._", "subgraph_", "(_", "self_", "._", "\\u", "dep", "graph_", "._", "nodes", "\\u", "iter_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keep", " ", "all", " ", "states_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "I", " ", "think", " ", "this", " ", "shou", "ld", " ", "only", " ", "keep", " ", "state", "s", " ", "of", " ", "comps", " ", "tha", "t", " ", "are", " ", "direct", "ly", " ", "rele", "van", "t", "..._", "\\u\\u\\uNL\\u\\u\\u_", "keep_", "=_", "set_", "(_", "[_", "n_", "for_", "n_", ",_", "d_", "in_", "dgr", "aph", "_", "._", "nodes", "\\u", "iter_", "(_", "data_", "=_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "d_", "._", "get_", "(_", "'", "iot", "ype", "'_", ")_", "==_", "'", "state", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "d", ".", "get", "('", "iot", "ype", "')", " ", "in", " ", "('", "state", "','", "residu", "al", "')]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parent_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "deriv", "s", "\\u", "required_", "=_", "self_", "._", "parent_", "._", "\\u", "deriv", "s", "\\u", "required_", "\\u\\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", "deriv", "s", "\\u", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "figure", " ", "out", " ", "the", " ", "rele", "van", "t", " ", "subgraph", " ", "based", " ", "on", " ", "give", "n", " ", "inputs", " ", "and", " ", "outputs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "inputs_", "is_", "None_", "and_", "outputs_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "deriv", "s", "\\u", "required_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dsr", "cs_", ",_", "dde", "sts_", "=_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "get", "\\u", "expr", "\\u", "var", "\\u", "depends_", "(_", "recurse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keep_", "._", "add_", "(_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keep_", "._", "update_", "(_", "[_", "c_", "._", "name_", "for_", "c_", "in_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "iterati", "on", "\\u", "set_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keep", " ", "any", " ", "connect", "ed", " ", "bound", "ary", " ", "vars_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "u_", ",_", "v_", "in_", "dgr", "aph", "_", "._", "list", "\\u", "connections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "bound", "ary", "\\u", "node_", "(_", "dgr", "aph", "_", ",_", "u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keep_", "._", "add_", "(_", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "bound", "ary", "\\u", "node_", "(_", "dgr", "aph", "_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keep_", "._", "add_", "(_", "v_", ")_", "\\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_", "inputs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inputs_", "=_", "list_", "(_", "dde", "sts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fix", " ", "any", " ", "single", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inputs_", "=_", "[_", "fix", "\\u", "single", "\\u", "tuple_", "(_", "i_", ")_", "for_", "i_", "in_", "inputs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "identify", " ", "any", " ", "broadcast", " ", "inputs_", "\\u\\u\\uNL\\u\\u\\u_", "ins_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "inp_", "in_", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "inp_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "keep_", "._", "add_", "(_", "inp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ins_", "._", "append_", "(_", "inp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "keep_", "._", "update_", "(_", "inp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ins_", "._", "append_", "(_", "inp_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inputs_", "=_", "ins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "outputs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outputs_", "=_", "dsr", "cs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dgr", "aph", "_", "=_", "dgr", "aph", "_", "._", "\\u", "explode", "\\u", "vart", "ree", "s_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "skip_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "any", " ", "variab", "les", " ", "request", "ed", " ", "tha", "t", " ", "don", "'", "t", " ", "exist", " ", "in", " ", "the", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "inp_", "in_", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "inp_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'['_", ")_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "inp_", "not_", "in_", "dgr", "aph", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "base", "\\u", "var_", "(_", "dgr", "aph", "_", ",_", "inp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "chain_", "(_", "dgr", "aph", "_", "._", "successors_", "(_", "base_", ")_", ",_", "dgr", "aph", "_", "._", "predecessor", "s_", "(_", "base_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "base", "\\u", "var_", "(_", "dgr", "aph", "_", ",_", "n_", ")_", "!=_", "base_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "keep_", "._", "add_", "(_", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dgr", "aph", "_", "._", "add", "\\u", "connect", "ed", "\\u", "subv", "ar_", "(_", "inp_", ")_", "\\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_", "out_", "in_", "outputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "out_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'['_", ")_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "out_", "not_", "in_", "dgr", "aph", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "base", "\\u", "var_", "(_", "dgr", "aph", "_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "chain_", "(_", "dgr", "aph", "_", "._", "successors_", "(_", "base_", ")_", ",_", "dgr", "aph", "_", "._", "predecessor", "s_", "(_", "base_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "base", "\\u", "var_", "(_", "dgr", "aph", "_", ",_", "n_", ")_", "!=_", "base_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "keep_", "._", "add_", "(_", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dgr", "aph", "_", "._", "add", "\\u", "connect", "ed", "\\u", "subv", "ar_", "(_", "out_", ")_", "\\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_", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dgr", "aph", "_", "=_", "dgr", "aph", "_", "._", "rele", "van", "t", "\\u", "subgraph_", "(_", "inputs_", ",_", "outputs_", ",_", "keep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dgr", "aph", "_", "._", "\\u", "remove", "\\u", "vart", "ree", "s_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keep_", "._", "update_", "(_", "inputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keep_", "._", "update_", "(_", "outputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dgr", "aph", "_", "._", "\\u", "fix", "\\u", "state", "\\u", "connections_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dgr", "aph", "_", "._", "\\u", "connect", "\\u", "subv", "ars", "\\u", "to", "\\u", "comps_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "collapse", " ", "all", " ", "connections", " ", "int", "o", " ", "single", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "collapsed", "\\u", "graph_", "=_", "dgr", "aph", "_", "._", "collapse", "\\u", "connections_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collapsed", "\\u", "graph_", "._", "fix", "\\u", "duplicat", "e\\u", "dest", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collapsed", "\\u", "graph_", "._", "\\u", "consolidat", "e\\u", "srcs", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collapsed", "\\u", "graph_", "._", "vars", "2t", "uple", "s_", "(_", "dgr", "aph", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "name2", "collapsed", "_", "=_", "collapsed", "\\u", "graph_", "._", "map", "\\u", "collapsed", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "Var", "System", "s", " ", "for", " ", "bound", "ary", " ", "vars_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", ",_", "data_", "in_", "collapsed", "\\u", "graph_", "._", "nodes", "\\u", "iter_", "(_", "data_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "bound", "ary", "'_", "in_", "data_", "and_", "collapsed", "\\u", "graph_", "._", "degree_", "(_", "node_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "._", "get_", "(_", "'", "iot", "ype", "'_", ")_", "==_", "'", "in", "'_", "and_", "collapsed", "\\u", "graph_", "._", "in", "\\u", "degree_", "(_", "node_", ")_", "==_", "0_", ":_", "#", " ", "input", " ", "bound", "ary", " ", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "collapsed", "\\u", "graph_", "._", "add", "\\u", "node_", "(_", "node_", "[_", "0_", "]_", "._", "split_", "(_", "'['_", ",_", "1_", ")_", "[_", "0_", "]_", ",_", "comp_", "=_", "'", "inva", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collapsed", "\\u", "graph_", "._", "add", "\\u", "edge_", "(_", "node_", "[_", "0_", "]_", "._", "split_", "(_", "'['_", ",_", "1_", ")_", "[_", "0_", "]_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", "._", "get_", "(_", "'", "iot", "ype", "'_", ")_", "==_", "'", "out", "'_", ":_", "#", " ", "output", " ", "bnd", "ry", " ", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "collapsed", "\\u", "graph_", "._", "add", "\\u", "node_", "(_", "node_", "[_", "1_", "]_", "[_", "0_", "]_", "._", "split_", "(_", "'['_", ",_", "1_", ")_", "[_", "0_", "]_", ",_", "comp_", "=_", "'", "out", "var", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collapsed", "\\u", "graph_", "._", "add", "\\u", "edge_", "(_", "node_", ",_", "node_", "[_", "1_", "]_", "[_", "0_", "]_", "._", "split_", "(_", "'['_", ",_", "1_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "translat", "e", " ", "kep", "t", " ", "nodes", " ", "to", " ", "collapsed", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coll", "\\u", "keep_", "=_", "set_", "(_", "[_", "self_", "._", "name2", "collapsed", "_", "._", "get_", "(_", "k_", ",_", "k_", ")_", "for_", "k_", "in_", "keep_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "all", " ", "vars", " ", "tha", "t", " ", "don", "'", "t", " ", "connect", " ", "components_", "\\u\\u\\uNL\\u\\u\\u_", "collapsed", "\\u", "graph_", "._", "prune", "_", "(_", "coll", "\\u", "keep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "collapsed", "\\u", "graph_", "._", "fix", "\\u", "dan", "glin", "g", "\\u", "vars_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "drv", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node_", "in_", "collapsed", "\\u", "graph_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "collapsed", "\\u", "graph_", "._", "in", "\\u", "degree_", "(_", "node_", ")_", ">_", "1_", "and_", "isinstance_", "(_", "node_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "pred_", "in_", "collapsed", "\\u", "graph_", "._", "predecessor", "s_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "pred_", "!=_", "drv", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "collapsed", "\\u", "graph_", "._", "remove", "\\u", "edge_", "(_", "pred_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "collapsed", "\\u", "graph_", "._", "in", "\\u", "degree_", "(_", "node_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "reduce", "d\\u", "graph_", "=_", "collapsed", "\\u", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "comp_", "in_", "self_", "._", "get", "\\u", "comps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "interface_", "(_", "comp_", ",_", "ID", "river", "_", ")_", "and_", "comp_", "._", "require", "s", "\\u", "deriv", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "deriv", "s", "\\u", "required_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "comp_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "setup", "\\u", "reduce", "d\\u", "graph_", "(_", "inputs_", "=_", "\\u", "get", "\\u", "scoped", "\\u", "inputs_", "(_", "comp_", ",_", "dgr", "aph", "_", ",_", "inputs_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "\\u", "get", "\\u", "scoped", "\\u", "outputs_", "(_", "comp_", ",_", "dgr", "aph", "_", ",_", "outputs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "ordering_", "(_", "self_", ",_", "graph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "n", " ", "a", " ", "component", " ", "graph", ",", " ", "each", " ", "driver", " ", "can", " ", "dete", "rmin", "e", " ", "its", " ", "iterati", "on", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "and", " ", "the", " ", "orderi", "ng", " ", "of", " ", "its", " ", "workf", "low", ".", " ", " ", "Ea", "ch", " ", "Asse", "mbly", " ", "has", " ", "its", " ", "own", "\\", "10", ";", " ", " ", " ", " ", "component", " ", "graph", ",", " ", "so", " ", "the", " ", "pass", "ed", " ", "in", " ", "graph", " ", "is", " ", "ignore", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp", "graph_", "=_", "self_", "._", "\\u", "dep", "graph_", "._", "component", "\\u", "graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "compute", "\\u", "ordering_", "(_", "comp", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "comp_", "in_", "self_", "._", "get", "\\u", "comps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "interface_", "(_", "comp_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "compute", "\\u", "ordering_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "iters", "ets_", "(_", "self_", ",_", "graph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Det", "erm", "ine", " ", "the", " ", "iterati", "on", " ", "sets", " ", "for", " ", "all", " ", "driver", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp", "graph_", "=_", "self_", "._", "\\u", "dep", "graph_", "._", "component", "\\u", "graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "compute", "\\u", "iters", "ets_", "(_", "comp", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "call", " ", "may", " ", "create", " ", "a", " ", "new", " ", "top", " ", "level", " ", "driver", " ", "for", " ", "components_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "need", " ", "to", " ", "execute", " ", "onc", "e", " ", "bef", "ore", " ", "the", " ", "normal", " ", "top", " ", "level_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "driver", " ", "execute", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "find", "\\u", "une", "xec", "ute", "d\\u", "comps_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "comp_", "in_", "self_", "._", "get", "\\u", "comps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "interface_", "(_", "comp_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "compute", "\\u", "iters", "ets_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "var", "\\u", "info_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collect", " ", "any", " ", "variab", "le", " ", "metadata", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "model", " ", "here", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "{_", "'", "size", "'_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nof", "lat_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "node_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "the", " ", "name", " ", "of", " ", "the", " ", "src_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "node_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "simple", "\\u", "node", "\\u", "iter_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "get", "\\u", "metadata_", "(_", "n_", "._", "split_", "(_", "'['_", ",_", "1_", ")_", "[_", "0_", "]_", ",_", "'", "nof", "lat", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "nof", "lat_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parts_", "=_", "name_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cname_", ",_", "vname_", "=_", "parts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child_", "=_", "getattr_", "(_", "self_", ",_", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cname_", ",_", "vname_", "=_", "''_", ",_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child_", "=_", "self_", "\\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_", "#", " ", "TOD", "O", ":", " ", "add", " ", "checking", " ", "of", " ", "local", "\\u", "size", " ", "metadata", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", ",_", "idx_", "=_", "get", "\\u", "val", "\\u", "and", "\\u", "index_", "(_", "child_", ",_", "vname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "val_", ",_", "real", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "[_", "'", "scala", "r", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "val_", ",_", "'", "shape", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "[_", "'", "shape", "'_", "]_", "=_", "val_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'['_", "in_", "vname_", ":_", "#", " ", "array", " ", "index", " ", "int", "o", " ", "base", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "vname_", "._", "split_", "(_", "'['_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flat", "\\u", "idx_", "=_", "to", "\\u", "idx", "\\u", "array_", "(_", "get", "\\u", "flattened", "\\u", "index_", "(_", "idx_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "var", "\\u", "shape_", "(_", "base_", ",_", "child_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cvt", "\\u", "to", "\\u", "slice_", "=_", "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 ", " _", "base_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flat", "\\u", "idx_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "[_", "'", "size", "'_", "]_", "=_", "flattened", "\\u", "size_", "(_", "vname_", ",_", "val_", ",_", "scope_", "=_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "flat", "\\u", "idx_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "[_", "'", "flat", "\\u", "idx", "'_", "]_", "=_", "flat", "\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Flat", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "[_", "'", "nof", "lat", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "base_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bname_", "=_", "'.'_", "._", "join_", "(_", "(_", "cname_", ",_", "base_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bname_", "=_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "[_", "'", "base", "var", "'_", "]_", "=_", "bname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "any", " ", "other", " ", "metadata", " ", "we", " ", "want_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meta_", "=_", "child_", "._", "get", "\\u", "metadata_", "(_", "vname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mname_", "in_", "[_", "'", "deriv", "\\u", "ignore", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "meta_", "._", "get_", "(_", "mname_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "[_", "mname_", "]_", "=_", "meta_", "\\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_", "nof", "lat_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "[_", "'", "nof", "lat", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "all", "\\u", "var", "\\u", "metadata_", "(_", "self_", ",_", "graph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collect", " ", "size", ",", " ", "shape", ",", " ", "etc", ".", " ", "info", " ", "for", " ", "all", " ", "variab", "les", " ", "referenced", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "graph", ".", " ", " ", "Thi", "s", " ", "info", " ", "can", " ", "then", " ", "be", " ", "used", " ", "by", " ", "all", " ", "subsystem", "s", "\\", "10", ";", " ", " ", " ", " ", "contain", "ed", " ", "in", " ", "this", " ", "Asse", "mbly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "meta_", "=_", "self_", "._", "\\u", "var", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", ",_", "data_", "in_", "graph_", "._", "nodes", "\\u", "iter_", "(_", "data_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "not_", "in_", "var", "meta_", "and_", "'", "comp", "'_", "not_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "self_", "._", "\\u", "get", "\\u", "var", "\\u", "info_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "var", "meta_", "(_", "node_", ",_", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "are", " ", "case", "s", " ", "where", " ", "a", " ", "component", " ", "will", " ", "return", " ", "names", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "its", " ", "list", "\\u", "deriv", "\\u", "vars", " ", "tha", "t", " ", "are", " ", "not", " ", "found", " ", "in", " ", "the", " ", "graph", ",", " ", "so", " ", "add", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "here", " ", "just", " ", "in", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", ",_", "data_", "in_", "graph_", "._", "nodes", "\\u", "iter_", "(_", "data_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "comp", "'_", "in_", "data_", "and_", "'.'_", "not_", "in_", "node_", ":_", "\\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 ", " ", "_", "comp_", "=_", "getattr_", "(_", "self_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ins_", ",_", "outs_", "=_", "comp_", "._", "list", "\\u", "deriv", "\\u", "vars_", "(_", ")_", "\\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 ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "chain_", "(_", "ins_", ",_", "outs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "'.'_", "._", "join_", "(_", "(_", "node_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "not_", "in_", "var", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "var", "meta_", "[_", "name_", "]_", "=_", "self_", "._", "\\u", "get", "\\u", "var", "\\u", "info_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "var", "meta_", "(_", "self_", ",_", "node_", ",_", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "var", "\\u", "meta_", "[_", "node_", "]_", "=_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "simple", "\\u", "node", "\\u", "iter_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "var", "\\u", "meta_", "[_", "name_", "]_", "=_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "var", "\\u", "print", "\\u", "ranks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collect", " ", "info", " ", "from", " ", "all", " ", "process", "es", " ", "indicati", "ng", " ", "what", " ", "variab", "les", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "local", " ", "to", " ", "tha", "t", " ", "process", ",", " ", "and", " ", "record", " ", "the", " ", "lowe", "st", " ", "rank", " ", "where", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "give", "n", " ", "variab", "le", " ", "is", " ", "local", ".", " ", " ", "Distribut", "ed", " ", "variab", "les", " ", "will", " ", "need", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "record", " ", "all", " ", "of", " ", "thei", "r", " ", "active", " ", "ranks", ",", " ", "sinc", "e", " ", "each", " ", "rank", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "contain", " ", "different", " ", "data", ".", " ", " ", "Thi", "s", " ", "info", " ", "is", " ", "used", " ", "for", " ", "parall", "el", " ", "case", "\\", "10", ";", " ", " ", " ", " ", "record", "ing", " ", "in", " ", "order", " ", "to", " ", "avoid", " ", "saving", " ", "redundant", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "print", "\\u", "ranks_", "=_", "print", "\\u", "ranks_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "MPI_", "is_", "None_", "or_", "not_", "self_", "._", "\\u", "system_", "._", "is", "\\u", "active_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", ",", " ", "get", " ", "all", " ", "of", " ", "our", " ", "local", " ", "vars_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "our", "vars_", "=_", "self_", "._", "get", "\\u", "all", "\\u", "local", "\\u", "vars_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "distribute", " ", "this", " ", "informati", "on", " ", "acro", "ss", " ", "all", " ", "ranks_", "\\u\\u\\uNL\\u\\u\\u_", "all", "vars_", "=_", "self_", "._", "mpi_", "._", "comm_", "._", "all", "gather_", "(_", "our", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "loop", " ", "over", " ", "all", " ", "vars", " ", "in", " ", "each", " ", "rank", " ", "and", " ", "record", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rank", ".", " ", " ", "Go", " ", "in", " ", "reverse", " ", "so", " ", "the", " ", "lowe", "st", " ", "rank", " ", "writt", "en", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "the", " ", "last", ".", " ", " ", "If", " ", "a", " ", "var", " ", "name", " ", "is", " ", "a", " ", "tuple", ",", " ", "tha", "t", " ", "indicat", "es_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "a", " ", "distributed", " ", "var", ",", " ", "so", " ", "all", " ", "ranks", " ", "will", " ", "be", " ", "recorde", "d_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rank_", "in_", "range_", "(_", "self_", "._", "mpi_", "._", "comm_", "._", "size_", "-_", "1_", ",_", "-_", "1_", ",_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "v_", "in_", "all", "vars_", "[_", "rank_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "v_", ",_", "tuple_", ")_", ":_", "#", " ", "it", "'", "s", " ", "a", " ", "distributed", " ", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "\\u", "ranks_", "._", "setdefault_", "(_", "v_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "rank_", ")_", "\\u\\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", "\\u", "ranks_", "[_", "v_", "]_", "=_", "(_", "rank_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "any", " ", "connect", "ed", " ", "vars", ",", " ", "the", " ", "rank", " ", "of", " ", "a", " ", "destinat", "ion", " ", "is", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "match", " ", "the", " ", "rank", " ", "of", " ", "its", " ", "source_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cname", "s_", "=_", "[_", "self_", "._", "name2", "collapsed", "_", "._", "get_", "(_", "n_", ",_", "n_", ")_", "for_", "n_", "in_", "print", "\\u", "ranks_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cname_", "in_", "cname", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "cname_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "cname_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dest_", "in_", "cname_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "\\u", "ranks_", "[_", "dest_", "]_", "=_", "print", "\\u", "ranks_", "[_", "src_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "local", "\\u", "vars_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "set", " ", "of", " ", "all", " ", "variab", "les", " ", "in", " ", "this", " ", "Asse", "mbly", " ", "and", " ", "any", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "its", " ", "child", "ren", " ", "tha", "t", " ", "are", " ", "local", " ", "to", " ", "the", " ", "current", " ", "MPI", " ", "process", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "locs_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "locs_", "._", "update_", "(_", "self_", "._", "list", "\\u", "inputs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "locs_", "._", "update_", "(_", "self_", "._", "list", "\\u", "outputs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "[_", "self_", "._", "\\u", "system_", "]_", "+_", "list_", "(_", "self_", "._", "\\u", "system_", "._", "local", "\\u", "subsystem", "s_", "(_", "recurse_", "=_", "True_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "Simple", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "obj_", "=_", "self_", "._", "get_", "(_", "s_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "all", "\\u", "locs_", "._", "update_", "(_", "[_", "'.'_", "._", "join_", "(_", "[_", "obj_", "._", "name_", ",_", "n_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "obj_", "._", "get", "\\u", "all", "\\u", "local", "\\u", "vars_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lv", "ars_", "=_", "[_", "'.'_", "._", "join_", "(_", "[_", "obj_", "._", "name_", ",_", "n_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "obj_", "._", "list", "\\u", "inputs_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "list", "\\u", "outputs_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "v_", "in_", "enumerate_", "(_", "lv", "ars_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "v_", "in_", "s_", "._", "distri", "b", "\\u", "idxs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "lv", "ars_", "[_", "i_", "]_", "=_", "(_", "v_", ",_", ")_", "#", " ", "wrap", " ", "in", " ", "tuple", " ", "to", " ", "indicat", "e", " ", "its", " ", "a", " ", "distri", "b", " ", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "locs_", "._", "update_", "(_", "lv", "ars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "s_", ",_", "Param", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "all", "\\u", "locs_", "._", "add_", "(_", "s_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "all", "\\u", "locs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "is", " ", "for", " ", "any", " ", "last", " ", "minute", " ", "configura", "tion", " ", "(", "like", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "Architecture", "Asse", "mbly", ").", " ", " ", "Compo", "nent", "s", "'", " ", "setup", "\\u", "init", " ", "method", "s", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "NOT", " ", "call", "ed", " ", "in", " ", "executi", "on", " ", "order", " ", "bec", "aus", "e", " ", "tha", "t", " ", "isn", "'", "t", "\\", "10", ";", " ", " ", " ", " ", "know", "n", " ", "at", " ", "this", " ", "point", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cpa", "th", "\\u", "updated_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "var", "\\u", "meta_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pre", "\\u", "driver_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "une", "xec", "ute", "d_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "provide", "J", "\\u", "bounds_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "system_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "deriv", "s", "\\u", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "rid", " ", "of", " ", "any", " ", "lefto", "ver", " ", "pseudo", "comps", " ", "from", " ", "last", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "._", "startswith_", "(_", "'\\u", "pseudo", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "self_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", ",_", "Pse", "udo", "Component_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "remove_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "comp_", "in_", "self_", "._", "get", "\\u", "comps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "setup", "\\u", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "var", "\\u", "sizes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "top", "\\u", "driver_", "._", "init", "\\u", "var", "\\u", "sizes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "comp_", "in_", "self_", "._", "get", "\\u", "comps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "post", "\\u", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "system_", "._", "is", "\\u", "active_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "system_", "._", "vec_", "[_", "'", "u", "'_", "]_", "._", "set\\u", "from", "\\u", "scope_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup_", "(_", "self_", ",_", "inputs_", "=_", "None_", ",_", "outputs_", "=_", "None_", ",_", "drv", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "is", " ", "call", "ed", " ", "automati", "call", "y", " ", "on", " ", "the", " ", "top", " ", "level", " ", "Asse", "mbly", "\\", "10", ";", " ", " ", " ", " ", "prior", " ", "to", " ", "executi", "on", ".", " ", " ", "It", " ", "will", " ", "als", "o", " ", "be", " ", "call", "ed", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "calc", "\\u", "gradi", "ent", " ", "is", " ", "call", "ed", " ", "with", " ", "input", " ", "or", " ", "output", " ", "lists", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "differ", " ", "from", " ", "the", " ", "lists", " ", "of", " ", "parameter", "s", " ", "or", " ", "objectives", "/", "constraint", "s", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "are", " ", "inh", "eren", "t", " ", "to", " ", "the", " ", "model", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "perform", " ", "full", " ", "setup", " ", "if", " ", "we", "'", "re", " ", "the", " ", "top", " ", "Asse", "mbly", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "MPI_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "MPI_", "._", "COMM", "\\u", "WORLD", "_", "._", "Set", "\\u", "err", "handler_", "(_", "MPI_", "._", "ERRORS", "\\u", "ARE", "\\u", "FATAL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comm_", "=_", "MPI_", "._", "COMM", "\\u", "WORLD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comm_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "setup", "\\u", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "setup", "\\u", "dep", "graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compute", "\\u", "iters", "ets_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compute", "\\u", "ordering_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "init", "\\u", "var", "\\u", "sizes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "setup", "\\u", "reduce", "d\\u", "graph_", "(_", "inputs_", "=_", "inputs_", ",_", "outputs_", "=_", "outputs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "drv", "name_", "=_", "drv", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "\\u", "systems_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "check", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "MPI", ".", "COMM", "\\u", "WORLD", ".", "rank", " ", "==", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "openm", "dao", ".", "util", ".", "dot", "graph", " ", "import", " ", "plot", "\\u", "system", "\\u", "tree", ",", " ", "plot", "\\u", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plot", "\\u", "system", "\\u", "tree", "(", "self", ".\\u", "system", ",'", "sys", ".", "pdf", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plot", "\\u", "graph", "(", "self", ".\\u", "reduce", "d\\u", "graph", ",", " ", "'", "red", ".", "pdf", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "communicator", "s", " ", "are", " ", "distributed", " ", "and", " ", "dist", " ", "idx", "s", " ", "are", " ", "gather", "ed", " ", "from", " ", "comps", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "setup", "\\u", "communicator", "s_", "(_", "comm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "collect", "\\u", "metadata_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "var", "\\u", "print", "\\u", "ranks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "setup", "\\u", "variables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "\\u", "sizes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "\\u", "vectors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "\\u", "scatter", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "[_", "0_", "]_", ",_", "exc_", "[_", "1_", "]_", ",_", "exc_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "post", "\\u", "setup_", "(_", ")_", "\\u\\u\\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_", "dump", "\\u", "iterati", "on", "\\u", "tree_", "(_", "obj_", ",_", "f_", "=_", "sys_", "._", "stdout_", ",_", "full_", "=_", "True_", ",_", "tabs", "ize_", "=_", "4_", ",_", "deriv", "s_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "text", " ", "version", " ", "of", " ", "the", " ", "iterati", "on", " ", "tree", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "an", " ", "Open", "MD", "AO", " ", "object", ".", " ", " ", "The", " ", "tree", " ", "show", "s", " ", "whi", "ch", " ", "are", " ", "bei", "ng", "\\", "10", ";", " ", " ", " ", " ", "iterate", "d", " ", "over", " ", "by", " ", "whi", "ch", " ", "driver", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "full", " ", "is", " ", "Tru", "e", ",", " ", "show", " ", "pseudo", "component", "s", " ", "as", " ", "well", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "deriv", "s", " ", "is", " ", "Tru", "e", ",", " ", "include", " ", "deriv", "ative", " ", "input", "/", "output", "\\", "10", ";", " ", " ", " ", " ", "informati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "dump", "\\u", "iterati", "on", "\\u", "tree_", "(_", "obj_", ",_", "f_", ",_", "table", "vel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tab_", "=_", "'", " ", "'_", "*_", "table", "vel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "instance_", "(_", "obj_", ",_", "Driver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"%", "s", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "tab_", ",_", "obj_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "deriv", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "dump", "ing", " ", "of", " ", "deriv", "ative", " ", "inputs", "/", "output", "s", " ", "not", " ", "support", "ed", " ", "ye", "t", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "f", ".", "write", "(\"", "%", "s", "*", "deriv", " ", "inputs", ":", " ", "%", "s", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "%", " ", "('", " ", "'*", "(", "table", "vel", "+", "tabs", "ize", "+", "2", "),", " ", "inputs", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "f", ".", "write", "(\"", "%", "s", "*", "deriv", " ", "output", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "%", " ", "('", " ", "'*", "(", "table", "vel", "+", "tabs", "ize", "+", "2", "),", " ", "output", "s", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "names_", "=_", "set_", "(_", "obj_", "._", "workflow_", "._", "\\u", "explicit", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cname_", "in_", "obj_", "._", "\\u", "ordering_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "=_", "getattr_", "(_", "obj_", "._", "parent_", ",_", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "full_", "and_", "comp_", "._", "name_", "not_", "in_", "names_", ":_", "\\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_", "is", "\\u", "instance_", "(_", "comp_", ",_", "Driver_", ")_", "or_", "is", "\\u", "instance_", "(_", "comp_", ",_", "Asse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "dump", "\\u", "iterati", "on", "\\u", "tree_", "(_", "comp_", ",_", "f_", ",_", "table", "vel_", "+_", "tabs", "ize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "instance_", "(_", "comp_", ",_", "Pse", "udo", "Component_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "._", "write_", "(_", "\"%", "s", "%", "s", " ", " ", "(%", "s", ")\\\\", "n", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", " ", "'_", "*_", "(_", "table", "vel_", "+_", "tabs", "ize_", ")_", ",_", "comp_", "._", "name_", ",_", "comp_", "._", "\\u", "orig", "\\u", "expr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "._", "write_", "(_", "\"%", "s", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "'", " ", "'_", "*_", "(_", "table", "vel_", "+_", "tabs", "ize_", ")_", ",_", "comp_", "._", "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_", "elif_", "is", "\\u", "instance_", "(_", "obj_", ",_", "Asse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"%", "s", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "tab_", ",_", "obj_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "dump", "\\u", "iterati", "on", "\\u", "tree_", "(_", "obj_", "._", "driver_", ",_", "f_", ",_", "table", "vel_", "+_", "tabs", "ize_", ")_", "\\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", "dump", "\\u", "iterati", "on", "\\u", "tree_", "(_", "obj_", ",_", "f_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "scoped", "\\u", "inputs_", "(_", "comp_", ",_", "g_", ",_", "explicit", "\\u", "ins_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "list", " ", "of", " ", "input", " ", "varnames", " ", "scoped", " ", "to", " ", "the", " ", "give", "n", " ", "name", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cname", "dot_", "=_", "comp_", "._", "name_", "+_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inputs_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "explicit", "\\u", "ins_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "explicit", "\\u", "ins_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "u_", ",_", "v_", "in_", "g_", "._", "list", "\\u", "connections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "._", "startswith_", "(_", "cname", "dot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inputs_", "._", "add_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inputs_", "._", "update_", "(_", "[_", "n_", "for_", "n_", "in_", "explicit", "\\u", "ins_", "if_", "n_", "._", "startswith_", "(_", "cname", "dot_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "n_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "[_", "1_", "]_", "for_", "n_", "in_", "inputs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "scoped", "\\u", "outputs_", "(_", "comp_", ",_", "g_", ",_", "explicit", "\\u", "outs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "list", " ", "of", " ", "output", " ", "varnames", " ", "scoped", " ", "to", " ", "the", " ", "give", "n", " ", "name", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cname", "dot_", "=_", "comp_", "._", "name_", "+_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outputs_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "explicit", "\\u", "outs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "explicit", "\\u", "outs_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "u_", ",_", "v_", "in_", "g_", "._", "list", "\\u", "connections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "u_", "._", "startswith_", "(_", "cname", "dot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outputs_", "._", "add_", "(_", "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_", "outputs_", "._", "update_", "(_", "[_", "n_", "for_", "n_", "in_", "explicit", "\\u", "outs_", "if_", "n_", "._", "startswith_", "(_", "cname", "dot_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "outputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "n_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "[_", "1_", "]_", "for_", "n_", "in_", "outputs_", "]_", "\\u\\u\\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", "split", "\\u", "var", "path_", "(_", "cont_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "tuple", " ", "of", " ", "comp", "name", ",", "component", ",", "varname", " ", "give", "n", " ", "a", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "name", " ", "of", " ", "the", " ", "form", " ", "'", "comp", "name", ".", "varname", "'.", " ", "If", " ", "the", " ", "name", " ", "is", " ", "of", " ", "the", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "'", "varname", "',", " ", "then", " ", "comp", "name", " ", "will", " ", "be", " ", "Non", "e", " ", "and", " ", "comp", " ", "is", " ", "cont", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp", "name_", ",_", "varname_", "=_", "path_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "cont_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "cont_", "._", "get", "\\u", "trait_", "(_", "comp", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "t_", "and_", "t_", "._", "iot", "ype_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "cont_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "comp", "name_", ",_", "getattr_", "(_", "cont_", ",_", "comp", "name_", ")_", ",_", "varname_", ")_", "\\u\\u\\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", "expand", "\\u", "tree_", "(_", "path_", ",_", "tree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "list", " ", "of", " ", "``", "(", "path", ",", " ", "value", ")`", "`", " ", "with", " ", ":", "class", ":`", "Varia", "ble", "Tree", "`", "\\", "10", ";", " ", " ", " ", " ", "expand", "ed", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "+=_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "val_", "in_", "tree_", "._", "\\u", "items_", "(_", "set_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "val_", ",_", "Varia", "ble", "Tree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "extend_", "(_", "\\u", "expand", "\\u", "tree_", "(_", "path_", "+_", "name_", ",_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "(_", "path_", "+_", "name_", ",_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
GreatFruitOmsk/nativeconfig/test/options/dict_option.py
[ { "content": " def test_option_raises_deserialization_error_if_value_option_invalid(self):\n c = MyConfig.get_instance()\n with self.assertRaises(DeserializationError):\n c.float_dict = {\"Key\": \"not_float\"}\n float_dict = c.float_dict", "metadata": "root.TestDictOption.test_option_raises_deserialization_error_if_value_option_invalid", "header": "['class', 'TestDictOption', '(', 'unittest', '.', 'TestCase', ',', 'TestOptionMixin', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_default_value_must_be_one_of_choices_if_any(self):\n with self.assertRaises(ValidationError):\n class MyConfig(DummyMemoryConfig):\n dict_option = self.OPTION_TYPE('DictOption', choices=[{\"key1\": \"value1\", \"key2\": \"value2\"}], default={\"key1\": \"value1\", \"key2\": \"value3\"})", "metadata": "root.TestDictOption.test_default_value_must_be_one_of_choices_if_any", "header": "['class', 'TestDictOption', '(', 'unittest', '.', 'TestCase', ',', 'TestOptionMixin', ')', ':', '___EOS___']", "index": 115 }, { "content": " def test_all_choices_must_be_valid(self):\n with self.assertRaises(ValidationError):\n class MyConfig(DummyMemoryConfig):\n dict_option = self.OPTION_TYPE('DictOption', choices=[{\"key1\": \"value1\", \"key2\": \"value2\"}, 1])", "metadata": "root.TestDictOption.test_all_choices_must_be_valid", "header": "['class', 'TestDictOption', '(', 'unittest', '.', 'TestCase', ',', 'TestOptionMixin', ')', ':', '___EOS___']", "index": 120 }, { "content": " def test_default_must_be_valid(self):\n with self.assertRaises(ValidationError):\n class MyConfig(DummyMemoryConfig):\n dict_option = self.OPTION_TYPE('DictOption', default='super dict')", "metadata": "root.TestDictOption.test_default_must_be_valid", "header": "['class', 'TestDictOption', '(', 'unittest', '.', 'TestCase', ',', 'TestOptionMixin', ')', ':', '___EOS___']", "index": 125 }, { "content": " def test_env_value_must_be_valid_json(self):\n os.environ['TEST_DICT'] = ']'\n\n with self.assertRaises(DeserializationError):\n c = MyConfig.get_instance()\n test_dict = c.test_dict\n\n os.environ['TEST_DICT'] = '{\"key3\": \"value3\"}'\n self.assertEqual(c.test_dict, {\"key3\": \"value3\"})", "metadata": "root.TestDictOption.test_env_value_must_be_valid_json", "header": "['class', 'TestDictOption', '(', 'unittest', '.', 'TestCase', ',', 'TestOptionMixin', ')', ':', '___EOS___']", "index": 218 } ]
[ { "span": "float_dict ", "start_line": 53, "start_column": 12, "end_line": 53, "end_column": 22 }, { "span": "MyConfig(", "start_line": 117, "start_column": 18, "end_line": 117, "end_column": 26 }, { "span": "MyConfig(", "start_line": 122, "start_column": 18, "end_line": 122, "end_column": 26 }, { "span": "MyConfig(", "start_line": 127, "start_column": 18, "end_line": 127, "end_column": 26 }, { "span": "test_dict ", "start_line": 223, "start_column": 12, "end_line": 223, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Dict", "Option_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Optio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "option", "\\u", "raise", "s", "\\u", "deser", "iali", "zatio", "n", "\\u", "error", "\\u", "if", "\\u", "value", "\\u", "option", "\\u", "invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "My", "Config_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Deserializ", "ation", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "float", "\\u", "dict_", "=_", "{_", "\"", "Key", "\"_", ":_", "\"", "not", "\\u", "float", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "float", "\\u", "dict_", "=_", "c_", "._", "float", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dict", "Option_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Optio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "value", "\\u", "must", "\\u", "be", "\\u", "one", "\\u", "of", "\\u", "choice", "s", "\\u", "if", "\\u", "any_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Validat", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "My", "Config_", "(_", "Du", "mm", "y", "Memo", "ry", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dict", "\\u", "option_", "=_", "self_", "._", "OPTION", "\\u", "TYPE_", "(_", "'", "Dict", "Optio", "n", "'_", ",_", "choices_", "=_", "[_", "{_", "\"", "key", "1", "\"_", ":_", "\"", "value", "1", "\"_", ",_", "\"", "key", "2", "\"_", ":_", "\"", "value", "2", "\"_", "}_", "]_", ",_", "default_", "=_", "{_", "\"", "key", "1", "\"_", ":_", "\"", "value", "1", "\"_", ",_", "\"", "key", "2", "\"_", ":_", "\"", "value", "3", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dict", "Option_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Optio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "all", "\\u", "choice", "s", "\\u", "must", "\\u", "be", "\\u", "valid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Validat", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "My", "Config_", "(_", "Du", "mm", "y", "Memo", "ry", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dict", "\\u", "option_", "=_", "self_", "._", "OPTION", "\\u", "TYPE_", "(_", "'", "Dict", "Optio", "n", "'_", ",_", "choices_", "=_", "[_", "{_", "\"", "key", "1", "\"_", ":_", "\"", "value", "1", "\"_", ",_", "\"", "key", "2", "\"_", ":_", "\"", "value", "2", "\"_", "}_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dict", "Option_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Optio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "must", "\\u", "be", "\\u", "valid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Validat", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "My", "Config_", "(_", "Du", "mm", "y", "Memo", "ry", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dict", "\\u", "option_", "=_", "self_", "._", "OPTION", "\\u", "TYPE_", "(_", "'", "Dict", "Optio", "n", "'_", ",_", "default_", "=_", "'", "super", " ", "dict", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dict", "Option_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Optio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "env", "\\u", "value", "\\u", "must", "\\u", "be", "\\u", "valid", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "TEST", "\\u", "DICT", "'_", "]_", "=_", "']'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Deserializ", "ation", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "My", "Config_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "dict_", "=_", "c_", "._", "test\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "TEST", "\\u", "DICT", "'_", "]_", "=_", "'{", "\"", "key", "3", "\":", " ", "\"", "value", "3", "\"}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "test\\u", "dict_", ",_", "{_", "\"", "key", "3", "\"_", ":_", "\"", "value", "3", "\"_", "}_", ")_", "\\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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
caseywstark/colab/colab/apps/feedback/templatetags/feedback_tags.py
[ { "content": "from django.template import Library, Node\n\nfrom feedback.models import Feedback\n\nregister = Library()\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@register.inclusion_tag(\"feedback/feedback_item.html\", takes_context=True)\ndef show_feedback(context, feedback):\n return {'feedback': feedback, 'request': context['request']}", "metadata": "root.show_feedback", "header": "['module', '___EOS___']", "index": 6 }, { "content": "@register.simple_tag\ndef clear_search_url(request):\n getvars = request.GET.copy()\n if 'search' in getvars:\n del getvars['search']\n if len(getvars.keys()) > 0:\n return \"%s?%s\" % (request.path, getvars.urlencode())\n else:\n return request.path", "metadata": "root.clear_search_url", "header": "['module', '___EOS___']", "index": 10 }, { "content": "@register.simple_tag\ndef persist_getvars(request):\n getvars = request.GET.copy()\n if len(getvars.keys()) > 0:\n return \"?%s\" % getvars.urlencode()\n return ''", "metadata": "root.persist_getvars", "header": "['module', '___EOS___']", "index": 20 } ]
[ { "span": "from django.template import Library, Node", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 41 }, { "span": "from feedback.models import Feedback", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 36 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Library_", ",_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "feedback_", "._", "models_", "import_", "Feed", "back_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register_", "=_", "Library_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "\"", "feed", "back", "/", "feed", "back", "\\u", "item", ".", "html", "\"_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "show", "\\u", "feedback_", "(_", "context_", ",_", "feedback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "feed", "back", "'_", ":_", "feedback_", ",_", "'", "request", "'_", ":_", "context_", "[_", "'", "request", "'_", "]_", "}_", "\\u\\u\\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_", "._", "simple", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "clear", "\\u", "search", "\\u", "url_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getv", "ars_", "=_", "request_", "._", "GET_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "search", "'_", "in_", "getv", "ars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "getv", "ars_", "[_", "'", "search", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "getv", "ars_", "._", "keys_", "(_", ")_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", "?", "%", "s", "\"_", "%_", "(_", "request_", "._", "path_", ",_", "getv", "ars_", "._", "urlencode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "request_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "simple", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "persist", "\\u", "getv", "ars_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getv", "ars_", "=_", "request_", "._", "GET_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "getv", "ars_", "._", "keys_", "(_", ")_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"?", "%", "s", "\"_", "%_", "getv", "ars_", "._", "urlencode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
pybee/voc/tests/structures/test_java.py
[ { "content": "from unittest import expectedFailure\n\nfrom ..utils import TranspileTestCase\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class JavaTests(TranspileTestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.JavaTests", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def test_multiple_constructors(self):\n \"The appropriate constructor for a native Java class can be interpolated from args\"\n self.assertJavaExecution(\n \"\"\"\n from java.lang import StringBuilder\n\n builder = StringBuilder(\"Hello, \")\n\n builder.append(\"world\")\n\n print(builder)\n print(\"Done.\")\n \"\"\",\n \"\"\"\n Hello, world\n Done.\n \"\"\", run_in_function=False)", "metadata": "root.JavaTests.test_multiple_constructors", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 7 }, { "content": " def test_most_specific_constructor(self):\n \"The most specific constructor for a native Java class will be selected based on argument.\"\n self.assertJavaExecution(\n \"\"\"\n from com.example import MyClass\n\n obj1 = MyClass()\n obj2 = MyClass(1.234)\n obj3 = MyClass(3742)\n\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass {\n public MyClass() {\n System.out.println(\"No argument\");\n }\n\n public MyClass(int arg) {\n System.out.println(\"Integer argument \" + arg);\n }\n\n public MyClass(double arg) {\n System.out.println(\"Double argument \" + arg);\n }\n }\n \"\"\"\n },\n out=\"\"\"\n No argument\n Double argument 1.234\n Integer argument 3742\n Done.\n \"\"\", run_in_function=False)", "metadata": "root.JavaTests.test_most_specific_constructor", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_field(self):\n \"Native fields on an instance can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import MyClass\n\n print(\"Class is\", MyClass)\n obj1 = MyClass()\n print(\"Field is\", MyClass.field)\n print(\"Field from instance is\", obj1.field)\n obj1.field = 37\n print(\"Updated Field from instance is\", obj1.field)\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass {\n public int field = 42;\n }\n \"\"\"\n },\n out=\"\"\"\n Class is <class 'com.example.MyClass'>\n Field is <unbound native field public int com.example.MyClass.field>\n Field from instance is 42\n Updated Field from instance is 37\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_field", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " def test_static_field(self):\n \"Class constants can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import MyClass\n\n print(\"Class is\", MyClass)\n obj1 = MyClass()\n print(\"Static field is\", MyClass.static_field)\n MyClass.static_field = 37\n print(\"Updated static field is\", MyClass.static_field)\n print(\"Static field from instance is\", obj1.static_field)\n MyClass.static_field = 42\n print(\"Updated static field from instance is\", obj1.static_field)\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass {\n public static int static_field = 42;\n }\n \"\"\"\n },\n out=\"\"\"\n Class is <class 'com.example.MyClass'>\n Static field is 42\n Updated static field is 37\n Static field from instance is 37\n Updated static field from instance is 42\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_static_field", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 93 }, { "content": " def test_superclass_field(self):\n \"Native fields defined on a superclass can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import MyBase, MyClass\n\n print(\"Base class is\", MyBase)\n print(\"Class is\", MyClass)\n obj1 = MyClass()\n print(\"Base field on superclass is\", MyBase.base_field)\n print(\"Base field is\", MyClass.base_field)\n print(\"Base field from instance is\", obj1.base_field)\n print(\"Field is\", MyClass.field)\n print(\"Field from instance is\", obj1.field)\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyBase': \"\"\"\n package com.example;\n\n public class MyBase {\n public int base_field = 37;\n }\n \"\"\",\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass extends MyBase {\n public int field = 42;\n }\n \"\"\"\n },\n out=\"\"\"\n Base class is <class 'com.example.MyBase'>\n Class is <class 'com.example.MyClass'>\n Base field on superclass is <unbound native field public int com.example.MyBase.base_field>\n Base field is <unbound native field public int com.example.MyBase.base_field>\n Base field from instance is 37\n Field is <unbound native field public int com.example.MyClass.field>\n Field from instance is 42\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_superclass_field", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 126 }, { "content": " def test_superclass_static_field(self):\n \"Native static fields defined on a superclass can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import MyBase, MyClass\n\n print(\"Base class is\", MyBase)\n print(\"Class is\", MyClass)\n obj1 = MyClass()\n print(\"Static base field on superclass is\", MyBase.base_static_field)\n print(\"Static base field is\", MyClass.base_static_field)\n print(\"Static base field from instance is\", obj1.base_static_field)\n print(\"Static field is\", MyClass.static_field)\n print(\"Static field from instance is\", obj1.static_field)\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyBase': \"\"\"\n package com.example;\n\n public class MyBase {\n public static int base_static_field = 37;\n }\n \"\"\",\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass extends MyBase {\n public static int static_field = 42;\n }\n \"\"\"\n },\n out=\"\"\"\n Base class is <class 'com.example.MyBase'>\n Class is <class 'com.example.MyClass'>\n Static base field on superclass is 37\n Static base field is 37\n Static base field from instance is 37\n Static field is 42\n Static field from instance is 42\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_superclass_static_field", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 168 }, { "content": " def test_constant(self):\n \"Instance constants can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import MyClass\n\n print(\"Class is\", MyClass)\n obj1 = MyClass()\n print(\"Constant is\", MyClass.CONSTANT)\n print(\"Constant from instance is\", obj1.CONSTANT)\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass {\n public final int CONSTANT = 42;\n }\n \"\"\"\n },\n out=\"\"\"\n Class is <class 'com.example.MyClass'>\n Constant is <unbound native field public final int com.example.MyClass.CONSTANT>\n Constant from instance is 42\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_constant", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 210 }, { "content": " def test_static_constant(self):\n \"Class constants can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import MyClass\n\n print(\"Class is\", MyClass)\n obj1 = MyClass()\n print(\"Static constant is\", MyClass.STATIC_CONSTANT)\n print(\"Static constant from instance is\", obj1.STATIC_CONSTANT)\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass {\n public static final int STATIC_CONSTANT = 42;\n }\n \"\"\"\n },\n out=\"\"\"\n Class is <class 'com.example.MyClass'>\n Static constant is 42\n Static constant from instance is 42\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_static_constant", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 237 }, { "content": " def test_method(self):\n \"Native methods on an instance can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import MyClass\n\n print(\"Class is\", MyClass)\n obj = MyClass()\n print(\"Method is\", MyClass.method)\n print(\"Method from instance is\", obj.method)\n obj.method()\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass {\n public void method() {\n System.out.println(\"Hello from the instance!\");\n }\n }\n \"\"\"\n },\n out=\"\"\"\n Class is <class 'com.example.MyClass'>\n Method is <native function com.example.MyClass.method>\n Method from instance is <bound native method com.example.MyClass.method of <Native class com.example.MyClass object at 0xXXXXXXXX>>\n Hello from the instance!\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_method", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 264 }, { "content": " def test_static_method(self):\n \"Native static methods on an instance can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import MyClass\n\n print(\"Class is\", MyClass)\n obj = MyClass()\n print(\"Static method is\", MyClass.method)\n MyClass.method()\n print(\"Static method from instance is\", obj.method)\n obj.method()\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass {\n public static void method() {\n System.out.println(\"Hello from the class!\");\n }\n }\n \"\"\"\n },\n out=\"\"\"\n Class is <class 'com.example.MyClass'>\n Static method is <native function com.example.MyClass.method>\n Hello from the class!\n Static method from instance is <bound native method com.example.MyClass.method of <Native class com.example.MyClass object at 0xXXXXXXXX>>\n Hello from the class!\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_static_method", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 295 }, { "content": " def test_superclass_method(self):\n \"Native methods defined on a superclass can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import MyBase, MyClass\n\n print(\"Base class is\", MyBase)\n print(\"Class is\", MyClass)\n\n print(\"Base method on superclass is\", MyBase.base_method)\n print(\"Method on superclass is\", MyBase.method)\n\n print(\"Base method is\", MyClass.base_method)\n print(\"Method is\", MyClass.method)\n\n obj1 = MyBase()\n print(\"Base method from superclass instance is\", obj1.base_method)\n obj1.base_method()\n print(\"Method from superclass instance is\", obj1.method)\n obj1.method()\n\n obj2 = MyClass()\n print(\"Base method from instance is\", obj2.base_method)\n obj2.base_method()\n print(\"Method from instance is\", obj2.method)\n obj2.method()\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyBase': \"\"\"\n package com.example;\n\n public class MyBase {\n public void base_method() {\n System.out.println(\"Hello from the base!\");\n }\n\n public void method() {\n System.out.println(\"Goodbye from the base!\");\n }\n }\n \"\"\",\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass extends MyBase {\n public void method() {\n System.out.println(\"Hello from the instance!\");\n }\n }\n \"\"\"\n },\n out=\"\"\"\n Base class is <class 'com.example.MyBase'>\n Class is <class 'com.example.MyClass'>\n Base method on superclass is <native function com.example.MyBase.base_method>\n Method on superclass is <native function com.example.MyBase.method>\n Base method is <native function com.example.MyBase.base_method>\n Method is <native function com.example.MyClass.method>\n Base method from superclass instance is <bound native method com.example.MyBase.base_method of <Native class com.example.MyBase object at 0xXXXXXXXX>>\n Hello from the base!\n Method from superclass instance is <bound native method com.example.MyBase.method of <Native class com.example.MyBase object at 0xXXXXXXXX>>\n Goodbye from the base!\n Base method from instance is <bound native method com.example.MyBase.base_method of <Native class com.example.MyClass object at 0xXXXXXXXX>>\n Hello from the base!\n Method from instance is <bound native method com.example.MyClass.method of <Native class com.example.MyClass object at 0xXXXXXXXX>>\n Hello from the instance!\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_superclass_method", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 328 }, { "content": " def test_superclass_static_method(self):\n \"Native static methods defined on a superclass can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import MyBase, MyClass\n\n print(\"Base class is\", MyBase)\n print(\"Class is\", MyClass)\n\n print(\"Static base method on superclass is\", MyBase.base_static_method)\n MyBase.base_static_method()\n print(\"Static method on superclass is\", MyBase.static_method)\n MyBase.static_method()\n\n print(\"Static base method is\", MyClass.base_static_method)\n MyClass.base_static_method()\n print(\"Static method is\", MyClass.static_method)\n MyClass.static_method()\n\n obj1 = MyBase()\n print(\"Base static method from superclass instance is\", obj1.base_static_method)\n obj1.base_static_method()\n print(\"Static method from superclass instance is\", obj1.static_method)\n obj1.static_method()\n\n obj2 = MyClass()\n print(\"Base static method from instance is\", obj2.base_static_method)\n obj2.base_static_method()\n print(\"Static method from instance is\", obj2.static_method)\n obj2.static_method()\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/MyBase': \"\"\"\n package com.example;\n\n public class MyBase {\n public static void base_static_method() {\n System.out.println(\"Hello from the base!\");\n }\n\n public static void static_method() {\n System.out.println(\"Goodbye from the base!\");\n }\n }\n \"\"\",\n 'com/example/MyClass': \"\"\"\n package com.example;\n\n public class MyClass extends MyBase {\n public static void static_method() {\n System.out.println(\"Hello from the class!\");\n }\n }\n \"\"\"\n },\n out=\"\"\"\n Base class is <class 'com.example.MyBase'>\n Class is <class 'com.example.MyClass'>\n Static base method on superclass is <native function com.example.MyBase.base_static_method>\n Hello from the base!\n Static method on superclass is <native function com.example.MyBase.static_method>\n Goodbye from the base!\n Static base method is <native function com.example.MyBase.base_static_method>\n Hello from the base!\n Static method is <native function com.example.MyClass.static_method>\n Hello from the class!\n Base static method from superclass instance is <bound native method com.example.MyBase.base_static_method of <Native class com.example.MyBase object at 0xXXXXXXXX>>\n Hello from the base!\n Static method from superclass instance is <bound native method com.example.MyBase.static_method of <Native class com.example.MyBase object at 0xXXXXXXXX>>\n Goodbye from the base!\n Base static method from instance is <bound native method com.example.MyBase.base_static_method of <Native class com.example.MyClass object at 0xXXXXXXXX>>\n Hello from the base!\n Static method from instance is <bound native method com.example.MyClass.static_method of <Native class com.example.MyClass object at 0xXXXXXXXX>>\n Hello from the class!\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_superclass_static_method", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 397 }, { "content": " def test_inner_class_constant(self):\n \"Constants on an inner class can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import OuterClass\n\n print(\"Outer class is\", OuterClass)\n print(\"Outer constant is\", OuterClass.OUTER_CONSTANT)\n\n print(\"Inner class is\", OuterClass.InnerClass)\n print(\"Inner constant is\", OuterClass.InnerClass.INNER_CONSTANT)\n\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/OuterClass': \"\"\"\n package com.example;\n\n public class OuterClass {\n public static final int OUTER_CONSTANT = 42;\n\n public static class InnerClass {\n public static final int INNER_CONSTANT = 37;\n }\n }\n \"\"\"\n },\n out=\"\"\"\n Outer class is <class 'com.example.OuterClass'>\n Outer constant is 42\n Inner class is <class 'com.example.OuterClass$InnerClass'>\n Inner constant is 37\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_inner_class_constant", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 474 }, { "content": " def test_inner_class_method(self):\n \"Inner classes can be instantiated, and methods invoked\"\n self.assertJavaExecution(\"\"\"\n from com.example import OuterClass\n\n print(\"Outer class is\", OuterClass)\n obj1 = OuterClass()\n obj1.method()\n\n print(\"Inner class is\", OuterClass.InnerClass)\n obj2 = OuterClass.InnerClass(obj1)\n obj2.method()\n\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/OuterClass': \"\"\"\n package com.example;\n\n public class OuterClass {\n public class InnerClass {\n public void method() {\n System.out.println(\"Hello from the inside!\");\n }\n }\n\n public void method() {\n System.out.println(\"Hello from the outside!\");\n }\n }\n \"\"\"\n },\n out=\"\"\"\n Outer class is <class 'com.example.OuterClass'>\n Hello from the outside!\n Inner class is <class 'com.example.OuterClass$InnerClass'>\n Hello from the inside!\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_inner_class_method", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 508 }, { "content": " def test_static_inner_class_constant(self):\n \"Constants on a static inner class can be accessed\"\n self.assertJavaExecution(\"\"\"\n from com.example import OuterClass\n\n print(\"Outer class is\", OuterClass)\n print(\"Outer constant is\", OuterClass.OUTER_CONSTANT)\n\n print(\"Inner class is\", OuterClass.InnerClass)\n print(\"Inner constant is\", OuterClass.InnerClass.INNER_CONSTANT)\n\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/OuterClass': \"\"\"\n package com.example;\n\n public class OuterClass {\n public static final int OUTER_CONSTANT = 42;\n\n public static class InnerClass {\n public static final int INNER_CONSTANT = 37;\n }\n }\n \"\"\"\n },\n out=\"\"\"\n Outer class is <class 'com.example.OuterClass'>\n Outer constant is 42\n Inner class is <class 'com.example.OuterClass$InnerClass'>\n Inner constant is 37\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_static_inner_class_constant", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 549 }, { "content": " def test_static_inner_class_method(self):\n \"Static inner classes can be instantiated, and methods invoked\"\n self.assertJavaExecution(\"\"\"\n from com.example import OuterClass\n\n print(\"Outer class is\", OuterClass)\n obj1 = OuterClass()\n obj1.method()\n\n print(\"Inner class is\", OuterClass.InnerClass)\n obj2 = OuterClass.InnerClass()\n obj2.method()\n\n print(\"Done.\")\n \"\"\",\n java={\n 'com/example/OuterClass': \"\"\"\n package com.example;\n\n public class OuterClass {\n public static class InnerClass {\n public void method() {\n System.out.println(\"Hello from the inside!\");\n }\n }\n\n public void method() {\n System.out.println(\"Hello from the outside!\");\n }\n }\n \"\"\"\n },\n out=\"\"\"\n Outer class is <class 'com.example.OuterClass'>\n Hello from the outside!\n Inner class is <class 'com.example.OuterClass$InnerClass'>\n Hello from the inside!\n Done.\n \"\"\")", "metadata": "root.JavaTests.test_static_inner_class_method", "header": "['class', 'JavaTests', '(', 'TranspileTestCase', ')', ':', '___EOS___']", "index": 583 } ]
[ { "span": "from unittest import expectedFailure", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 36 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "unittest_", "import_", "expected", "Failure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "utils_", "import_", "Transp", "ile", "Test", "Case_", "\\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_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "multiple", "\\u", "construct", "ors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "appropr", "iate", " ", "construct", "or", " ", "for", " ", "a", " ", "nativ", "e", " ", "Ja", "va", " ", "class", " ", "can", " ", "be", " ", "interpolated", " ", "from", " ", "args", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "java", ".", "lang", " ", "import", " ", "String", "Build", "er", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "builde", "r", " ", "=", " ", "String", "Build", "er", "(\"", "Hell", "o", ",", " ", "\")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "builde", "r", ".", "append", "(\"", "world", "\")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(", "builde", "r", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", ",", " ", "world", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "run", "\\u", "in", "\\u", "function_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "most", "\\u", "specific", "\\u", "constructor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "The", " ", "most", " ", "specific", " ", "construct", "or", " ", "for", " ", "a", " ", "nativ", "e", " ", "Ja", "va", " ", "class", " ", "will", " ", "be", " ", "selecte", "d", " ", "based", " ", "on", " ", "argu", "ment", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "obj2", " ", "=", " ", "My", "Class", "(", "1.23", "4", ")", "\\", "10", ";", " ", " ", " ", " ", "obj3", " ", "=", " ", "My", "Class", "(", "374", "2", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "My", "Class", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "No", " ", "argu", "ment", "\");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", "public", " ", "My", "Class", "(", "int", " ", "arg", ")", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Integer", " ", "argu", "ment", " ", "\"", " ", "+", " ", "arg", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", "public", " ", "My", "Class", "(", "double", " ", "arg", ")", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Doub", "le", " ", "argu", "ment", " ", "\"", " ", "+", " ", "arg", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "No", " ", "argu", "ment", "\\", "10", ";", " ", " ", " ", " ", "Doub", "le", " ", "argu", "ment", " ", "1.23", "4", "\\", "10", ";", " ", " ", " ", " ", "Integer", " ", "argu", "ment", " ", "374", "2", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "run", "\\u", "in", "\\u", "function_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Nat", "ive", " ", "fields", " ", "on", " ", "an", " ", "instance", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Class", " ", "is", "\",", " ", "My", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Field", " ", "is", "\",", " ", "My", "Class", ".", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Field", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", ".", "field", " ", "=", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Update", "d", " ", "Field", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "int", " ", "field", " ", "=", " ", "4", "2", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Field", " ", "is", " ", "<", "unbound", " ", "nativ", "e", " ", "field", " ", "public", " ", "int", " ", "com", ".", "example", ".", "My", "Class", ".", "field", ">", "\\", "10", ";", " ", " ", " ", " ", "Field", " ", "from", " ", "instance", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "Update", "d", " ", "Field", " ", "from", " ", "instance", " ", "is", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "static", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Class", " ", "constant", "s", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Class", " ", "is", "\",", " ", "My", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "field", " ", "is", "\",", " ", "My", "Class", ".", "static", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "My", "Class", ".", "static", "\\u", "field", " ", "=", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Update", "d", " ", "static", " ", "field", " ", "is", "\",", " ", "My", "Class", ".", "static", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "field", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "static", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "My", "Class", ".", "static", "\\u", "field", " ", "=", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Update", "d", " ", "static", " ", "field", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "static", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "int", " ", "static", "\\u", "field", " ", "=", " ", "4", "2", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "field", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "Update", "d", " ", "static", " ", "field", " ", "is", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "field", " ", "from", " ", "instance", " ", "is", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "Update", "d", " ", "static", " ", "field", " ", "from", " ", "instance", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "superclass", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Nat", "ive", " ", "fields", " ", "defin", "ed", " ", "on", " ", "a", " ", "superclass", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Base", ",", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "class", " ", "is", "\",", " ", "My", "Base", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Class", " ", "is", "\",", " ", "My", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "field", " ", "on", " ", "superclass", " ", "is", "\",", " ", "My", "Base", ".", "base", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "field", " ", "is", "\",", " ", "My", "Class", ".", "base", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "field", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "base", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Field", " ", "is", "\",", " ", "My", "Class", ".", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Field", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Base", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Base", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "int", " ", "base", "\\u", "field", " ", "=", " ", "3", "7", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "extend", "s", " ", "My", "Base", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "int", " ", "field", " ", "=", " ", "4", "2", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Base", "'>", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "field", " ", "on", " ", "superclass", " ", "is", " ", "<", "unbound", " ", "nativ", "e", " ", "field", " ", "public", " ", "int", " ", "com", ".", "example", ".", "My", "Base", ".", "base", "\\u", "field", ">", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "field", " ", "is", " ", "<", "unbound", " ", "nativ", "e", " ", "field", " ", "public", " ", "int", " ", "com", ".", "example", ".", "My", "Base", ".", "base", "\\u", "field", ">", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "field", " ", "from", " ", "instance", " ", "is", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "Field", " ", "is", " ", "<", "unbound", " ", "nativ", "e", " ", "field", " ", "public", " ", "int", " ", "com", ".", "example", ".", "My", "Class", ".", "field", ">", "\\", "10", ";", " ", " ", " ", " ", "Field", " ", "from", " ", "instance", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "superclass", "\\u", "static", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Nat", "ive", " ", "static", " ", "fields", " ", "defin", "ed", " ", "on", " ", "a", " ", "superclass", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Base", ",", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "class", " ", "is", "\",", " ", "My", "Base", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Class", " ", "is", "\",", " ", "My", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "base", " ", "field", " ", "on", " ", "superclass", " ", "is", "\",", " ", "My", "Base", ".", "base", "\\u", "static", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "base", " ", "field", " ", "is", "\",", " ", "My", "Class", ".", "base", "\\u", "static", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "base", " ", "field", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "base", "\\u", "static", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "field", " ", "is", "\",", " ", "My", "Class", ".", "static", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "field", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "static", "\\u", "field", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Base", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Base", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "int", " ", "base", "\\u", "static", "\\u", "field", " ", "=", " ", "3", "7", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "extend", "s", " ", "My", "Base", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "int", " ", "static", "\\u", "field", " ", "=", " ", "4", "2", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Base", "'>", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "base", " ", "field", " ", "on", " ", "superclass", " ", "is", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "base", " ", "field", " ", "is", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "base", " ", "field", " ", "from", " ", "instance", " ", "is", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "field", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "field", " ", "from", " ", "instance", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "constant_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Insta", "nce", " ", "constant", "s", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Class", " ", "is", "\",", " ", "My", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Const", "ant", " ", "is", "\",", " ", "My", "Class", ".", "CONSTANT", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Const", "ant", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "CONSTANT", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "final", " ", "int", " ", "CONSTANT", " ", "=", " ", "4", "2", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Const", "ant", " ", "is", " ", "<", "unbound", " ", "nativ", "e", " ", "field", " ", "public", " ", "final", " ", "int", " ", "com", ".", "example", ".", "My", "Class", ".", "CONSTANT", ">", "\\", "10", ";", " ", " ", " ", " ", "Const", "ant", " ", "from", " ", "instance", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "static", "\\u", "constant_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Class", " ", "constant", "s", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Class", " ", "is", "\",", " ", "My", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "constant", " ", "is", "\",", " ", "My", "Class", ".", "STATI", "C", "\\u", "CONSTANT", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "constant", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "STATI", "C", "\\u", "CONSTANT", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "final", " ", "int", " ", "STATI", "C", "\\u", "CONSTANT", " ", "=", " ", "4", "2", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "constant", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "constant", " ", "from", " ", "instance", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Nat", "ive", " ", "method", "s", " ", "on", " ", "an", " ", "instance", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Class", " ", "is", "\",", " ", "My", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Meth", "od", " ", "is", "\",", " ", "My", "Class", ".", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Meth", "od", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj", ".", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "obj", ".", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "voi", "d", " ", "method", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Hell", "o", " ", "from", " ", "the", " ", "instance", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "is", " ", "<", "nativ", "e", " ", "function", " ", "com", ".", "example", ".", "My", "Class", ".", "method", ">", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "from", " ", "instance", " ", "is", " ", "<", "bound", " ", "nativ", "e", " ", "method", " ", "com", ".", "example", ".", "My", "Class", ".", "method", " ", "of", " ", "<", "Nat", "ive", " ", "class", " ", "com", ".", "example", ".", "My", "Class", " ", "object", " ", "at", " ", "0", "x", "XXXXXXXX", ">>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "instance", "!", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "static", "\\u", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Nat", "ive", " ", "static", " ", "method", "s", " ", "on", " ", "an", " ", "instance", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Class", " ", "is", "\",", " ", "My", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "method", " ", "is", "\",", " ", "My", "Class", ".", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "My", "Class", ".", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "method", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj", ".", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "obj", ".", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "voi", "d", " ", "method", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Hell", "o", " ", "from", " ", "the", " ", "class", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "method", " ", "is", " ", "<", "nativ", "e", " ", "function", " ", "com", ".", "example", ".", "My", "Class", ".", "method", ">", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "class", "!", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "method", " ", "from", " ", "instance", " ", "is", " ", "<", "bound", " ", "nativ", "e", " ", "method", " ", "com", ".", "example", ".", "My", "Class", ".", "method", " ", "of", " ", "<", "Nat", "ive", " ", "class", " ", "com", ".", "example", ".", "My", "Class", " ", "object", " ", "at", " ", "0", "x", "XXXXXXXX", ">>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "class", "!", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "superclass", "\\u", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Nat", "ive", " ", "method", "s", " ", "defin", "ed", " ", "on", " ", "a", " ", "superclass", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Base", ",", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "class", " ", "is", "\",", " ", "My", "Base", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Class", " ", "is", "\",", " ", "My", "Class", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "method", " ", "on", " ", "superclass", " ", "is", "\",", " ", "My", "Base", ".", "base", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Meth", "od", " ", "on", " ", "superclass", " ", "is", "\",", " ", "My", "Base", ".", "method", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "method", " ", "is", "\",", " ", "My", "Class", ".", "base", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Meth", "od", " ", "is", "\",", " ", "My", "Class", ".", "method", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "My", "Base", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "method", " ", "from", " ", "superclass", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "base", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", ".", "base", "\\u", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Meth", "od", " ", "from", " ", "superclass", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", ".", "method", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "obj2", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "method", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj2", ".", "base", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "obj2", ".", "base", "\\u", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Meth", "od", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj2", ".", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "obj2", ".", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Base", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Base", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "voi", "d", " ", "base", "\\u", "method", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Hell", "o", " ", "from", " ", "the", " ", "base", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", "public", " ", "voi", "d", " ", "method", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Good", "bye", " ", "from", " ", "the", " ", "base", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "extend", "s", " ", "My", "Base", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "voi", "d", " ", "method", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Hell", "o", " ", "from", " ", "the", " ", "instance", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Base", "'>", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "method", " ", "on", " ", "superclass", " ", "is", " ", "<", "nativ", "e", " ", "function", " ", "com", ".", "example", ".", "My", "Base", ".", "base", "\\u", "method", ">", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "on", " ", "superclass", " ", "is", " ", "<", "nativ", "e", " ", "function", " ", "com", ".", "example", ".", "My", "Base", ".", "method", ">", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "method", " ", "is", " ", "<", "nativ", "e", " ", "function", " ", "com", ".", "example", ".", "My", "Base", ".", "base", "\\u", "method", ">", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "is", " ", "<", "nativ", "e", " ", "function", " ", "com", ".", "example", ".", "My", "Class", ".", "method", ">", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "method", " ", "from", " ", "superclass", " ", "instance", " ", "is", " ", "<", "bound", " ", "nativ", "e", " ", "method", " ", "com", ".", "example", ".", "My", "Base", ".", "base", "\\u", "method", " ", "of", " ", "<", "Nat", "ive", " ", "class", " ", "com", ".", "example", ".", "My", "Base", " ", "object", " ", "at", " ", "0", "x", "XXXXXXXX", ">>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "base", "!", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "from", " ", "superclass", " ", "instance", " ", "is", " ", "<", "bound", " ", "nativ", "e", " ", "method", " ", "com", ".", "example", ".", "My", "Base", ".", "method", " ", "of", " ", "<", "Nat", "ive", " ", "class", " ", "com", ".", "example", ".", "My", "Base", " ", "object", " ", "at", " ", "0", "x", "XXXXXXXX", ">>", "\\", "10", ";", " ", " ", " ", " ", "Good", "bye", " ", "from", " ", "the", " ", "base", "!", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "method", " ", "from", " ", "instance", " ", "is", " ", "<", "bound", " ", "nativ", "e", " ", "method", " ", "com", ".", "example", ".", "My", "Base", ".", "base", "\\u", "method", " ", "of", " ", "<", "Nat", "ive", " ", "class", " ", "com", ".", "example", ".", "My", "Class", " ", "object", " ", "at", " ", "0", "x", "XXXXXXXX", ">>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "base", "!", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "from", " ", "instance", " ", "is", " ", "<", "bound", " ", "nativ", "e", " ", "method", " ", "com", ".", "example", ".", "My", "Class", ".", "method", " ", "of", " ", "<", "Nat", "ive", " ", "class", " ", "com", ".", "example", ".", "My", "Class", " ", "object", " ", "at", " ", "0", "x", "XXXXXXXX", ">>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "instance", "!", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "superclass", "\\u", "static", "\\u", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Nat", "ive", " ", "static", " ", "method", "s", " ", "defin", "ed", " ", "on", " ", "a", " ", "superclass", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "My", "Base", ",", " ", "My", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "class", " ", "is", "\",", " ", "My", "Base", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Class", " ", "is", "\",", " ", "My", "Class", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "base", " ", "method", " ", "on", " ", "superclass", " ", "is", "\",", " ", "My", "Base", ".", "base", "\\u", "static", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "My", "Base", ".", "base", "\\u", "static", "\\u", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "method", " ", "on", " ", "superclass", " ", "is", "\",", " ", "My", "Base", ".", "static", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "My", "Base", ".", "static", "\\u", "method", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "base", " ", "method", " ", "is", "\",", " ", "My", "Class", ".", "base", "\\u", "static", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "My", "Class", ".", "base", "\\u", "static", "\\u", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "method", " ", "is", "\",", " ", "My", "Class", ".", "static", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "My", "Class", ".", "static", "\\u", "method", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "My", "Base", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "static", " ", "method", " ", "from", " ", "superclass", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "base", "\\u", "static", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", ".", "base", "\\u", "static", "\\u", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "method", " ", "from", " ", "superclass", " ", "instance", " ", "is", "\",", " ", "obj1", ".", "static", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", ".", "static", "\\u", "method", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "obj2", " ", "=", " ", "My", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Base", " ", "static", " ", "method", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj2", ".", "base", "\\u", "static", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "obj2", ".", "base", "\\u", "static", "\\u", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Static", " ", "method", " ", "from", " ", "instance", " ", "is", "\",", " ", "obj2", ".", "static", "\\u", "method", ")", "\\", "10", ";", " ", " ", " ", " ", "obj2", ".", "static", "\\u", "method", "()", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Base", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Base", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "voi", "d", " ", "base", "\\u", "static", "\\u", "method", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Hell", "o", " ", "from", " ", "the", " ", "base", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "voi", "d", " ", "static", "\\u", "method", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Good", "bye", " ", "from", " ", "the", " ", "base", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "My", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "My", "Class", " ", "extend", "s", " ", "My", "Base", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "voi", "d", " ", "static", "\\u", "method", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Hell", "o", " ", "from", " ", "the", " ", "class", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Base", "'>", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "My", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "base", " ", "method", " ", "on", " ", "superclass", " ", "is", " ", "<", "nativ", "e", " ", "function", " ", "com", ".", "example", ".", "My", "Base", ".", "base", "\\u", "static", "\\u", "method", ">", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "base", "!", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "method", " ", "on", " ", "superclass", " ", "is", " ", "<", "nativ", "e", " ", "function", " ", "com", ".", "example", ".", "My", "Base", ".", "static", "\\u", "method", ">", "\\", "10", ";", " ", " ", " ", " ", "Good", "bye", " ", "from", " ", "the", " ", "base", "!", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "base", " ", "method", " ", "is", " ", "<", "nativ", "e", " ", "function", " ", "com", ".", "example", ".", "My", "Base", ".", "base", "\\u", "static", "\\u", "method", ">", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "base", "!", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "method", " ", "is", " ", "<", "nativ", "e", " ", "function", " ", "com", ".", "example", ".", "My", "Class", ".", "static", "\\u", "method", ">", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "class", "!", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "static", " ", "method", " ", "from", " ", "superclass", " ", "instance", " ", "is", " ", "<", "bound", " ", "nativ", "e", " ", "method", " ", "com", ".", "example", ".", "My", "Base", ".", "base", "\\u", "static", "\\u", "method", " ", "of", " ", "<", "Nat", "ive", " ", "class", " ", "com", ".", "example", ".", "My", "Base", " ", "object", " ", "at", " ", "0", "x", "XXXXXXXX", ">>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "base", "!", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "method", " ", "from", " ", "superclass", " ", "instance", " ", "is", " ", "<", "bound", " ", "nativ", "e", " ", "method", " ", "com", ".", "example", ".", "My", "Base", ".", "static", "\\u", "method", " ", "of", " ", "<", "Nat", "ive", " ", "class", " ", "com", ".", "example", ".", "My", "Base", " ", "object", " ", "at", " ", "0", "x", "XXXXXXXX", ">>", "\\", "10", ";", " ", " ", " ", " ", "Good", "bye", " ", "from", " ", "the", " ", "base", "!", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "static", " ", "method", " ", "from", " ", "instance", " ", "is", " ", "<", "bound", " ", "nativ", "e", " ", "method", " ", "com", ".", "example", ".", "My", "Base", ".", "base", "\\u", "static", "\\u", "method", " ", "of", " ", "<", "Nat", "ive", " ", "class", " ", "com", ".", "example", ".", "My", "Class", " ", "object", " ", "at", " ", "0", "x", "XXXXXXXX", ">>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "base", "!", "\\", "10", ";", " ", " ", " ", " ", "Static", " ", "method", " ", "from", " ", "instance", " ", "is", " ", "<", "bound", " ", "nativ", "e", " ", "method", " ", "com", ".", "example", ".", "My", "Class", ".", "static", "\\u", "method", " ", "of", " ", "<", "Nat", "ive", " ", "class", " ", "com", ".", "example", ".", "My", "Class", " ", "object", " ", "at", " ", "0", "x", "XXXXXXXX", ">>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "class", "!", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "inner", "\\u", "class", "\\u", "constant_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Const", "ant", "s", " ", "on", " ", "an", " ", "inner", " ", "class", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "Out", "er", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Out", "er", " ", "class", " ", "is", "\",", " ", "Out", "er", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Out", "er", " ", "constant", " ", "is", "\",", " ", "Out", "er", "Class", ".", "OUTE", "R", "\\u", "CONSTANT", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "In", "ner", " ", "class", " ", "is", "\",", " ", "Out", "er", "Class", ".", "In", "ner", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "In", "ner", " ", "constant", " ", "is", "\",", " ", "Out", "er", "Class", ".", "In", "ner", "Class", ".", "INN", "ER", "\\u", "CONSTANT", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "Out", "er", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "Out", "er", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "final", " ", "int", " ", "OUTE", "R", "\\u", "CONSTANT", " ", "=", " ", "4", "2", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "class", " ", "In", "ner", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "final", " ", "int", " ", "INN", "ER", "\\u", "CONSTANT", " ", "=", " ", "3", "7", ";", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Out", "er", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "Out", "er", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Out", "er", " ", "constant", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "In", "ner", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "Out", "er", "Class", "$", "In", "ner", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "In", "ner", " ", "constant", " ", "is", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "inner", "\\u", "class", "\\u", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "In", "ner", " ", "classe", "s", " ", "can", " ", "be", " ", "instantiate", "d", ",", " ", "and", " ", "method", "s", " ", "invoke", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "Out", "er", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Out", "er", " ", "class", " ", "is", "\",", " ", "Out", "er", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "Out", "er", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "obj1", ".", "method", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "In", "ner", " ", "class", " ", "is", "\",", " ", "Out", "er", "Class", ".", "In", "ner", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj2", " ", "=", " ", "Out", "er", "Class", ".", "In", "ner", "Class", "(", "obj1", ")", "\\", "10", ";", " ", " ", " ", " ", "obj2", ".", "method", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "Out", "er", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "Out", "er", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "class", " ", "In", "ner", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "voi", "d", " ", "method", "()", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "System", ".", "out", ".", "println", "(\"", "Hell", "o", " ", "from", " ", "the", " ", "insi", "de", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", "public", " ", "voi", "d", " ", "method", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Hell", "o", " ", "from", " ", "the", " ", "outsi", "de", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Out", "er", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "Out", "er", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "outsi", "de", "!", "\\", "10", ";", " ", " ", " ", " ", "In", "ner", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "Out", "er", "Class", "$", "In", "ner", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "insi", "de", "!", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "static", "\\u", "inner", "\\u", "class", "\\u", "constant_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Const", "ant", "s", " ", "on", " ", "a", " ", "static", " ", "inner", " ", "class", " ", "can", " ", "be", " ", "accesse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "Out", "er", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Out", "er", " ", "class", " ", "is", "\",", " ", "Out", "er", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Out", "er", " ", "constant", " ", "is", "\",", " ", "Out", "er", "Class", ".", "OUTE", "R", "\\u", "CONSTANT", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "In", "ner", " ", "class", " ", "is", "\",", " ", "Out", "er", "Class", ".", "In", "ner", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "In", "ner", " ", "constant", " ", "is", "\",", " ", "Out", "er", "Class", ".", "In", "ner", "Class", ".", "INN", "ER", "\\u", "CONSTANT", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "Out", "er", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "Out", "er", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "final", " ", "int", " ", "OUTE", "R", "\\u", "CONSTANT", " ", "=", " ", "4", "2", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "class", " ", "In", "ner", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "final", " ", "int", " ", "INN", "ER", "\\u", "CONSTANT", " ", "=", " ", "3", "7", ";", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Out", "er", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "Out", "er", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Out", "er", " ", "constant", " ", "is", " ", "4", "2", "\\", "10", ";", " ", " ", " ", " ", "In", "ner", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "Out", "er", "Class", "$", "In", "ner", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "In", "ner", " ", "constant", " ", "is", " ", "3", "7", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "va", "Tests_", "(_", "Transp", "ile", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "static", "\\u", "inner", "\\u", "class", "\\u", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Static", " ", "inner", " ", "classe", "s", " ", "can", " ", "be", " ", "instantiate", "d", ",", " ", "and", " ", "method", "s", " ", "invoke", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Ja", "va", "Execution_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "com", ".", "example", " ", "import", " ", "Out", "er", "Class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Out", "er", " ", "class", " ", "is", "\",", " ", "Out", "er", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj1", " ", "=", " ", "Out", "er", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "obj1", ".", "method", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "In", "ner", " ", "class", " ", "is", "\",", " ", "Out", "er", "Class", ".", "In", "ner", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", "obj2", " ", "=", " ", "Out", "er", "Class", ".", "In", "ner", "Class", "()", "\\", "10", ";", " ", " ", " ", " ", "obj2", ".", "method", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", "(\"", "Don", "e", ".\"", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "java_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", "/", "example", "/", "Out", "er", "Class", "'_", ":_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "com", ".", "example", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "class", " ", "Out", "er", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "static", " ", "class", " ", "In", "ner", "Class", " ", "{", "\\", "10", ";", " ", " ", "public", " ", "voi", "d", " ", "method", "()", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "System", ".", "out", ".", "println", "(\"", "Hell", "o", " ", "from", " ", "the", " ", "insi", "de", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", "public", " ", "voi", "d", " ", "method", "()", " ", "{", "\\", "10", ";", " ", " ", "System", ".", "out", ".", "println", "(\"", "Hell", "o", " ", "from", " ", "the", " ", "outsi", "de", "!\"", ");", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Out", "er", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "Out", "er", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "outsi", "de", "!", "\\", "10", ";", " ", " ", " ", " ", "In", "ner", " ", "class", " ", "is", " ", "<", "class", " ", "'", "com", ".", "example", ".", "Out", "er", "Class", "$", "In", "ner", "Class", "'>", "\\", "10", ";", " ", " ", " ", " ", "Hell", "o", " ", "from", " ", "the", " ", "insi", "de", "!", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused local variable
zeaphoo/cocopot/tests/test_http.py
[ { "content": "def test_exception():\n exc = HTTPException()\n assert exc.get_description() == 'Unknown http exception'\n assert exc.name == 'Unknown Error'\n assert exc.get_body() == 'Unknown http exception'\n s = repr(exc)", "metadata": "root.test_exception", "header": "['module', '___EOS___']", "index": 47 } ]
[ { "span": "s ", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "exception_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc_", "=_", "HTTP", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "exc_", "._", "get", "\\u", "description_", "(_", ")_", "==_", "'", "Un", "know", "n", " ", "http", " ", "exception", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "exc_", "._", "name_", "==_", "'", "Un", "know", "n", " ", "Error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "exc_", "._", "get", "\\u", "body_", "(_", ")_", "==_", "'", "Un", "know", "n", " ", "http", " ", "exception", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "repr_", "(_", "exc_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2 ]
Unused local variable
thricedotted/twitterbot/examples/fartbot/fartbot.py
[ { "content": " def on_mention(self, tweet, prefix):\n \"\"\"\n Defines actions to take when a mention is received.\n\n tweet - a tweepy.Status object. You can access the text with\n tweet.text\n\n prefix - the @-mentions for this reply. No need to include this in the\n reply string; it's provided so you can use it to make sure the value\n you return is within the 140 character limit with this.\n\n It's up to you to ensure that the prefix and tweet are less than 140\n characters.\n\n When calling post_tweet, you MUST include reply_to=tweet, or\n Twitter won't count it as a reply.\n \"\"\"\n text = 'fart ' + choice(self.words)\n prefixed_text = prefix + ' ' + text\n self.post_tweet(prefix + ' ' + text, reply_to=tweet)\n\n # call this to fav the tweet!\n # if something:\n # self.favorite_tweet(tweet)", "metadata": "root.FartBot.on_mention", "header": "['class', 'FartBot', '(', 'TwitterBot', ')', ':', '___EOS___']", "index": 94 }, { "content": " def on_timeline(self, tweet, prefix):\n \"\"\"\n Defines actions to take on a timeline tweet.\n\n tweet - a tweepy.Status object. You can access the text with\n tweet.text\n\n prefix - the @-mentions for this reply. No need to include this in the\n reply string; it's provided so you can use it to make sure the value\n you return is within the 140 character limit with this.\n\n It's up to you to ensure that the prefix and tweet are less than 140\n characters.\n\n When calling post_tweet, you MUST include reply_to=tweet, or\n Twitter won't count it as a reply.\n \"\"\"\n if 'fart' in tweet.text.lower():\n text = 'fart ' + choice(self.words)\n prefixed_text = prefix + ' ' + text\n self.post_tweet(prefix + ' ' + text, reply_to=tweet)\n\n # call this to fav the tweet!\n # if something:\n # self.favorite_tweet(tweet)", "metadata": "root.FartBot.on_timeline", "header": "['class', 'FartBot', '(', 'TwitterBot', ')', ':', '___EOS___']", "index": 120 } ]
[ { "span": "prefixed_text ", "start_line": 112, "start_column": 8, "end_line": 112, "end_column": 21 }, { "span": "prefixed_text ", "start_line": 139, "start_column": 12, "end_line": 139, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Far", "t", "Bot_", "(_", "Twit", "ter", "Bot_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "mention_", "(_", "self_", ",_", "tweet_", ",_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Define", "s", " ", "action", "s", " ", "to", " ", "take", " ", "whe", "n", " ", "a", " ", "menti", "on", " ", "is", " ", "receive", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "tweet", " ", "-", " ", "a", " ", "twee", "py", ".", "Status", " ", "object", ".", " ", "You", " ", "can", " ", "access", " ", "the", " ", "text", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "tweet", ".", "text", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "prefix", " ", "-", " ", "the", " ", "@", "-", "mentions", " ", "for", " ", "this", " ", "repl", "y", ".", " ", "No", " ", "need", " ", "to", " ", "include", " ", "this", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "repl", "y", " ", "string", ";", " ", "it", "'", "s", " ", "provided", " ", "so", " ", "you", " ", "can", " ", "use", " ", "it", " ", "to", " ", "make", " ", "sure", " ", "the", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "you", " ", "return", " ", "is", " ", "within", " ", "the", " ", "140", " ", "character", " ", "limit", " ", "with", " ", "this", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", "'", "s", " ", "up", " ", "to", " ", "you", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "prefix", " ", "and", " ", "tweet", " ", "are", " ", "less", " ", "than", " ", "140", "\\", "10", ";", " ", " ", " ", " ", "character", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "calling", " ", "post", "\\u", "tweet", ",", " ", "you", " ", "MUS", "T", " ", "include", " ", "repl", "y", "\\u", "to", "=", "tweet", ",", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "Twit", "ter", " ", "won", "'", "t", " ", "count", " ", "it", " ", "as", " ", "a", " ", "repl", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "'", "far", "t", " ", "'_", "+_", "choice_", "(_", "self_", "._", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefixed", "\\u", "text_", "=_", "prefix_", "+_", "'", " ", "'_", "+_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "\\u", "tweet_", "(_", "prefix_", "+_", "'", " ", "'_", "+_", "text_", ",_", "repl", "y", "\\u", "to_", "=_", "tweet_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "this", " ", "to", " ", "fav", " ", "the", " ", "tweet", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "somet", "hing", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "favorite", "\\u", "tweet", "(", "tweet", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Far", "t", "Bot_", "(_", "Twit", "ter", "Bot_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "timeline_", "(_", "self_", ",_", "tweet_", ",_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Define", "s", " ", "action", "s", " ", "to", " ", "take", " ", "on", " ", "a", " ", "timeline", " ", "tweet", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "tweet", " ", "-", " ", "a", " ", "twee", "py", ".", "Status", " ", "object", ".", " ", "You", " ", "can", " ", "access", " ", "the", " ", "text", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "tweet", ".", "text", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "prefix", " ", "-", " ", "the", " ", "@", "-", "mentions", " ", "for", " ", "this", " ", "repl", "y", ".", " ", "No", " ", "need", " ", "to", " ", "include", " ", "this", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "repl", "y", " ", "string", ";", " ", "it", "'", "s", " ", "provided", " ", "so", " ", "you", " ", "can", " ", "use", " ", "it", " ", "to", " ", "make", " ", "sure", " ", "the", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "you", " ", "return", " ", "is", " ", "within", " ", "the", " ", "140", " ", "character", " ", "limit", " ", "with", " ", "this", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", "'", "s", " ", "up", " ", "to", " ", "you", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "prefix", " ", "and", " ", "tweet", " ", "are", " ", "less", " ", "than", " ", "140", "\\", "10", ";", " ", " ", " ", " ", "character", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "calling", " ", "post", "\\u", "tweet", ",", " ", "you", " ", "MUS", "T", " ", "include", " ", "repl", "y", "\\u", "to", "=", "tweet", ",", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "Twit", "ter", " ", "won", "'", "t", " ", "count", " ", "it", " ", "as", " ", "a", " ", "repl", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "far", "t", "'_", "in_", "tweet_", "._", "text_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "'", "far", "t", " ", "'_", "+_", "choice_", "(_", "self_", "._", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefixed", "\\u", "text_", "=_", "prefix_", "+_", "'", " ", "'_", "+_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "\\u", "tweet_", "(_", "prefix_", "+_", "'", " ", "'_", "+_", "text_", ",_", "repl", "y", "\\u", "to_", "=_", "tweet_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "this", " ", "to", " ", "fav", " ", "the", " ", "tweet", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "somet", "hing", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "favorite", "\\u", "tweet", "(", "tweet", ")_", "\\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, 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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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
RDFLib/rdfextras/test/test_sparql/sparql/QueryTests/Test11_3.py
[ { "content": "#!/d/Bin/Python/python.exe\n# -*- coding: utf-8 -*-\n#\n#\n# $Date: 2005/04/02 07:29:46 $, by $Author: ivan $, $Revision: 1.1 $\n#\n\"\"\"\n Datatype test. Note that this is not 100% kosher. The problem is that the Literal of rdflib does not check the\n datatypes. In theory, if the data contains:\n\n x ns:p 42.\n\n instead of:\n\n x ns:p 42^^http://www.w3.org/2001/XMLSchema#integer\n\n the query should return no results, because the first object is of datatype string. However, Literal does not\n implement this...\n\n\"\"\"\n\nrdfData =\"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"\n xmlns:ns = \"http://example.org/ns#\"\n>\n <rdf:Description>\n <foaf:name>Alice</foaf:name>\n <foaf:mbox rdf:resource=\"mailto:[email protected]\"/>\n </rdf:Description>\n <rdf:Description>\n <foaf:name>Bob</foaf:name>\n <foaf:mbox>[email protected]</foaf:mbox>\n </rdf:Description>\n</rdf:RDF>\n\"\"\"\n\n\n\nfrom testSPARQL import ns_rdf\nfrom testSPARQL import ns_rdfs\nfrom testSPARQL import ns_dc\nfrom testSPARQL import ns_foaf\nfrom testSPARQL import ns_ns\nfrom testSPARQL import ns_book\n\nfrom rdflib import Literal\nfrom rdfextras.sparql.graph import GraphPattern\n\nfrom rdfextras.sparql.operators import isURI\n\n\nselect = [\"?name\", \"?mbox\"]\npattern = GraphPattern([(\"?x\", ns_foaf[\"name\"],\"?name\"),(\"?x\",ns_foaf[\"mbox\"],\"?mbox\")])\npattern.addConstraint(isURI(\"?mbox\"))\noptional = []\ntripleStore = None\nexpected = '''\n ?name: Alice\n ?mbox: mailto:[email protected]\n'''\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from testSPARQL import ns_rdf", "start_line": 42, "start_column": 0, "end_line": 42, "end_column": 29 }, { "span": "from testSPARQL import ns_rdfs", "start_line": 43, "start_column": 0, "end_line": 43, "end_column": 30 }, { "span": "from testSPARQL import ns_dc", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 28 }, { "span": "from testSPARQL import ns_ns", "start_line": 46, "start_column": 0, "end_line": 46, "end_column": 28 }, { "span": "from testSPARQL import ns_book", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 30 }, { "span": "from rdflib import Literal", "start_line": 49, "start_column": 0, "end_line": 49, "end_column": 26 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "d", "/", "Bin", "/", "Pyth", "on", "/", "python", ".", "exe_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", "Date", ":", " ", "2005", "/", "04", "/", "02", " ", "0", "7", ":", "2", "9", ":", "4", "6", " ", "$", ",", " ", "by", " ", "$", "Author", ":", " ", "iva", "n", " ", "$", ",", " ", "$", "Revi", "sion", ":", " ", "1.1", " ", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", "Datat", "ype", " ", "test", ".", " ", "Not", "e", " ", "tha", "t", " ", "this", " ", "is", " ", "not", " ", "100", "%", " ", "ko", "sher", ".", " ", "The", " ", "problem", " ", "is", " ", "tha", "t", " ", "the", " ", "Lite", "ral", " ", "of", " ", "rdf", "lib", " ", "doe", "s", " ", "not", " ", "check", " ", "the", "\\", "10", ";", " ", " ", " ", "datatype", "s", ".", " ", "In", " ", "theory", ",", " ", "if", " ", "the", " ", "data", " ", "contain", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "x", " ", "ns", ":", "p", " ", "42.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "inst", "ead", " ", "of", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "x", " ", "ns", ":", "p", " ", "4", "2", "^", "^", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "#", "integ", "er", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "query", " ", "shou", "ld", " ", "return", " ", "no", " ", "results", ",", " ", "bec", "aus", "e", " ", "the", " ", "first", " ", "object", " ", "is", " ", "of", " ", "datatype", " ", "string", ".", " ", "Ho", "we", "ver", ",", " ", "Lite", "ral", " ", "doe", "s", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "implement", " ", "this", "...", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rdf", "Data_", "=_", "\"\"\"", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "UT", "F", "-", "8", "\"?", ">", "\\", "10", ";<", "rdf", ":", "RDF", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "rdfs", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "2000", "/", "01", "/", "rdf", "-", "schema", "#\"", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "rdf", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "1999", "/", "02", "/", "2", "2", "-", "rdf", "-", "synta", "x", "-", "ns", "#\"", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "dc", "=\"", "http", "://", "pur", "l", ".", "org", "/", "dc", "/", "element", "s", "/", "1.1", "/\"", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "foa", "f", "=\"", "http", "://", "xml", "ns", ".", "com", "/", "foa", "f", "/", "0.", "1", "/\"", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "ns", " ", "=", " ", "\"", "http", "://", "example", ".", "org", "/", "ns", "#\"", "\\", "10", ";", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "rdf", ":", "Descripti", "on", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "foa", "f", ":", "name", ">", "Ali", "ce", "</", "foa", "f", ":", "name", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "foa", "f", ":", "mbox", " ", "rdf", ":", "resource", "=\"", "mail", "to", ":", "alic", "e", "@", "work", ".", "example", "\"/>", "\\", "10", ";", " ", " ", " ", " ", "</", "rdf", ":", "Descripti", "on", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "rdf", ":", "Descripti", "on", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "foa", "f", ":", "name", ">", "Bob", "</", "foa", "f", ":", "name", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "foa", "f", ":", "mbox", ">", "bob", "@", "work", ".", "example", "</", "foa", "f", ":", "mbox", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "rdf", ":", "Descripti", "on", ">", "\\", "10", ";<", "/", "rdf", ":", "RDF", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "rdf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "rdfs", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "dc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "foa", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "book_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rdflib_", "import_", "Literal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rdf", "extras_", "._", "sparql", "_", "._", "graph_", "import_", "Graph", "Pattern_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rdf", "extras_", "._", "sparql", "_", "._", "operators_", "import_", "is", "URI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "select_", "=_", "[_", "\"?", "name", "\"_", ",_", "\"?", "mbox", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "Graph", "Pattern_", "(_", "[_", "(_", "\"?", "x", "\"_", ",_", "ns", "\\u", "foa", "f_", "[_", "\"", "name", "\"_", "]_", ",_", "\"?", "name", "\"_", ")_", ",_", "(_", "\"?", "x", "\"_", ",_", "ns", "\\u", "foa", "f_", "[_", "\"", "mbox", "\"_", "]_", ",_", "\"?", "mbox", "\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "._", "add", "Constraint_", "(_", "is", "URI_", "(_", "\"?", "mbox", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "optional_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "triple", "Store_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "'''", "\\", "10", ";", " ", " ", "?", "name", ":", " ", "Ali", "ce", "\\", "10", ";", " ", " ", "?", "mbox", ":", " ", "mail", "to", ":", "alic", "e", "@", "work", ".", "example", "\\", "10", ";'", "''_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
karlnapf/kameleon-mcmc/kameleon_mcmc/gp/scripts/madelon_gaussian_ard.py
[ { "content": "\"\"\"\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 3 of the License, or\n(at your option) any later version.\n\nWritten (W) 2013 Heiko Strathmann\n\"\"\"\nfrom kameleon_mcmc.distribution.Gaussian import Gaussian\nfrom kameleon_mcmc.experiments.SingleChainExperiment import SingleChainExperiment\nfrom kameleon_mcmc.gp.GPData import GPData\nfrom kameleon_mcmc.gp.mcmc.PseudoMarginalHyperparameterDistribution import \\\n PseudoMarginalHyperparameterDistribution\nfrom kameleon_mcmc.kernel.GaussianKernel import GaussianKernel\nfrom kameleon_mcmc.mcmc.MCMCChain import MCMCChain\nfrom kameleon_mcmc.mcmc.MCMCParams import MCMCParams\nfrom kameleon_mcmc.mcmc.output.PlottingOutput import PlottingOutput\nfrom kameleon_mcmc.mcmc.output.StatisticsOutput import StatisticsOutput\nfrom kameleon_mcmc.mcmc.samplers.AdaptiveMetropolisLearnScale import \\\n AdaptiveMetropolisLearnScale\nfrom kameleon_mcmc.mcmc.samplers.KameleonWindowLearnScale import KameleonWindowLearnScale\nfrom kameleon_mcmc.mcmc.samplers.StandardMetropolis import StandardMetropolis\nfrom numpy.lib.twodim_base import eye\nfrom numpy.linalg.linalg import cholesky\nfrom numpy.ma.core import mean, ones, shape, asarray, std, zeros\nfrom numpy.ma.extras import cov\nfrom numpy.random import permutation, seed\nfrom scipy.linalg.basic import solve_triangular\nimport os\nimport sys\n \nif __name__ == '__main__':\n # load data\n data,labels=GPData.get_madelon_data()\n\n # throw away some data\n n=750\n seed(1)\n idx=permutation(len(data))\n idx=idx[:n]\n data=data[idx]\n labels=labels[idx]\n \n # normalise dataset\n data-=mean(data, 0)\n data/=std(data,0)\n dim=shape(data)[1]\n\n # prior on theta and posterior target estimate\n theta_prior=Gaussian(mu=0*ones(dim), Sigma=eye(dim)*5)\n target=PseudoMarginalHyperparameterDistribution(data, labels, \\\n n_importance=500, prior=theta_prior, \\\n ridge=1e-3)\n \n # create sampler\n burnin=5000\n num_iterations=burnin+50000\n kernel = GaussianKernel(sigma=8.0)\n sampler=KameleonWindowLearnScale(target, kernel, stop_adapt=burnin)\n# sampler=AdaptiveMetropolisLearnScale(target)\n# sampler=StandardMetropolis(target)\n \n # posterior mode derived by initial tests\n start=zeros(dim)\n params = MCMCParams(start=start, num_iterations=num_iterations, burnin=burnin)\n \n # create MCMC chain\n chain=MCMCChain(sampler, params)\n chain.append_mcmc_output(StatisticsOutput(print_from=0, lag=100))\n# chain.append_mcmc_output(PlottingOutput(plot_from=0, lag=500))\n \n # create experiment instance to store results\n experiment_dir = str(os.path.abspath(sys.argv[0])).split(os.sep)[-1].split(\".\")[0] + os.sep\n experiment = SingleChainExperiment(chain, experiment_dir)\n \n experiment.run()\n \n sigma=GaussianKernel.get_sigma_median_heuristic(experiment.mcmc_chain.samples.T)\n print \"median kernel width\", sigma", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from kameleon_mcmc.mcmc.output.PlottingOutput import PlottingOutput", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 67 }, { "span": "from kameleon_mcmc.mcmc.samplers.AdaptiveMetropolisLearnScale import \\\n AdaptiveMetropolisLearnScale", "start_line": 18, "start_column": 0, "end_line": 19, "end_column": 32 }, { "span": "from kameleon_mcmc.mcmc.samplers.StandardMetropolis import StandardMetropolis", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 77 }, { "span": "from numpy.linalg.linalg import cholesky", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 40 }, { "span": "from numpy.ma.core import mean, ones, shape, asarray, std, zeros", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 64 }, { "span": "from numpy.ma.extras import cov", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 31 }, { "span": "from scipy.linalg.basic import solve_triangular", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 47 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ";", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", "\\", "10", ";", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by", "\\", "10", ";", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ";", " ", "eit", "her", " ", "version", " ", "3", " ", "of", " ", "the", " ", "License", ",", " ", "or", "\\", "10", ";", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", ".", "\\", "10", ";", "\\", "10", ";", "Writ", "ten", " ", "(", "W", ")", " ", "2013", " ", "Hei", "ko", " ", "Strat", "hma", "nn", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "distribution_", "._", "Gaussian", "_", "import_", "Gaussian", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "experiments_", "._", "Sing", "le", "Chain", "Experiment_", "import_", "Sing", "le", "Chain", "Experiment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "gp_", "._", "GP", "Data_", "import_", "GP", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "gp_", "._", "mcmc", "_", "._", "Pse", "udo", "Marg", "inal", "Hyper", "parameter", "Distribution_", "import_", "Pse", "udo", "Marg", "inal", "Hyper", "parameter", "Distribution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "kernel_", "._", "Gaussian", "Kernel_", "import_", "Gaussian", "Kernel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "MCM", "CC", "hain", "_", "import_", "MCM", "CC", "hain", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "MCM", "CP", "arams_", "import_", "MCM", "CP", "arams_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "output_", "._", "Plott", "ing", "Output_", "import_", "Plott", "ing", "Output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "output_", "._", "Statistic", "s", "Output_", "import_", "Statistic", "s", "Output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "sampler", "s_", "._", "Adapti", "ve", "Metro", "polis", "Learn", "Scale_", "import_", "Adapti", "ve", "Metro", "polis", "Learn", "Scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "sampler", "s_", "._", "Kam", "ele", "on", "Window", "Learn", "Scale_", "import_", "Kam", "ele", "on", "Window", "Learn", "Scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "mcmc", "_", "._", "sampler", "s_", "._", "Standard", "Metro", "polis", "_", "import_", "Standard", "Metro", "polis", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "lib_", "._", "two", "dim", "\\u", "base_", "import_", "eye_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "linalg_", "._", "linalg_", "import_", "choles", "ky_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "ma_", "._", "core_", "import_", "mean_", ",_", "ones_", ",_", "shape_", ",_", "asarray_", ",_", "std_", ",_", "zeros_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "ma_", "._", "extras_", "import_", "cov_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "random_", "import_", "permutation_", ",_", "seed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "linalg_", "._", "basic_", "import_", "solve", "\\u", "triangular", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "load", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", ",_", "labels_", "=_", "GP", "Data_", "._", "get", "\\u", "made", "lon", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "throw", " ", "awa", "y", " ", "some", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "750_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seed_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "permutation_", "(_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "idx_", "[_", ":_", "n_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "labels_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "normalise", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "-=_", "mean_", "(_", "data_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "/=_", "std_", "(_", "data_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim_", "=_", "shape_", "(_", "data_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prior", " ", "on", " ", "theta", " ", "and", " ", "posterior", " ", "target", " ", "estimate_", "\\u\\u\\uNL\\u\\u\\u_", "theta", "\\u", "prior_", "=_", "Gaussian", "_", "(_", "mu_", "=_", "0_", "*_", "ones_", "(_", "dim_", ")_", ",_", "Sigma_", "=_", "eye_", "(_", "dim_", ")_", "*_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "Pse", "udo", "Marg", "inal", "Hyper", "parameter", "Distribution_", "(_", "data_", ",_", "labels_", ",_", "n", "\\u", "importance", "_", "=_", "500_", ",_", "prior_", "=_", "theta", "\\u", "prior_", ",_", "ridge", "_", "=_", "1e-3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "sampler_", "\\u\\u\\uNL\\u\\u\\u_", "burn", "in_", "=_", "5000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "iterations_", "=_", "burn", "in_", "+_", "50000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kernel_", "=_", "Gaussian", "Kernel_", "(_", "sigma_", "=_", "8.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sampler_", "=_", "Kam", "ele", "on", "Window", "Learn", "Scale_", "(_", "target_", ",_", "kernel_", ",_", "stop", "\\u", "adapt", "_", "=_", "burn", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "sampler", "=", "Adapti", "ve", "Metro", "polis", "Learn", "Scale", "(", "target", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "sampler", "=", "Standard", "Metro", "polis", "(", "target", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "posterior", " ", "mode", " ", "derive", "d", " ", "by", " ", "initial", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "zeros_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "MCM", "CP", "arams_", "(_", "start_", "=_", "start_", ",_", "num", "\\u", "iterations_", "=_", "num", "\\u", "iterations_", ",_", "burn", "in_", "=_", "burn", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "MCM", "C", " ", "chain_", "\\u\\u\\uNL\\u\\u\\u_", "chain_", "=_", "MCM", "CC", "hain", "_", "(_", "sampler_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chain_", "._", "append", "\\u", "mcmc", "\\u", "output_", "(_", "Statistic", "s", "Output_", "(_", "print", "\\u", "from_", "=_", "0_", ",_", "lag_", "=_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "chain", ".", "append", "\\u", "mcmc", "\\u", "output", "(", "Plott", "ing", "Output", "(", "plot", "\\u", "from", "=", "0", ",", " ", "lag", "=", "500", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "experiment", " ", "instance", " ", "to", " ", "store", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "experiment", "\\u", "dir_", "=_", "str_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", ")_", "._", "split_", "(_", "os_", "._", "sep_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "\".\"_", ")_", "[_", "0_", "]_", "+_", "os_", "._", "sep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "experiment_", "=_", "Sing", "le", "Chain", "Experiment_", "(_", "chain_", ",_", "experiment", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "experiment_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sigma_", "=_", "Gaussian", "Kernel_", "._", "get", "\\u", "sigma", "\\u", "median", "\\u", "heuristic", "_", "(_", "experiment_", "._", "mcmc", "\\u", "chain_", "._", "samples_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "median", " ", "kernel", " ", "widt", "h", "\"_", ",_", "sigma_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
sightmachine/SimpleCV/SimpleCV/tests/test_stereovision.py
[ { "content": "def test_StereoCalibration():\n cam = StereoCamera()\n try :\n cam1 = Camera(0)\n cam2 = Camera(1)\n cam1.getImage()\n cam2.getImage()\n try :\n cam = StereoCamera()\n calib = cam.StereoCalibration(0,1,nboards=1)\n if (calib):\n assert True\n else :\n assert False\n except:\n assert False\n except :\n assert True", "metadata": "root.test_StereoCalibration", "header": "['module', '___EOS___']", "index": 141 } ]
[ { "span": "except:", "start_line": 155, "start_column": 8, "end_line": 155, "end_column": 15 }, { "span": "except :", "start_line": 157, "start_column": 4, "end_line": 157, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Ster", "eo", "Calibrat", "ion_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cam_", "=_", "Ster", "eo", "Camera_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cam", "1_", "=_", "Camera_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cam", "2_", "=_", "Camera_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cam", "1_", "._", "get", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cam", "2_", "._", "get", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cam_", "=_", "Ster", "eo", "Camera_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calib", "_", "=_", "cam_", "._", "Ster", "eo", "Calibrat", "ion_", "(_", "0_", ",_", "1_", ",_", "nbo", "ards", "_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "calib", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "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 ", " _", "assert_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused local variable
PyTables/PyTables/bench/LRU-experiments.py
[ { "content": "def modify_junk_LRU2():\n fileh = open_file(filename, 'a')\n group = fileh.root.newgroup\n for j in range(20):\n t1 = time()\n for i in range(100):\n #print(\"table-->\", tt._v_name)\n tt = getattr(group, \"table\" + str(i))\n #for row in tt:\n # pass\n print(\"iter and time -->\", j + 1, round(time() - t1, 3))\n fileh.close()", "metadata": "root.modify_junk_LRU2", "header": "['module', '___EOS___']", "index": 59 } ]
[ { "span": "tt ", "start_line": 66, "start_column": 12, "end_line": 66, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "modif", "y", "\\u", "junk", "\\u", "LR", "U2", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fileh", "_", "=_", "open", "\\u", "file_", "(_", "filename_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "fileh", "_", "._", "root_", "._", "newg", "roup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(\"", "table", "-->", "\",", " ", "tt", ".\\u", "v", "\\u", "name", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "getattr_", "(_", "group_", ",_", "\"", "table", "\"_", "+_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "for", " ", "row", " ", "in", " ", "tt", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "iter", " ", "and", " ", "time", " ", "-->", "\"_", ",_", "j_", "+_", "1_", ",_", "round_", "(_", "time_", "(_", ")_", "-_", "t1_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fileh", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Yelp/fullerite/src/diamond/collectors/jolokia/cassandra_jolokia.py
[ { "content": "# coding=utf-8\n\n\"\"\"\nCollects Cassandra JMX metrics from the Jolokia Agent. Extends the\nJolokiaCollector to interpret Histogram beans with information about the\ndistribution of request latencies.\n\n#### Example Configuration\nCassandraJolokiaCollector uses a regular expression to determine which\nattributes represent histograms. This regex can be overridden by providing a\n`histogram_regex` in your configuration. You can also override `percentiles` to\ncollect specific percentiles from the histogram statistics. The format is shown\nbelow with the default values.\n\nCassandraJolokiaCollector.conf\n\n```\n percentiles '50,95,99'\n histogram_regex '.*HistogramMicros$'\n```\n\"\"\"\n\nfrom diamond.collector import str_to_bool\nfrom jolokia import JolokiaCollector, MBean\nimport math\nimport string\nimport re\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CassandraJolokiaCollector(JolokiaCollector):\n # override to allow setting which percentiles will be collected\n\n # override to allow setting which percentiles will be collected\n\n\n\n\n\n\n # override: Interpret beans that match the `histogram_regex` as histograms,\n # and collect percentiles from them.\n\n # Adapted from Cassandra docs:\n # https://bit.ly/13M5JPE\n # The index corresponds to the x-axis in a histogram. It represents buckets\n # of values, which are a series of ranges. Each offset includes the range of\n # values greater than the previous offset and less than or equal to the\n # current offset. The offsets start at 1 and each subsequent offset is\n # calculated by multiplying the previous offset by 1.2, rounding up, and\n # removing duplicates. The offsets can range from 1 to approximately 25\n # million, with less precision as the offsets get larger.\n\n # Returns a list of offsets for `n` buckets.", "metadata": "root.CassandraJolokiaCollector", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def get_default_config_help(self):\n config_help = super(CassandraJolokiaCollector,\n self).get_default_config_help()\n config_help.update({\n 'percentiles':\n 'Comma separated list of percentiles to be collected '\n '(e.g., \"50,95,99\").',\n 'histogram_regex':\n 'Filter to only process attributes that match this regex',\n 'nested': 'Whether or not to enable nested values from JMX'\n })\n return config_help", "metadata": "root.CassandraJolokiaCollector.get_default_config_help", "header": "['class', 'CassandraJolokiaCollector', '(', 'JolokiaCollector', ')', ':', '___NEWLINE___', '# override to allow setting which percentiles will be collected', '___NL___', '___EOS___']", "index": 31 }, { "content": " def get_default_config(self):\n config = super(CassandraJolokiaCollector, self).get_default_config()\n config.update({\n 'percentiles': ['50', '95', '99'],\n 'histogram_regex': '.*HistogramMicros$',\n 'nested': 'False'\n })\n return config", "metadata": "root.CassandraJolokiaCollector.get_default_config", "header": "['class', 'CassandraJolokiaCollector', '(', 'JolokiaCollector', ')', ':', '___NEWLINE___', '# override to allow setting which percentiles will be collected', '___NL___', '___EOS___']", "index": 45 }, { "content": " def __init__(self, *args, **kwargs):\n super(CassandraJolokiaCollector, self).__init__(*args, **kwargs)\n self.offsets = self.create_offsets(91)\n self.update_config(self.config)", "metadata": "root.CassandraJolokiaCollector.__init__", "header": "['class', 'CassandraJolokiaCollector', '(', 'JolokiaCollector', ')', ':', '___NEWLINE___', '# override to allow setting which percentiles will be collected', '___NL___', '___EOS___']", "index": 54 }, { "content": " def update_config(self, config):\n if 'percentiles' in config:\n self.percentiles = map(int, config['percentiles'])\n if 'histogram_regex' in config:\n self.histogram_regex = re.compile(config['histogram_regex'])", "metadata": "root.CassandraJolokiaCollector.update_config", "header": "['class', 'CassandraJolokiaCollector', '(', 'JolokiaCollector', ')', ':', '___NEWLINE___', '# override to allow setting which percentiles will be collected', '___NL___', '___EOS___']", "index": 59 }, { "content": " def collect_bean(self, prefix, obj):\n for k, v in obj.iteritems():\n if type(v) in [int, float, long]:\n self.parse_dimension_bean(prefix, k, v)\n elif isinstance(v, dict) and str_to_bool(self.config['nested']):\n self.collect_bean(\"%s.%s\" % (prefix, k), v)\n elif isinstance(v, list) and str_to_bool(self.config['nested']):\n self.interpret_bean_with_list(\"%s.%s\" % (prefix, k), v)", "metadata": "root.CassandraJolokiaCollector.collect_bean", "header": "['class', 'CassandraJolokiaCollector', '(', 'JolokiaCollector', ')', ':', '___NEWLINE___', '# override to allow setting which percentiles will be collected', '___NL___', '___EOS___']", "index": 65 }, { "content": " def patch_dimensions(self, bean, dims):\n metric_name = dims.pop(\"name\", None)\n metric_type = dims.pop(\"type\", None)\n scope_type = dims.pop(\"scope\", None)\n if scope_type:\n dims[\"type\"] = scope_type\n\n return metric_name, metric_type, dims", "metadata": "root.CassandraJolokiaCollector.patch_dimensions", "header": "['class', 'CassandraJolokiaCollector', '(', 'JolokiaCollector', ')', ':', '___NEWLINE___', '# override to allow setting which percentiles will be collected', '___NL___', '___EOS___']", "index": 74 }, { "content": " def patch_metric_name(self, bean, metric_name_list):\n if self.config.get('prefix', None):\n metric_name_list = [self.config['prefix']] + metric_name_list\n\n if bean.bean_key.lower() != 'value':\n metric_name_list.append(bean.bean_key.lower())\n\n return metric_name_list", "metadata": "root.CassandraJolokiaCollector.patch_metric_name", "header": "['class', 'CassandraJolokiaCollector', '(', 'JolokiaCollector', ')', ':', '___NEWLINE___', '# override to allow setting which percentiles will be collected', '___NL___', '___EOS___']", "index": 83 }, { "content": " def interpret_bean_with_list(self, prefix, values):\n if not self.histogram_regex.match(prefix):\n return\n\n buckets = values\n offsets = self.offsets\n for percentile in self.percentiles:\n value = self.compute_percentile(offsets, buckets, percentile)\n cleaned_key = self.clean_up(\"%s.p%s\" % (prefix, percentile))\n self.publish(cleaned_key, value)", "metadata": "root.CassandraJolokiaCollector.interpret_bean_with_list", "header": "['class', 'CassandraJolokiaCollector', '(', 'JolokiaCollector', ')', ':', '___NEWLINE___', '# override to allow setting which percentiles will be collected', '___NL___', '___EOS___']", "index": 94 }, { "content": " def compute_percentile(self, offsets, buckets, percentile_int):\n non_zero_points_sum = sum(buckets)\n if non_zero_points_sum is 0:\n return 0\n middle_point_index = math.floor(\n non_zero_points_sum * (percentile_int / float(100)))\n\n points_seen = 0\n for index, bucket in enumerate(buckets):\n points_seen += bucket\n if points_seen >= middle_point_index:\n return round((offsets[index] - offsets[index - 1]) / 2)", "metadata": "root.CassandraJolokiaCollector.compute_percentile", "header": "['class', 'CassandraJolokiaCollector', '(', 'JolokiaCollector', ')', ':', '___NEWLINE___', '# override to allow setting which percentiles will be collected', '___NL___', '___EOS___']", "index": 114 }, { "content": " def create_offsets(self, bucket_count):\n last_num = 1\n offsets = [last_num]\n\n for index in range(bucket_count):\n next_num = round(last_num * 1.2)\n if next_num == last_num:\n next_num += 1\n offsets.append(next_num)\n last_num = next_num\n\n return offsets", "metadata": "root.CassandraJolokiaCollector.create_offsets", "header": "['class', 'CassandraJolokiaCollector', '(', 'JolokiaCollector', ')', ':', '___NEWLINE___', '# override to allow setting which percentiles will be collected', '___NL___', '___EOS___']", "index": 128 } ]
[ { "span": "from jolokia import JolokiaCollector, MBean", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 43 }, { "span": "import string", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", "=", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Collect", "s", " ", "Cass", "andra", " ", "JM", "X", " ", "metric", "s", " ", "from", " ", "the", " ", "Jo", "lok", "ia", " ", "Agent", ".", " ", " ", "Extend", "s", " ", "the", "\\", "10", ";", "Jo", "lok", "ia", "Collect", "or", " ", "to", " ", "interpret", " ", "Histogram", " ", "beans", " ", "with", " ", "informati", "on", " ", "abo", "ut", " ", "the", "\\", "10", ";", "distribu", "tion", " ", "of", " ", "request", " ", "latenc", "ies", ".", "\\", "10", ";", "\\", "10", ";", "###", "#", " ", "Exam", "ple", " ", "Configura", "tion", "\\", "10", ";", "Cass", "andra", "Jo", "lok", "ia", "Collect", "or", " ", "use", "s", " ", "a", " ", "regular", " ", "express", "ion", " ", "to", " ", "dete", "rmin", "e", " ", "whi", "ch", "\\", "10", ";", "attribute", "s", " ", "represent", " ", "histograms", ".", " ", "Thi", "s", " ", "regex", " ", "can", " ", "be", " ", "overrid", "den", " ", "by", " ", "provi", "ding", " ", "a", "\\", "10", ";", "`", "histo", "gram", "\\u", "regex", "`", " ", "in", " ", "your", " ", "configura", "tion", ".", " ", " ", "You", " ", "can", " ", "als", "o", " ", "override", " ", "`", "percentile", "s", "`", " ", "to", "\\", "10", ";", "collect", " ", "specific", " ", "percentile", "s", " ", "from", " ", "the", " ", "histo", "gram", " ", "statistic", "s", ".", " ", " ", "The", " ", "format", " ", "is", " ", "shown", "\\", "10", ";", "belo", "w", " ", "with", " ", "the", " ", "default", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", "Cass", "andra", "Jo", "lok", "ia", "Collect", "or", ".", "conf", "\\", "10", ";", "\\", "10", ";", "```", "\\", "10", ";", " ", " ", " ", " ", "percentile", "s", " ", "'", "50", ",", "9", "5", ",", "9", "9", "'", "\\", "10", ";", " ", " ", " ", " ", "histo", "gram", "\\u", "regex", " ", "'.*", "Histogram", "Micro", "s", "$", "'", "\\", "10", ";", "```", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "diamond", "_", "._", "collector_", "import_", "str", "\\u", "to", "\\u", "bool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "jo", "lok", "ia_", "import_", "Jo", "lok", "ia", "Collector_", ",_", "MB", "ean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "override", ":", " ", "Interpret", " ", "beans", " ", "tha", "t", " ", "match", " ", "the", " ", "`", "histo", "gram", "\\u", "regex", "`", " ", "as", " ", "histograms", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "collect", " ", "percentile", "s", " ", "from", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Adapt", "ed", " ", "from", " ", "Cass", "andra", " ", "docs", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "bit", ".", "ly", "/", "13", "M", "5", "JP", "E_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "index", " ", "correspond", "s", " ", "to", " ", "the", " ", "x", "-", "axis", " ", "in", " ", "a", " ", "histo", "gram", ".", " ", " ", "It", " ", "represent", "s", " ", "buckets_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "values", ",", " ", "whi", "ch", " ", "are", " ", "a", " ", "series", " ", "of", " ", "ranges", ".", " ", "Ea", "ch", " ", "offset", " ", "include", "s", " ", "the", " ", "range", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "values", " ", "great", "er", " ", "than", " ", "the", " ", "previ", "ous", " ", "offset", " ", "and", " ", "less", " ", "than", " ", "or", " ", "equal", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "current", " ", "offset", ".", " ", "The", " ", "offset", "s", " ", "start", " ", "at", " ", "1", " ", "and", " ", "each", " ", "subsequen", "t", " ", "offset", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calculated", " ", "by", " ", "multipl", "ying", " ", "the", " ", "previ", "ous", " ", "offset", " ", "by", " ", "1.2", ",", " ", "rounding", " ", "up", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remo", "ving", " ", "duplicat", "es", ".", " ", "The", " ", "offset", "s", " ", "can", " ", "range", " ", "from", " ", "1", " ", "to", " ", "approximate", "ly", " ", "25_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "milli", "on", ",", " ", "with", " ", "less", " ", "preci", "sion", " ", "as", " ", "the", " ", "offset", "s", " ", "get", " ", "large", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "offset", "s", " ", "for", " ", "`", "n", "`", " ", "bucket", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "default", "\\u", "config", "\\u", "help_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "help_", "=_", "super_", "(_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ")_", "._", "get", "\\u", "default", "\\u", "config", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "help_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "percentile", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Comm", "a", " ", "separate", "d", " ", "list", " ", "of", " ", "percentile", "s", " ", "to", " ", "be", " ", "collected", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "e", ".", "g", ".,", " ", "\"", "50", ",", "9", "5", ",", "9", "9", "\")", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "histo", "gram", "\\u", "regex", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Filter", " ", "to", " ", "only", " ", "process", " ", "attribute", "s", " ", "tha", "t", " ", "match", " ", "this", " ", "regex", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nest", "ed", "'_", ":_", "'", "Whe", "ther", " ", "or", " ", "not", " ", "to", " ", "enable", " ", "nest", "ed", " ", "values", " ", "from", " ", "JM", "X", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "config", "\\u", "help_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\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", "default", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "super_", "(_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", ",_", "self_", ")_", "._", "get", "\\u", "default", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "percentile", "s", "'_", ":_", "[_", "'", "50", "'_", ",_", "'", "9", "5", "'_", ",_", "'", "9", "9", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "histo", "gram", "\\u", "regex", "'_", ":_", "'.*", "Histogram", "Micro", "s", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nest", "ed", "'_", ":_", "'", "Fal", "se", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\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_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "offsets_", "=_", "self_", "._", "create", "\\u", "offsets_", "(_", "91_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "config_", "(_", "self_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\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_", "update", "\\u", "config_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "percentile", "s", "'_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "percentile", "s_", "=_", "map_", "(_", "int_", ",_", "config_", "[_", "'", "percentile", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "histo", "gram", "\\u", "regex", "'_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "histo", "gram", "\\u", "regex_", "=_", "re_", "._", "compile_", "(_", "config_", "[_", "'", "histo", "gram", "\\u", "regex", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "collect", "\\u", "bean", "_", "(_", "self_", ",_", "prefix_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", ",_", "v_", "in_", "obj_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "v_", ")_", "in_", "[_", "int_", ",_", "float_", ",_", "long_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parse", "\\u", "dimension", "\\u", "bean", "_", "(_", "prefix_", ",_", "k_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "v_", ",_", "dict_", ")_", "and_", "str", "\\u", "to", "\\u", "bool_", "(_", "self_", "._", "config_", "[_", "'", "nest", "ed", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "collect", "\\u", "bean", "_", "(_", "\"%", "s", ".", "%", "s", "\"_", "%_", "(_", "prefix_", ",_", "k_", ")_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "v_", ",_", "list_", ")_", "and_", "str", "\\u", "to", "\\u", "bool_", "(_", "self_", "._", "config_", "[_", "'", "nest", "ed", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "interpret", "\\u", "bean", "\\u", "with", "\\u", "list_", "(_", "\"%", "s", ".", "%", "s", "\"_", "%_", "(_", "prefix_", ",_", "k_", ")_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "patch", "\\u", "dimensions_", "(_", "self_", ",_", "bean", "_", ",_", "dims_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metric", "\\u", "name_", "=_", "dims_", "._", "pop_", "(_", "\"", "name", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metric", "\\u", "type_", "=_", "dims_", "._", "pop_", "(_", "\"", "type", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope", "\\u", "type_", "=_", "dims_", "._", "pop_", "(_", "\"", "scope", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scope", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dims_", "[_", "\"", "type", "\"_", "]_", "=_", "scope", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "metric", "\\u", "name_", ",_", "metric", "\\u", "type_", ",_", "dims_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\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_", "patch", "\\u", "metric", "\\u", "name_", "(_", "self_", ",_", "bean", "_", ",_", "metric", "\\u", "name", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "config_", "._", "get_", "(_", "'", "prefix", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metric", "\\u", "name", "\\u", "list_", "=_", "[_", "self_", "._", "config_", "[_", "'", "prefix", "'_", "]_", "]_", "+_", "metric", "\\u", "name", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bean", "_", "._", "bean", "\\u", "key_", "._", "lower_", "(_", ")_", "!=_", "'", "value", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metric", "\\u", "name", "\\u", "list_", "._", "append_", "(_", "bean", "_", "._", "bean", "\\u", "key_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "metric", "\\u", "name", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\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_", "interpret", "\\u", "bean", "\\u", "with", "\\u", "list_", "(_", "self_", ",_", "prefix_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "histo", "gram", "\\u", "regex_", "._", "match_", "(_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buckets_", "=_", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offsets_", "=_", "self_", "._", "offsets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "percentile_", "in_", "self_", "._", "percentile", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "compute", "\\u", "percentile_", "(_", "offsets_", ",_", "buckets_", ",_", "percentile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "ed", "\\u", "key_", "=_", "self_", "._", "clean", "\\u", "up_", "(_", "\"%", "s", ".", "p", "%", "s", "\"_", "%_", "(_", "prefix_", ",_", "percentile_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "publish_", "(_", "clean", "ed", "\\u", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "percentile_", "(_", "self_", ",_", "offsets_", ",_", "buckets_", ",_", "percentile", "\\u", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "non", "\\u", "zero", "\\u", "points", "\\u", "sum_", "=_", "sum_", "(_", "buckets_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "non", "\\u", "zero", "\\u", "points", "\\u", "sum_", "is_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "middle", "\\u", "point", "\\u", "index_", "=_", "math_", "._", "floor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "non", "\\u", "zero", "\\u", "points", "\\u", "sum_", "*_", "(_", "percentile", "\\u", "int_", "/_", "float_", "(_", "100_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points", "\\u", "seen_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index_", ",_", "bucket_", "in_", "enumerate_", "(_", "buckets_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points", "\\u", "seen_", "+=_", "bucket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "points", "\\u", "seen_", ">=_", "middle", "\\u", "point", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "round_", "(_", "(_", "offsets_", "[_", "index_", "]_", "-_", "offsets_", "[_", "index_", "-_", "1_", "]_", ")_", "/_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cass", "andra", "Jo", "lok", "ia", "Collector_", "(_", "Jo", "lok", "ia", "Collector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "to", " ", "allow", " ", "setti", "ng", " ", "whi", "ch", " ", "percentile", "s", " ", "will", " ", "be", " ", "collected", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "offsets_", "(_", "self_", ",_", "bucket", "\\u", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "num_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offsets_", "=_", "[_", "last", "\\u", "num_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "index_", "in_", "range_", "(_", "bucket", "\\u", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "num_", "=_", "round_", "(_", "last", "\\u", "num_", "*_", "1.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "next", "\\u", "num_", "==_", "last", "\\u", "num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "num_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offsets_", "._", "append_", "(_", "next", "\\u", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "num_", "=_", "next", "\\u", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
mpirnat/hackday/hackday/blog/notifications.py
[ { "content": " def send_email(self):\n profiles = UserProfile.objects.filter(notify_by_email=True)\n recipients = [p.user.email for p in profiles]\n\n subject = '[{0}]: {1}'.format(self.site.name, self.entry.title)\n body = self.render_template('blog/notification_email.html')\n message = EmailMultiAlternatives(subject,\n body,\n settings.DEFAULT_FROM_EMAIL,\n [settings.DEFAULT_FROM_EMAIL],\n recipients)\n message.mixed_subtype = \"related\"\n try:\n body_html = self.render_template('blog/notification_email_html.html')\n\n soup = BeautifulSoup(body_html)\n images = {}\n for index, tag in enumerate(soup.findAll(self._image_finder)):\n if tag['src'] not in images.keys():\n images[tag['src']] = \"image_{0}\".format(index)\n tag['src'] = 'cid:{0}'.format(images[tag['src']])\n\n body_html = str(soup)\n\n for filename, file_id in images.items():\n image_file = self._file_finder(filename)\n if image_file:\n msg_image = MIMEImage(image_file.read())\n image_file.close()\n msg_image.add_header('Content-ID', '<{0}>'.format(file_id))\n message.attach(msg_image)\n\n message.attach_alternative(body_html, \"text/html\")\n\n except Exception, e:\n raise e\n # if we can't load the html template or related images,\n # don't send the HTML version\n pass\n\n message.send()", "metadata": "root.BlogNotification.send_email", "header": "['class', 'BlogNotification', '(', 'object', ')', ':', '___EOS___']", "index": 24 } ]
[ { "span": "pass", "start_line": 62, "start_column": 12, "end_line": 62, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Blog", "Notification_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "email_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "profiles_", "=_", "User", "Profile_", "._", "objects_", "._", "filter_", "(_", "notif", "y", "\\u", "by", "\\u", "email_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recipients_", "=_", "[_", "p_", "._", "user_", "._", "email_", "for_", "p_", "in_", "profiles_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subject_", "=_", "'[{", "0", "}]", ":", " ", "{", "1", "}'_", "._", "format_", "(_", "self_", "._", "site_", "._", "name_", ",_", "self_", "._", "entry_", "._", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "self_", "._", "render", "\\u", "template_", "(_", "'", "blog", "/", "notification", "\\u", "email", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "Ema", "il", "Multi", "Alternative", "s_", "(_", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "DEF", "AUL", "T", "\\u", "FROM", "\\u", "EMAIL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "settings_", "._", "DEF", "AUL", "T", "\\u", "FROM", "\\u", "EMAIL_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "mixed", "\\u", "subtype_", "=_", "\"", "relate", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "html_", "=_", "self_", "._", "render", "\\u", "template_", "(_", "'", "blog", "/", "notification", "\\u", "email", "\\u", "html", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "soup_", "=_", "Bea", "uti", "ful", "Soup_", "(_", "body", "\\u", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index_", ",_", "tag_", "in_", "enumerate_", "(_", "soup_", "._", "find", "All_", "(_", "self_", "._", "\\u", "image", "\\u", "finder_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tag_", "[_", "'", "src", "'_", "]_", "not_", "in_", "images_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "images_", "[_", "tag_", "[_", "'", "src", "'_", "]_", "]_", "=_", "\"", "image", "\\u{", "0", "}\"_", "._", "format_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tag_", "[_", "'", "src", "'_", "]_", "=_", "'", "cid", ":", "{", "0", "}'_", "._", "format_", "(_", "images_", "[_", "tag_", "[_", "'", "src", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body", "\\u", "html_", "=_", "str_", "(_", "soup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "filename_", ",_", "file", "\\u", "id_", "in_", "images_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "\\u", "file_", "=_", "self_", "._", "\\u", "file", "\\u", "finder_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "image", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg", "\\u", "image_", "=_", "MIME", "Image_", "(_", "image", "\\u", "file_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "image_", "._", "add", "\\u", "header_", "(_", "'", "Conten", "t", "-", "ID", "'_", ",_", "'<", "{", "0", "}>", "'_", "._", "format_", "(_", "file", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "attach_", "(_", "msg", "\\u", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "._", "attach", "\\u", "alternative", "_", "(_", "body", "\\u", "html_", ",_", "\"", "text", "/", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "can", "'", "t", " ", "load", " ", "the", " ", "html", " ", "template", " ", "or", " ", "relate", "d", " ", "images", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "send", " ", "the", " ", "HTM", "L", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "._", "send_", "(_", ")_", "\\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, 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/cassback/cassback/endpoints/endpoints.py
[ { "content": "#!/usr/bin/env python\n# encoding: utf-8\n\n# Copyright 2012 Aaron Morton\n# \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# \n# http://www.apache.org/licenses/LICENSE-2.0\n# \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport cStringIO\nimport errno\nimport json\nimport logging\nimport os.path\nimport pkg_resources\nimport shutil\nimport time\n\nimport boto\nfrom boto.s3 import key\n\nfrom cassback import dt_util, file_util\n\n# ============================================================================ \n#\n\n\n\n\n# ============================================================================ \n#\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def create_from_args(args):\n\n endpoint_name = args.endpoint\n for entry_point in pkg_resources.iter_entry_points(\"cassback.endpoints\"): \n \n endpoint_class = entry_point.load()\n if endpoint_class.name == endpoint_name:\n return endpoint_class(args)\n\n raise RuntimeError(\"Unknown endpoint name %s\" % (endpoint_name,))", "metadata": "root.create_from_args", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def validate_args(args):\n\n endpoint_name = args.endpoint\n for entry_point in pkg_resources.iter_entry_points(\"cassback.endpoints\"): \n \n endpoint_class = entry_point.load()\n if endpoint_class.name == endpoint_name:\n endpoint_class.validate_args(args)\n return\n\n raise RuntimeError(\"Unknown endpoint name %s\" % (endpoint_name,))", "metadata": "root.validate_args", "header": "['module', '___EOS___']", "index": 46 }, { "content": "class EndpointBase(object):\n \"\"\"Base for all endpoints.\"\"\"\n\n name = None\n \"\"\"Endpoint name, used in command line to identifity it. \n \"\"\"\n\n \n \n\n\n\n\n\n\n\n\n \n", "metadata": "root.EndpointBase", "header": "['module', '___EOS___']", "index": 62 }, { "content": " @classmethod\n def add_arg_group(cls, main_parser):\n \"\"\"\n \"\"\"\n pass", "metadata": "root.EndpointBase.add_arg_group", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 69 }, { "content": " @classmethod\n def validate_args(cls, args):\n pass", "metadata": "root.EndpointBase.validate_args", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 75 }, { "content": " def backup_file(self, backup_file):\n \"\"\"Store the SSTable ``backup_file``.\n \n Returns the fully qualified path to the file in the backup. \n \"\"\"\n raise NotImplementedError()", "metadata": "root.EndpointBase.backup_file", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 79 }, { "content": " def read_backup_file(self, path):\n \"\"\"Creates a :cls:`cassandra.BackupFile` from the meta for the file \n at ``path``\n \"\"\"\n raise NotImplementedError()", "metadata": "root.EndpointBase.read_backup_file", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 86 }, { "content": " def backup_keyspace(self, ks_backup):\n raise NotImplementedError()", "metadata": "root.EndpointBase.backup_keyspace", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": " def read_keyspace(self, path):\n raise NotImplementedError()", "metadata": "root.EndpointBase.read_keyspace", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 95 }, { "content": " def restore_file(self, backup_file, dest_prefix):\n \"\"\"Restore the ``backup_file`` under the ``dest_prefix``.\n \n Returns the fully qualified backup path.\n \"\"\"\n raise NotImplementedError()", "metadata": "root.EndpointBase.restore_file", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 98 }, { "content": " def exists(self, relative_path):\n \"\"\"Returns ``True`` if the file at ``relative_path`` exists. False \n otherwise. \n \"\"\"\n raise NotImplementedError() ", "metadata": "root.EndpointBase.exists", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 105 }, { "content": " def validate_checksum(self, relative_path, expected_md5_hex):\n \"\"\"Validates that the MD5 checksum of the file in the backup at \n ``relative_path`` matches ``expected_md5_hex``. \n \"\"\"\n raise NotImplementedError()", "metadata": "root.EndpointBase.validate_checksum", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 111 }, { "content": " def iter_dir(self, relative_path, include_files=True, \n include_dirs=False, recursive=False):\n raise NotImplementedError()", "metadata": "root.EndpointBase.iter_dir", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 118 }, { "content": " def remove_file(self, relative_path, dry_run=False):\n \"\"\"Removes the file at the ``relative_path``. \n \n If ``dry_run`` the file is not deleted. \n \n Returns the fill path to the file in the backup.\"\"\"\n raise NotImplementedError()", "metadata": "root.EndpointBase.remove_file", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 122 }, { "content": " def remove_file_with_meta(self, relative_path, dry_run):\n \"\"\"Removes the file at the ``relative_path`` that is expected to \n have meta data. \n \n If ``dry_run`` the file is not deleted. \n \n Returns the fill path to the file in the backup.\"\"\"\n raise NotImplementedError()", "metadata": "root.EndpointBase.remove_file_with_meta", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 130 }, { "content": "class TransferTiming(object):\n \n\n \n ", "metadata": "root.TransferTiming", "header": "['module', '___EOS___']", "index": 140 }, { "content": " def __init__(self, logger, path, size):\n self.log = logger\n self.path = path\n self.start_ms = int(time.time() * 1000)\n self.size = size # bytes\n \n # number of boto callbacks we should ask for. \n mb = 1024 **2\n pattern = [\n (1 * mb, 0), # 1MB, none\n (10 * mb, 1), # 10MB, 1\n (100 * mb, 2), # 100MB, 2\n (1024 * mb, 5), # 1GB , 5\n (10 * 1024 * mb, 10), # 10GB , 10\n ]\n \n self.num_callbacks = 20\n for i, j in pattern:\n if self.size < i:\n self.num_callbacks = j\n break", "metadata": "root.TransferTiming.__init__", "header": "['class', 'TransferTiming', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " def progress(self, progress, total):\n \"\"\"Boto progress callback function. \n \n Logs the progress. \n \"\"\"\n \n path = self.path\n elapsed_ms = int(time.time() * 1000) - self.start_ms\n throughput = ((progress * 1.0) / (1024**2)) / ((elapsed_ms / 1000) or 1)\n \n if progress == total:\n pattern = \"Transfered file {path} in {elapsed_ms:d} ms size \"\\\n \"{total} at {throughput:f} MB/sec\"\n else:\n pattern = \"Progress transfering file {path} elapsed \"\\\n \"{elapsed_ms:d} ms, transferred \"\\\n \"{progress} bytes at {throughput:f} MB/sec {total} \"\\\n \"total\"\n\n self.log.info(pattern.format(**vars()))\n return", "metadata": "root.TransferTiming.progress", "header": "['class', 'TransferTiming', '(', 'object', ')', ':', '___EOS___']", "index": 164 }, { "content": " def __enter__(self):\n \"\"\"Entry function when used as a context.\"\"\"\n \n # Nothing to do. \n return self", "metadata": "root.TransferTiming.__enter__", "header": "['class', 'TransferTiming', '(', 'object', ')', ':', '___EOS___']", "index": 186 }, { "content": " def __exit__(self, exc_type, exc_value, traceback):\n \n if exc_value is not None:\n # There was an error, let's just get out of here.\n return False\n \n # report 100% progress.\n self.progress(self.size, self.size)\n return False", "metadata": "root.TransferTiming.__exit__", "header": "['class', 'TransferTiming', '(', 'object', ')', ':', '___EOS___']", "index": 192 } ]
[ { "span": "import argparse", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 15 }, { "span": "import cStringIO", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 16 }, { "span": "import errno", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 12 }, { "span": "import json", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 11 }, { "span": "import logging", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 14 }, { "span": "import os.path", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 14 }, { "span": "import shutil", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 13 }, { "span": "import boto", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 11 }, { "span": "from boto.s3 import key", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 23 }, { "span": "from cassback import dt_util, file_util", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "Aa", "ron", " ", "Mor", "ton_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pkg", "\\u", "resources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "boto_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "boto_", "._", "s3_", "import_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cass", "back_", "import_", "dt", "\\u", "util_", ",_", "file", "\\u", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "=====", "=", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "=====", "=", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create", "\\u", "from", "\\u", "args_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint", "\\u", "name_", "=_", "args_", "._", "endpoint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entry", "\\u", "point_", "in_", "pkg", "\\u", "resources_", "._", "iter", "\\u", "entry", "\\u", "points_", "(_", "\"", "cass", "back", ".", "endpoint", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint", "\\u", "class_", "=_", "entry", "\\u", "point_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "endpoint", "\\u", "class_", "._", "name_", "==_", "endpoint", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "endpoint", "\\u", "class_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "\"", "Un", "know", "n", " ", "endpoint", " ", "name", " ", "%", "s", "\"_", "%_", "(_", "endpoint", "\\u", "name_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validat", "e\\u", "args_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint", "\\u", "name_", "=_", "args_", "._", "endpoint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entry", "\\u", "point_", "in_", "pkg", "\\u", "resources_", "._", "iter", "\\u", "entry", "\\u", "points_", "(_", "\"", "cass", "back", ".", "endpoint", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint", "\\u", "class_", "=_", "entry", "\\u", "point_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "endpoint", "\\u", "class_", "._", "name_", "==_", "endpoint", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint", "\\u", "class_", "._", "validat", "e\\u", "args_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "\"", "Un", "know", "n", " ", "endpoint", " ", "name", " ", "%", "s", "\"_", "%_", "(_", "endpoint", "\\u", "name_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "for", " ", "all", " ", "endpoint", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "End", "point", " ", "name", ",", " ", "used", " ", "in", " ", "command", " ", "line", " ", "to", " ", "identifi", "ty", " ", "it", ".", " ", "\\", "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\\uNL\\u\\u\\u_", "\\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_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "arg", "\\u", "group_", "(_", "cls_", ",_", "main", "\\u", "parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "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_", "validat", "e\\u", "args_", "(_", "cls_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backup", "\\u", "file_", "(_", "self_", ",_", "backup", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Stor", "e", " ", "the", " ", "SS", "Table", " ", "``", "backup", "\\u", "file", "``.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "full", "y", " ", "qualified", " ", "path", " ", "to", " ", "the", " ", "file", " ", "in", " ", "the", " ", "backup", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "backup", "\\u", "file_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", ":", "cls", ":`", "cass", "andra", ".", "Back", "up", "File", "`", " ", "from", " ", "the", " ", "meta", " ", "for", " ", "the", " ", "file", " ", "\\", "10", ";", " ", " ", " ", " ", "at", " ", "``", "path", "``", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backup", "\\u", "keyspace_", "(_", "self_", ",_", "ks", "\\u", "backup_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "keyspace_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "restore", "\\u", "file_", "(_", "self_", ",_", "backup", "\\u", "file_", ",_", "dest", "\\u", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Restor", "e", " ", "the", " ", "``", "backup", "\\u", "file", "``", " ", "under", " ", "the", " ", "``", "dest", "\\u", "prefix", "``.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "full", "y", " ", "qualified", " ", "backup", " ", "path", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exists_", "(_", "self_", ",_", "relative", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "``", "Tru", "e", "``", " ", "if", " ", "the", " ", "file", " ", "at", " ", "``", "relative", "\\u", "path", "``", " ", "exist", "s", ".", " ", "Fal", "se", " ", "\\", "10", ";", " ", " ", " ", " ", "other", "wis", "e", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validat", "e\\u", "checksum_", "(_", "self_", ",_", "relative", "\\u", "path_", ",_", "expected", "\\u", "md5", "\\u", "hex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validate", "s", " ", "tha", "t", " ", "the", " ", "MD", "5", " ", "checks", "um", " ", "of", " ", "the", " ", "file", " ", "in", " ", "the", " ", "backup", " ", "at", " ", "\\", "10", ";", " ", " ", " ", " ", "``", "relative", "\\u", "path", "``", " ", "matche", "s", " ", "``", "expected", "\\u", "md5", "\\u", "hex", "``.", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "iter", "\\u", "dir_", "(_", "self_", ",_", "relative", "\\u", "path_", ",_", "include", "\\u", "files_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "dirs_", "=_", "False_", ",_", "recursive_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "file_", "(_", "self_", ",_", "relative", "\\u", "path_", ",_", "dry", "\\u", "run_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", "s", " ", "the", " ", "file", " ", "at", " ", "the", " ", "``", "relative", "\\u", "path", "``.", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "``", "dry", "\\u", "run", "``", " ", "the", " ", "file", " ", "is", " ", "not", " ", "delete", "d", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "fill", " ", "path", " ", "to", " ", "the", " ", "file", " ", "in", " ", "the", " ", "backup", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "file", "\\u", "with", "\\u", "meta_", "(_", "self_", ",_", "relative", "\\u", "path_", ",_", "dry", "\\u", "run_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", "s", " ", "the", " ", "file", " ", "at", " ", "the", " ", "``", "relative", "\\u", "path", "``", " ", "tha", "t", " ", "is", " ", "expected", " ", "to", " ", "\\", "10", ";", " ", " ", " ", " ", "have", " ", "meta", " ", "data", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "``", "dry", "\\u", "run", "``", " ", "the", " ", "file", " ", "is", " ", "not", " ", "delete", "d", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "fill", " ", "path", " ", "to", " ", "the", " ", "file", " ", "in", " ", "the", " ", "backup", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\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_", "Transfer", "Tim", "ing_", "(_", "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_", "Transfer", "Tim", "ing_", "(_", "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_", ",_", "logger_", ",_", "path_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "=_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "\\u", "ms_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "size_", "=_", "size_", "#", " ", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "boto", " ", "callback", "s", " ", "we", " ", "shou", "ld", " ", "ask", " ", "for", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "mb_", "=_", "1024_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", "*_", "mb_", ",_", "0_", ")_", ",_", "#", " ", "1", "MB", ",", " ", "none_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "10_", "*_", "mb_", ",_", "1_", ")_", ",_", "#", " ", "10", "MB", ",", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "100_", "*_", "mb_", ",_", "2_", ")_", ",_", "#", " ", "100", "MB", ",", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1024_", "*_", "mb_", ",_", "5_", ")_", ",_", "#", " ", "1", "GB", " ", ",", " ", "5_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "10_", "*_", "1024_", "*_", "mb_", ",_", "10_", ")_", ",_", "#", " ", "10", "GB", " ", ",", " ", "10_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "num", "\\u", "callbacks_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "j_", "in_", "pattern_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "size_", "<_", "i_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "num", "\\u", "callbacks_", "=_", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Transfer", "Tim", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "progress_", "(_", "self_", ",_", "progress_", ",_", "total_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Bot", "o", " ", "progress", " ", "callback", " ", "function", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Log", "s", " ", "the", " ", "progress", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "self_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ela", "pse", "d\\u", "ms_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "1000_", ")_", "-_", "self_", "._", "start", "\\u", "ms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "throughput", "_", "=_", "(_", "(_", "progress_", "*_", "1.0_", ")_", "/_", "(_", "1024_", "**_", "2_", ")_", ")_", "/_", "(_", "(_", "ela", "pse", "d\\u", "ms_", "/_", "1000_", ")_", "or_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "progress_", "==_", "total_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern_", "=_", "\"", "Transfer", "ed", " ", "file", " ", "{", "path", "}", " ", "in", " ", "{", "ela", "pse", "d\\u", "ms", ":", "d", "}", " ", "ms", " ", "size", " ", "\"_", "\"{", "total", "}", " ", "at", " ", "{", "throughput", ":", "f", "}", " ", "MB", "/", "sec", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern_", "=_", "\"", "Progres", "s", " ", "transfer", "ing", " ", "file", " ", "{", "path", "}", " ", "ela", "pse", "d", " ", "\"_", "\"{", "ela", "pse", "d\\u", "ms", ":", "d", "}", " ", "ms", ",", " ", "transferred", " ", "\"_", "\"{", "progress", "}", " ", "bytes", " ", "at", " ", "{", "throughput", ":", "f", "}", " ", "MB", "/", "sec", " ", "{", "total", "}", " ", "\"_", "\"", "total", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "pattern_", "._", "format_", "(_", "**_", "vars_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Transfer", "Tim", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Entr", "y", " ", "function", " ", "whe", "n", " ", "used", " ", "as", " ", "a", " ", "context", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "hing", " ", "to", " ", "do", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Transfer", "Tim", "ing_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "exit\\u\\u_", "(_", "self_", ",_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "traceback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exc", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "There", " ", "was", " ", "an", " ", "error", ",", " ", "let", "'", "s", " ", "just", " ", "get", " ", "out", " ", "of", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "report", " ", "100", "%", " ", "progress", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "progress_", "(_", "self_", "._", "size_", ",_", "self_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
aldebaran/qibuild/python/qipkg/builder.py
[ { "content": "## Copyright (c) 2012-2016 Aldebaran Robotics. All rights reserved.\n## Use of this source code is governed by a BSD-style license that can be\n## found in the COPYING file.\n\"\"\" Builder for pml files \"\"\"\nimport os\nimport sys\nimport tempfile\nimport zipfile\n\nfrom qisys import ui\nimport qisys.error\nimport qisys.qixml\nimport qibuild.breakpad\nimport qibuild.worktree\nimport qibuild.cmake_builder\nimport qipy.worktree\nimport qipy.python_builder\nimport qilinguist.worktree\nimport qilinguist.builder\nimport qilinguist.pml_translator\nimport qipkg.manifest\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PMLBuilder(object):\n \"\"\" Build a package from a pml file \"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.PMLBuilder", "header": "['module', '___EOS___']", "index": 22 }, { "content": " def __init__(self, pml_path, worktree=None):\n if not os.path.exists(pml_path):\n raise qisys.error.Error(\"%s does not exist\" % pml_path)\n self.pml_path = pml_path\n self.base_dir = os.path.dirname(self.pml_path)\n self.manifest_xml = os.path.join(self.base_dir, \"manifest.xml\")\n if not os.path.exists(self.manifest_xml):\n raise qisys.error.Error(\"%s does not exist\" % self.manifest_xml)\n self.pkg_name = pkg_name(self.manifest_xml)\n\n\n self.worktree = worktree\n\n if self.worktree:\n self.build_worktree = qibuild.worktree.BuildWorkTree(self.worktree)\n self.cmake_builder = qibuild.cmake_builder.CMakeBuilder(self.build_worktree)\n\n self.python_worktree = qipy.worktree.PythonWorkTree(self.worktree)\n self.python_builder = qipy.python_builder.PythonBuilder(\n self.python_worktree,\n build_worktree=self.build_worktree)\n\n self.linguist_worktree = qilinguist.worktree.LinguistWorkTree(self.worktree)\n self.linguist_builder = qilinguist.builder.QiLinguistBuilder()\n\n self.builders = [self.cmake_builder, self.python_builder, self.linguist_builder]\n else:\n self.cmake_builder = None\n self.build_worktree = None\n self.python_builder = None\n self.python_worktree = None\n self.linguist_builder = None\n self.linguist_worktree = None\n self.builders = list()\n\n # Hack: we don't want to generate symbols from the staged dir\n # unless we have at least one qibuild project\n self.build_project = None\n\n self._stage_path = None\n self.pml_extra_files = list()\n\n self.load_pml(pml_path)\n\n # read the manifest and validate it\n self.validator = qipkg.manifest.Validator(self.manifest_xml)\n self.validator.print_errors()\n self.validator.print_warnings()", "metadata": "root.PMLBuilder.__init__", "header": "['class', 'PMLBuilder', '(', 'object', ')', ':', '___EOS___']", "index": 24 }, { "content": " @property\n def stage_path(self):\n if self.worktree:\n dot_qi = self.worktree.dot_qi\n build_config = self.cmake_builder.build_config\n name = build_config.build_directory(prefix=\"qipkg\")\n return os.path.join(dot_qi, name)\n else:\n if not self._stage_path:\n self._stage_path = tempfile.mkdtemp()\n return self._stage_path", "metadata": "root.PMLBuilder.stage_path", "header": "['class', 'PMLBuilder', '(', 'object', ')', ':', '___EOS___']", "index": 73 }, { "content": " def load_pml(self, pml_path):\n try:\n self._load_pml(pml_path)\n except qisys.worktree.NoSuchProject as e:\n mess = \"\"\" \\\nError when parsing {pml_path}\n{mess}\n\"\"\"\n raise qisys.error.Error(\n mess.format(pml_path=pml_path, mess=str(e)))", "metadata": "root.PMLBuilder.load_pml", "header": "['class', 'PMLBuilder', '(', 'object', ')', ':', '___EOS___']", "index": 85 }, { "content": " def _load_pml(self, pml_path):\n for builder in self.builders:\n builder.projects = list()\n tree= qisys.qixml.read(pml_path)\n root = tree.getroot()\n qibuild_elems = root.findall(\"qibuild\")\n if qibuild_elems and not self.worktree:\n raise qisys.error.Error(\n \"<qibuild> tag found but not in a worktree\")\n for qibuild_elem in qibuild_elems:\n name = qisys.qixml.parse_required_attr(qibuild_elem, \"name\", pml_path)\n project = self.build_worktree.get_build_project(name, raises=True)\n self.cmake_builder.projects.append(project)\n self.build_project = project\n\n qipython_elems = root.findall(\"qipython\")\n if qipython_elems and not self.worktree:\n raise qisys.error.Error(\n \"<qipython> tag found but not in a worktree\")\n for qipython_elem in qipython_elems:\n name = qisys.qixml.parse_required_attr(qipython_elem, \"name\", pml_path)\n project = self.python_worktree.get_python_project(name, raises=True)\n self.python_builder.projects.append(project)\n\n qilinguist_elems = root.findall(\"qilinguist\")\n if qilinguist_elems and not self.worktree:\n raise qisys.error.Error(\n \"<qilinguist> tag found but not in a worktree\")\n for qilinguist_elem in qilinguist_elems:\n name = qisys.qixml.parse_required_attr(qilinguist_elem, \"name\", pml_path)\n project = self.linguist_worktree.get_linguist_project(name, raises=True)\n self.linguist_builder.projects.append(project)\n\n # For top, ressource, dialog, behavior, add stuff to self.pml_extra_files\n behaviors = root.find(\"BehaviorDescriptions\")\n if behaviors is not None:\n for child in behaviors.findall(\"BehaviorDescription\"):\n src = child.get(\"src\")\n full_src = os.path.join(src, \"behavior.xar\")\n self.pml_extra_files.append(full_src)\n\n # Dialog\n dialogs = root.find(\"Dialogs\")\n if dialogs is not None:\n for child in dialogs.findall(\"Dialog\"):\n src = child.get(\"src\")\n self.pml_extra_files.append(src)\n\n # Resources\n resources = root.find(\"Resources\")\n if resources is not None:\n for child in resources.findall(\"File\"):\n src = child.get(\"src\")\n self.pml_extra_files.append(src)\n\n # Topics\n topics = root.find(\"Topics\")\n if topics is not None:\n for child in topics.findall(\"Topic\"):\n src = child.get(\"src\")\n self.pml_extra_files.append(src)\n\n errors = list()\n for file in self.pml_extra_files:\n full_path = os.path.join(self.base_dir, file)\n if not os.path.exists(full_path):\n errors.append(file)\n if errors:\n mess = \"Some files do not exist\\n\"\n for error in errors:\n mess += error + \"\\n\"\n raise qisys.error.Error(mess)", "metadata": "root.PMLBuilder._load_pml", "header": "['class', 'PMLBuilder', '(', 'object', ')', ':', '___EOS___']", "index": 96 }, { "content": " def configure(self):\n \"\"\" Configure every project \"\"\"\n for builder in self.builders:\n if isinstance(builder, qibuild.cmake_builder.CMakeBuilder):\n builder.dep_types=[\"build\", \"runtime\", \"test\"]\n builder.configure()", "metadata": "root.PMLBuilder.configure", "header": "['class', 'PMLBuilder', '(', 'object', ')', ':', '___EOS___']", "index": 169 }, { "content": " def build(self):\n \"\"\" Build every project \"\"\"\n for builder in self.builders:\n builder.build()", "metadata": "root.PMLBuilder.build", "header": "['class', 'PMLBuilder', '(', 'object', ')', ':', '___EOS___']", "index": 176 }, { "content": " def install(self, destination):\n \"\"\" Install every project to the given destination \"\"\"\n qisys.sh.mkdir(destination, recursive=True)\n # Copy the manifest\n qisys.sh.install(self.manifest_xml, destination)\n\n # Use every available builder to install\n for builder in self.builders:\n desc = desc_from_builder(builder)\n if builder.projects:\n ui.info(ui.bold, \"-> Adding %s ...\" % desc)\n if isinstance(builder, qibuild.cmake_builder.CMakeBuilder):\n builder.dep_types=[\"runtime\"]\n builder.install(destination, components=[\"runtime\"])\n else:\n builder.install(destination)\n\n # Install self.pml_extra_files\n if self.pml_extra_files:\n ui.info(ui.bold, \"-> Adding extra files ...\")\n for src in self.pml_extra_files:\n full_src = os.path.join(self.base_dir, src)\n rel_src = os.path.relpath(full_src, self.base_dir)\n full_dest = os.path.join(destination, rel_src)\n qisys.sh.install(full_src, full_dest)\n\n # Generate and install translations\n ui.info(ui.bold, \"-> Generating translations ...\")\n pml_translator = qilinguist.pml_translator.PMLTranslator(self.pml_path)\n pml_translator.release()\n pml_translator.install(destination)", "metadata": "root.PMLBuilder.install", "header": "['class', 'PMLBuilder', '(', 'object', ')', ':', '___EOS___']", "index": 181 }, { "content": " def deploy(self, url):\n \"\"\" Deploy every project to the given url \"\"\"\n qisys.remote.deploy(self.stage_path, url)", "metadata": "root.PMLBuilder.deploy", "header": "['class', 'PMLBuilder', '(', 'object', ')', ':', '___EOS___']", "index": 214 }, { "content": " def package(self, output=None, with_breakpad=False, force=False):\n \"\"\" Generate a package containing every project.\n\n :param: with_breakpad generate debug symbols for usage\n with breakpad\n\n :param: force make package even if it does not satisfy\n default package requirements\n\n \"\"\"\n\n # If the package is not valid, do not go further\n if not self.validator.is_valid and not force:\n raise qisys.error.Error(\n \"Given package does not satisfy \"\n \"default package requirements.\\n\"\n \"Use option '--force' to bypass this validation\")\n\n # Make sure self.stage_path exists and is empty\n qisys.sh.rm(self.stage_path)\n qisys.sh.mkdir(self.stage_path, recursive=True)\n res = list()\n if not output:\n output = os.path.join(os.getcwd(), self.pkg_name + \".pkg\")\n\n\n # Add everything from the staged path\n self.install(self.stage_path)\n\n ui.info(ui.bold, \"-> Compressing package ...\")\n qisys.archive.compress(self.stage_path, output=output, flat=True,\n display_progress=True)\n\n symbols_archive = None\n if with_breakpad and self.build_project:\n ui.info(ui.bold, \"-> Generating breakpad symbols ...\")\n dirname = os.path.dirname(output)\n symbols_archive = os.path.join(dirname, self.pkg_name + \"-symbols.zip\")\n qibuild.breakpad.gen_symbol_archive(base_dir=self.stage_path,\n output=symbols_archive)\n ui.info(ui.bold, \"-> Symbols generated in\", symbols_archive)\n ui.info(ui.bold, \"-> Package generated in\", output, \"\\n\")\n qisys.sh.rm(self.stage_path)\n if symbols_archive:\n return [output, symbols_archive]\n else:\n return output", "metadata": "root.PMLBuilder.package", "header": "['class', 'PMLBuilder', '(', 'object', ')', ':', '___EOS___']", "index": 218 }, { "content": " def __repr__(self):\n return \"<PMLBuilder for %s>\" % self.pml_path", "metadata": "root.PMLBuilder.__repr__", "header": "['class', 'PMLBuilder', '(', 'object', ')', ':', '___EOS___']", "index": 266 }, { "content": "def pkg_name(manifest_xml):\n \"Return a string name-version\"\n root = qisys.qixml.read(manifest_xml).getroot()\n uuid = qisys.qixml.parse_required_attr(root, \"uuid\", xml_path=manifest_xml)\n version = qisys.qixml.parse_required_attr(root, \"version\", xml_path=manifest_xml)\n output_name = \"%s-%s\" % (uuid, version)\n return output_name", "metadata": "root.pkg_name", "header": "['module', '___EOS___']", "index": 269 }, { "content": "def desc_from_builder(builder):\n class_name = builder.__class__.__name__\n if \"CMakeBuilder\" in class_name:\n return \"C++ projects\"\n if \"Linguist\" in class_name:\n return \"translations\"\n if \"Python\" in class_name:\n return \"Python projects\"", "metadata": "root.desc_from_builder", "header": "['module', '___EOS___']", "index": 277 } ]
[ { "span": "import sys", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 10 }, { "span": "import zipfile", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "2016", " ", "Al", "deb", "aran", " ", "Robot", "ics", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Us", "e", " ", "of", " ", "this", " ", "source", " ", "code", " ", "is", " ", "govern", "ed", " ", "by", " ", "a", " ", "BS", "D", "-", "style", " ", "license", " ", "tha", "t", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "found", " ", "in", " ", "the", " ", "COPY", "ING", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Build", "er", " ", "for", " ", "pm", "l", " ", "files", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "qi", "sys_", "import_", "ui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "sys_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "sys_", "._", "qi", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "build_", "._", "break", "pad_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "build_", "._", "work", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "build_", "._", "cma", "ke", "\\u", "builder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "py_", "._", "work", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "py_", "._", "python", "\\u", "builder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "ling", "uis", "t_", "._", "work", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "ling", "uis", "t_", "._", "builder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "ling", "uis", "t_", "._", "pm", "l\\u", "translator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "pkg_", "._", "manifest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "PM", "LB", "uild", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Build", " ", "a", " ", "package", " ", "from", " ", "a", " ", "pm", "l", " ", "file", " ", "\"\"\"_", "\\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\\uNL\\u\\u\\u_", "\\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_", "PM", "LB", "uild", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "pm", "l\\u", "path_", ",_", "work", "tree_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "pm", "l\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "qi", "sys_", "._", "error_", "._", "Error_", "(_", "\"%", "s", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "%_", "pm", "l\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pm", "l\\u", "path_", "=_", "pm", "l\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "base", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "self_", "._", "pm", "l\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "manifest", "\\u", "xml_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "base", "\\u", "dir_", ",_", "\"", "manifest", ".", "xml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "manifest", "\\u", "xml_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "qi", "sys_", "._", "error_", "._", "Error_", "(_", "\"%", "s", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "%_", "self_", "._", "manifest", "\\u", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pkg", "\\u", "name_", "=_", "pkg", "\\u", "name_", "(_", "self_", "._", "manifest", "\\u", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "work", "tree_", "=_", "work", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "work", "tree_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "build", "\\u", "work", "tree_", "=_", "qi", "build_", "._", "work", "tree_", "._", "Build", "Work", "Tree_", "(_", "self_", "._", "work", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cma", "ke", "\\u", "builder_", "=_", "qi", "build_", "._", "cma", "ke", "\\u", "builder_", "._", "CM", "ake", "Builder_", "(_", "self_", "._", "build", "\\u", "work", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "python", "\\u", "work", "tree_", "=_", "qi", "py_", "._", "work", "tree_", "._", "Pyth", "on", "Work", "Tree_", "(_", "self_", "._", "work", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "python", "\\u", "builder_", "=_", "qi", "py_", "._", "python", "\\u", "builder_", "._", "Pyth", "on", "Builder_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "python", "\\u", "work", "tree_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "build", "\\u", "work", "tree_", "=_", "self_", "._", "build", "\\u", "work", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ling", "uis", "t", "\\u", "work", "tree_", "=_", "qi", "ling", "uis", "t_", "._", "work", "tree_", "._", "Lin", "gui", "st", "Work", "Tree_", "(_", "self_", "._", "work", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ling", "uis", "t", "\\u", "builder_", "=_", "qi", "ling", "uis", "t_", "._", "builder_", "._", "Qi", "Lin", "gui", "st", "Builder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "builders_", "=_", "[_", "self_", "._", "cma", "ke", "\\u", "builder_", ",_", "self_", "._", "python", "\\u", "builder_", ",_", "self_", "._", "ling", "uis", "t", "\\u", "builder_", "]_", "\\u\\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_", "._", "cma", "ke", "\\u", "builder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "build", "\\u", "work", "tree_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "python", "\\u", "builder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "python", "\\u", "work", "tree_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ling", "uis", "t", "\\u", "builder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ling", "uis", "t", "\\u", "work", "tree_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "builders_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hack", ":", " ", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "generat", "e", " ", "symbols", " ", "from", " ", "the", " ", "staged", " ", "dir_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unl", "ess", " ", "we", " ", "have", " ", "at", " ", "leas", "t", " ", "one", " ", "qi", "build", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "build", "\\u", "project_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "stage", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pm", "l\\u", "extra", "\\u", "files_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "load", "\\u", "pm", "l_", "(_", "pm", "l\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "the", " ", "manifest", " ", "and", " ", "validat", "e", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "validator_", "=_", "qi", "pkg_", "._", "manifest_", "._", "Validator_", "(_", "self_", "._", "manifest", "\\u", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validator_", "._", "print", "\\u", "errors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validator_", "._", "print", "\\u", "warnings_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "LB", "uild", "er_", "(_", "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_", "stage", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "work", "tree_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "\\u", "qi", "_", "=_", "self_", "._", "work", "tree_", "._", "dot", "\\u", "qi", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "\\u", "config_", "=_", "self_", "._", "cma", "ke", "\\u", "builder_", "._", "build", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "build", "\\u", "config_", "._", "build", "\\u", "directory_", "(_", "prefix_", "=_", "\"", "qi", "pkg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "join_", "(_", "dot", "\\u", "qi", "_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "stage", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "stage", "\\u", "path_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "stage", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "LB", "uild", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "pm", "l_", "(_", "self_", ",_", "pm", "l\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "load", "\\u", "pm", "l_", "(_", "pm", "l\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "qi", "sys_", "._", "work", "tree_", "._", "No", "Suc", "h", "Project_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mess_", "=_", "\"\"\"", " ", "\\\\", "\\", "10", ";", "Error", " ", "whe", "n", " ", "pars", "ing", " ", "{", "pm", "l\\u", "path", "}", "\\", "10", ";", "{", "mess", "}", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "qi", "sys_", "._", "error_", "._", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mess_", "._", "format_", "(_", "pm", "l\\u", "path_", "=_", "pm", "l\\u", "path_", ",_", "mess_", "=_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "LB", "uild", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "load", "\\u", "pm", "l_", "(_", "self_", ",_", "pm", "l\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "builder_", "in_", "self_", "._", "builders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "builder_", "._", "projects_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tree_", "=_", "qi", "sys_", "._", "qi", "xml_", "._", "read_", "(_", "pm", "l\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "tree_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "elems_", "=_", "root_", "._", "findall_", "(_", "\"", "qi", "build", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "qi", "build", "\\u", "elems_", "and_", "not_", "self_", "._", "work", "tree_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "qi", "sys_", "._", "error_", "._", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "qi", "build", ">", " ", "tag", " ", "found", " ", "but", " ", "not", " ", "in", " ", "a", " ", "work", "tree", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "qi", "build", "\\u", "elem_", "in_", "qi", "build", "\\u", "elems_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "qi", "sys_", "._", "qi", "xml_", "._", "parse", "\\u", "require", "d\\u", "attr_", "(_", "qi", "build", "\\u", "elem_", ",_", "\"", "name", "\"_", ",_", "pm", "l\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "self_", "._", "build", "\\u", "work", "tree_", "._", "get", "\\u", "build", "\\u", "project_", "(_", "name_", ",_", "raises_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cma", "ke", "\\u", "builder_", "._", "projects_", "._", "append_", "(_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "build", "\\u", "project_", "=_", "project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "qi", "python", "\\u", "elems_", "=_", "root_", "._", "findall_", "(_", "\"", "qi", "python", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "qi", "python", "\\u", "elems_", "and_", "not_", "self_", "._", "work", "tree_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "qi", "sys_", "._", "error_", "._", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "qi", "python", ">", " ", "tag", " ", "found", " ", "but", " ", "not", " ", "in", " ", "a", " ", "work", "tree", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "qi", "python", "\\u", "elem_", "in_", "qi", "python", "\\u", "elems_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "qi", "sys_", "._", "qi", "xml_", "._", "parse", "\\u", "require", "d\\u", "attr_", "(_", "qi", "python", "\\u", "elem_", ",_", "\"", "name", "\"_", ",_", "pm", "l\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "self_", "._", "python", "\\u", "work", "tree_", "._", "get", "\\u", "python", "\\u", "project_", "(_", "name_", ",_", "raises_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "python", "\\u", "builder_", "._", "projects_", "._", "append_", "(_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "qi", "ling", "uis", "t", "\\u", "elems_", "=_", "root_", "._", "findall_", "(_", "\"", "qi", "ling", "uis", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "qi", "ling", "uis", "t", "\\u", "elems_", "and_", "not_", "self_", "._", "work", "tree_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "qi", "sys_", "._", "error_", "._", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "qi", "ling", "uis", "t", ">", " ", "tag", " ", "found", " ", "but", " ", "not", " ", "in", " ", "a", " ", "work", "tree", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "qi", "ling", "uis", "t", "\\u", "elem_", "in_", "qi", "ling", "uis", "t", "\\u", "elems_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "qi", "sys_", "._", "qi", "xml_", "._", "parse", "\\u", "require", "d\\u", "attr_", "(_", "qi", "ling", "uis", "t", "\\u", "elem_", ",_", "\"", "name", "\"_", ",_", "pm", "l\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "self_", "._", "ling", "uis", "t", "\\u", "work", "tree_", "._", "get", "\\u", "ling", "uis", "t", "\\u", "project_", "(_", "name_", ",_", "raises_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ling", "uis", "t", "\\u", "builder_", "._", "projects_", "._", "append_", "(_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "top", ",", " ", "ress", "ource", ",", " ", "dialog", ",", " ", "behavior", ",", " ", "add", " ", "stu", "ff", " ", "to", " ", "self", ".", "pm", "l\\u", "extra", "\\u", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "behavior", "s_", "=_", "root_", "._", "find_", "(_", "\"", "Behavio", "r", "Descripti", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "behavior", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "child_", "in_", "behavior", "s_", "._", "findall_", "(_", "\"", "Behavio", "r", "Descripti", "on", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "child_", "._", "get_", "(_", "\"", "src", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "src_", "=_", "os_", "._", "path_", "._", "join_", "(_", "src_", ",_", "\"", "behavior", ".", "xar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pm", "l\\u", "extra", "\\u", "files_", "._", "append_", "(_", "full", "\\u", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dialog_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dialogs_", "=_", "root_", "._", "find_", "(_", "\"", "Dialog", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dialogs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "child_", "in_", "dialogs_", "._", "findall_", "(_", "\"", "Dialog", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "child_", "._", "get_", "(_", "\"", "src", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pm", "l\\u", "extra", "\\u", "files_", "._", "append_", "(_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Resources_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resources_", "=_", "root_", "._", "find_", "(_", "\"", "Reso", "urc", "es", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resources_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "child_", "in_", "resources_", "._", "findall_", "(_", "\"", "File", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "child_", "._", "get_", "(_", "\"", "src", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pm", "l\\u", "extra", "\\u", "files_", "._", "append_", "(_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Topic", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "topics_", "=_", "root_", "._", "find_", "(_", "\"", "Topic", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "topics_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "child_", "in_", "topics_", "._", "findall_", "(_", "\"", "Topic", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "child_", "._", "get_", "(_", "\"", "src", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pm", "l\\u", "extra", "\\u", "files_", "._", "append_", "(_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "errors_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file_", "in_", "self_", "._", "pm", "l\\u", "extra", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "base", "\\u", "dir_", ",_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "full", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mess_", "=_", "\"", "Some", " ", "files", " ", "do", " ", "not", " ", "exist", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "error_", "in_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mess_", "+=_", "error_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "qi", "sys_", "._", "error_", "._", "Error_", "(_", "mess_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "LB", "uild", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "configure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Configure", " ", "every", " ", "project", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "builder_", "in_", "self_", "._", "builders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "builder_", ",_", "qi", "build_", "._", "cma", "ke", "\\u", "builder_", "._", "CM", "ake", "Builder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "builder_", "._", "dep", "\\u", "types_", "=_", "[_", "\"", "build", "\"_", ",_", "\"", "runt", "ime", "\"_", ",_", "\"", "test", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "builder_", "._", "configure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "LB", "uild", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Build", " ", "every", " ", "project", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "builder_", "in_", "self_", "._", "builders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "builder_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "LB", "uild", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "install_", "(_", "self_", ",_", "destination_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Install", " ", "every", " ", "project", " ", "to", " ", "the", " ", "give", "n", " ", "destinat", "ion", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "sys_", "._", "sh_", "._", "mkdir_", "(_", "destination_", ",_", "recursive_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "the", " ", "manifest_", "\\u\\u\\uNL\\u\\u\\u_", "qi", "sys_", "._", "sh_", "._", "install_", "(_", "self_", "._", "manifest", "\\u", "xml_", ",_", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "every", " ", "avail", "able", " ", "builde", "r", " ", "to", " ", "install_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "builder_", "in_", "self_", "._", "builders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "desc_", "=_", "desc", "\\u", "from", "\\u", "builder_", "(_", "builder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "builder_", "._", "projects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "bold_", ",_", "\"->", " ", "Add", "ing", " ", "%", "s", " ", "...\"_", "%_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "builder_", ",_", "qi", "build_", "._", "cma", "ke", "\\u", "builder_", "._", "CM", "ake", "Builder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "builder_", "._", "dep", "\\u", "types_", "=_", "[_", "\"", "runt", "ime", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builder_", "._", "install_", "(_", "destination_", ",_", "components_", "=_", "[_", "\"", "runt", "ime", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "builder_", "._", "install_", "(_", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Install", " ", "self", ".", "pm", "l\\u", "extra", "\\u", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "pm", "l\\u", "extra", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "bold_", ",_", "\"->", " ", "Add", "ing", " ", "extra", " ", "files", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "src_", "in_", "self_", "._", "pm", "l\\u", "extra", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "src_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "base", "\\u", "dir_", ",_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rel", "\\u", "src_", "=_", "os_", "._", "path_", "._", "relpath_", "(_", "full", "\\u", "src_", ",_", "self_", "._", "base", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "dest_", "=_", "os_", "._", "path_", "._", "join_", "(_", "destination_", ",_", "rel", "\\u", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "sys_", "._", "sh_", "._", "install_", "(_", "full", "\\u", "src_", ",_", "full", "\\u", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "and", " ", "install", " ", "translations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ui_", "._", "info_", "(_", "ui_", "._", "bold_", ",_", "\"->", " ", "Generat", "ing", " ", "translatio", "ns", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pm", "l\\u", "translator_", "=_", "qi", "ling", "uis", "t_", "._", "pm", "l\\u", "translator_", "._", "PM", "LT", "rans", "lator", "_", "(_", "self_", "._", "pm", "l\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pm", "l\\u", "translator_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pm", "l\\u", "translator_", "._", "install_", "(_", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "LB", "uild", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deploy_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Deploy", " ", "every", " ", "project", " ", "to", " ", "the", " ", "give", "n", " ", "url", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "sys_", "._", "remote_", "._", "deploy_", "(_", "self_", "._", "stage", "\\u", "path_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "LB", "uild", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "package_", "(_", "self_", ",_", "output_", "=_", "None_", ",_", "with", "\\u", "break", "pad_", "=_", "False_", ",_", "force_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Generate", " ", "a", " ", "package", " ", "contain", "ing", " ", "every", " ", "project", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", ":", " ", "with", "\\u", "break", "pad", " ", "generat", "e", " ", "debug", " ", "symbols", " ", "for", " ", "usage", "\\", "10", ";", " ", " ", " ", " ", " ", "with", " ", "break", "pad", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", ":", " ", "force", " ", "make", " ", "package", " ", "even", " ", "if", " ", "it", " ", "doe", "s", " ", "not", " ", "satisfy", "\\", "10", ";", " ", " ", " ", " ", " ", "default", " ", "package", " ", "require", "ment", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "package", " ", "is", " ", "not", " ", "valid", ",", " ", "do", " ", "not", " ", "go", " ", "fur", "ther_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "validator_", "._", "is", "\\u", "valid_", "and_", "not_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "qi", "sys_", "._", "error_", "._", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Give", "n", " ", "package", " ", "doe", "s", " ", "not", " ", "satisfy", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "default", " ", "package", " ", "require", "ment", "s", ".\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Us", "e", " ", "option", " ", "'--", "force", "'", " ", "to", " ", "bypass", " ", "this", " ", "validation", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "self", ".", "stage", "\\u", "path", " ", "exist", "s", " ", "and", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "qi", "sys_", "._", "sh_", "._", "rm_", "(_", "self_", "._", "stage", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "sys_", "._", "sh_", "._", "mkdir_", "(_", "self_", "._", "stage", "\\u", "path_", ",_", "recursive_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "getcwd_", "(_", ")_", ",_", "self_", "._", "pkg", "\\u", "name_", "+_", "\".", "pkg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "every", "thing", " ", "from", " ", "the", " ", "staged", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "install_", "(_", "self_", "._", "stage", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ui_", "._", "info_", "(_", "ui_", "._", "bold_", ",_", "\"->", " ", "Compress", "ing", " ", "package", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "sys_", "._", "archive_", "._", "compress_", "(_", "self_", "._", "stage", "\\u", "path_", ",_", "output_", "=_", "output_", ",_", "flat_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "display", "\\u", "progress_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "symbols", "\\u", "archive_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "with", "\\u", "break", "pad_", "and_", "self_", "._", "build", "\\u", "project_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "bold_", ",_", "\"->", " ", "Generat", "ing", " ", "break", "pad", " ", "symbols", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirname_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbols", "\\u", "archive_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dirname_", ",_", "self_", "._", "pkg", "\\u", "name_", "+_", "\"-", "symbols", ".", "zip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build_", "._", "break", "pad_", "._", "gen", "\\u", "symbol", "\\u", "archive_", "(_", "base", "\\u", "dir_", "=_", "self_", "._", "stage", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "symbols", "\\u", "archive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "info_", "(_", "ui_", "._", "bold_", ",_", "\"->", " ", "Sym", "bol", "s", " ", "generat", "ed", " ", "in", "\"_", ",_", "symbols", "\\u", "archive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ui_", "._", "info_", "(_", "ui_", "._", "bold_", ",_", "\"->", " ", "Packa", "ge", " ", "generat", "ed", " ", "in", "\"_", ",_", "output_", ",_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "sys_", "._", "sh_", "._", "rm_", "(_", "self_", "._", "stage", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "symbols", "\\u", "archive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "output_", ",_", "symbols", "\\u", "archive_", "]_", "\\u\\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_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "LB", "uild", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"<", "PM", "LB", "uild", "er", " ", "for", " ", "%", "s", ">\"_", "%_", "self_", "._", "pm", "l\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pkg", "\\u", "name_", "(_", "manifest", "\\u", "xml_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", " ", "a", " ", "string", " ", "name", "-", "version", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "qi", "sys_", "._", "qi", "xml_", "._", "read_", "(_", "manifest", "\\u", "xml_", ")_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uuid_", "=_", "qi", "sys_", "._", "qi", "xml_", "._", "parse", "\\u", "require", "d\\u", "attr_", "(_", "root_", ",_", "\"", "uuid", "\"_", ",_", "xml", "\\u", "path_", "=_", "manifest", "\\u", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "qi", "sys_", "._", "qi", "xml_", "._", "parse", "\\u", "require", "d\\u", "attr_", "(_", "root_", ",_", "\"", "version", "\"_", ",_", "xml", "\\u", "path_", "=_", "manifest", "\\u", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "name_", "=_", "\"%", "s", "-%", "s", "\"_", "%_", "(_", "uuid_", ",_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "desc", "\\u", "from", "\\u", "builder_", "(_", "builder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class", "\\u", "name_", "=_", "builder_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "CM", "ake", "Build", "er", "\"_", "in_", "class", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "C", "++", " ", "project", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "Lin", "gui", "st", "\"_", "in_", "class", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "translatio", "ns", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "Pyth", "on", "\"_", "in_", "class", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Pyth", "on", " ", "project", "s", "\"_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
rizar/attention-lvcsr/exp/timit/read_phone60_transcripts.py
[ { "content": "#!/usr/bin/env python\n\nimport os\nimport glob\nimport cPickle as pickle\n\nfrom collections import defaultdict, OrderedDict\nimport string\n\nimport logging\nlogger = logging.getLogger(__file__)\n\nimport kaldi_argparse\n\n\n\n\n\nif __name__ == '__main__':\n logging.basicConfig(level=logging.INFO)\n parser = get_parser()\n args = parser.parse_args()\n\n # 1. do the transcriptions\n transcriptions, phones = get_phones60(args.timit_path)\n\n with open(os.path.join(args.dir, 'phones60_all'), 'w') as tf:\n for tk in sorted(transcriptions.keys()):\n tf.write(\"%s %s\\n\" % (tk, ' '.join(transcriptions[tk])))\n\n # 2. compute words dict\n symbols = OrderedDict()\n\n\n for l in sorted(phones):\n symbols_append(l)\n symbols_append('<eol>')\n\n # now symbols map symbol -> id\n # 1 - wrtie new words.txt\n with open(os.path.join(args.dir, 'phones60.txt'), 'w') as ow:\n for s, i in symbols.items():\n ow.write('%s %s\\n' % (s, i))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_phones60(tloc, filter=lambda x: True):\n trans = []\n phones = set()\n for tset in ['TRAIN', 'TEST']:\n trans.extend(glob.glob(tloc + '/' + tset + '/*/*/*.PHN'))\n transcriptions = {}\n for transcription_file in trans:\n file_parts = transcription_file.split('/')\n speaker = file_parts[-2]\n utt = file_parts[-1][:-4]\n utt_id = speaker + '_' + utt\n transcript = []\n with open(transcription_file, 'r') as f:\n for line in f:\n line = line.strip().split()\n if len(line) < 3:\n break\n phone = line[2]\n transcript.append(phone)\n phones.update(transcript)\n assert utt_id not in transcriptions\n transcriptions[utt_id] = transcript\n return transcriptions, phones", "metadata": "root.get_phones60", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def get_parser():\n parser = kaldi_argparse.KaldiArgumentParser(\n description=\"Get timit 60 phoneme transcriptions\")\n parser.add_argument('timit_path')\n parser.add_argument('dir')\n parser.add_standard_arguments()\n return parser", "metadata": "root.get_parser", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def symbols_append(s):\n assert s not in symbols\n symbols[s] = len(symbols)", "metadata": "root.symbols_append", "header": "['module', '___EOS___']", "index": 63 } ]
[ { "span": "import cPickle as pickle", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 24 }, { "span": "from collections import defaultdict, OrderedDict", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 48 }, { "span": "import string", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", ",_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "kal", "di", "\\u", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "basic", "Config_", "(_", "level_", "=_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "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_", "#", " ", "1", ".", " ", "do", " ", "the", " ", "transcription", "s_", "\\u\\u\\uNL\\u\\u\\u_", "transcription", "s_", ",_", "phones_", "=_", "get", "\\u", "phone", "s", "60_", "(_", "args_", "._", "tim", "it", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "args_", "._", "dir_", ",_", "'", "phone", "s", "60", "\\u", "all", "'_", ")_", ",_", "'", "w", "'_", ")_", "as_", "tf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tk_", "in_", "sorted_", "(_", "transcription", "s_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tf_", "._", "write_", "(_", "\"%", "s", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "tk_", ",_", "'", " ", "'_", "._", "join_", "(_", "transcription", "s_", "[_", "tk_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "compute", " ", "words", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "symbols_", "=_", "Order", "ed", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "l_", "in_", "sorted_", "(_", "phones_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbols", "\\u", "append_", "(_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "symbols", "\\u", "append_", "(_", "'<", "eol", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "symbols", " ", "map", " ", "symbol", " ", "->", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", " ", "-", " ", "wrt", "ie", " ", "new", " ", "words", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "args_", "._", "dir_", ",_", "'", "phone", "s", "60", ".", "txt", "'_", ")_", ",_", "'", "w", "'_", ")_", "as_", "ow_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "s_", ",_", "i_", "in_", "symbols_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ow_", "._", "write_", "(_", "'%", "s", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "s_", ",_", "i_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "phone", "s", "60_", "(_", "tlo", "c_", ",_", "filter_", "=_", "lambda_", "x_", ":_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trans_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phones_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tse", "t_", "in_", "[_", "'", "TRAIN", "'_", ",_", "'", "TEST", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trans_", "._", "extend_", "(_", "glob_", "._", "glob_", "(_", "tlo", "c_", "+_", "'/'_", "+_", "tse", "t_", "+_", "'/*", "/*", "/*", ".", "PH", "N", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transcription", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "transcription", "\\u", "file_", "in_", "trans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "parts_", "=_", "transcription", "\\u", "file_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "speaker_", "=_", "file", "\\u", "parts_", "[_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utt", "_", "=_", "file", "\\u", "parts_", "[_", "-_", "1_", "]_", "[_", ":_", "-_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utt", "\\u", "id_", "=_", "speaker_", "+_", "'\\u'_", "+_", "utt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transcript_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "transcription", "\\u", "file_", ",_", "'", "r", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "line_", "._", "strip_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "line_", ")_", "<_", "3_", ":_", "\\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_", "phone_", "=_", "line_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transcript_", "._", "append_", "(_", "phone_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "phones_", "._", "update_", "(_", "transcript_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "utt", "\\u", "id_", "not_", "in_", "transcription", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transcription", "s_", "[_", "utt", "\\u", "id_", "]_", "=_", "transcript_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "transcription", "s_", ",_", "phones_", "\\u\\u\\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", "parser_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "kal", "di", "\\u", "argparse_", "._", "Kal", "di", "Arg", "ument", "Parser_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Get", " ", "tim", "it", " ", "60", " ", "phoneme", " ", "transcription", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "tim", "it", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "dir", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "standard", "\\u", "arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "symbols", "\\u", "append_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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, 4, 2, 2, 2, 2, 2, 2, 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
jdswinbank/Comet/comet/utility/test/test_whitelist.py
[ { "content": " def test_empty_whitelist(self):\n # All connections should be denied and a default message logged.\n factory = WhitelistingFactory(TestFactory(), [])\n self.assertEqual(\n factory.buildProtocol(IPv4Address('TCP', '127.0.0.1', 0)),\n None\n )\n self.assertEqual(len(self.observer.messages), 1)\n self.assertTrue(\"connection\" in self.observer.messages[0][0])", "metadata": "root.WhitelistingFactoryTestCase.test_empty_whitelist", "header": "['class', 'WhitelistingFactoryTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_log_message(self):\n # Should be possible to customize the message which is logged.\n TEST_STRING = \"test-1234\"\n factory = WhitelistingFactory(\n TestFactory(), [ip_network('127.0.0.1/32')], TEST_STRING\n )\n self.assertEqual(\n factory.buildProtocol(IPv4Address('TCP', '127.0.0.2', 0)),\n None\n )\n self.assertFalse(\"connection\" in self.observer.messages[0][0])\n self.assertTrue(TEST_STRING in self.observer.messages[0][0])", "metadata": "root.WhitelistingFactoryTestCase.test_log_message", "header": "['class', 'WhitelistingFactoryTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 52 } ]
[ { "span": "self.assertTrue(\"connection\" in self.observer.messages[0][0])", "start_line": 33, "start_column": 8, "end_line": 33, "end_column": 69 }, { "span": "self.assertFalse(\"connection\" in self.observer.messages[0][0])", "start_line": 62, "start_column": 8, "end_line": 62, "end_column": 70 }, { "span": "self.assertTrue(TEST_STRING in self.observer.messages[0][0])", "start_line": 63, "start_column": 8, "end_line": 63, "end_column": 68 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "White", "listi", "ng", "Factor", "y", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "empty", "\\u", "whitelist_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", " ", "connections", " ", "shou", "ld", " ", "be", " ", "deni", "ed", " ", "and", " ", "a", " ", "default", " ", "message", " ", "logged", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "factory_", "=_", "White", "listi", "ng", "Factory_", "(_", "Test", "Factory_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "factory_", "._", "build", "Protocol_", "(_", "IP", "v", "4", "Address_", "(_", "'", "TC", "P", "'_", ",_", "'", "127", ".0", ".0", ".1", "'_", ",_", "0_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "self_", "._", "observer_", "._", "messages_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "connecti", "on", "\"_", "in_", "self_", "._", "observer_", "._", "messages_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "White", "listi", "ng", "Factor", "y", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "log", "\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sho", "ul", "d", " ", "be", " ", "possib", "le", " ", "to", " ", "customize", " ", "the", " ", "message", " ", "whi", "ch", " ", "is", " ", "logged", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "TEST", "\\u", "STRING_", "=_", "\"", "test", "-1", "234", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "factory_", "=_", "White", "listi", "ng", "Factory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Factory_", "(_", ")_", ",_", "[_", "ip", "\\u", "network_", "(_", "'", "127", ".0", ".0", ".1", "/", "32", "'_", ")_", "]_", ",_", "TEST", "\\u", "STRING_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "factory_", "._", "build", "Protocol_", "(_", "IP", "v", "4", "Address_", "(_", "'", "TC", "P", "'_", ",_", "'", "127", ".0", ".0", ".2", "'_", ",_", "0_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"", "connecti", "on", "\"_", "in_", "self_", "._", "observer_", "._", "messages_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "TEST", "\\u", "STRING_", "in_", "self_", "._", "observer_", "._", "messages_", "[_", "0_", "]_", "[_", "0_", "]_", ")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Except block handles 'BaseException'
kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/tex.py
[ { "content": "def generate_darwin(env):\n try:\n environ = env['ENV']\n except KeyError:\n environ = {}\n env['ENV'] = environ\n\n if (platform.system() == 'Darwin'):\n try:\n ospath = env['ENV']['PATHOSX']\n except:\n ospath = None\n if ospath:\n env.AppendENVPath('PATH', ospath)", "metadata": "root.generate_darwin", "header": "['module', '___EOS___']", "index": 855 } ]
[ { "span": "except:", "start_line": 865, "start_column": 8, "end_line": 865, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "dar", "win_", "(_", "env_", ")_", ":_", "\\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 ", " _", "environ_", "=_", "env_", "[_", "'", "ENV", "'_", "]_", "\\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 ", " _", "environ_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "ENV", "'_", "]_", "=_", "environ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Dar", "win", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ospath_", "=_", "env_", "[_", "'", "ENV", "'_", "]_", "[_", "'", "PATH", "OSX", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ospath_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ospath_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "._", "Append", "ENV", "Path_", "(_", "'", "PATH", "'_", ",_", "ospath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
zzzeek/sqlalchemy/test/orm/test_manytomany.py
[ { "content": " @classmethod\n def setup_classes(cls):\n class Place(cls.Basic):\n def __init__(self, name):\n self.name = name\n\n class PlaceThingy(cls.Basic):\n def __init__(self, name):\n self.name = name\n\n class Transition(cls.Basic):\n def __init__(self, name):\n self.name = name", "metadata": "root.M2MTest.setup_classes", "header": "['class', 'M2MTest', '(', 'fixtures', '.', 'MappedTest', ')', ':', '___EOS___']", "index": 60 }, { "content": " @classmethod\n def setup_classes(cls):\n class A(cls.Comparable):\n pass\n class B(cls.Comparable):\n pass", "metadata": "root.AssortedPersistenceTests.setup_classes", "header": "['class', 'AssortedPersistenceTests', '(', 'fixtures', '.', 'MappedTest', ')', ':', '___EOS___']", "index": 325 } ]
[ { "span": "Place(", "start_line": 62, "start_column": 14, "end_line": 62, "end_column": 19 }, { "span": "PlaceThingy(", "start_line": 66, "start_column": 14, "end_line": 66, "end_column": 25 }, { "span": "Transition(", "start_line": 70, "start_column": 14, "end_line": 70, "end_column": 24 }, { "span": "A(", "start_line": 327, "start_column": 14, "end_line": 327, "end_column": 15 }, { "span": "B(", "start_line": 329, "start_column": 14, "end_line": 329, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "M2", "MT", "est_", "(_", "fixtures_", "._", "Map", "ped", "Test_", ")_", ":_", "\\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_", "setup", "\\u", "classes_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Place_", "(_", "cls_", "._", "Basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Place", "Thin", "gy_", "(_", "cls_", "._", "Basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Transition_", "(_", "cls_", "._", "Basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ass", "orte", "d", "Persisten", "ce", "Tests_", "(_", "fixtures_", "._", "Map", "ped", "Test_", ")_", ":_", "\\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_", "setup", "\\u", "classes_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "A_", "(_", "cls_", "._", "Compara", "ble_", ")_", ":_", "\\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_", "class_", "B_", "(_", "cls_", "._", "Compara", "ble_", ")_", ":_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
genzj/pybingwallpaper/src/config.py
[ { "content": "#!/usr/bin/env python3\nimport log\nfrom log import PAGEDUMP\nimport argparse\nimport sys\nimport io\nfrom argparse import Namespace\nfrom copy import copy\n\n_logger = log.getChild('config')\n\n\nstr_to_bool = lambda x: True if bool(x) and x.lower() != 'false' else False\n\n\n\n\n\nfrom configparser import ConfigParser\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import argparse", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "log_", "import_", "PAGE", "DUMP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "argparse_", "import_", "Namespace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "copy_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "logger_", "=_", "log_", "._", "get", "Child_", "(_", "'", "config", "'_", ")_", "\\u\\u\\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_", "str", "\\u", "to", "\\u", "bool_", "=_", "lambda_", "x_", ":_", "True_", "if_", "bool_", "(_", "x_", ")_", "and_", "x_", "._", "lower_", "(_", ")_", "!=_", "'", "fal", "se", "'_", "else_", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "configparser_", "import_", "Config", "Parser_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Redundant assignment
amrdraz/kodr/app/brython/www/src/Lib/time.py
[ { "content": "def _check_input(t):\n if t and isinstance(t, struct_time) and len(t.args) == 9:\n t = t.args\n elif t and isinstance(t, tuple) and len(t) == 9:\n t = t\n elif t and isinstance(t, struct_time) and len(t.args) != 9:\n raise TypeError(\"function takes exactly 9 arguments ({} given)\".format(len(t.args)))\n elif t and isinstance(t, tuple) and len(t) != 9:\n raise TypeError(\"function takes exactly 9 arguments ({} given)\".format(len(t.args)))\n elif t and not isinstance(t, (tuple, struct_time)):\n raise TypeError(\"Tuple or struct_time argument required\")\n else:\n t = localtime().args\n return t", "metadata": "root._check_input", "header": "['module', '___EOS___']", "index": 125 } ]
[ { "span": "t = t", "start_line": 129, "start_column": 8, "end_line": 129, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "input_", "(_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "and_", "isinstance_", "(_", "t_", ",_", "struct", "\\u", "time_", ")_", "and_", "len_", "(_", "t_", "._", "args_", ")_", "==_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "t_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "and_", "isinstance_", "(_", "t_", ",_", "tuple_", ")_", "and_", "len_", "(_", "t_", ")_", "==_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "and_", "isinstance_", "(_", "t_", ",_", "struct", "\\u", "time_", ")_", "and_", "len_", "(_", "t_", "._", "args_", ")_", "!=_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "function", " ", "take", "s", " ", "exact", "ly", " ", "9", " ", "argu", "ment", "s", " ", "({}", " ", "give", "n", ")\"_", "._", "format_", "(_", "len_", "(_", "t_", "._", "args_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "and_", "isinstance_", "(_", "t_", ",_", "tuple_", ")_", "and_", "len_", "(_", "t_", ")_", "!=_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "function", " ", "take", "s", " ", "exact", "ly", " ", "9", " ", "argu", "ment", "s", " ", "({}", " ", "give", "n", ")\"_", "._", "format_", "(_", "len_", "(_", "t_", "._", "args_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "and_", "not_", "isinstance_", "(_", "t_", ",_", "(_", "tuple_", ",_", "struct", "\\u", "time_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "Tup", "le", " ", "or", " ", "struct", "\\u", "time", " ", "argu", "ment", " ", "require", "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 ", " _", "t_", "=_", "localtime_", "(_", ")_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
gkno/gkno_launcher/src/networkx/readwrite/gml.py
[ { "content": "def generate_gml(G):\n \"\"\"Generate a single entry of the graph G in GML format.\n\n Parameters\n ----------\n G : NetworkX graph\n\n Returns\n -------\n lines: string\n Lines in GML format.\n\n Notes\n -----\n This implementation does not support all Python data types as GML\n data. Nodes, node attributes, edge attributes, and graph\n attributes must be either dictionaries or single stings or\n numbers. If they are not an attempt is made to represent them as\n strings. For example, a list as edge data\n G[1][2]['somedata']=[1,2,3], will be represented in the GML file\n as::\n\n edge [\n source 1\n target 2\n somedata \"[1, 2, 3]\"\n ]\n \"\"\"\n # recursively make dicts into gml brackets\n def listify(d,indent,indentlevel):\n result='[ \\n'\n for k,v in d.items():\n if type(v)==dict:\n v=listify(v,indent,indentlevel+1)\n result += (indentlevel+1)*indent + \\\n string_item(k,v,indentlevel*indent)+'\\n'\n return result+indentlevel*indent+\"]\"\n\n def string_item(k,v,indent):\n # try to make a string of the data\n if type(v)==dict: \n v=listify(v,indent,2)\n elif is_string_like(v):\n v='\"%s\"'%v\n elif type(v)==bool:\n v=int(v)\n return \"%s %s\"%(k,v)\n\n # check for attributes or assign empty dict\n if hasattr(G,'graph_attr'):\n graph_attr=G.graph_attr\n else:\n graph_attr={}\n if hasattr(G,'node_attr'):\n node_attr=G.node_attr\n else:\n node_attr={}\n\n indent=2*' '\n count=iter(range(len(G)))\n node_id={}\n\n yield \"graph [\"\n if G.is_directed():\n yield indent+\"directed 1\"\n # write graph attributes \n for k,v in G.graph.items():\n if k == 'directed':\n continue\n yield indent+string_item(k,v,indent)\n # write nodes\n for n in G:\n yield indent+\"node [\"\n # get id or assign number\n nid=G.node[n].get('id',next(count))\n node_id[n]=nid\n yield 2*indent+\"id %s\"%nid\n label=G.node[n].get('label',n)\n if is_string_like(label):\n label='\"%s\"'%label\n yield 2*indent+'label %s'%label\n if n in G:\n for k,v in G.node[n].items():\n if k=='id' or k == 'label': continue\n yield 2*indent+string_item(k,v,indent)\n yield indent+\"]\"\n # write edges\n for u,v,edgedata in G.edges_iter(data=True):\n yield indent+\"edge [\"\n yield 2*indent+\"source %s\"%node_id[u]\n yield 2*indent+\"target %s\"%node_id[v]\n for k,v in edgedata.items():\n if k=='source': continue\n if k=='target': continue\n yield 2*indent+string_item(k,v,indent)\n yield indent+\"]\"\n yield \"]\"", "metadata": "root.generate_gml", "header": "['module', '___EOS___']", "index": 247 } ]
[ { "span": "graph_attr=", "start_line": 297, "start_column": 8, "end_line": 297, "end_column": 18 }, { "span": "graph_attr=", "start_line": 299, "start_column": 8, "end_line": 299, "end_column": 18 }, { "span": "node_attr=", "start_line": 301, "start_column": 8, "end_line": 301, "end_column": 17 }, { "span": "node_attr=", "start_line": 303, "start_column": 8, "end_line": 303, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "gm", "l_", "(_", "G_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "a", " ", "single", " ", "entry", " ", "of", " ", "the", " ", "graph", " ", "G", " ", "in", " ", "GM", "L", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "G", " ", ":", " ", "Network", "X", " ", "graph", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "lines", ":", " ", "string", "\\", "10", ";", " ", " ", " ", "Line", "s", " ", "in", " ", "GM", "L", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "implementation", " ", "doe", "s", " ", "not", " ", "support", " ", "all", " ", "Pyth", "on", " ", "data", " ", "types", " ", "as", " ", "GM", "L", "\\", "10", ";", " ", " ", " ", " ", "data", ".", " ", " ", "Node", "s", ",", " ", "node", " ", "attribute", "s", ",", " ", "edge", " ", "attribute", "s", ",", " ", "and", " ", "graph", "\\", "10", ";", " ", " ", " ", " ", "attribute", "s", " ", "must", " ", "be", " ", "eit", "her", " ", "dictionar", "ies", " ", "or", " ", "single", " ", "stin", "gs", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "numbers", ".", " ", " ", "If", " ", "the", "y", " ", "are", " ", "not", " ", "an", " ", "atte", "mpt", " ", "is", " ", "made", " ", "to", " ", "represent", " ", "them", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "string", "s", ".", " ", " ", "For", " ", "example", ",", " ", "a", " ", "list", " ", "as", " ", "edge", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "G", "[", "1", "][", "2", "]['", "some", "data", "']", "=[", "1", ",", "2", ",", "3", "],", " ", "will", " ", "be", " ", "represent", "ed", " ", "in", " ", "the", " ", "GM", "L", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "as", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "edge", " ", "[", "\\", "10", ";", " ", " ", " ", " ", " ", "source", " ", "1", "\\", "10", ";", " ", " ", " ", " ", " ", "target", " ", "2", "\\", "10", ";", " ", " ", " ", " ", " ", "some", "data", " ", "\"[", "1", ",", " ", "2", ",", " ", "3", "]\"", "\\", "10", ";", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "recurs", "ively", " ", "make", " ", "dict", "s", " ", "int", "o", " ", "gm", "l", " ", "brackets", "_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "listi", "fy_", "(_", "d_", ",_", "indent_", ",_", "indent", "level_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "'[", " ", "\\\\", "n", "'_", "\\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_", "type_", "(_", "v_", ")_", "==_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "listi", "fy_", "(_", "v_", ",_", "indent_", ",_", "indent", "level_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "+=_", "(_", "indent", "level_", "+_", "1_", ")_", "*_", "indent_", "+_", "string", "\\u", "item_", "(_", "k_", ",_", "v_", ",_", "indent", "level_", "*_", "indent_", ")_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "+_", "indent", "level_", "*_", "indent_", "+_", "\"]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "string", "\\u", "item_", "(_", "k_", ",_", "v_", ",_", "indent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "make", " ", "a", " ", "string", " ", "of", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "v_", ")_", "==_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "listi", "fy_", "(_", "v_", ",_", "indent_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "string", "\\u", "like_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "'\"", "%", "s", "\"'_", "%_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "v_", ")_", "==_", "bool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "int_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "k_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "attribute", "s", " ", "or", " ", "assign", " ", "empty", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "G_", ",_", "'", "graph", "\\u", "attr", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph", "\\u", "attr_", "=_", "G_", "._", "graph", "\\u", "attr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph", "\\u", "attr_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "G_", ",_", "'", "node", "\\u", "attr", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "\\u", "attr_", "=_", "G_", "._", "node", "\\u", "attr_", "\\u\\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", "attr_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "indent_", "=_", "2_", "*_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "iter_", "(_", "range_", "(_", "len_", "(_", "G_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "id_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "\"", "graph", " ", "[\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "G_", "._", "is", "\\u", "directed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "indent_", "+_", "\"", "direct", "ed", " ", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "write", " ", "graph", " ", "attribute", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "G_", "._", "graph_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "==_", "'", "direct", "ed", "'_", ":_", "\\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_", "yield_", "indent_", "+_", "string", "\\u", "item_", "(_", "k_", ",_", "v_", ",_", "indent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "write", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "indent_", "+_", "\"", "node", " ", "[\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "id", " ", "or", " ", "assign", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "nid_", "=_", "G_", "._", "node_", "[_", "n_", "]_", "._", "get_", "(_", "'", "id", "'_", ",_", "next_", "(_", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "id_", "[_", "n_", "]_", "=_", "nid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "2_", "*_", "indent_", "+_", "\"", "id", " ", "%", "s", "\"_", "%_", "nid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "G_", "._", "node_", "[_", "n_", "]_", "._", "get_", "(_", "'", "label", "'_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "string", "\\u", "like_", "(_", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "'\"", "%", "s", "\"'_", "%_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "2_", "*_", "indent_", "+_", "'", "label", " ", "%", "s", "'_", "%_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", ",_", "v_", "in_", "G_", "._", "node_", "[_", "n_", "]_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "==_", "'", "id", "'_", "or_", "k_", "==_", "'", "label", "'_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "2_", "*_", "indent_", "+_", "string", "\\u", "item_", "(_", "k_", ",_", "v_", ",_", "indent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "indent_", "+_", "\"]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "write", " ", "edges_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "u_", ",_", "v_", ",_", "edge", "data_", "in_", "G_", "._", "edge", "s", "\\u", "iter_", "(_", "data_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "indent_", "+_", "\"", "edge", " ", "[\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "2_", "*_", "indent_", "+_", "\"", "source", " ", "%", "s", "\"_", "%_", "node", "\\u", "id_", "[_", "u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "2_", "*_", "indent_", "+_", "\"", "target", " ", "%", "s", "\"_", "%_", "node", "\\u", "id_", "[_", "v_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "edge", "data_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "==_", "'", "source", "'_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", "==_", "'", "target", "'_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "2_", "*_", "indent_", "+_", "string", "\\u", "item_", "(_", "k_", ",_", "v_", ",_", "indent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "indent_", "+_", "\"]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "\"]\"_", "\\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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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 ]
Signature mismatch in overriding method
babble/babble/include/jython/Lib/bdb.py
[ { "content": "class Bdb:\n\n \"\"\"Generic Python debugger base class.\n\n This class takes care of details of the trace facility;\n a derived class should implement user interaction.\n The standard debugger class (pdb.Pdb) is an example.\n \"\"\"\n\n\n\n\n\n\n\n\n\n # Normally derived classes don't override the following\n # methods, but they may if they want to redefine the\n # definition of stopping and breakpoints.\n\n\n\n\n\n # Derived classes should override the user_* methods\n # to gain control.\n\n\n\n\n\n # Derived classes and clients can call the following methods\n # to affect the stepping state.\n\n\n\n\n\n\n\n # Derived classes and clients can call the following methods\n # to manipulate breakpoints. These methods return an\n # error message is something went wrong, None if all is well.\n # Set_break prints out the breakpoint line and file:lineno.\n # Call self.get_*break*() to see the breakpoints or better\n # for bp in Breakpoint.bpbynumber: if bp: bp.bpprint().\n\n\n\n\n\n\n\n\n\n\n # Derived classes and clients can call the following method\n # to get a data structure representing a stack trace.\n\n\n #\n\n\n # The following two methods can be called by clients to use\n # a debugger to debug a statement, given as a string.\n\n\n\n\n # This method is more useful to debug a single function call.\n", "metadata": "root.Bdb", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self):\n self.breaks = {}\n self.fncache = {}", "metadata": "root.Bdb.__init__", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 21 }, { "content": " def canonic(self, filename):\n if filename == \"<\" + filename[1:-1] + \">\":\n return filename\n canonic = self.fncache.get(filename)\n if not canonic:\n canonic = os.path.abspath(filename)\n canonic = os.path.normcase(canonic)\n self.fncache[filename] = canonic\n return canonic", "metadata": "root.Bdb.canonic", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 25 }, { "content": " def reset(self):\n import linecache\n linecache.checkcache()\n self.botframe = None\n self.stopframe = None\n self.returnframe = None\n self.quitting = 0", "metadata": "root.Bdb.reset", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 35 }, { "content": " def trace_dispatch(self, frame, event, arg):\n if self.quitting:\n return # None\n if event == 'line':\n return self.dispatch_line(frame)\n if event == 'call':\n return self.dispatch_call(frame, arg)\n if event == 'return':\n return self.dispatch_return(frame, arg)\n if event == 'exception':\n return self.dispatch_exception(frame, arg)\n if event == 'c_call':\n return self.trace_dispatch\n if event == 'c_exception':\n return self.trace_dispatch\n if event == 'c_return':\n return self.trace_dispatch\n print 'bdb.Bdb.dispatch: unknown debugging event:', repr(event)\n return self.trace_dispatch", "metadata": "root.Bdb.trace_dispatch", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 43 }, { "content": " def dispatch_line(self, frame):\n if self.stop_here(frame) or self.break_here(frame):\n self.user_line(frame)\n if self.quitting: raise BdbQuit\n return self.trace_dispatch", "metadata": "root.Bdb.dispatch_line", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 63 }, { "content": " def dispatch_call(self, frame, arg):\n # XXX 'arg' is no longer used\n if self.botframe is None:\n # First call of dispatch since reset()\n self.botframe = frame.f_back # (CT) Note that this may also be None!\n return self.trace_dispatch\n if not (self.stop_here(frame) or self.break_anywhere(frame)):\n # No need to trace this function\n return # None\n self.user_call(frame, arg)\n if self.quitting: raise BdbQuit\n return self.trace_dispatch", "metadata": "root.Bdb.dispatch_call", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 69 }, { "content": " def dispatch_return(self, frame, arg):\n if self.stop_here(frame) or frame == self.returnframe:\n self.user_return(frame, arg)\n if self.quitting: raise BdbQuit\n return self.trace_dispatch", "metadata": "root.Bdb.dispatch_return", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 82 }, { "content": " def dispatch_exception(self, frame, arg):\n if self.stop_here(frame):\n self.user_exception(frame, arg)\n if self.quitting: raise BdbQuit\n return self.trace_dispatch", "metadata": "root.Bdb.dispatch_exception", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 88 }, { "content": " def stop_here(self, frame):\n # (CT) stopframe may now also be None, see dispatch_call.\n # (CT) the former test for None is therefore removed from here.\n if frame is self.stopframe:\n return True\n while frame is not None and frame is not self.stopframe:\n if frame is self.botframe:\n return True\n frame = frame.f_back\n return False", "metadata": "root.Bdb.stop_here", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 98 }, { "content": " def break_here(self, frame):\n filename = self.canonic(frame.f_code.co_filename)\n if not filename in self.breaks:\n return False\n lineno = frame.f_lineno\n if not lineno in self.breaks[filename]:\n # The line itself has no breakpoint, but maybe the line is the\n # first line of a function with breakpoint set by function name.\n lineno = frame.f_code.co_firstlineno\n if not lineno in self.breaks[filename]:\n return False\n\n # flag says ok to delete temp. bp\n (bp, flag) = effective(filename, lineno, frame)\n if bp:\n self.currentbp = bp.number\n if (flag and bp.temporary):\n self.do_clear(str(bp.number))\n return True\n else:\n return False", "metadata": "root.Bdb.break_here", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 109 }, { "content": " def do_clear(self, arg):\n raise NotImplementedError, \"subclass of bdb must implement do_clear()\"", "metadata": "root.Bdb.do_clear", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 131 }, { "content": " def break_anywhere(self, frame):\n return self.breaks.has_key(\n self.canonic(frame.f_code.co_filename))", "metadata": "root.Bdb.break_anywhere", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 134 }, { "content": " def user_call(self, frame, argument_list):\n \"\"\"This method is called when there is the remote possibility\n that we ever need to stop in this function.\"\"\"\n pass", "metadata": "root.Bdb.user_call", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 141 }, { "content": " def user_line(self, frame):\n \"\"\"This method is called when we stop or break at this line.\"\"\"\n pass", "metadata": "root.Bdb.user_line", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 146 }, { "content": " def user_return(self, frame, return_value):\n \"\"\"This method is called when a return trap is set here.\"\"\"\n pass", "metadata": "root.Bdb.user_return", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 150 }, { "content": " def user_exception(self, frame, (exc_type, exc_value, exc_traceback)):\n \"\"\"This method is called if an exception occurs,\n but only if we are to stop at or just below this level.\"\"\"\n pass", "metadata": "root.Bdb.user_exception", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 154 }, { "content": " def set_step(self):\n \"\"\"Stop after one line of code.\"\"\"\n self.stopframe = None\n self.returnframe = None\n self.quitting = 0", "metadata": "root.Bdb.set_step", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 162 }, { "content": " def set_next(self, frame):\n \"\"\"Stop on the next line in or below the given frame.\"\"\"\n self.stopframe = frame\n self.returnframe = None\n self.quitting = 0", "metadata": "root.Bdb.set_next", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 168 }, { "content": " def set_return(self, frame):\n \"\"\"Stop when returning from the given frame.\"\"\"\n self.stopframe = frame.f_back\n self.returnframe = frame\n self.quitting = 0", "metadata": "root.Bdb.set_return", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 174 }, { "content": " def set_trace(self, frame=None):\n \"\"\"Start debugging from `frame`.\n\n If frame is not specified, debugging starts from caller's frame.\n \"\"\"\n if frame is None:\n frame = sys._getframe().f_back\n self.reset()\n while frame:\n frame.f_trace = self.trace_dispatch\n self.botframe = frame\n frame = frame.f_back\n self.set_step()\n sys.settrace(self.trace_dispatch)", "metadata": "root.Bdb.set_trace", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 180 }, { "content": " def set_continue(self):\n # Don't stop except at breakpoints or when finished\n self.stopframe = self.botframe\n self.returnframe = None\n self.quitting = 0\n if not self.breaks:\n # no breakpoints; run without debugger overhead\n sys.settrace(None)\n frame = sys._getframe().f_back\n while frame and frame is not self.botframe:\n del frame.f_trace\n frame = frame.f_back", "metadata": "root.Bdb.set_continue", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 195 }, { "content": " def set_quit(self):\n self.stopframe = self.botframe\n self.returnframe = None\n self.quitting = 1\n sys.settrace(None)", "metadata": "root.Bdb.set_quit", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 208 }, { "content": " def set_break(self, filename, lineno, temporary=0, cond = None,\n funcname=None):\n filename = self.canonic(filename)\n import linecache # Import as late as possible\n line = linecache.getline(filename, lineno)\n if not line:\n return 'Line %s:%d does not exist' % (filename,\n lineno)\n if not filename in self.breaks:\n self.breaks[filename] = []\n list = self.breaks[filename]\n if not lineno in list:\n list.append(lineno)\n bp = Breakpoint(filename, lineno, temporary, cond, funcname)", "metadata": "root.Bdb.set_break", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 221 }, { "content": " def clear_break(self, filename, lineno):\n filename = self.canonic(filename)\n if not filename in self.breaks:\n return 'There are no breakpoints in %s' % filename\n if lineno not in self.breaks[filename]:\n return 'There is no breakpoint at %s:%d' % (filename,\n lineno)\n # If there's only one bp in the list for that file,line\n # pair, then remove the breaks entry\n for bp in Breakpoint.bplist[filename, lineno][:]:\n bp.deleteMe()\n if not Breakpoint.bplist.has_key((filename, lineno)):\n self.breaks[filename].remove(lineno)\n if not self.breaks[filename]:\n del self.breaks[filename]", "metadata": "root.Bdb.clear_break", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 236 }, { "content": " def clear_bpbynumber(self, arg):\n try:\n number = int(arg)\n except:\n return 'Non-numeric breakpoint number (%s)' % arg\n try:\n bp = Breakpoint.bpbynumber[number]\n except IndexError:\n return 'Breakpoint number (%d) out of range' % number\n if not bp:\n return 'Breakpoint (%d) already deleted' % number\n self.clear_break(bp.file, bp.line)", "metadata": "root.Bdb.clear_bpbynumber", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 252 }, { "content": " def clear_all_file_breaks(self, filename):\n filename = self.canonic(filename)\n if not filename in self.breaks:\n return 'There are no breakpoints in %s' % filename\n for line in self.breaks[filename]:\n blist = Breakpoint.bplist[filename, line]\n for bp in blist:\n bp.deleteMe()\n del self.breaks[filename]", "metadata": "root.Bdb.clear_all_file_breaks", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 265 }, { "content": " def clear_all_breaks(self):\n if not self.breaks:\n return 'There are no breakpoints'\n for bp in Breakpoint.bpbynumber:\n if bp:\n bp.deleteMe()\n self.breaks = {}", "metadata": "root.Bdb.clear_all_breaks", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 275 }, { "content": " def get_break(self, filename, lineno):\n filename = self.canonic(filename)\n return filename in self.breaks and \\\n lineno in self.breaks[filename]", "metadata": "root.Bdb.get_break", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 283 }, { "content": " def get_breaks(self, filename, lineno):\n filename = self.canonic(filename)\n return filename in self.breaks and \\\n lineno in self.breaks[filename] and \\\n Breakpoint.bplist[filename, lineno] or []", "metadata": "root.Bdb.get_breaks", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 288 }, { "content": " def get_file_breaks(self, filename):\n filename = self.canonic(filename)\n if filename in self.breaks:\n return self.breaks[filename]\n else:\n return []", "metadata": "root.Bdb.get_file_breaks", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 294 }, { "content": " def get_all_breaks(self):\n return self.breaks", "metadata": "root.Bdb.get_all_breaks", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 301 }, { "content": " def get_stack(self, f, t):\n stack = []\n if t and t.tb_frame is f:\n t = t.tb_next\n while f is not None:\n stack.append((f, f.f_lineno))\n if f is self.botframe:\n break\n f = f.f_back\n stack.reverse()\n i = max(0, len(stack) - 1)\n while t is not None:\n stack.append((t.tb_frame, t.tb_lineno))\n t = t.tb_next\n return stack, i", "metadata": "root.Bdb.get_stack", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 307 }, { "content": " def format_stack_entry(self, frame_lineno, lprefix=': '):\n import linecache, repr\n frame, lineno = frame_lineno\n filename = self.canonic(frame.f_code.co_filename)\n s = '%s(%r)' % (filename, lineno)\n if frame.f_code.co_name:\n s = s + frame.f_code.co_name\n else:\n s = s + \"<lambda>\"\n if '__args__' in frame.f_locals:\n args = frame.f_locals['__args__']\n else:\n args = None\n if args:\n s = s + repr.repr(args)\n else:\n s = s + '()'\n if '__return__' in frame.f_locals:\n rv = frame.f_locals['__return__']\n s = s + '->'\n s = s + repr.repr(rv)\n line = linecache.getline(filename, lineno)\n if line: s = s + lprefix + line.strip()\n return s", "metadata": "root.Bdb.format_stack_entry", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 325 }, { "content": " def run(self, cmd, globals=None, locals=None):\n if globals is None:\n import __main__\n globals = __main__.__dict__\n if locals is None:\n locals = globals\n self.reset()\n sys.settrace(self.trace_dispatch)\n if not isinstance(cmd, types.CodeType):\n cmd = cmd+'\\n'\n try:\n try:\n exec cmd in globals, locals\n except BdbQuit:\n pass\n finally:\n self.quitting = 1\n sys.settrace(None)", "metadata": "root.Bdb.run", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 353 }, { "content": " def runeval(self, expr, globals=None, locals=None):\n if globals is None:\n import __main__\n globals = __main__.__dict__\n if locals is None:\n locals = globals\n self.reset()\n sys.settrace(self.trace_dispatch)\n if not isinstance(expr, types.CodeType):\n expr = expr+'\\n'\n try:\n try:\n return eval(expr, globals, locals)\n except BdbQuit:\n pass\n finally:\n self.quitting = 1\n sys.settrace(None)", "metadata": "root.Bdb.runeval", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 372 }, { "content": " def runctx(self, cmd, globals, locals):\n # B/W compatibility\n self.run(cmd, globals, locals)", "metadata": "root.Bdb.runctx", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 391 }, { "content": " def runcall(self, func, *args, **kwds):\n self.reset()\n sys.settrace(self.trace_dispatch)\n res = None\n try:\n try:\n res = func(*args, **kwds)\n except BdbQuit:\n pass\n finally:\n self.quitting = 1\n sys.settrace(None)\n return res", "metadata": "root.Bdb.runcall", "header": "['class', 'Bdb', ':', '___EOS___']", "index": 397 }, { "content": "class Tdb(Bdb):", "metadata": "root.Tdb", "header": "['module', '___EOS___']", "index": 581 }, { "content": " def user_call(self, frame, args):\n name = frame.f_code.co_name\n if not name: name = '???'\n print '+++ call', name, args", "metadata": "root.Tdb.user_call", "header": "['class', 'Tdb', '(', 'Bdb', ')', ':', '___EOS___']", "index": 582 }, { "content": " def user_line(self, frame):\n import linecache\n name = frame.f_code.co_name\n if not name: name = '???'\n fn = self.canonic(frame.f_code.co_filename)\n line = linecache.getline(fn, frame.f_lineno)\n print '+++', fn, frame.f_lineno, name, ':', line.strip()", "metadata": "root.Tdb.user_line", "header": "['class', 'Tdb', '(', 'Bdb', ')', ':', '___EOS___']", "index": 586 }, { "content": " def user_return(self, frame, retval):\n print '+++ return', retval", "metadata": "root.Tdb.user_return", "header": "['class', 'Tdb', '(', 'Bdb', ')', ':', '___EOS___']", "index": 593 }, { "content": " def user_exception(self, frame, exc_stuff):\n print '+++ exception', exc_stuff\n self.set_continue()", "metadata": "root.Tdb.user_exception", "header": "['class', 'Tdb', '(', 'Bdb', ')', ':', '___EOS___']", "index": 595 } ]
[ { "span": "def user_exception(self, frame, exc_stuff):", "start_line": 595, "start_column": 4, "end_line": 595, "end_column": 47 } ]
[ { "span": "def user_exception(self, frame, (exc_type, exc_value, exc_traceback)):", "start_line": 154, "start_column": 4, "end_line": 154, "end_column": 74 } ]
1
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bd", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Gene", "ric", " ", "Pyth", "on", " ", "debugg", "er", " ", "base", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "take", "s", " ", "care", " ", "of", " ", "deta", "il", "s", " ", "of", " ", "the", " ", "trace", " ", "facilit", "y", ";", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "derive", "d", " ", "class", " ", "shou", "ld", " ", "implement", " ", "user", " ", "interacti", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "standard", " ", "debugg", "er", " ", "class", " ", "(", "pdb", ".", "Pd", "b", ")", " ", "is", " ", "an", " ", "example", ".", "\\", "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_", "#", " ", "Normal", "ly", " ", "derive", "d", " ", "classe", "s", " ", "don", "'", "t", " ", "override", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "method", "s", ",", " ", "but", " ", "the", "y", " ", "may", " ", "if", " ", "the", "y", " ", "want", " ", "to", " ", "rede", "fine", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "definit", "ion", " ", "of", " ", "stopping", " ", "and", " ", "breakpoints", "._", "\\u\\u\\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_", "#", " ", "Derive", "d", " ", "classe", "s", " ", "shou", "ld", " ", "override", " ", "the", " ", "user", "\\u*", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "gain", " ", "control", "._", "\\u\\u\\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_", "#", " ", "Derive", "d", " ", "classe", "s", " ", "and", " ", "clients", " ", "can", " ", "call", " ", "the", " ", "follow", "ing", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "affect", " ", "the", " ", "step", "ping", " ", "state", "._", "\\u\\u\\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_", "#", " ", "Derive", "d", " ", "classe", "s", " ", "and", " ", "clients", " ", "can", " ", "call", " ", "the", " ", "follow", "ing", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "manipulate", " ", "breakpoints", ".", " ", " ", "The", "se", " ", "method", "s", " ", "return", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", " ", "message", " ", "is", " ", "somet", "hing", " ", "wen", "t", " ", "wrong", ",", " ", "Non", "e", " ", "if", " ", "all", " ", "is", " ", "well", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "\\u", "break", " ", "print", "s", " ", "out", " ", "the", " ", "break", "point", " ", "line", " ", "and", " ", "file", ":", "linen", "o", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "self", ".", "get", "\\u*", "break", "*(", ")", " ", "to", " ", "see", " ", "the", " ", "breakpoints", " ", "or", " ", "bett", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "bp", " ", "in", " ", "Breakpoint", ".", "bp", "by", "number", ":", " ", "if", " ", "bp", ":", " ", "bp", ".", "bp", "print", "()", "._", "\\u\\u\\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_", "#", " ", "Derive", "d", " ", "classe", "s", " ", "and", " ", "clients", " ", "can", " ", "call", " ", "the", " ", "follow", "ing", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "get", " ", "a", " ", "data", " ", "structure", " ", "represent", "ing", " ", "a", " ", "stack", " ", "trace", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "The", " ", "follow", "ing", " ", "two", " ", "method", "s", " ", "can", " ", "be", " ", "call", "ed", " ", "by", " ", "clients", " ", "to", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "debugg", "er", " ", "to", " ", "debug", " ", "a", " ", "statem", "ent", ",", " ", "give", "n", " ", "as", " ", "a", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "method", " ", "is", " ", "more", " ", "usef", "ul", " ", "to", " ", "debug", " ", "a", " ", "single", " ", "function", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "breaks_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fnc", "ache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "canon", "ic_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "filename_", "==_", "\"<\"_", "+_", "filename_", "[_", "1_", ":_", "-_", "1_", "]_", "+_", "\">\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "canon", "ic_", "=_", "self_", "._", "fnc", "ache_", "._", "get_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "canon", "ic_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "canon", "ic_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canon", "ic_", "=_", "os_", "._", "path_", "._", "norm", "case_", "(_", "canon", "ic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fnc", "ache_", "[_", "filename_", "]_", "=_", "canon", "ic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "canon", "ic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "linec", "ache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linec", "ache_", "._", "check", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bot", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "return", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quit", "ting_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "trace", "\\u", "dispatch_", "(_", "self_", ",_", "frame_", ",_", "event_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "quit", "ting_", ":_", "\\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_", "event_", "==_", "'", "line", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dispatch", "\\u", "line_", "(_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "==_", "'", "call", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dispatch", "\\u", "call_", "(_", "frame_", ",_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "==_", "'", "return", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dispatch", "\\u", "return_", "(_", "frame_", ",_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "==_", "'", "exception", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dispatch", "\\u", "exception_", "(_", "frame_", ",_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "==_", "'", "c\\u", "call", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "trace", "\\u", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "==_", "'", "c\\u", "exception", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "trace", "\\u", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "==_", "'", "c\\u", "return", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "trace", "\\u", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "bdb", ".", "Bd", "b", ".", "dispatch", ":", " ", "unknown", " ", "debugg", "ing", " ", "event", ":'_", ",_", "repr_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "trace", "\\u", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispatch", "\\u", "line_", "(_", "self_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "stop", "\\u", "here_", "(_", "frame_", ")_", "or_", "self_", "._", "break", "\\u", "here_", "(_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "\\u", "line_", "(_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "quit", "ting_", ":_", "raise_", "Bd", "b", "Quit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "trace", "\\u", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispatch", "\\u", "call_", "(_", "self_", ",_", "frame_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "'", "arg", "'", " ", "is", " ", "no", " ", "long", "er", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "bot", "frame_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "call", " ", "of", " ", "dispatch", " ", "sinc", "e", " ", "reset", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bot", "frame_", "=_", "frame_", "._", "f", "\\u", "back_", "#", " ", "(", "CT", ")", " ", "Not", "e", " ", "tha", "t", " ", "this", " ", "may", " ", "als", "o", " ", "be", " ", "Non", "e", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "trace", "\\u", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "self_", "._", "stop", "\\u", "here_", "(_", "frame_", ")_", "or_", "self_", "._", "break", "\\u", "any", "where_", "(_", "frame_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "need", " ", "to", " ", "trace", " ", "this", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "#", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "user", "\\u", "call_", "(_", "frame_", ",_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "quit", "ting_", ":_", "raise_", "Bd", "b", "Quit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "trace", "\\u", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispatch", "\\u", "return_", "(_", "self_", ",_", "frame_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "stop", "\\u", "here_", "(_", "frame_", ")_", "or_", "frame_", "==_", "self_", "._", "return", "frame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "\\u", "return_", "(_", "frame_", ",_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "quit", "ting_", ":_", "raise_", "Bd", "b", "Quit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "trace", "\\u", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispatch", "\\u", "exception_", "(_", "self_", ",_", "frame_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "stop", "\\u", "here_", "(_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "\\u", "exception_", "(_", "frame_", ",_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "quit", "ting_", ":_", "raise_", "Bd", "b", "Quit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "trace", "\\u", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop", "\\u", "here_", "(_", "self_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "(", "CT", ")", " ", "stop", "frame", " ", "may", " ", "now", " ", "als", "o", " ", "be", " ", "Non", "e", ",", " ", "see", " ", "dispatch", "\\u", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "CT", ")", " ", "the", " ", "former", " ", "test", " ", "for", " ", "Non", "e", " ", "is", " ", "there", "fore", " ", "remove", "d", " ", "from", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "frame_", "is_", "self_", "._", "stop", "frame_", ":_", "\\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_", "while_", "frame_", "is_", "not_", "None_", "and_", "frame_", "is_", "not_", "self_", "._", "stop", "frame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "frame_", "is_", "self_", "._", "bot", "frame_", ":_", "\\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_", "frame_", "=_", "frame_", "._", "f", "\\u", "back_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "break", "\\u", "here_", "(_", "self_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "canon", "ic_", "(_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "filename_", "in_", "self_", "._", "breaks_", ":_", "\\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_", "lineno_", "=_", "frame_", "._", "f", "\\u", "lineno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "lineno_", "in_", "self_", "._", "breaks_", "[_", "filename_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "line", " ", "its", "elf", " ", "has", " ", "no", " ", "break", "point", ",", " ", "but", " ", "may", "be", " ", "the", " ", "line", " ", "is", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "line", " ", "of", " ", "a", " ", "function", " ", "with", " ", "break", "point", " ", "set", " ", "by", " ", "function", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lineno_", "=_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "firstl", "inen", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "lineno_", "in_", "self_", "._", "breaks_", "[_", "filename_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flag", " ", "say", "s", " ", "ok", " ", "to", " ", "delete", " ", "temp", ".", " ", "bp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "bp_", ",_", "flag_", ")_", "=_", "effective", "_", "(_", "filename_", ",_", "lineno_", ",_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "current", "bp_", "=_", "bp_", "._", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "flag_", "and_", "bp_", "._", "temporar", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "do", "\\u", "clear_", "(_", "str_", "(_", "bp_", "._", "number_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "clear_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", ",_", "\"", "subclass", " ", "of", " ", "bdb", " ", "must", " ", "implement", " ", "do", "\\u", "clear", "()\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "break", "\\u", "any", "where_", "(_", "self_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "breaks_", "._", "has", "\\u", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "canon", "ic_", "(_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "call_", "(_", "self_", ",_", "frame_", ",_", "argu", "ment", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "whe", "n", " ", "there", " ", "is", " ", "the", " ", "remote", " ", "possibilit", "y", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "we", " ", "ever", " ", "need", " ", "to", " ", "stop", " ", "in", " ", "this", " ", "function", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "line_", "(_", "self_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "whe", "n", " ", "we", " ", "stop", " ", "or", " ", "break", " ", "at", " ", "this", " ", "line", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "return_", "(_", "self_", ",_", "frame_", ",_", "return", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "whe", "n", " ", "a", " ", "return", " ", "trap", " ", "is", " ", "set", " ", "here", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "exception_", "(_", "self_", ",_", "frame_", ",_", "(_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "traceback_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "if", " ", "an", " ", "exception", " ", "occur", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "only", " ", "if", " ", "we", " ", "are", " ", "to", " ", "stop", " ", "at", " ", "or", " ", "just", " ", "belo", "w", " ", "this", " ", "level", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "step_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sto", "p", " ", "after", " ", "one", " ", "line", " ", "of", " ", "code", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "return", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quit", "ting_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "next_", "(_", "self_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sto", "p", " ", "on", " ", "the", " ", "next", " ", "line", " ", "in", " ", "or", " ", "belo", "w", " ", "the", " ", "give", "n", " ", "frame", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "frame_", "=_", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "return", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quit", "ting_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "return_", "(_", "self_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sto", "p", " ", "whe", "n", " ", "return", "ing", " ", "from", " ", "the", " ", "give", "n", " ", "frame", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "frame_", "=_", "frame_", "._", "f", "\\u", "back_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "return", "frame_", "=_", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quit", "ting_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "trace_", "(_", "self_", ",_", "frame_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", " ", "debugg", "ing", " ", "from", " ", "`", "frame", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "frame", " ", "is", " ", "not", " ", "specified", ",", " ", "debugg", "ing", " ", "starts", " ", "from", " ", "caller", "'", "s", " ", "frame", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "frame_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "sys_", "._", "\\u", "getframe_", "(_", ")_", "._", "f", "\\u", "back_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "frame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "._", "f", "\\u", "trace_", "=_", "self_", "._", "trace", "\\u", "dispatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bot", "frame_", "=_", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame_", "=_", "frame_", "._", "f", "\\u", "back_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "step_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "sett", "race_", "(_", "self_", "._", "trace", "\\u", "dispatch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "continue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "stop", " ", "except", " ", "at", " ", "breakpoints", " ", "or", " ", "whe", "n", " ", "finished_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stop", "frame_", "=_", "self_", "._", "bot", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "return", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quit", "ting_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "breaks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "breakpoints", ";", " ", "run", " ", "with", "out", " ", "debugg", "er", " ", "overhead", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "sett", "race_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame_", "=_", "sys_", "._", "\\u", "getframe_", "(_", ")_", "._", "f", "\\u", "back_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "frame_", "and_", "frame_", "is_", "not_", "self_", "._", "bot", "frame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "frame_", "._", "f", "\\u", "trace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame_", "=_", "frame_", "._", "f", "\\u", "back_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\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_", "set\\u", "quit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stop", "frame_", "=_", "self_", "._", "bot", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "return", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quit", "ting_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "sett", "race_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "break_", "(_", "self_", ",_", "filename_", ",_", "lineno_", ",_", "temporar", "y_", "=_", "0_", ",_", "cond_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "funcname_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "canon", "ic_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "linec", "ache_", "#", " ", "Import", " ", "as", " ", "late", " ", "as", " ", "possible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "linec", "ache_", "._", "getl", "ine_", "(_", "filename_", ",_", "lineno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Line", " ", "%", "s", ":", "%", "d", " ", "doe", "s", " ", "not", " ", "exist", "'_", "%_", "(_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lineno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "filename_", "in_", "self_", "._", "breaks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "breaks_", "[_", "filename_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list_", "=_", "self_", "._", "breaks_", "[_", "filename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "lineno_", "in_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "._", "append_", "(_", "lineno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bp_", "=_", "Breakpoint", "_", "(_", "filename_", ",_", "lineno_", ",_", "temporar", "y_", ",_", "cond_", ",_", "funcname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "break_", "(_", "self_", ",_", "filename_", ",_", "lineno_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "canon", "ic_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "filename_", "in_", "self_", "._", "breaks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "There", " ", "are", " ", "no", " ", "breakpoints", " ", "in", " ", "%", "s", "'_", "%_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lineno_", "not_", "in_", "self_", "._", "breaks_", "[_", "filename_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "There", " ", "is", " ", "no", " ", "break", "point", " ", "at", " ", "%", "s", ":", "%", "d", "'_", "%_", "(_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lineno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "there", "'", "s", " ", "only", " ", "one", " ", "bp", " ", "in", " ", "the", " ", "list", " ", "for", " ", "tha", "t", " ", "file", ",", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pair", ",", " ", "then", " ", "remove", " ", "the", " ", "breaks", " ", "entry_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "bp_", "in_", "Breakpoint", "_", "._", "bp", "list_", "[_", "filename_", ",_", "lineno_", "]_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bp_", "._", "delete", "Me_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "Breakpoint", "_", "._", "bp", "list_", "._", "has", "\\u", "key_", "(_", "(_", "filename_", ",_", "lineno_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "breaks_", "[_", "filename_", "]_", "._", "remove_", "(_", "lineno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "breaks_", "[_", "filename_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "breaks_", "[_", "filename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "bp", "by", "number_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\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 ", " _", "number_", "=_", "int_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Non", "-", "numeri", "c", " ", "break", "point", " ", "number", " ", "(%", "s", ")'_", "%_", "arg_", "\\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 ", " _", "bp_", "=_", "Breakpoint", "_", "._", "bp", "by", "number_", "[_", "number_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Breakpoint", " ", "number", " ", "(%", "d", ")", " ", "out", " ", "of", " ", "range", "'_", "%_", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "bp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Breakpoint", " ", "(%", "d", ")", " ", "alr", "ead", "y", " ", "delete", "d", "'_", "%_", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "clear", "\\u", "break_", "(_", "bp_", "._", "file_", ",_", "bp_", "._", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "all", "\\u", "file", "\\u", "breaks_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "canon", "ic_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "filename_", "in_", "self_", "._", "breaks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "There", " ", "are", " ", "no", " ", "breakpoints", " ", "in", " ", "%", "s", "'_", "%_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "self_", "._", "breaks_", "[_", "filename_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blis", "t_", "=_", "Breakpoint", "_", "._", "bp", "list_", "[_", "filename_", ",_", "line_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "bp_", "in_", "blis", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bp_", "._", "delete", "Me_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "self_", "._", "breaks_", "[_", "filename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "all", "\\u", "breaks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "breaks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "There", " ", "are", " ", "no", " ", "breakpoints", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "bp_", "in_", "Breakpoint", "_", "._", "bp", "by", "number_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bp_", "._", "delete", "Me_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "breaks_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "break_", "(_", "self_", ",_", "filename_", ",_", "lineno_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "canon", "ic_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "filename_", "in_", "self_", "._", "breaks_", "and_", "lineno_", "in_", "self_", "._", "breaks_", "[_", "filename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "breaks_", "(_", "self_", ",_", "filename_", ",_", "lineno_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "canon", "ic_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "filename_", "in_", "self_", "._", "breaks_", "and_", "lineno_", "in_", "self_", "._", "breaks_", "[_", "filename_", "]_", "and_", "Breakpoint", "_", "._", "bp", "list_", "[_", "filename_", ",_", "lineno_", "]_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "file", "\\u", "breaks_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "canon", "ic_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filename_", "in_", "self_", "._", "breaks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "breaks_", "[_", "filename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\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", "all", "\\u", "breaks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "breaks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "stack_", "(_", "self_", ",_", "f_", ",_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stack_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "t_", "and_", "t_", "._", "tb", "\\u", "frame_", "is_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "t_", "._", "tb", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "f_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stack_", "._", "append_", "(_", "(_", "f_", ",_", "f_", "._", "f", "\\u", "lineno_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "is_", "self_", "._", "bot", "frame_", ":_", "\\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_", "f_", "=_", "f_", "._", "f", "\\u", "back_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stack_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "max_", "(_", "0_", ",_", "len_", "(_", "stack_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "t_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stack_", "._", "append_", "(_", "(_", "t_", "._", "tb", "\\u", "frame_", ",_", "t_", "._", "tb", "\\u", "lineno_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "t_", "._", "tb", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "stack_", ",_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "format\\u", "stack", "\\u", "entry_", "(_", "self_", ",_", "frame", "\\u", "lineno_", ",_", "lpr", "efi", "x_", "=_", "':", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "linec", "ache_", ",_", "repr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame_", ",_", "lineno_", "=_", "frame", "\\u", "lineno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "self_", "._", "canon", "ic_", "(_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "'%", "s", "(%", "r", ")'_", "%_", "(_", "filename_", ",_", "lineno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "s_", "+_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\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 ", " _", "s_", "=_", "s_", "+_", "\"<", "lambda", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "\\u", "args", "\\u\\u'_", "in_", "frame_", "._", "f", "\\u", "locals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "frame_", "._", "f", "\\u", "locals_", "[_", "'\\u", "\\u", "args", "\\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 ", " _", "args_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "s_", "+_", "repr_", "._", "repr_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "s_", "+_", "'()'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "\\u", "return", "\\u\\u'_", "in_", "frame_", "._", "f", "\\u", "locals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "frame_", "._", "f", "\\u", "locals_", "[_", "'\\u", "\\u", "return", "\\u\\u'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "s_", "+_", "'->", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "s_", "+_", "repr_", "._", "repr_", "(_", "rv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line_", "=_", "linec", "ache_", "._", "getl", "ine_", "(_", "filename_", ",_", "lineno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", ":_", "s_", "=_", "s_", "+_", "lpr", "efi", "x_", "+_", "line_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "cmd_", ",_", "globals_", "=_", "None_", ",_", "locals_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "globals_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u\\u", "main\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "globals_", "=_", "\\u\\u", "main\\u\\u_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "locals_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locals_", "=_", "globals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "sett", "race_", "(_", "self_", "._", "trace", "\\u", "dispatch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "cmd_", ",_", "types_", "._", "Code", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "cmd_", "+_", "'\\\\", "n", "'_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "cmd_", "in_", "globals_", ",_", "locals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Bd", "b", "Quit_", ":_", "\\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_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "quit", "ting_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "sett", "race_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rune", "val_", "(_", "self_", ",_", "expr_", ",_", "globals_", "=_", "None_", ",_", "locals_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "globals_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u\\u", "main\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "globals_", "=_", "\\u\\u", "main\\u\\u_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "locals_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locals_", "=_", "globals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "sett", "race_", "(_", "self_", "._", "trace", "\\u", "dispatch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "expr_", ",_", "types_", "._", "Code", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expr_", "=_", "expr_", "+_", "'\\\\", "n", "'_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "eval_", "(_", "expr_", ",_", "globals_", ",_", "locals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Bd", "b", "Quit_", ":_", "\\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_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "quit", "ting_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "sett", "race_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "runc", "tx_", "(_", "self_", ",_", "cmd_", ",_", "globals_", ",_", "locals_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "B", "/", "W", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "cmd_", ",_", "globals_", ",_", "locals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bd", "b_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "runc", "all_", "(_", "self_", ",_", "func_", ",_", "*_", "args_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "sett", "race_", "(_", "self_", "._", "trace", "\\u", "dispatch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "func_", "(_", "*_", "args_", ",_", "**_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Bd", "b", "Quit_", ":_", "\\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_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "quit", "ting_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "sett", "race_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Td", "b_", "(_", "Bd", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Td", "b_", "(_", "Bd", "b_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "user", "\\u", "call_", "(_", "self_", ",_", "frame_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "name_", ":_", "name_", "=_", "'?", "??", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'+", "++", " ", "call", "'_", ",_", "name_", ",_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Td", "b_", "(_", "Bd", "b_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "line_", "(_", "self_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "linec", "ache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "name_", ":_", "name_", "=_", "'?", "??", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "self_", "._", "canon", "ic_", "(_", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "linec", "ache_", "._", "getl", "ine_", "(_", "fn_", ",_", "frame_", "._", "f", "\\u", "lineno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'+", "++'_", ",_", "fn_", ",_", "frame_", "._", "f", "\\u", "lineno_", ",_", "name_", ",_", "':'_", ",_", "line_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Td", "b_", "(_", "Bd", "b_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "return_", "(_", "self_", ",_", "frame_", ",_", "retval_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'+", "++", " ", "return", "'_", ",_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Td", "b_", "(_", "Bd", "b_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "exception_", "(_", "self_", ",_", "frame_", ",_", "exc", "\\u", "stuff_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'+", "++", " ", "exception", "'_", ",_", "exc", "\\u", "stuff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "continue_", "(_", ")_", "\\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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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
lbryio/lbry/lbrynet/lbrynet_daemon/LBRYDaemon.py
[ { "content": " def __init__(self, ui_version_info, wallet_type=\"lbryum\"):\n jsonrpc.JSONRPC.__init__(self)\n reactor.addSystemEventTrigger('before', 'shutdown', self._shutdown)\n\n self.startup_status = STARTUP_STAGES[0]\n self.startup_message = None\n self.announced_startup = False\n self.query_handlers = {}\n self.ui_version = ui_version_info.replace('\\n', '')\n self.git_lbrynet_version = None\n self.git_lbryum_version = None\n self.wallet_type = wallet_type\n self.session_settings = None\n self.first_run = None\n self.log_file = LOG_FILENAME\n self.fetcher = None\n self.current_db_revision = 1\n self.run_server = True\n self.session = None\n self.known_dht_nodes = KNOWN_DHT_NODES\n self.platform_info = {\n \"processor\": platform.processor(),\n \"python_version: \": platform.python_version(),\n \"platform\": platform.platform(),\n \"os_release\": platform.release(),\n \"os_system\": platform.system(),\n \"lbrynet_version: \": lbrynet_version,\n \"lbryum_version: \": lbryum_version,\n \"ui_version\": self.ui_version,\n }\n try:\n self.platform_info['ip'] = json.load(urlopen('http://jsonip.com'))['ip']\n except:\n self.platform_info['ip'] = \"Could not determine\"\n\n if os.name == \"nt\":\n from lbrynet.winhelpers.knownpaths import get_path, FOLDERID, UserHandle\n self.download_directory = get_path(FOLDERID.Downloads, UserHandle.current)\n self.db_dir = os.path.join(get_path(FOLDERID.RoamingAppData, UserHandle.current), \"lbrynet\")\n self.lbrycrdd_path = \"lbrycrdd.exe\"\n if wallet_type == \"lbrycrd\":\n self.wallet_dir = os.path.join(get_path(FOLDERID.RoamingAppData, UserHandle.current), \"lbrycrd\")\n else:\n self.wallet_dir = os.path.join(get_path(FOLDERID.RoamingAppData, UserHandle.current), \"lbryum\")\n elif sys.platform == \"darwin\":\n self.download_directory = os.path.join(os.path.expanduser(\"~\"), 'Downloads')\n self.db_dir = user_data_dir(\"LBRY\")\n self.lbrycrdd_path = \"./lbrycrdd\"\n if wallet_type == \"lbrycrd\":\n self.wallet_dir = user_data_dir(\"lbrycrd\")\n else:\n self.wallet_dir = user_data_dir(\"LBRY\")\n else:\n self.download_directory = os.getcwd()\n self.db_dir = os.path.join(os.path.expanduser(\"~\"), \".lbrynet\")\n self.lbrycrdd_path = \"./lbrycrdd\"\n if wallet_type == \"lbrycrd\":\n self.wallet_dir = os.path.join(os.path.expanduser(\"~\"), \".lbrycrd\")\n else:\n self.wallet_dir = os.path.join(os.path.expanduser(\"~\"), \".lbryum\")\n\n self.created_data_dir = False\n if not os.path.exists(self.db_dir):\n os.mkdir(self.db_dir)\n self.created_data_dir = True\n\n self.blobfile_dir = os.path.join(self.db_dir, \"blobfiles\")\n self.lbrycrd_conf = os.path.join(self.wallet_dir, \"lbrycrd.conf\")\n self.autofetcher_conf = os.path.join(self.wallet_dir, \"autofetcher.conf\")\n self.daemon_conf = os.path.join(self.db_dir, 'daemon_settings.json')\n self.wallet_conf = os.path.join(self.wallet_dir, \"lbrycrd.conf\")\n self.wallet_user = None\n self.wallet_password = None\n\n self.sd_identifier = StreamDescriptorIdentifier()\n self.stream_info_manager = TempLBRYFileMetadataManager()\n self.settings = LBRYSettings(self.db_dir)\n self.blob_request_payment_rate_manager = None\n self.lbry_file_metadata_manager = None\n self.lbry_file_manager = None\n\n #defaults for settings otherwise loaded from daemon_settings.json\n self.default_settings = {\n 'run_on_startup': False,\n 'data_rate': MIN_BLOB_DATA_PAYMENT_RATE,\n 'max_key_fee': DEFAULT_MAX_KEY_FEE,\n 'default_download_directory': self.download_directory,\n 'max_upload': 0.0,\n 'max_download': 0.0,\n 'upload_log': True,\n 'search_timeout': 3.0,\n 'max_search_results': DEFAULT_MAX_SEARCH_RESULTS,\n 'wallet_type': wallet_type,\n 'delete_blobs_on_remove': True,\n 'peer_port': 3333,\n 'dht_node_port': 4444,\n 'use_upnp': True,\n 'start_lbrycrdd': True,\n 'requested_first_run_credits': False\n }", "metadata": "root.LBRYDaemon.__init__", "header": "['class', 'LBRYDaemon', '(', 'jsonrpc', '.', 'JSONRPC', ')', ':', '___EOS___']", "index": 100 }, { "content": " def _cbRender(self, result, request, id, version):\n if isinstance(result, Handler):\n result = result.result\n\n if isinstance(result, dict):\n result = result['result']\n\n if version == jsonrpclib.VERSION_PRE1:\n if not isinstance(result, jsonrpclib.Fault):\n result = (result,)\n # Convert the result (python) to JSON-RPC\n try:\n s = jsonrpclib.dumps(result, version=version)\n except:\n f = jsonrpclib.Fault(self.FAILURE, \"can't serialize output\")\n s = jsonrpclib.dumps(f, version=version)\n request.setHeader(\"content-length\", str(len(s)))\n request.write(s)\n request.finish()", "metadata": "root.LBRYDaemon._cbRender", "header": "['class', 'LBRYDaemon', '(', 'jsonrpc', '.', 'JSONRPC', ')', ':', '___EOS___']", "index": 241 }, { "content": " def jsonrpc_is_first_run(self):\n \"\"\"\n Check if this is the first time lbrynet daemon has been run\n\n Args:\n None\n Returns:\n True if first run, otherwise False\n \"\"\"\n\n log.info(\"[\" + str(datetime.now()) + \"] Check if is first run\")\n try:\n d = self.session.wallet.is_first_run()\n except:\n d = defer.fail(None)\n\n d.addCallbacks(lambda r: self._render_response(r, OK_CODE), lambda _: self._render_response(None, OK_CODE))\n\n return d", "metadata": "root.LBRYDaemon.jsonrpc_is_first_run", "header": "['class', 'LBRYDaemon', '(', 'jsonrpc', '.', 'JSONRPC', ')', ':', '___EOS___']", "index": 978 }, { "content": " def jsonrpc_get_time_behind_blockchain(self):\n \"\"\"\n Get number of blocks behind the blockchain\n\n Args:\n None\n Returns:\n number of blocks behind blockchain, int\n \"\"\"\n\n def _get_time_behind():\n try:\n local_height = self.session.wallet.network.get_local_height()\n remote_height = self.session.wallet.network.get_server_height()\n return defer.succeed(remote_height - local_height)\n except:\n return defer.fail()\n\n d = _get_time_behind()\n d.addCallback(lambda r: self._render_response(r, OK_CODE))\n\n return d", "metadata": "root.LBRYDaemon.jsonrpc_get_time_behind_blockchain", "header": "['class', 'LBRYDaemon', '(', 'jsonrpc', '.', 'JSONRPC', ')', ':', '___EOS___']", "index": 1499 } ]
[ { "span": "except:", "start_line": 132, "start_column": 8, "end_line": 132, "end_column": 15 }, { "span": "except:", "start_line": 254, "start_column": 8, "end_line": 254, "end_column": 15 }, { "span": "except:", "start_line": 991, "start_column": 8, "end_line": 991, "end_column": 15 }, { "span": "except:", "start_line": 1514, "start_column": 12, "end_line": 1514, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "LB", "RY", "Daemon_", "(_", "jsonrpc", "_", "._", "JSONR", "PC_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "ui", "\\u", "version", "\\u", "info_", ",_", "walle", "t", "\\u", "type_", "=_", "\"", "lbr", "yum", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jsonrpc", "_", "._", "JSONR", "PC_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reactor_", "._", "add", "System", "Event", "Trigger_", "(_", "'", "bef", "ore", "'_", ",_", "'", "shut", "down", "'_", ",_", "self_", "._", "\\u", "shutdown_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "start", "up", "\\u", "status_", "=_", "START", "UP", "\\u", "STAGE", "S_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "up", "\\u", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "announce", "d\\u", "startup_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "query", "\\u", "handlers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ui", "\\u", "version_", "=_", "ui", "\\u", "version", "\\u", "info_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "git", "\\u", "lbr", "yne", "t", "\\u", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "git", "\\u", "lbr", "yum", "\\u", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "walle", "t", "\\u", "type_", "=_", "walle", "t", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "\\u", "settings_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "first", "\\u", "run_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "file_", "=_", "LOG", "\\u", "FILENAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fetcher_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "current", "\\u", "db", "\\u", "revision_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "server_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "know", "n", "\\u", "dht", "\\u", "nodes_", "=_", "KNOWN", "\\u", "DH", "T", "\\u", "NODES", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "platform", "\\u", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "process", "or", "\"_", ":_", "platform_", "._", "processor_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "python", "\\u", "version", ":", " ", "\"_", ":_", "platform_", "._", "python", "\\u", "version_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "platform", "\"_", ":_", "platform_", "._", "platform_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "\\u", "release", "\"_", ":_", "platform_", "._", "release_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "\\u", "system", "\"_", ":_", "platform_", "._", "system_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lbr", "yne", "t", "\\u", "version", ":", " ", "\"_", ":_", "lbr", "yne", "t", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lbr", "yum", "\\u", "version", ":", " ", "\"_", ":_", "lbr", "yum", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ui", "\\u", "version", "\"_", ":_", "self_", "._", "ui", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "platform", "\\u", "info_", "[_", "'", "ip", "'_", "]_", "=_", "json_", "._", "load_", "(_", "urlopen_", "(_", "'", "http", "://", "json", "ip", ".", "com", "'_", ")_", ")_", "[_", "'", "ip", "'_", "]_", "\\u\\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_", "._", "platform", "\\u", "info_", "[_", "'", "ip", "'_", "]_", "=_", "\"", "Cou", "ld", " ", "not", " ", "dete", "rmin", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "\"", "nt", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "lbr", "yne", "t_", "._", "win", "helpers_", "._", "know", "npa", "ths_", "import_", "get", "\\u", "path_", ",_", "FOLDER", "ID_", ",_", "User", "Handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "download", "\\u", "directory_", "=_", "get", "\\u", "path_", "(_", "FOLDER", "ID_", "._", "Down", "loads_", ",_", "User", "Handle_", "._", "current_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "get", "\\u", "path_", "(_", "FOLDER", "ID_", "._", "Roa", "ming", "App", "Data_", ",_", "User", "Handle_", "._", "current_", ")_", ",_", "\"", "lbr", "yne", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lbr", "yc", "rd", "d\\u", "path_", "=_", "\"", "lbr", "yc", "rd", "d", ".", "exe", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "walle", "t", "\\u", "type_", "==_", "\"", "lbr", "yc", "rd", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "walle", "t", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "get", "\\u", "path_", "(_", "FOLDER", "ID_", "._", "Roa", "ming", "App", "Data_", ",_", "User", "Handle_", "._", "current_", ")_", ",_", "\"", "lbr", "yc", "rd", "\"_", ")_", "\\u\\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_", "._", "walle", "t", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "get", "\\u", "path_", "(_", "FOLDER", "ID_", "._", "Roa", "ming", "App", "Data_", ",_", "User", "Handle_", "._", "current_", ")_", ",_", "\"", "lbr", "yum", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "\"", "dar", "win", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "download", "\\u", "directory_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "\"~\"_", ")_", ",_", "'", "Down", "load", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db", "\\u", "dir_", "=_", "user", "\\u", "data\\u", "dir_", "(_", "\"", "LB", "RY", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lbr", "yc", "rd", "d\\u", "path_", "=_", "\"./", "lbr", "yc", "rd", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "walle", "t", "\\u", "type_", "==_", "\"", "lbr", "yc", "rd", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "walle", "t", "\\u", "dir_", "=_", "user", "\\u", "data\\u", "dir_", "(_", "\"", "lbr", "yc", "rd", "\"_", ")_", "\\u\\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_", "._", "walle", "t", "\\u", "dir_", "=_", "user", "\\u", "data\\u", "dir_", "(_", "\"", "LB", "RY", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "download", "\\u", "directory_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "\"~\"_", ")_", ",_", "\".", "lbr", "yne", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lbr", "yc", "rd", "d\\u", "path_", "=_", "\"./", "lbr", "yc", "rd", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "walle", "t", "\\u", "type_", "==_", "\"", "lbr", "yc", "rd", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "walle", "t", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "\"~\"_", ")_", ",_", "\".", "lbr", "yc", "rd", "\"_", ")_", "\\u\\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_", "._", "walle", "t", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "\"~\"_", ")_", ",_", "\".", "lbr", "yum", "\"_", ")_", "\\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_", "._", "created", "\\u", "data\\u", "dir_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "db", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "self_", "._", "db", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "created", "\\u", "data\\u", "dir_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "blob", "file", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "db", "\\u", "dir_", ",_", "\"", "blob", "files", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lbr", "yc", "rd", "\\u", "conf_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "walle", "t", "\\u", "dir_", ",_", "\"", "lbr", "yc", "rd", ".", "conf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "autof", "etch", "er", "\\u", "conf_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "walle", "t", "\\u", "dir_", ",_", "\"", "autof", "etch", "er", ".", "conf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "daemon", "\\u", "conf_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "db", "\\u", "dir_", ",_", "'", "daemon", "\\u", "settings", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "walle", "t", "\\u", "conf_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "walle", "t", "\\u", "dir_", ",_", "\"", "lbr", "yc", "rd", ".", "conf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "walle", "t", "\\u", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "walle", "t", "\\u", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sd", "\\u", "identifier_", "=_", "Stream", "Descrip", "tor", "Identifier_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stream", "\\u", "info", "\\u", "manager_", "=_", "Temp", "LB", "RY", "File", "Meta", "data", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "settings_", "=_", "LB", "RY", "Settings_", "(_", "self_", "._", "db", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "blob", "\\u", "request", "\\u", "pay", "ment", "\\u", "rate", "\\u", "manager_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lbr", "y", "\\u", "file", "\\u", "metadata", "\\u", "manager_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lbr", "y", "\\u", "file", "\\u", "manager_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "s", " ", "for", " ", "settings", " ", "other", "wis", "e", " ", "load", "ed", " ", "from", " ", "daemon", "\\u", "settings", ".", "json_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "default", "\\u", "settings_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "run", "\\u", "on", "\\u", "start", "up", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data\\u", "rate", "'_", ":_", "MIN", "\\u", "BLOB", "\\u", "DATA", "\\u", "PAY", "MENT", "\\u", "RATE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "key", "\\u", "fe", "e", "'_", ":_", "DEF", "AUL", "T", "\\u", "MAX", "\\u", "KEY", "\\u", "FE", "E_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "download", "\\u", "director", "y", "'_", ":_", "self_", "._", "download", "\\u", "directory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "upload", "'_", ":_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "download", "'_", ":_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "upload", "\\u", "log", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "search", "\\u", "timeo", "ut", "'_", ":_", "3.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "search", "\\u", "results", "'_", ":_", "DEF", "AUL", "T", "\\u", "MAX", "\\u", "SEARCH", "\\u", "RESULTS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "walle", "t", "\\u", "type", "'_", ":_", "walle", "t", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "\\u", "blobs", "\\u", "on", "\\u", "remove", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "peer", "\\u", "port", "'_", ":_", "3333", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dht", "\\u", "node", "\\u", "port", "'_", ":_", "4444", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "use", "\\u", "upnp", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "\\u", "lbr", "yc", "rd", "d", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "ed", "\\u", "first", "\\u", "run", "\\u", "credits", "'_", ":_", "False_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LB", "RY", "Daemon_", "(_", "jsonrpc", "_", "._", "JSONR", "PC_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cb", "Render_", "(_", "self_", ",_", "result_", ",_", "request_", ",_", "id_", ",_", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "result_", ",_", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "result_", "._", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "result_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "result_", "[_", "'", "result", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "version_", "==_", "jsonrpc", "lib_", "._", "VERSI", "ON", "\\u", "PRE", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "result_", ",_", "jsonrpc", "lib_", "._", "Fault_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "(_", "result_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Convert", " ", "the", " ", "result", " ", "(", "python", ")", " ", "to", " ", "JSO", "N", "-", "RP", "C_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "jsonrpc", "lib_", "._", "dumps_", "(_", "result_", ",_", "version_", "=_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "jsonrpc", "lib_", "._", "Fault_", "(_", "self_", "._", "FAILURE_", ",_", "\"", "can", "'", "t", " ", "serialize", " ", "output", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "jsonrpc", "lib_", "._", "dumps_", "(_", "f_", ",_", "version_", "=_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "._", "set", "Header_", "(_", "\"", "content", "-", "length", "\"_", ",_", "str_", "(_", "len_", "(_", "s_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "write_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LB", "RY", "Daemon_", "(_", "jsonrpc", "_", "._", "JSONR", "PC_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "jsonrpc", "\\u", "is", "\\u", "first", "\\u", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "if", " ", "this", " ", "is", " ", "the", " ", "first", " ", "time", " ", "lbr", "yne", "t", " ", "daemon", " ", "has", " ", "bee", "n", " ", "run", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", " ", "if", " ", "first", " ", "run", ",", " ", "other", "wis", "e", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"[\"_", "+_", "str_", "(_", "datetime_", "._", "now_", "(_", ")_", ")_", "+_", "\"]", " ", "Check", " ", "if", " ", "is", " ", "first", " ", "run", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "session_", "._", "wallet_", "._", "is", "\\u", "first", "\\u", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "defer_", "._", "fail_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "._", "add", "Callbacks_", "(_", "lambda_", "r_", ":_", "self_", "._", "\\u", "render", "\\u", "response_", "(_", "r_", ",_", "OK", "\\u", "CODE_", ")_", ",_", "lambda_", "\\u_", ":_", "self_", "._", "\\u", "render", "\\u", "response_", "(_", "None_", ",_", "OK", "\\u", "CODE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LB", "RY", "Daemon_", "(_", "jsonrpc", "_", "._", "JSONR", "PC_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "jsonrpc", "\\u", "get", "\\u", "time", "\\u", "beh", "ind", "\\u", "blockchain", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "number", " ", "of", " ", "blocks", " ", "beh", "ind", " ", "the", " ", "blockchain", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "number", " ", "of", " ", "blocks", " ", "beh", "ind", " ", "blockchain", ",", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "time", "\\u", "beh", "ind_", "(_", ")_", ":_", "\\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 ", " _", "local", "\\u", "height_", "=_", "self_", "._", "session_", "._", "wallet_", "._", "network_", "._", "get", "\\u", "local", "\\u", "height_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "height_", "=_", "self_", "._", "session_", "._", "wallet_", "._", "network_", "._", "get", "\\u", "server", "\\u", "height_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "defer_", "._", "succeed_", "(_", "remote", "\\u", "height_", "-_", "local", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "defer_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "\\u", "get", "\\u", "time", "\\u", "beh", "ind_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "r_", ":_", "self_", "._", "\\u", "render", "\\u", "response_", "(_", "r_", ",_", "OK", "\\u", "CODE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
karesansui/pysilhouette/pysilhouette/prep.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# This file is part of Pysilhouette.\n#\n# Copyright (c) 2009-2010 HDE, Inc.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\n\"\"\"\n@author: Kei Funagayama <[email protected]>\n\"\"\"\n\nimport re\nimport sys\nimport os\nimport pwd\nimport grp\nfrom optparse import OptionParser\n\ntry:\n from cStringIO import StringIO\nexcept ImportError:\n from StringIO import StringIO\n\nfrom pysilhouette import __version__\n\nusage = '%prog [options]'\n\n\n\n\n\n\nif __name__ == \"__main__\":\n pass\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def getopts():\n optp = OptionParser(usage=usage, version=__version__)\n optp.add_option('-c', '--config', dest='config', help='configuration file')\n optp.add_option('-d', '--daemon', dest='daemon', action=\"store_true\", help='Daemon startup')\n optp.add_option('-v', '--verbose', dest='verbose', action=\"store_true\", help='Has not been used.')\n optp.add_option('-p', '--pidfile', dest='pidfile', action=\"store\", type='string', help='process file path')\n optp.add_option('-k', '--uniqkey', dest='uniqkey', action=\"store_true\", help='show unique key')\n return optp.parse_args()", "metadata": "root.getopts", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def chkopts(opts):\n if not opts.config:\n print >>sys.stderr, '-c or --config option is required.'\n return True\n\n if os.path.isfile(opts.config) is False:\n print >>sys.stderr, '-c or --config file is specified in the option does not exist.'\n return True\n\n if opts.uniqkey:\n return False\n\n if opts.daemon is True and not opts.pidfile:\n print >>sys.stderr, '-p or --pidfile option is required.'\n return True\n\n if not opts.daemon and opts.pidfile:\n print >>sys.stderr, '-p doesn work without -d. Please add the option to -d or --daemon.'\n return True\n\n return False", "metadata": "root.chkopts", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def parse_conf(cf):\n from pysilhouette.util import is_int, is_key, set_cf_int\n from pysilhouette.uniqkey import is_uuid\n\n # env\n err_key = \"\"\n if len(err_key) <= 0 and is_key(cf, \"env.python\") is False:\n err_key = \"env.python\"\n if len(err_key) <= 0 and is_key(cf, \"env.sys.log.conf.path\") is False:\n err_key = \"env.sys.log.conf.path\"\n if len(err_key) <= 0 and is_key(cf, \"env.uniqkey\") is False:\n err_key = \"env.uniqkey\"\n if len(err_key) <= 0 and is_key(cf, \"daemon.stdin\") is False:\n err_key = \"daemon.stdin\"\n if len(err_key) <= 0 and is_key(cf, \"daemon.stdout\") is False:\n err_key = \"daemon.stdout\"\n if len(err_key) <= 0 and is_key(cf, \"daemon.stderr\") is False:\n err_key = \"daemon.stderr\"\n if len(err_key) <= 0 and is_key(cf, \"observer.target.python\") is False:\n err_key = \"observer.target.python\"\n if len(err_key) <= 0 and is_key(cf, \"observer.target.scheduler\") is False:\n err_key = \"observer.target.scheduler\"\n if len(err_key) <= 0 and is_key(cf, \"observer.target.performer\") is False:\n err_key = \"observer.target.performer\"\n if len(err_key) <= 0 and is_key(cf, \"observer.restart.count\") is False:\n err_key = \"observer.restart.count\"\n if len(err_key) <= 0 and is_key(cf, \"observer.restart.count.clear.time\") is False:\n err_key = \"observer.restart.count.clear.time\"\n if len(err_key) <= 0 and is_key(cf, \"observer.check.interval\") is False:\n err_key = \"observer.check.interval\"\n if len(err_key) <= 0 and is_key(cf, \"observer.status.path\") is False:\n err_key = \"observer.status.path\"\n\n # performer\n if len(err_key) <= 0 and is_key(cf, \"performer.mkfifo.start.code\") is False:\n err_key = \"performer.mkfifo.start.code\"\n if len(err_key) <= 0 and is_key(cf, \"performer.mkfifo.ignore.code\") is False:\n err_key = \"performer.mkfifo.ignore.code\"\n if len(err_key) <= 0 and is_key(cf, \"performer.mkfifo.stop.code\") is False:\n err_key = \"performer.mkfifo.stop.code\"\n if len(err_key) <= 0 and is_key(cf, \"performer.mkfifo.user.name\") is False:\n err_key = \"performer.mkfifo.user.name\"\n if len(err_key) <= 0 and is_key(cf, \"performer.mkfifo.group.name\") is False:\n err_key = \"performer.mkfifo.group.name\"\n if len(err_key) <= 0 and is_key(cf, \"performer.mkfifo.perms\") is False:\n err_key = \"performer.mkfifo.perms\"\n if len(err_key) <= 0 and is_key(cf, \"performer.mkfifo.path\") is False:\n err_key = \"performer.mkfifo.path\"\n\n # asynperformer\n if len(err_key) <= 0 and is_key(cf, \"asynperformer.mkfifo.start.code\") is False:\n err_key = \"asynperformer.mkfifo.start.code\"\n if len(err_key) <= 0 and is_key(cf, \"asynperformer.mkfifo.ignore.code\") is False:\n err_key = \"asynperformer.mkfifo.ignore.code\"\n if len(err_key) <= 0 and is_key(cf, \"asynperformer.mkfifo.stop.code\") is False:\n err_key = \"asynperformer.mkfifo.stop.code\"\n if len(err_key) <= 0 and is_key(cf, \"asynperformer.mkfifo.user.name\") is False:\n err_key = \"asynperformer.mkfifo.user.name\"\n if len(err_key) <= 0 and is_key(cf, \"asynperformer.mkfifo.group.name\") is False:\n err_key = \"asynperformer.mkfifo.group.name\"\n if len(err_key) <= 0 and is_key(cf, \"asynperformer.mkfifo.perms\") is False:\n err_key = \"asynperformer.mkfifo.perms\"\n if len(err_key) <= 0 and is_key(cf, \"asynperformer.mkfifo.path\") is False:\n err_key = \"asynperformer.mkfifo.path\"\n\n # asynscheduler\n if len(err_key) <= 0 and is_key(cf, \"asynscheduler.interval\") is False:\n err_key = \"asynscheduler.interval\"\n\n if len(err_key) <= 0 and is_key(cf, \"scheduler.interval\") is False:\n err_key = \"scheduler.interval\"\n if len(err_key) <= 0 and is_key(cf, \"job.popen.env.lang\") is False:\n err_key = \"job.popen.env.lang\"\n if len(err_key) <= 0 and is_key(cf, \"job.popen.timeout\") is False:\n err_key = \"job.popen.timeout\"\n if len(err_key) <= 0 and is_key(cf, \"job.popen.waittime\") is False:\n err_key = \"job.popen.waittime\"\n if len(err_key) <= 0 and is_key(cf, \"job.popen.output.limit\") is False:\n err_key = \"job.popen.output.limit\"\n\n if len(err_key) <= 0 and is_key(cf, \"database.url\") is False:\n err_key = \"database.url\"\n if len(err_key) <= 0 and is_key(cf, \"database.pool.status\") is False:\n err_key = \"database.pool.status\"\n\n if is_uuid(cf[\"env.uniqkey\"]) is False:\n print >>sys.stderr, 'UUID format is not set. - env.uniqkey'\n return False\n\n if 0 < len(err_key):\n print >>sys.stderr, 'Configuration files are missing. - %s' % (err_key)\n return False\n\n if os.access(cf[\"env.python\"], os.R_OK | os.X_OK) is False:\n print >>sys.stderr, 'Incorrect file permissions. - env.python=%s' % (cf[\"env.python\"])\n return False\n\n if os.access(cf[\"observer.target.python\"], os.R_OK | os.X_OK) is False:\n print >>sys.stderr, 'Incorrect file permissions. - observer.target.python=%s' % (cf[\"observer.target.python\"])\n return False\n\n if os.access(cf[\"observer.target.scheduler\"], os.R_OK) is False:\n print >>sys.stderr, 'Incorrect file permissions. - observer.target.scheduler=%s' % (cf[\"observer.target.scheduler\"])\n return False\n\n if os.access(cf[\"observer.target.performer\"], os.R_OK) is False:\n print >>sys.stderr, 'Incorrect file permissions. - observer.target.performer=%s' % (cf[\"observer.target.performer\"])\n return False\n\n if is_int(cf[\"observer.restart.count\"]) is False:\n print >>sys.stderr, 'Must be a number. - observer.restart.count=%s' % (cf[\"observer.restart.count\"])\n return False\n else:\n set_cf_int(cf, \"observer.restart.count\")\n\n if is_int(cf[\"observer.restart.count.clear.time\"]) is False:\n print >>sys.stderr, 'Must be a number. - observer.restart.count.clear.time=%s' % (cf[\"observer.restart.count.clear.time\"])\n return False\n else:\n set_cf_int(cf, \"observer.restart.count.clear.time\")\n\n if is_int(cf[\"observer.check.interval\"]) is False:\n print >>sys.stderr, 'Must be a number. - observer.check.interval=%s' % (cf[\"observer.check.interval\"])\n return False\n else:\n set_cf_int(cf, \"observer.check.interval\")\n\n # performer\n if is_int(cf[\"performer.mkfifo.start.code\"]) is False:\n print >>sys.stderr, 'Must be a number. - performer.mkfifo.start.code=%s' % (cf[\"performer.mkfifo.start.code\"])\n return False\n\n if is_int(cf[\"performer.mkfifo.ignore.code\"]) is False:\n print >>sys.stderr, 'Must be a number. - performer.mkfifo.ignore.code=%s' % (cf[\"performer.mkfifo.ignore.code\"])\n return False\n\n if is_int(cf[\"performer.mkfifo.stop.code\"]) is False:\n print >>sys.stderr, 'Must be a number. - performer.mkfifo.stop.code=%s' % (cf[\"performer.mkfifo.stop.code\"])\n return False\n\n # asynperformer\n if is_int(cf[\"asynperformer.mkfifo.start.code\"]) is False:\n print >>sys.stderr, 'Must be a number. - asynperformer.mkfifo.start.code=%s' % (cf[\"asynperformer.mkfifo.start.code\"])\n return False\n\n if is_int(cf[\"asynperformer.mkfifo.ignore.code\"]) is False:\n print >>sys.stderr, 'Must be a number. - asynperformer.mkfifo.ignore.code=%s' % (cf[\"asynperformer.mkfifo.ignore.code\"])\n return False\n\n if is_int(cf[\"asynperformer.mkfifo.stop.code\"]) is False:\n print >>sys.stderr, 'Must be a number. - asynperformer.mkfifo.stop.code=%s' % (cf[\"asynperformer.mkfifo.stop.code\"])\n return False\n\n if is_int(cf[\"asynscheduler.interval\"]) is False:\n print >>sys.stderr, 'Must be a number. - asynscheduler.interval=%s' % (cf[\"asynscheduler.interval\"])\n return False\n else:\n set_cf_int(cf, \"asynscheduler.interval\")\n\n if is_int(cf[\"scheduler.interval\"]) is False:\n print >>sys.stderr, 'Must be a number. - scheduler.interval=%s' % (cf[\"scheduler.interval\"])\n return False\n else:\n set_cf_int(cf, \"scheduler.interval\")\n\n if is_int(cf[\"job.popen.timeout\"]) is False:\n print >>sys.stderr, 'Must be a number. - job.popen.timeout=%s' % (cf[\"job.popen.timeout\"])\n return False\n else:\n set_cf_int(cf, \"job.popen.timeout\")\n\n if is_int(cf[\"job.popen.waittime\"]) is False:\n print >>sys.stderr, 'Must be a number. - job.popen.waittime=%s' % (cf[\"job.popen.waittime\"])\n return False\n else:\n set_cf_int(cf, \"job.popen.waittime\")\n\n if is_int(cf[\"job.popen.output.limit\"]) is False:\n print >>sys.stderr, 'Must be a number. - job.popen.output.limit=%s' % (cf[\"job.popen.output.limit\"])\n return False\n else:\n set_cf_int(cf, \"job.popen.output.limit\")\n\n # performer\n p_mkfifo = set([cf[\"performer.mkfifo.start.code\"],\n cf[\"performer.mkfifo.ignore.code\"],\n cf[\"performer.mkfifo.stop.code\"]],\n )\n if len(p_mkfifo) != 3:\n print >>sys.stderr, 'Is not unique. - performer.mkfifo.[start,ignore,stop]=%s,%s,%s' \\\n % (cf[\"performer.mkfifo.start.code\"],\n cf[\"performer.mkfifo.ignore.code\"],\n cf[\"performer.mkfifo.stop.code\"],\n )\n return False\n\n try:\n pwd.getpwnam(cf[\"performer.mkfifo.user.name\"])\n except:\n print >>sys.stderr, 'Can not get information of the user (nonexistent?). - performer.mkfifo.user.name=%s' % (cf[\"performer.mkfifo.user.name\"])\n\n try:\n grp.getgrnam(cf[\"performer.mkfifo.group.name\"])\n except:\n print >>sys.stderr, 'Can not get information of the group (nonexistent?). - performer.mkfifo.group.name=%s' % (cf[\"performer.mkfifo.group.name\"])\n\n try:\n int(cf[\"performer.mkfifo.perms\"], 8)\n except:\n print >>sys.stderr, 'Incorrect file permissions. - performer.mkfifo.perms=%s' % (cf[\"performer.mkfifo.perms\"])\n return False\n\n # asynperformer\n a_mkfifo = set([cf[\"asynperformer.mkfifo.start.code\"],\n cf[\"asynperformer.mkfifo.ignore.code\"],\n cf[\"asynperformer.mkfifo.stop.code\"]],\n )\n if len(a_mkfifo) != 3:\n print >>sys.stderr, 'Is not unique. - asynperformer.mkfifo.[start,ignore,stop]=%s,%s,%s' \\\n % (cf[\"asynperformer.mkfifo.start.code\"],\n cf[\"asynperformer.mkfifo.ignore.code\"],\n cf[\"asynperformer.mkfifo.stop.code\"],\n )\n return False\n\n try:\n pwd.getpwnam(cf[\"asynperformer.mkfifo.user.name\"])\n except:\n print >>sys.stderr, 'Can not get information of the user (nonexistent?). - asynperformer.mkfifo.user.name=%s' % (cf[\"asynperformer.mkfifo.user.name\"])\n\n try:\n grp.getgrnam(cf[\"asynperformer.mkfifo.group.name\"])\n except:\n print >>sys.stderr, 'Can not get information of the group (nonexistent?). - asynperformer.mkfifo.group.name=%s' % (cf[\"asynperformer.mkfifo.group.name\"])\n\n try:\n int(cf[\"asynperformer.mkfifo.perms\"], 8)\n except:\n print >>sys.stderr, 'Incorrect file permissions. - asynperformer.mkfifo.perms=%s' % (cf[\"asynperformer.mkfifo.perms\"])\n return False\n\n if cf.has_key(\"job.whitelist.flag\") is True \\\n and cf[\"job.whitelist.flag\"] == \"1\" \\\n and cf.has_key(\"job.whitelist.path\") is True \\\n and 0 < len(cf[\"job.whitelist.path\"]):\n if os.path.isfile(cf[\"job.whitelist.path\"]) is False:\n print >>sys.stderr, 'File not found. - job.whitelist.path=%s' % (cf[\"job.whitelist.path\"])\n return False\n\n # database.pool.status\n if (cf[\"database.pool.status\"] in (\"0\",\"1\")) is False:\n print >>sys.stderr, 'The mistake is found in the set value. Please set 0 or 1. - database.pool.status'\n return False\n\n if cf[\"database.pool.status\"] == \"1\":\n # database.pool.max.overflow\n if cf.has_key(\"database.pool.max.overflow\") is False:\n print >>sys.stderr, 'Configuration information is missing. - database.pool.max.overflow'\n return False\n\n # database.pool.size\n if cf.has_key(\"database.pool.size\") is False:\n print >>sys.stderr, 'Configuration information is missing. - database.pool.size'\n return False\n\n # int\n if is_int(cf[\"database.pool.max.overflow\"]) is False:\n print >>sys.stderr, 'Please set it by the numerical value. - database.pool.max.overflow'\n return False\n else:\n set_cf_int(cf, \"database.pool.max.overflow\")\n\n if is_int(cf[\"database.pool.size\"]) is False:\n print >>sys.stderr, 'Please set it by the numerical value. - database.pool.size'\n return False\n else:\n set_cf_int(cf, \"database.pool.size\")\n\n if int(cf[\"database.pool.size\"]) <= 0:\n print >>sys.stderr, 'Please set values that are larger than 0. - database.pool.size'\n return False\n else:\n set_cf_int(cf, \"database.pool.size\")\n\n # Comparison\n if int(cf[\"database.pool.max.overflow\"]) < int(cf[\"database.pool.size\"]):\n print >>sys.stderr, 'Please set \"database.pool.max.overflow\" to a value that is larger than \"database.pool.size\".'\n return False\n\n # asynperformer.thread.pool.size\n if cf.has_key(\"asynperformer.thread.pool.size\") is False:\n print >>sys.stderr, 'Configuration information is missing. - asynperformer.thread.pool.size'\n return False\n\n if is_int(cf[\"asynperformer.thread.pool.size\"]) is False:\n print >>sys.stderr, 'Please set it by the numerical value. - asynperformer.thread.pool.size'\n return False\n else:\n set_cf_int(cf, \"asynperformer.thread.pool.size\")\n\n if int(cf[\"asynperformer.thread.pool.size\"]) <= 0:\n print >>sys.stderr, 'Please set values that are larger than 0. - asynperformer.thread.pool.size'\n return False\n\n return True", "metadata": "root.parse_conf", "header": "['module', '___EOS___']", "index": 77 }, { "content": "def readconf(path):\n if not os.path.isfile(path):\n print >>sys.stderr, 'file=%s - file specified in the option does not exist.' % path\n return None\n\n fp = open(path, 'r')\n try:\n try:\n _r = {}\n for line in fp:\n line = re.sub(r'[ \\t]', '', line).strip()\n if len(line) <= 0 or line[0] == '#':\n continue\n key, value = line.split('=', 1)\n try:\n value = value[:value.rindex('#')]\n except ValueError,ve:\n pass\n _r[key] = value\n return _r\n except Exception, e:\n print >>sys.stderr, 'file=%s - Failed to load configuration files. : except=%s' \\\n % (path, e.args)\n return None\n finally:\n fp.close()", "metadata": "root.readconf", "header": "['module', '___EOS___']", "index": 383 }, { "content": "def sysappend(pkg):\n lines = []\n if type(pkg) is list:\n lines = pkg\n else:\n print >>sys.stderr, '%s should be list type.' % (pkg,)\n return False\n \n for line in lines:\n f = False\n for path in sys.path:\n if line == path:\n f = True\n break\n if f is False:\n sys.path.insert(1, line)\n return True", "metadata": "root.sysappend", "header": "['module', '___EOS___']", "index": 410 } ]
[ { "span": "from cStringIO import StringIO", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 34 }, { "span": "from StringIO import StringIO", "start_line": 40, "start_column": 4, "end_line": 40, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Py", "sil", "hou", "ette", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "9", "-", "2010", " ", "HD", "E", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "@", "author", ":", " ", "Ke", "i", " ", "Fun", "aga", "ya", "ma", " ", "<", "kei", "@", "kar", "esa", "nsu", "i", "-", "project", ".", "info", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pwd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "grp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "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 ", " _", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "pys", "il", "hou", "ette", "_", "import_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "'%", "prog", " ", "[", "options", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "getop", "ts_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "p_", "=_", "Optio", "n", "Parser_", "(_", "usage_", "=_", "usage_", ",_", "version_", "=_", "\\u\\u", "version\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "c", "'_", ",_", "'--", "config", "'_", ",_", "dest_", "=_", "'", "config", "'_", ",_", "help_", "=_", "'", "configura", "tion", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "d", "'_", ",_", "'--", "daemon", "'_", ",_", "dest_", "=_", "'", "daemon", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "help_", "=_", "'", "Da", "emo", "n", " ", "start", "up", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "v", "'_", ",_", "'--", "verbo", "se", "'_", ",_", "dest_", "=_", "'", "verbo", "se", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "help_", "=_", "'", "Has", " ", "not", " ", "bee", "n", " ", "used", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "p", "'_", ",_", "'--", "pid", "file", "'_", ",_", "dest_", "=_", "'", "pid", "file", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "'", "string", "'_", ",_", "help_", "=_", "'", "process", " ", "file", " ", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "k", "'_", ",_", "'--", "uniq", "key", "'_", ",_", "dest_", "=_", "'", "uniq", "key", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "help_", "=_", "'", "show", " ", "unique", " ", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "opt", "p_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "chk", "opts_", "(_", "opts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "opts_", "._", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'-", "c", " ", "or", " ", "--", "config", " ", "option", " ", "is", " ", "require", "d", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "opts_", "._", "config_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'-", "c", " ", "or", " ", "--", "config", " ", "file", " ", "is", " ", "specified", " ", "in", " ", "the", " ", "option", " ", "doe", "s", " ", "not", " ", "exist", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "uniq", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "daemon_", "is_", "True_", "and_", "not_", "opts_", "._", "pidfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'-", "p", " ", "or", " ", "--", "pid", "file", " ", "option", " ", "is", " ", "require", "d", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "opts_", "._", "daemon_", "and_", "opts_", "._", "pidfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'-", "p", " ", "doe", "sn", " ", "work", " ", "with", "out", " ", "-", "d", ".", " ", "Ple", "ase", " ", "add", " ", "the", " ", "option", " ", "to", " ", "-", "d", " ", "or", " ", "--", "daemon", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "conf_", "(_", "cf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pys", "il", "hou", "ette", "_", "._", "util_", "import_", "is", "\\u", "int_", ",_", "is", "\\u", "key_", ",_", "set\\u", "cf", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pys", "il", "hou", "ette", "_", "._", "uniq", "key_", "import_", "is", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "env_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "key_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "env", ".", "python", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "env", ".", "python", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "env", ".", "sys", ".", "log", ".", "conf", ".", "path", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "env", ".", "sys", ".", "log", ".", "conf", ".", "path", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "env", ".", "uniq", "key", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "env", ".", "uniq", "key", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "daemon", ".", "std", "in", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "daemon", ".", "std", "in", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "daemon", ".", "stdout", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "daemon", ".", "stdout", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "daemon", ".", "std", "err", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "daemon", ".", "std", "err", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "observer", ".", "target", ".", "python", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "observer", ".", "target", ".", "python", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "observer", ".", "target", ".", "schedule", "r", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "observer", ".", "target", ".", "schedule", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "observer", ".", "target", ".", "perform", "er", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "observer", ".", "target", ".", "perform", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "observer", ".", "restart", ".", "count", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "observer", ".", "restart", ".", "count", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "observer", ".", "restart", ".", "count", ".", "clear", ".", "time", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "observer", ".", "restart", ".", "count", ".", "clear", ".", "time", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "observer", ".", "check", ".", "interval", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "observer", ".", "check", ".", "interval", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "observer", ".", "status", ".", "path", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "observer", ".", "status", ".", "path", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "perform", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "user", ".", "name", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "user", ".", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "group", ".", "name", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "group", ".", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "perm", "s", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "perm", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "path", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "path", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "asy", "npe", "rf", "orm", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "user", ".", "name", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "user", ".", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "group", ".", "name", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "group", ".", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "perm", "s", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "perm", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "path", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "path", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "asy", "nsc", "hedule", "r_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "asy", "nsc", "hedule", "r", ".", "interval", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "asy", "nsc", "hedule", "r", ".", "interval", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "schedule", "r", ".", "interval", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "schedule", "r", ".", "interval", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "job", ".", "popen", ".", "env", ".", "lang", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "job", ".", "popen", ".", "env", ".", "lang", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "job", ".", "popen", ".", "timeo", "ut", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "job", ".", "popen", ".", "timeo", "ut", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "job", ".", "popen", ".", "wait", "time", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "job", ".", "popen", ".", "wait", "time", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "job", ".", "popen", ".", "output", ".", "limit", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "job", ".", "popen", ".", "output", ".", "limit", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "databa", "se", ".", "url", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "databa", "se", ".", "url", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "err", "\\u", "key_", ")_", "<=_", "0_", "and_", "is", "\\u", "key_", "(_", "cf_", ",_", "\"", "databa", "se", ".", "pool", ".", "status", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "key_", "=_", "\"", "databa", "se", ".", "pool", ".", "status", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "uuid_", "(_", "cf_", "[_", "\"", "env", ".", "uniq", "key", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "UU", "ID", " ", "format", " ", "is", " ", "not", " ", "set", ".", " ", "-", " ", "env", ".", "uniq", "key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "0_", "<_", "len_", "(_", "err", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Configura", "tion", " ", "files", " ", "are", " ", "missi", "ng", ".", " ", "-", " ", "%", "s", "'_", "%_", "(_", "err", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "access_", "(_", "cf_", "[_", "\"", "env", ".", "python", "\"_", "]_", ",_", "os_", "._", "R", "\\u", "OK_", "|_", "os_", "._", "X", "\\u", "OK_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Inco", "rrect", " ", "file", " ", "permissi", "ons", ".", " ", "-", " ", "env", ".", "python", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "env", ".", "python", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "access_", "(_", "cf_", "[_", "\"", "observer", ".", "target", ".", "python", "\"_", "]_", ",_", "os_", "._", "R", "\\u", "OK_", "|_", "os_", "._", "X", "\\u", "OK_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Inco", "rrect", " ", "file", " ", "permissi", "ons", ".", " ", "-", " ", "observer", ".", "target", ".", "python", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "observer", ".", "target", ".", "python", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "access_", "(_", "cf_", "[_", "\"", "observer", ".", "target", ".", "schedule", "r", "\"_", "]_", ",_", "os_", "._", "R", "\\u", "OK_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Inco", "rrect", " ", "file", " ", "permissi", "ons", ".", " ", "-", " ", "observer", ".", "target", ".", "schedule", "r", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "observer", ".", "target", ".", "schedule", "r", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "access_", "(_", "cf_", "[_", "\"", "observer", ".", "target", ".", "perform", "er", "\"_", "]_", ",_", "os_", "._", "R", "\\u", "OK_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Inco", "rrect", " ", "file", " ", "permissi", "ons", ".", " ", "-", " ", "observer", ".", "target", ".", "perform", "er", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "observer", ".", "target", ".", "perform", "er", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "observer", ".", "restart", ".", "count", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "observer", ".", "restart", ".", "count", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "observer", ".", "restart", ".", "count", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "observer", ".", "restart", ".", "count", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "observer", ".", "restart", ".", "count", ".", "clear", ".", "time", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "observer", ".", "restart", ".", "count", ".", "clear", ".", "time", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "observer", ".", "restart", ".", "count", ".", "clear", ".", "time", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "observer", ".", "restart", ".", "count", ".", "clear", ".", "time", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "observer", ".", "check", ".", "interval", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "observer", ".", "check", ".", "interval", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "observer", ".", "check", ".", "interval", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "observer", ".", "check", ".", "interval", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "perform", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "perform", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "perform", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "perform", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "asy", "npe", "rf", "orm", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "asy", "nsc", "hedule", "r", ".", "interval", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "asy", "nsc", "hedule", "r", ".", "interval", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "asy", "nsc", "hedule", "r", ".", "interval", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "asy", "nsc", "hedule", "r", ".", "interval", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "schedule", "r", ".", "interval", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "schedule", "r", ".", "interval", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "schedule", "r", ".", "interval", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "schedule", "r", ".", "interval", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "job", ".", "popen", ".", "timeo", "ut", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "job", ".", "popen", ".", "timeo", "ut", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "job", ".", "popen", ".", "timeo", "ut", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "job", ".", "popen", ".", "timeo", "ut", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "job", ".", "popen", ".", "wait", "time", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "job", ".", "popen", ".", "wait", "time", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "job", ".", "popen", ".", "wait", "time", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "job", ".", "popen", ".", "wait", "time", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "job", ".", "popen", ".", "output", ".", "limit", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "number", ".", " ", "-", " ", "job", ".", "popen", ".", "output", ".", "limit", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "job", ".", "popen", ".", "output", ".", "limit", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "job", ".", "popen", ".", "output", ".", "limit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "perform", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p", "\\u", "mkf", "ifo", "_", "=_", "set_", "(_", "[_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "p", "\\u", "mkf", "ifo", "_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Is", " ", "not", " ", "unique", ".", " ", "-", " ", "perform", "er", ".", "mkf", "ifo", ".", "[", "start", ",", "ignore", ",", "stop", "]=", "%", "s", ",%", "s", ",%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\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 ", " _", "pwd_", "._", "getpw", "nam_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "user", ".", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Can", " ", "not", " ", "get", " ", "informati", "on", " ", "of", " ", "the", " ", "user", " ", "(", "nonexist", "ent", "?)", ".", " ", "-", " ", "perform", "er", ".", "mkf", "ifo", ".", "user", ".", "name", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "user", ".", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grp_", "._", "getg", "rnam", "_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "group", ".", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Can", " ", "not", " ", "get", " ", "informati", "on", " ", "of", " ", "the", " ", "group", " ", "(", "nonexist", "ent", "?)", ".", " ", "-", " ", "perform", "er", ".", "mkf", "ifo", ".", "group", ".", "name", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "group", ".", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "int_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "perm", "s", "\"_", "]_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Inco", "rrect", " ", "file", " ", "permissi", "ons", ".", " ", "-", " ", "perform", "er", ".", "mkf", "ifo", ".", "perm", "s", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "perform", "er", ".", "mkf", "ifo", ".", "perm", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "asy", "npe", "rf", "orm", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "a", "\\u", "mkf", "ifo", "_", "=_", "set_", "(_", "[_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "a", "\\u", "mkf", "ifo", "_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Is", " ", "not", " ", "unique", ".", " ", "-", " ", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "[", "start", ",", "ignore", ",", "stop", "]=", "%", "s", ",%", "s", ",%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "start", ".", "code", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "ignore", ".", "code", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "stop", ".", "code", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\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 ", " _", "pwd_", "._", "getpw", "nam_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "user", ".", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Can", " ", "not", " ", "get", " ", "informati", "on", " ", "of", " ", "the", " ", "user", " ", "(", "nonexist", "ent", "?)", ".", " ", "-", " ", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "user", ".", "name", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "user", ".", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grp_", "._", "getg", "rnam", "_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "group", ".", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Can", " ", "not", " ", "get", " ", "informati", "on", " ", "of", " ", "the", " ", "group", " ", "(", "nonexist", "ent", "?)", ".", " ", "-", " ", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "group", ".", "name", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "group", ".", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "int_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "perm", "s", "\"_", "]_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Inco", "rrect", " ", "file", " ", "permissi", "ons", ".", " ", "-", " ", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "perm", "s", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "mkf", "ifo", ".", "perm", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cf_", "._", "has", "\\u", "key_", "(_", "\"", "job", ".", "whitelist", ".", "flag", "\"_", ")_", "is_", "True_", "and_", "cf_", "[_", "\"", "job", ".", "whitelist", ".", "flag", "\"_", "]_", "==_", "\"", "1", "\"_", "and_", "cf_", "._", "has", "\\u", "key_", "(_", "\"", "job", ".", "whitelist", ".", "path", "\"_", ")_", "is_", "True_", "and_", "0_", "<_", "len_", "(_", "cf_", "[_", "\"", "job", ".", "whitelist", ".", "path", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "cf_", "[_", "\"", "job", ".", "whitelist", ".", "path", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "File", " ", "not", " ", "found", ".", " ", "-", " ", "job", ".", "whitelist", ".", "path", "=", "%", "s", "'_", "%_", "(_", "cf_", "[_", "\"", "job", ".", "whitelist", ".", "path", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "databa", "se", ".", "pool", ".", "status_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "cf_", "[_", "\"", "databa", "se", ".", "pool", ".", "status", "\"_", "]_", "in_", "(_", "\"", "0", "\"_", ",_", "\"", "1", "\"_", ")_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "The", " ", "mist", "ake", " ", "is", " ", "found", " ", "in", " ", "the", " ", "set", " ", "value", ".", " ", "Ple", "ase", " ", "set", " ", "0", " ", "or", " ", "1", ".", " ", "-", " ", "databa", "se", ".", "pool", ".", "status", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cf_", "[_", "\"", "databa", "se", ".", "pool", ".", "status", "\"_", "]_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "databa", "se", ".", "pool", ".", "max", ".", "overflow", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cf_", "._", "has", "\\u", "key_", "(_", "\"", "databa", "se", ".", "pool", ".", "max", ".", "overflow", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Configura", "tion", " ", "informati", "on", " ", "is", " ", "missi", "ng", ".", " ", "-", " ", "databa", "se", ".", "pool", ".", "max", ".", "overflow", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "databa", "se", ".", "pool", ".", "size_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cf_", "._", "has", "\\u", "key_", "(_", "\"", "databa", "se", ".", "pool", ".", "size", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Configura", "tion", " ", "informati", "on", " ", "is", " ", "missi", "ng", ".", " ", "-", " ", "databa", "se", ".", "pool", ".", "size", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "int_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "databa", "se", ".", "pool", ".", "max", ".", "overflow", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Ple", "ase", " ", "set", " ", "it", " ", "by", " ", "the", " ", "numerical", " ", "value", ".", " ", "-", " ", "databa", "se", ".", "pool", ".", "max", ".", "overflow", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "databa", "se", ".", "pool", ".", "max", ".", "overflow", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "databa", "se", ".", "pool", ".", "size", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Ple", "ase", " ", "set", " ", "it", " ", "by", " ", "the", " ", "numerical", " ", "value", ".", " ", "-", " ", "databa", "se", ".", "pool", ".", "size", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "databa", "se", ".", "pool", ".", "size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "int_", "(_", "cf_", "[_", "\"", "databa", "se", ".", "pool", ".", "size", "\"_", "]_", ")_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Ple", "ase", " ", "set", " ", "values", " ", "tha", "t", " ", "are", " ", "large", "r", " ", "than", " ", "0.", " ", "-", " ", "databa", "se", ".", "pool", ".", "size", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "databa", "se", ".", "pool", ".", "size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compari", "son_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "int_", "(_", "cf_", "[_", "\"", "databa", "se", ".", "pool", ".", "max", ".", "overflow", "\"_", "]_", ")_", "<_", "int_", "(_", "cf_", "[_", "\"", "databa", "se", ".", "pool", ".", "size", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Ple", "ase", " ", "set", " ", "\"", "databa", "se", ".", "pool", ".", "max", ".", "overflow", "\"", " ", "to", " ", "a", " ", "value", " ", "tha", "t", " ", "is", " ", "large", "r", " ", "than", " ", "\"", "databa", "se", ".", "pool", ".", "size", "\".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "asy", "npe", "rf", "orm", "er", ".", "thread", ".", "pool", ".", "size_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cf_", "._", "has", "\\u", "key_", "(_", "\"", "asy", "npe", "rf", "orm", "er", ".", "thread", ".", "pool", ".", "size", "\"_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Configura", "tion", " ", "informati", "on", " ", "is", " ", "missi", "ng", ".", " ", "-", " ", "asy", "npe", "rf", "orm", "er", ".", "thread", ".", "pool", ".", "size", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "int_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "thread", ".", "pool", ".", "size", "\"_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Ple", "ase", " ", "set", " ", "it", " ", "by", " ", "the", " ", "numerical", " ", "value", ".", " ", "-", " ", "asy", "npe", "rf", "orm", "er", ".", "thread", ".", "pool", ".", "size", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "cf", "\\u", "int_", "(_", "cf_", ",_", "\"", "asy", "npe", "rf", "orm", "er", ".", "thread", ".", "pool", ".", "size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "int_", "(_", "cf_", "[_", "\"", "asy", "npe", "rf", "orm", "er", ".", "thread", ".", "pool", ".", "size", "\"_", "]_", ")_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Ple", "ase", " ", "set", " ", "values", " ", "tha", "t", " ", "are", " ", "large", "r", " ", "than", " ", "0.", " ", "-", " ", "asy", "npe", "rf", "orm", "er", ".", "thread", ".", "pool", ".", "size", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "conf_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "file", "=", "%", "s", " ", "-", " ", "file", " ", "specified", " ", "in", " ", "the", " ", "option", " ", "doe", "s", " ", "not", " ", "exist", ".'_", "%_", "path_", "\\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_", "fp_", "=_", "open_", "(_", "path_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "r_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "re_", "._", "sub_", "(_", "r", "'[", " ", "\\\\", "t", "]'_", ",_", "''_", ",_", "line_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "line_", ")_", "<=_", "0_", "or_", "line_", "[_", "0_", "]_", "==_", "'#'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", ",_", "value_", "=_", "line_", "._", "split_", "(_", "'='_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "value_", "[_", ":_", "value_", "._", "rindex", "_", "(_", "'#'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ",_", "ve_", ":_", "\\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", "r_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "file", "=", "%", "s", " ", "-", " ", "Fail", "ed", " ", "to", " ", "load", " ", "configura", "tion", " ", "files", ".", " ", ":", " ", "except", "=", "%", "s", "'_", "%_", "(_", "path_", ",_", "e_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sys", "append_", "(_", "pkg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "pkg_", ")_", "is_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "pkg_", "\\u\\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_", ">>_", "sys_", "._", "stderr_", ",_", "'%", "s", " ", "shou", "ld", " ", "be", " ", "list", " ", "type", ".'_", "%_", "(_", "pkg_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "path_", "in_", "sys_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "==_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "True_", "\\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_", "if_", "f_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "insert_", "(_", "1_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
XiaoMi/minos/client/deploy_hbase.py
[ { "content": "def vacate_region_server(args, ip, port):\n package_root = deploy_utils.get_artifact_package_root(args,\n args.hbase_config.cluster, \"hbase\")\n Log.print_info(\"Vacate region server: \" + ip);\n try:\n host = socket.gethostbyaddr(ip)[0]\n except:\n host = ip\n args.command = [\"ruby\", \"%s/bin/region_mover.rb\" % package_root,\n \"unload\", \"%s:%d\" % (host, port)]\n if run_shell(args) != 0:\n Log.print_critical(\"Unload host %s failed.\" % host);", "metadata": "root.vacate_region_server", "header": "['module', '___EOS___']", "index": 321 }, { "content": "def recover_region_server(args, ip, port):\n package_root = deploy_utils.get_artifact_package_root(args,\n args.hbase_config.cluster, \"hbase\")\n Log.print_info(\"Recover region server: \" + ip);\n try:\n host = socket.gethostbyaddr(ip)[0]\n except:\n host = ip\n args.command = [\"ruby\", \"%s/bin/region_mover.rb\" % package_root,\n \"load\", \"%s:%d\" % (host, port)]\n if run_shell(args) != 0:\n Log.print_critical(\"Load host %s failed.\" % host);", "metadata": "root.recover_region_server", "header": "['module', '___EOS___']", "index": 334 } ]
[ { "span": "except:", "start_line": 327, "start_column": 2, "end_line": 327, "end_column": 9 }, { "span": "except:", "start_line": 340, "start_column": 2, "end_line": 340, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "vaca", "te", "\\u", "region", "\\u", "server_", "(_", "args_", ",_", "ip_", ",_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package", "\\u", "root_", "=_", "deploy", "\\u", "utils_", "._", "get", "\\u", "artifact", "\\u", "package", "\\u", "root_", "(_", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "hbase", "\\u", "config_", "._", "cluster_", ",_", "\"", "hbase", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "print", "\\u", "info_", "(_", "\"", "Vac", "ate", " ", "region", " ", "server", ":", " ", "\"_", "+_", "ip_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "socket_", "._", "geth", "ost", "by", "addr_", "(_", "ip_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "._", "command_", "=_", "[_", "\"", "rub", "y", "\"_", ",_", "\"%", "s", "/", "bin", "/", "region", "\\u", "mover", ".", "rb", "\"_", "%_", "package", "\\u", "root_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unload", "\"_", ",_", "\"%", "s", ":", "%", "d", "\"_", "%_", "(_", "host_", ",_", "port_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "run", "\\u", "shell_", "(_", "args_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "print", "\\u", "critical_", "(_", "\"", "Unlo", "ad", " ", "host", " ", "%", "s", " ", "fail", "ed", ".\"_", "%_", "host_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "recover", "\\u", "region", "\\u", "server_", "(_", "args_", ",_", "ip_", ",_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package", "\\u", "root_", "=_", "deploy", "\\u", "utils_", "._", "get", "\\u", "artifact", "\\u", "package", "\\u", "root_", "(_", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "hbase", "\\u", "config_", "._", "cluster_", ",_", "\"", "hbase", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "print", "\\u", "info_", "(_", "\"", "Recover", " ", "region", " ", "server", ":", " ", "\"_", "+_", "ip_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "socket_", "._", "geth", "ost", "by", "addr_", "(_", "ip_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "._", "command_", "=_", "[_", "\"", "rub", "y", "\"_", ",_", "\"%", "s", "/", "bin", "/", "region", "\\u", "mover", ".", "rb", "\"_", "%_", "package", "\\u", "root_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "load", "\"_", ",_", "\"%", "s", ":", "%", "d", "\"_", "%_", "(_", "host_", ",_", "port_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "run", "\\u", "shell_", "(_", "args_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\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 ]
Unused import
dropbox/questions/questions/management/commands/dump_questions_json.py
[ { "content": "\nimport json\nfrom django.core.management.base import BaseCommand, CommandError\nfrom questions.models import Group, Question\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Command(BaseCommand):\n help = 'Dumps Questions to JSON'\n", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def handle(self, *args, **options):\n data = {}\n\n groups = Group.objects.all()\n for group in groups:\n data[group.name] = []\n\n for question in group.question_set.all():\n if question.status != \"Approved\":\n continue\n data[group.name].append((question.title, question.tags.split(\",\")))\n\n print json.dumps(data)", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 8 } ]
[ { "span": "from django.core.management.base import BaseCommand, CommandError", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 65 }, { "span": "from questions.models import Group, Question", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "questions_", "._", "models_", "import_", "Group_", ",_", "Question_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "help_", "=_", "'", "Dump", "s", " ", "Questions", " ", "to", " ", "JSO", "N", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "groups_", "=_", "Group_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "group_", "in_", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "group_", "._", "name_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "question_", "in_", "group_", "._", "question", "\\u", "set_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "question_", "._", "status_", "!=_", "\"", "Appro", "ved", "\"_", ":_", "\\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_", "data_", "[_", "group_", "._", "name_", "]_", "._", "append_", "(_", "(_", "question_", "._", "title_", ",_", "question_", "._", "tags_", "._", "split_", "(_", "\",\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "json_", "._", "dumps_", "(_", "data_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
neuropoly/spinalcordtoolbox/scripts/msct_gmseg_utils.py
[ { "content": "def extract_metric_from_slice_set(slices_set, seg_to_use=None, metric='Mean', gm_percentile=0.03, wm_percentile=0.05, save=False, output='metric_in_dictionary.txt'):\n \"\"\"\n uses the registereg images and GM segmentation (or another segmentation)to extract mean intensity values in the WM dn GM\n :param slices_set:\n :param seg_to_use: must be of GM not WM\n :param gm_percentile:\n :param wm_percentile:\n :param save:\n :return:\n \"\"\"\n import copy\n level_label = {0: '', 1: 'C1', 2: 'C2', 3: 'C3', 4: 'C4', 5: 'C5', 6: 'C6', 7: 'C7', 8: 'T1', 9: 'T2', 10: 'T3', 11: 'T4', 12: 'T5', 13: 'T6'}\n if save:\n f = open(output, 'w')\n f.write('Slice id - Slice level - '+metric+' in WM - '+metric+' in GM - Std in WM - Std in GM\\n')\n else:\n f = None\n slice_set_metric = {}\n for i, slice_i in enumerate(slices_set):\n gm_dat = copy.deepcopy(slice_i.im_M)\n wm_dat = copy.deepcopy(slice_i.im_M)\n\n # mask with the gray matter segmentation\n if seg_to_use is None:\n gm_dat[slice_i.gm_seg_M == 0] = 0\n wm_dat[slice_i.gm_seg_M == 1] = 0\n else:\n gm_dat[seg_to_use[i] == 0] = 0\n wm_dat[seg_to_use[i] == 1] = 0\n\n # threshold to 0.1 to get rid of the (almost) null values\n gm_dat = gm_dat[gm_dat > 0.1]\n wm_dat = wm_dat[wm_dat > 0.1]\n\n # metric in GM\n if gm_percentile != 0:\n # removing outliers with a percentile\n gm_dat = sorted(gm_dat.flatten())\n n_gm_outliers = int(round(gm_percentile*len(gm_dat)/2.0))\n if n_gm_outliers != 0 and n_gm_outliers*2 < len(gm_dat):\n gm_dat = gm_dat[n_gm_outliers:-n_gm_outliers]\n\n if gm_dat == []:\n gm_met = 0\n gm_std = 0\n else:\n if metric.lower() == 'mean':\n gm_met = np.mean(gm_dat)\n elif metric.lower() == 'median':\n gm_met = np.median(gm_dat)\n gm_std = np.std(gm_dat)\n\n # metric in WM\n if wm_percentile != 0:\n # removing outliers with a percentile\n wm_dat = sorted(wm_dat.flatten())\n n_wm_outliers = int(round(wm_percentile*len(wm_dat)/2.0))\n if n_wm_outliers != 0 and n_wm_outliers*2 < len(wm_dat):\n wm_dat = wm_dat[n_wm_outliers:-n_wm_outliers]\n if wm_dat == []:\n wm_met = 0\n wm_std = 0\n else:\n if metric.lower() == 'mean':\n wm_met = np.mean(wm_dat)\n elif metric.lower() == 'median':\n wm_met = np.median(wm_dat)\n wm_std = np.std(wm_dat)\n\n slice_set_metric[slice_i.id] = (wm_met, gm_met, wm_std, gm_std)\n if save:\n f.write(str(slice_i.id) + ' - ' + level_label[int(slice_i.level)] + ' - ' + str(wm_met) + ' - ' + str(gm_met) + ' - ' + str(wm_std) + ' - ' + str(gm_std) + '\\n')\n if save:\n f.close()\n return slice_set_metric", "metadata": "root.extract_metric_from_slice_set", "header": "['module', '___EOS___']", "index": 500 }, { "content": "def crop_t2_star(t2star, sc_seg, box_size=75):\n \"\"\"\n Pretreatment function croping the t2star file around the spinal cord and to a 75*75 squared image\n\n :param t2star: t2star image to be croped\n\n :param sc_seg: segmentation of the spinal cord\n \"\"\"\n t2star_name = sct.extract_fname(t2star)[1]\n sc_seg_name = sct.extract_fname(sc_seg)[1]\n mask_box = None\n\n try:\n ext = '.nii.gz'\n seg_in_name = t2star_name + '_seg_in'\n seg_in = seg_in_name + ext\n sct.run('sct_crop_image -i ' + t2star + ' -m ' + sc_seg + ' -b 0 -o ' + seg_in)\n\n mask_box = t2star_name + '_square_mask_from_sc_seg'+ext\n sct.run('sct_create_mask -i ' + seg_in + ' -p centerline,' + sc_seg + ' -size ' + str(box_size) + ' -o ' + mask_box + ' -f box')\n\n seg_in_im = Image(seg_in)\n mask_im = Image(mask_box)\n seg_in_im.crop_and_stack(mask_im, suffix='_croped', save=True)\n seg_in_name += '_croped'\n seg_in_im.setFileName(seg_in_name +ext)\n seg_in_im = set_orientation(seg_in_im, 'IRP')\n\n fname_seg_in_IRP = seg_in_name+'_IRP'+ext\n\n if t2star_name + '_square_mask_from_sc_seg_IRP.nii.gz' in os.listdir('.'):\n mask_box = t2star_name + '_square_mask_from_sc_seg_IRP.nii.gz'\n\n except Exception, e:\n sct.printv('WARNING: an error occured when croping ' + t2star_name + '... \\n ' + str(e), 1, 'warning')\n return mask_box, fname_seg_in_IRP", "metadata": "root.crop_t2_star", "header": "['module', '___EOS___']", "index": 655 }, { "content": "def leave_one_out_by_subject(dic_path, dic_3d, denoising=True, reg='Affine', metric='MI', use_levels=True, weight=2.5, eq=1, mode_weighted_sim=False, weighted_label_fusion=False):\n \"\"\"\n Leave one out cross validation taking 1 SUBJECT out of the dictionary at each step\n and computing the resulting dice coefficient, the time of computation and an error map\n\n :param dic_path: path to the dictionary to use to do the model validation\n\n \"\"\"\n import time\n from msct_multiatlas_seg import Model, SegmentationParam, SupervisedSegmentationMethod\n from sct_segment_graymatter import FullGmSegmentation\n init = time.time()\n\n wm_dice_file = open('wm_dice_coeff.txt', 'w')\n gm_dice_file = open('gm_dice_coeff.txt', 'w')\n wm_csa_file = open('wm_csa.txt', 'w')\n gm_csa_file = open('gm_csa.txt', 'w')\n hd_file = open('hd.txt', 'w')\n n_slices = 0\n e = None\n\n level_label = {0: '', 1: 'C1', 2: 'C2', 3: 'C3', 4: 'C4', 5: 'C5', 6: 'C6', 7: 'C7', 8: 'T1', 9: 'T2', 10: 'T3', 11: 'T4', 12: 'T5', 13: 'T6'}\n # for the error map\n gm_diff_by_level = {'C1': [], 'C2': [], 'C3': [], 'C4': [], 'C5': [], 'C6': [], 'C7': [], 'T1': [], 'T2': [], '': []}\n wm_diff_by_level = {'C1': [], 'C2': [], 'C3': [], 'C4': [], 'C5': [], 'C6': [], 'C7': [], 'T1': [], 'T2': [], '': []}\n\n for subject_dir in os.listdir(dic_path):\n subject_path = dic_path + '/' + subject_dir\n if os.path.isdir(subject_path):\n try:\n tmp_dir = 'tmp_' + subject_dir + '_as_target'\n sct.run('mkdir ' + tmp_dir)\n\n tmp_dic_name = 'dic'\n sct.run('cp -r ' + dic_path + ' ./' + tmp_dir + '/' + tmp_dic_name + '/')\n sct.run('cp -r ' + dic_3d + '/' + subject_dir + ' ./' + tmp_dir + '/')\n sct.run('mv ./' + tmp_dir + '/' + tmp_dic_name + '/' + subject_dir + ' ./' + tmp_dir + '/' + subject_dir + '_by_slice')\n\n # Gray matter segmentation using this subject as target\n os.chdir(tmp_dir)\n model_param = SegmentationParam()\n model_param.path_model = tmp_dic_name\n model_param.todo_model = 'compute'\n model_param.weight_gamma = float(weight)\n model_param.use_levels = use_levels\n model_param.res_type = 'prob'\n model_param.reg = reg.split(':')\n model_param.reg_metric = metric\n model_param.equation_id = eq\n model_param.mode_weight_similarity = mode_weighted_sim\n model_param.weight_label_fusion = weighted_label_fusion\n model_param.target_denoising = denoising\n\n model = Model(model_param=model_param, k=0.8)\n\n n_slices_model = model.dictionary.J\n\n target = ''\n sc_seg = ''\n ref_gm_seg_im = ''\n level = ''\n for file_name in os.listdir(subject_dir): # 3d files\n\n if 'im' in file_name:\n target = subject_dir + '/' + file_name\n elif 'level' in file_name:\n level = subject_dir + '/' + file_name\n elif 'gm' in file_name:\n ref_gm_seg_im = subject_dir + '/' + file_name\n elif 'seg' in file_name:\n sc_seg = subject_dir + '/' + file_name\n\n\n full_gmseg = FullGmSegmentation(target, sc_seg, None, level, ref_gm_seg=ref_gm_seg_im, model=model, param=model_param)\n\n # ## VALIDATION ##\n # Dice coeff\n subject_dice = open(full_gmseg.dice_name, 'r')\n dice_lines_list = subject_dice.readlines()\n subject_dice.close()\n\n gm_dices = None\n wm_dices = None\n n_subject_slices = len(full_gmseg.gm_seg.target_seg_methods.target)\n n_slices += n_subject_slices\n\n for i, line in enumerate(dice_lines_list):\n if 'Gray Matter' in line:\n gm_dices = dice_lines_list[i+10:i+10+n_subject_slices]\n\n if 'White Matter' in line:\n wm_dices = dice_lines_list[i+10:i+10+n_subject_slices]\n\n subject_slices_levels = {}\n for slice_dice in wm_dices:\n target_slice, wm_dice = slice_dice[:-1].split(' ')\n\n if int(target_slice) < 10:\n target_slice = 'slice0' + target_slice\n else:\n target_slice = 'slice' + target_slice\n\n slice_level = ''\n for file_name in os.listdir('./' + subject_dir + '_by_slice'):\n if target_slice in file_name:\n slice_level = file_name[file_name.find(target_slice)+8:file_name.find(target_slice)+10]\n subject_slices_levels[target_slice] = slice_level\n wm_dice_file.write(subject_dir + ' ' + target_slice + ' ' + slice_level + ': ' + wm_dice + ' ; nslices: ' + str(n_slices_model) + '\\n')\n\n for slice_dice in gm_dices:\n target_slice, gm_dice = slice_dice[:-1].split(' ')\n\n if int(target_slice) < 10:\n target_slice = 'slice0' + target_slice\n else:\n target_slice = 'slice' + target_slice\n slice_level = subject_slices_levels[target_slice]\n\n gm_dice_file.write(subject_dir + ' ' + target_slice + ' ' + slice_level + ': ' + gm_dice + ' ; nslices: ' + str(n_slices_model) + '\\n')\n\n # hausdorff distance\n subject_hd = open(full_gmseg.hausdorff_name, 'r')\n hd_res_list = subject_hd.readlines()[1:-4]\n for line in hd_res_list:\n n_slice, res_slice = line.split(':')\n hd, med1, med2 = res_slice.split('-')\n n_slice = n_slice[-1:]\n med1 = float(med1)\n med2 = float(med2[:-2])\n\n if int(n_slice) < 10:\n target_slice = 'slice0' + n_slice\n else:\n target_slice = 'slice' + n_slice\n slice_level = subject_slices_levels[target_slice]\n hd_file.write(subject_dir + ' ' + target_slice + ' ' + slice_level + ': ' + str(hd) + ' - ' + str(max(med1, med2)) + '\\n')\n\n # error map\n\n print 'ERROR MAP BY LEVEL COMPUTATION'\n path_validation = full_gmseg.tmp_dir + '/validation/'\n ref_gm_seg_im = Image(path_validation + 'ref_gm_seg.nii.gz')\n ref_wm_seg_im = Image(path_validation + 'ref_wm_seg.nii.gz')\n res_gm_seg_im = Image(path_validation + 'res_gm_seg_bin_RPI.nii.gz')\n res_wm_seg_im = Image(path_validation + 'res_wm_seg_bin_RPI.nii.gz')\n\n ref_gm_seg_im.change_orientation('IRP')\n ref_wm_seg_im.change_orientation('IRP')\n res_gm_seg_im.change_orientation('IRP')\n res_wm_seg_im.change_orientation('IRP')\n\n for i_slice in range(len(ref_gm_seg_im.data)):\n slice_gm_error = abs(ref_gm_seg_im.data[i_slice] - res_gm_seg_im.data[i_slice])\n slice_wm_error = abs(ref_wm_seg_im.data[i_slice] - res_wm_seg_im.data[i_slice])\n if int(i_slice) < 10:\n target_slice = 'slice0' + str(i_slice)\n else:\n target_slice = 'slice' + str(i_slice)\n slice_level = subject_slices_levels[target_slice]\n gm_diff_by_level[slice_level].append(slice_gm_error)\n wm_diff_by_level[slice_level].append(slice_wm_error)\n\n # csa\n sct.run('sct_process_segmentation -i ' + full_gmseg.res_names['corrected_wm_seg'] + ' -p csa')\n tmp_csa_file = open('csa.txt')\n csa_lines = tmp_csa_file.readlines()\n tmp_csa_file.close()\n for slice_csa in csa_lines:\n target_slice, wm_csa = slice_csa.split(',')\n if int(target_slice) < 10:\n target_slice = 'slice0' + target_slice\n else:\n target_slice = 'slice' + target_slice\n slice_level = subject_slices_levels[target_slice]\n wm_csa_file.write(subject_dir + ' ' + target_slice + ' ' + slice_level + ': ' + wm_csa[:-1] + '\\n')\n sct.run('mv csa.txt csa_corrected_wm_seg.txt')\n\n sct.run('sct_process_segmentation -i ' + full_gmseg.res_names['gm_seg'] + ' -p csa')\n tmp_csa_file = open('csa.txt')\n csa_lines = tmp_csa_file.readlines()\n tmp_csa_file.close()\n for slice_csa in csa_lines:\n target_slice, gm_csa = slice_csa.split(',')\n if int(target_slice) < 10:\n target_slice = 'slice0' + target_slice\n else:\n target_slice = 'slice' + target_slice\n slice_level = subject_slices_levels[target_slice]\n gm_csa_file.write(subject_dir + ' ' + target_slice + ' ' + slice_level + ': ' + gm_csa[:-1] + '\\n')\n sct.run('mv csa.txt csa_gm_seg.txt')\n\n os.chdir('..')\n\n except Exception, e:\n sct.printv('WARNING: an error occurred ...', 1, 'warning')\n print e\n # else:\n # sct.run('rm -rf ' + tmp_dir)\n # error map\n for l, level_error in gm_diff_by_level.items():\n try:\n n = len(level_error)\n if n != 0:\n Image(param=sum(level_error)/n, absolutepath='error_map_gm_' + str(l) + '.nii.gz').save()\n except ZeroDivisionError:\n sct.printv('WARNING: no data for level ' + str(l), 1, 'warning')\n\n for l, level_error in wm_diff_by_level.items():\n try:\n n = len(level_error)\n if n != 0:\n Image(param=sum(level_error)/n, absolutepath='error_map_wm_' + str(l) + '.nii.gz').save()\n except ZeroDivisionError:\n sct.printv('WARNING: no data for level ' + str(l), 1, 'warning')\n\n if e is None:\n wm_dice_file.close()\n gm_dice_file.close()\n wm_csa_file.close()\n gm_csa_file.close()\n hd_file.close()\n\n # Image(param=error_map_abs_sum/n_slices, absolutepath='error_map_abs.nii.gz').save()\n t = time.time() - init\n print 'Done in ' + str(t) + ' sec'", "metadata": "root.leave_one_out_by_subject", "header": "['module', '___EOS___']", "index": 997 } ]
[ { "span": "f ", "start_line": 516, "start_column": 8, "end_line": 516, "end_column": 9 }, { "span": "sc_seg_name ", "start_line": 664, "start_column": 4, "end_line": 664, "end_column": 15 }, { "span": "seg_in_im ", "start_line": 681, "start_column": 8, "end_line": 681, "end_column": 17 }, { "span": "level_label ", "start_line": 1018, "start_column": 4, "end_line": 1018, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "\\u", "metric", "\\u", "from", "\\u", "slice", "\\u", "set_", "(_", "slice", "s", "\\u", "set_", ",_", "seg", "\\u", "to", "\\u", "use_", "=_", "None_", ",_", "metric_", "=_", "'", "Mea", "n", "'_", ",_", "gm", "\\u", "percentile_", "=_", "0.03_", ",_", "wm", "\\u", "percentile_", "=_", "0.05_", ",_", "save_", "=_", "False_", ",_", "output_", "=_", "'", "metric", "\\u", "in", "\\u", "dictionar", "y", ".", "txt", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "use", "s", " ", "the", " ", "register", "eg", " ", "images", " ", "and", " ", "GM", " ", "segmentation", " ", "(", "or", " ", "anot", "her", " ", "segmentation", ")", "to", " ", "extract", " ", "mean", " ", "intensity", " ", "values", " ", "in", " ", "the", " ", "WM", " ", "dn", " ", "GM", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "slice", "s", "\\u", "set", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "seg", "\\u", "to", "\\u", "use", ":", " ", "must", " ", "be", " ", "of", " ", "GM", " ", "not", " ", "WM", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "gm", "\\u", "percentile", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "wm", "\\u", "percentile", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "save", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level", "\\u", "label_", "=_", "{_", "0_", ":_", "''_", ",_", "1_", ":_", "'", "C1", "'_", ",_", "2_", ":_", "'", "C2", "'_", ",_", "3_", ":_", "'", "C3", "'_", ",_", "4_", ":_", "'", "C4", "'_", ",_", "5_", ":_", "'", "C5", "'_", ",_", "6_", ":_", "'", "C6", "'_", ",_", "7_", ":_", "'", "C", "7", "'_", ",_", "8_", ":_", "'", "T1", "'_", ",_", "9_", ":_", "'", "T2", "'_", ",_", "10_", ":_", "'", "T3", "'_", ",_", "11_", ":_", "'", "T", "4", "'_", ",_", "12_", ":_", "'", "T", "5", "'_", ",_", "13_", ":_", "'", "T6", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "save_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "output_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'", "Slice", " ", "id", " ", "-", " ", "Slice", " ", "level", " ", "-", " ", "'_", "+_", "metric_", "+_", "'", " ", "in", " ", "WM", " ", "-", " ", "'_", "+_", "metric_", "+_", "'", " ", "in", " ", "GM", " ", "-", " ", "Std", " ", "in", " ", "WM", " ", "-", " ", "Std", " ", "in", " ", "GM", "\\\\", "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 ", " _", "f_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slice", "\\u", "set\\u", "metric_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "slice", "\\u", "i_", "in_", "enumerate_", "(_", "slice", "s", "\\u", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm", "\\u", "dat_", "=_", "copy_", "._", "deepcopy_", "(_", "slice", "\\u", "i_", "._", "im", "\\u", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "dat_", "=_", "copy_", "._", "deepcopy_", "(_", "slice", "\\u", "i_", "._", "im", "\\u", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mask", " ", "with", " ", "the", " ", "gray", " ", "matte", "r", " ", "segmentation_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "seg", "\\u", "to", "\\u", "use_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm", "\\u", "dat_", "[_", "slice", "\\u", "i_", "._", "gm", "\\u", "seg", "\\u", "M_", "==_", "0_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "dat_", "[_", "slice", "\\u", "i_", "._", "gm", "\\u", "seg", "\\u", "M_", "==_", "1_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm", "\\u", "dat_", "[_", "seg", "\\u", "to", "\\u", "use_", "[_", "i_", "]_", "==_", "0_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "dat_", "[_", "seg", "\\u", "to", "\\u", "use_", "[_", "i_", "]_", "==_", "1_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "threshol", "d", " ", "to", " ", "0.", "1", " ", "to", " ", "get", " ", "rid", " ", "of", " ", "the", " ", "(", "alm", "ost", ")", " ", "null", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gm", "\\u", "dat_", "=_", "gm", "\\u", "dat_", "[_", "gm", "\\u", "dat_", ">_", "0.1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "dat_", "=_", "wm", "\\u", "dat_", "[_", "wm", "\\u", "dat_", ">_", "0.1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "metric", " ", "in", " ", "GM", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "gm", "\\u", "percentile_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remo", "ving", " ", "outliers", " ", "with", " ", "a", " ", "percentile_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm", "\\u", "dat_", "=_", "sorted_", "(_", "gm", "\\u", "dat_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "gm", "\\u", "outliers", "_", "=_", "int_", "(_", "round_", "(_", "gm", "\\u", "percentile_", "*_", "len_", "(_", "gm", "\\u", "dat_", ")_", "/_", "2.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n", "\\u", "gm", "\\u", "outliers", "_", "!=_", "0_", "and_", "n", "\\u", "gm", "\\u", "outliers", "_", "*_", "2_", "<_", "len_", "(_", "gm", "\\u", "dat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm", "\\u", "dat_", "=_", "gm", "\\u", "dat_", "[_", "n", "\\u", "gm", "\\u", "outliers", "_", ":_", "-_", "n", "\\u", "gm", "\\u", "outliers", "_", "]_", "\\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_", "gm", "\\u", "dat_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm", "\\u", "met_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm", "\\u", "std_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "metric_", "._", "lower_", "(_", ")_", "==_", "'", "mean", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm", "\\u", "met_", "=_", "np_", "._", "mean_", "(_", "gm", "\\u", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "metric_", "._", "lower_", "(_", ")_", "==_", "'", "median", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm", "\\u", "met_", "=_", "np_", "._", "median_", "(_", "gm", "\\u", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gm", "\\u", "std_", "=_", "np_", "._", "std_", "(_", "gm", "\\u", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "metric", " ", "in", " ", "WM", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "wm", "\\u", "percentile_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remo", "ving", " ", "outliers", " ", "with", " ", "a", " ", "percentile_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wm", "\\u", "dat_", "=_", "sorted_", "(_", "wm", "\\u", "dat_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "wm", "\\u", "outliers", "_", "=_", "int_", "(_", "round_", "(_", "wm", "\\u", "percentile_", "*_", "len_", "(_", "wm", "\\u", "dat_", ")_", "/_", "2.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n", "\\u", "wm", "\\u", "outliers", "_", "!=_", "0_", "and_", "n", "\\u", "wm", "\\u", "outliers", "_", "*_", "2_", "<_", "len_", "(_", "wm", "\\u", "dat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wm", "\\u", "dat_", "=_", "wm", "\\u", "dat_", "[_", "n", "\\u", "wm", "\\u", "outliers", "_", ":_", "-_", "n", "\\u", "wm", "\\u", "outliers", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "wm", "\\u", "dat_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wm", "\\u", "met_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "std_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "metric_", "._", "lower_", "(_", ")_", "==_", "'", "mean", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wm", "\\u", "met_", "=_", "np_", "._", "mean_", "(_", "wm", "\\u", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "metric_", "._", "lower_", "(_", ")_", "==_", "'", "median", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wm", "\\u", "met_", "=_", "np_", "._", "median_", "(_", "wm", "\\u", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wm", "\\u", "std_", "=_", "np_", "._", "std_", "(_", "wm", "\\u", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slice", "\\u", "set\\u", "metric_", "[_", "slice", "\\u", "i_", "._", "id_", "]_", "=_", "(_", "wm", "\\u", "met_", ",_", "gm", "\\u", "met_", ",_", "wm", "\\u", "std_", ",_", "gm", "\\u", "std_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "save_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "str_", "(_", "slice", "\\u", "i_", "._", "id_", ")_", "+_", "'", " ", "-", " ", "'_", "+_", "level", "\\u", "label_", "[_", "int_", "(_", "slice", "\\u", "i_", "._", "level_", ")_", "]_", "+_", "'", " ", "-", " ", "'_", "+_", "str_", "(_", "wm", "\\u", "met_", ")_", "+_", "'", " ", "-", " ", "'_", "+_", "str_", "(_", "gm", "\\u", "met_", ")_", "+_", "'", " ", "-", " ", "'_", "+_", "str_", "(_", "wm", "\\u", "std_", ")_", "+_", "'", " ", "-", " ", "'_", "+_", "str_", "(_", "gm", "\\u", "std_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "save_", ":_", "\\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_", "return_", "slice", "\\u", "set\\u", "metric_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "crop", "\\u", "t2", "\\u", "star_", "(_", "t2", "star_", ",_", "sc", "\\u", "seg_", ",_", "box", "\\u", "size_", "=_", "75_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pret", "rea", "tme", "nt", " ", "function", " ", "crop", "ing", " ", "the", " ", "t2", "star", " ", "file", " ", "aro", "und", " ", "the", " ", "spin", "al", " ", "cord", " ", "and", " ", "to", " ", "a", " ", "7", "5", "*", "7", "5", " ", "square", "d", " ", "image", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "t2", "star", ":", " ", "t2", "star", " ", "image", " ", "to", " ", "be", " ", "crop", "ed", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "sc", "\\u", "seg", ":", " ", "segmentation", " ", "of", " ", "the", " ", "spin", "al", " ", "cord", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2", "star", "\\u", "name_", "=_", "sct", "_", "._", "extract", "\\u", "fname_", "(_", "t2", "star_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sc", "\\u", "seg", "\\u", "name_", "=_", "sct", "_", "._", "extract", "\\u", "fname_", "(_", "sc", "\\u", "seg_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "box_", "=_", "None_", "\\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 ", " _", "ext_", "=_", "'.", "ni", "i", ".", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "in", "\\u", "name_", "=_", "t2", "star", "\\u", "name_", "+_", "'\\u", "seg", "\\u", "in", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "in_", "=_", "seg", "\\u", "in", "\\u", "name_", "+_", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "crop", "\\u", "image", " ", "-", "i", " ", "'_", "+_", "t2", "star_", "+_", "'", " ", "-", "m", " ", "'_", "+_", "sc", "\\u", "seg_", "+_", "'", " ", "-", "b", " ", "0", " ", "-", "o", " ", "'_", "+_", "seg", "\\u", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mask", "\\u", "box_", "=_", "t2", "star", "\\u", "name_", "+_", "'\\u", "square", "\\u", "mask", "\\u", "from", "\\u", "sc", "\\u", "seg", "'_", "+_", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "create", "\\u", "mask", " ", "-", "i", " ", "'_", "+_", "seg", "\\u", "in_", "+_", "'", " ", "-", "p", " ", "center", "line", ",'_", "+_", "sc", "\\u", "seg_", "+_", "'", " ", "-", "size", " ", "'_", "+_", "str_", "(_", "box", "\\u", "size_", ")_", "+_", "'", " ", "-", "o", " ", "'_", "+_", "mask", "\\u", "box_", "+_", "'", " ", "-", "f", " ", "box", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seg", "\\u", "in", "\\u", "im_", "=_", "Image_", "(_", "seg", "\\u", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "im_", "=_", "Image_", "(_", "mask", "\\u", "box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "in", "\\u", "im_", "._", "crop", "\\u", "and", "\\u", "stack_", "(_", "mask", "\\u", "im_", ",_", "suffix_", "=_", "'\\u", "crop", "ed", "'_", ",_", "save_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "in", "\\u", "name_", "+=_", "'\\u", "crop", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "in", "\\u", "im_", "._", "set", "File", "Name_", "(_", "seg", "\\u", "in", "\\u", "name_", "+_", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "in", "\\u", "im_", "=_", "set\\u", "orientation_", "(_", "seg", "\\u", "in", "\\u", "im_", ",_", "'", "IR", "P", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fname", "\\u", "seg", "\\u", "in", "\\u", "IR", "P_", "=_", "seg", "\\u", "in", "\\u", "name_", "+_", "'\\u", "IR", "P", "'_", "+_", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "t2", "star", "\\u", "name_", "+_", "'\\u", "square", "\\u", "mask", "\\u", "from", "\\u", "sc", "\\u", "seg", "\\u", "IR", "P", ".", "ni", "i", ".", "gz", "'_", "in_", "os_", "._", "listdir_", "(_", "'.'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mask", "\\u", "box_", "=_", "t2", "star", "\\u", "name_", "+_", "'\\u", "square", "\\u", "mask", "\\u", "from", "\\u", "sc", "\\u", "seg", "\\u", "IR", "P", ".", "ni", "i", ".", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", ":", " ", "an", " ", "error", " ", "occure", "d", " ", "whe", "n", " ", "crop", "ing", " ", "'_", "+_", "t2", "star", "\\u", "name_", "+_", "'...", " ", "\\\\", "n", " ", "'_", "+_", "str_", "(_", "e_", ")_", ",_", "1_", ",_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mask", "\\u", "box_", ",_", "fname", "\\u", "seg", "\\u", "in", "\\u", "IR", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lea", "ve", "\\u", "one", "\\u", "out", "\\u", "by", "\\u", "subject_", "(_", "dic", "\\u", "path_", ",_", "dic", "\\u", "3d_", ",_", "deno", "ising", "_", "=_", "True_", ",_", "reg_", "=_", "'", "Affi", "ne", "'_", ",_", "metric_", "=_", "'", "MI", "'_", ",_", "use", "\\u", "levels_", "=_", "True_", ",_", "weight_", "=_", "2.5_", ",_", "eq_", "=_", "1_", ",_", "mode", "\\u", "weight", "ed", "\\u", "sim_", "=_", "False_", ",_", "weight", "ed", "\\u", "label", "\\u", "fusion", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Leav", "e", " ", "one", " ", "out", " ", "cross", " ", "validation", " ", "tak", "ing", " ", "1", " ", "SUBJECT", " ", "out", " ", "of", " ", "the", " ", "dictionar", "y", " ", "at", " ", "each", " ", "step", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "compu", "ting", " ", "the", " ", "result", "ing", " ", "dice", " ", "coefficient", ",", " ", "the", " ", "time", " ", "of", " ", "computation", " ", "and", " ", "an", " ", "error", " ", "map", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "dic", "\\u", "path", ":", " ", "path", " ", "to", " ", "the", " ", "dictionar", "y", " ", "to", " ", "use", " ", "to", " ", "do", " ", "the", " ", "model", " ", "validation", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "msc", "t", "\\u", "multia", "tla", "s", "\\u", "seg_", "import_", "Model_", ",_", "Segmentation", "Param_", ",_", "Supervis", "ed", "Segmentation", "Method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sct", "\\u", "segment", "\\u", "gray", "matte", "r_", "import_", "Full", "Gm", "Segmentation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wm", "\\u", "dice", "\\u", "file_", "=_", "open_", "(_", "'", "wm", "\\u", "dice", "\\u", "coef", "f", ".", "txt", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm", "\\u", "dice", "\\u", "file_", "=_", "open_", "(_", "'", "gm", "\\u", "dice", "\\u", "coef", "f", ".", "txt", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "csa", "\\u", "file_", "=_", "open_", "(_", "'", "wm", "\\u", "csa", ".", "txt", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm", "\\u", "csa", "\\u", "file_", "=_", "open_", "(_", "'", "gm", "\\u", "csa", ".", "txt", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd", "\\u", "file_", "=_", "open_", "(_", "'", "hd", ".", "txt", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "slices_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "level", "\\u", "label_", "=_", "{_", "0_", ":_", "''_", ",_", "1_", ":_", "'", "C1", "'_", ",_", "2_", ":_", "'", "C2", "'_", ",_", "3_", ":_", "'", "C3", "'_", ",_", "4_", ":_", "'", "C4", "'_", ",_", "5_", ":_", "'", "C5", "'_", ",_", "6_", ":_", "'", "C6", "'_", ",_", "7_", ":_", "'", "C", "7", "'_", ",_", "8_", ":_", "'", "T1", "'_", ",_", "9_", ":_", "'", "T2", "'_", ",_", "10_", ":_", "'", "T3", "'_", ",_", "11_", ":_", "'", "T", "4", "'_", ",_", "12_", ":_", "'", "T", "5", "'_", ",_", "13_", ":_", "'", "T6", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "the", " ", "error", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "gm", "\\u", "diff", "\\u", "by", "\\u", "level_", "=_", "{_", "'", "C1", "'_", ":_", "[_", "]_", ",_", "'", "C2", "'_", ":_", "[_", "]_", ",_", "'", "C3", "'_", ":_", "[_", "]_", ",_", "'", "C4", "'_", ":_", "[_", "]_", ",_", "'", "C5", "'_", ":_", "[_", "]_", ",_", "'", "C6", "'_", ":_", "[_", "]_", ",_", "'", "C", "7", "'_", ":_", "[_", "]_", ",_", "'", "T1", "'_", ":_", "[_", "]_", ",_", "'", "T2", "'_", ":_", "[_", "]_", ",_", "''_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "diff", "\\u", "by", "\\u", "level_", "=_", "{_", "'", "C1", "'_", ":_", "[_", "]_", ",_", "'", "C2", "'_", ":_", "[_", "]_", ",_", "'", "C3", "'_", ":_", "[_", "]_", ",_", "'", "C4", "'_", ":_", "[_", "]_", ",_", "'", "C5", "'_", ":_", "[_", "]_", ",_", "'", "C6", "'_", ":_", "[_", "]_", ",_", "'", "C", "7", "'_", ":_", "[_", "]_", ",_", "'", "T1", "'_", ":_", "[_", "]_", ",_", "'", "T2", "'_", ":_", "[_", "]_", ",_", "''_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "subject", "\\u", "dir_", "in_", "os_", "._", "listdir_", "(_", "dic", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject", "\\u", "path_", "=_", "dic", "\\u", "path_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "subject", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "\\u", "dir_", "=_", "'", "tmp", "\\u'_", "+_", "subject", "\\u", "dir_", "+_", "'\\u", "as", "\\u", "target", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "mkd", "ir", " ", "'_", "+_", "tmp", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "\\u", "dic", "\\u", "name_", "=_", "'", "dic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "cp", " ", "-", "r", " ", "'_", "+_", "dic", "\\u", "path_", "+_", "'", " ", "./", "'_", "+_", "tmp", "\\u", "dir_", "+_", "'/'_", "+_", "tmp", "\\u", "dic", "\\u", "name_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "cp", " ", "-", "r", " ", "'_", "+_", "dic", "\\u", "3d_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", "+_", "'", " ", "./", "'_", "+_", "tmp", "\\u", "dir_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "mv", " ", "./", "'_", "+_", "tmp", "\\u", "dir_", "+_", "'/'_", "+_", "tmp", "\\u", "dic", "\\u", "name_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", "+_", "'", " ", "./", "'_", "+_", "tmp", "\\u", "dir_", "+_", "'/'_", "+_", "subject", "\\u", "dir_", "+_", "'\\u", "by", "\\u", "slice", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gra", "y", " ", "matte", "r", " ", "segmentation", " ", "usi", "ng", " ", "this", " ", "subject", " ", "as", " ", "target_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "tmp", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "=_", "Segmentation", "Param_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "path", "\\u", "model_", "=_", "tmp", "\\u", "dic", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "todo", "\\u", "model_", "=_", "'", "compute", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "weight", "\\u", "gamma_", "=_", "float_", "(_", "weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "use", "\\u", "levels_", "=_", "use", "\\u", "levels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "res", "\\u", "type_", "=_", "'", "prob", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "reg_", "=_", "reg_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "reg", "\\u", "metric_", "=_", "metric_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "equation", "\\u", "id_", "=_", "eq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "mode", "\\u", "weight", "\\u", "similarity_", "=_", "mode", "\\u", "weight", "ed", "\\u", "sim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "weight", "\\u", "label", "\\u", "fusion", "_", "=_", "weight", "ed", "\\u", "label", "\\u", "fusion", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "param_", "._", "target", "\\u", "deno", "ising", "_", "=_", "deno", "ising", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "Model_", "(_", "model", "\\u", "param_", "=_", "model", "\\u", "param_", ",_", "k_", "=_", "0.8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "slice", "s", "\\u", "model_", "=_", "model_", "._", "dictionary_", "._", "J_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sc", "\\u", "seg_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "gm", "\\u", "seg", "\\u", "im_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file", "\\u", "name_", "in_", "os_", "._", "listdir_", "(_", "subject", "\\u", "dir_", ")_", ":_", "#", " ", "3d", " ", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "'", "im", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target_", "=_", "subject", "\\u", "dir_", "+_", "'/'_", "+_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "level", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "level_", "=_", "subject", "\\u", "dir_", "+_", "'/'_", "+_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "gm", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ref", "\\u", "gm", "\\u", "seg", "\\u", "im_", "=_", "subject", "\\u", "dir_", "+_", "'/'_", "+_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "seg", "'_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sc", "\\u", "seg_", "=_", "subject", "\\u", "dir_", "+_", "'/'_", "+_", "file", "\\u", "name_", "\\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_", "full", "\\u", "gm", "seg_", "=_", "Full", "Gm", "Segmentation", "_", "(_", "target_", ",_", "sc", "\\u", "seg_", ",_", "None_", ",_", "level_", ",_", "ref", "\\u", "gm", "\\u", "seg_", "=_", "ref", "\\u", "gm", "\\u", "seg", "\\u", "im_", ",_", "model_", "=_", "model_", ",_", "param_", "=_", "model", "\\u", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "##", " ", "VALIDATION", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dic", "e", " ", "coeff_", "\\u\\u\\uNL\\u\\u\\u_", "subject", "\\u", "dice_", "=_", "open_", "(_", "full", "\\u", "gm", "seg_", "._", "dice", "\\u", "name_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dice", "\\u", "lines", "\\u", "list_", "=_", "subject", "\\u", "dice_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject", "\\u", "dice_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm", "\\u", "dice", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "dice", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "subject", "\\u", "slices_", "=_", "len_", "(_", "full", "\\u", "gm", "seg_", "._", "gm", "\\u", "seg_", "._", "target", "\\u", "seg", "\\u", "methods_", "._", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "slices_", "+=_", "n", "\\u", "subject", "\\u", "slices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "dice", "\\u", "lines", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "'", "Gra", "y", " ", "Matt", "er", "'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "gm", "\\u", "dice", "s_", "=_", "dice", "\\u", "lines", "\\u", "list_", "[_", "i_", "+_", "10_", ":_", "i_", "+_", "10_", "+_", "n", "\\u", "subject", "\\u", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "White", " ", "Matt", "er", "'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "wm", "\\u", "dice", "s_", "=_", "dice", "\\u", "lines", "\\u", "list_", "[_", "i_", "+_", "10_", ":_", "i_", "+_", "10_", "+_", "n", "\\u", "subject", "\\u", "slices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subject", "\\u", "slice", "s", "\\u", "levels_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "slice", "\\u", "dice_", "in_", "wm", "\\u", "dice", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target", "\\u", "slice_", ",_", "wm", "\\u", "dice_", "=_", "slice", "\\u", "dice_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "int_", "(_", "target", "\\u", "slice_", ")_", "<_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "0", "'_", "+_", "target", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "'_", "+_", "target", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slice", "\\u", "level_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file", "\\u", "name_", "in_", "os_", "._", "listdir_", "(_", "'./'_", "+_", "subject", "\\u", "dir_", "+_", "'\\u", "by", "\\u", "slice", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "target", "\\u", "slice_", "in_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "slice", "\\u", "level_", "=_", "file", "\\u", "name_", "[_", "file", "\\u", "name_", "._", "find_", "(_", "target", "\\u", "slice_", ")_", "+_", "8_", ":_", "file", "\\u", "name_", "._", "find_", "(_", "target", "\\u", "slice_", ")_", "+_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject", "\\u", "slice", "s", "\\u", "levels_", "[_", "target", "\\u", "slice_", "]_", "=_", "slice", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wm", "\\u", "dice", "\\u", "file_", "._", "write_", "(_", "subject", "\\u", "dir_", "+_", "'", " ", "'_", "+_", "target", "\\u", "slice_", "+_", "'", " ", "'_", "+_", "slice", "\\u", "level_", "+_", "':", " ", "'_", "+_", "wm", "\\u", "dice_", "+_", "'", " ", ";", " ", "nsl", "ices", ":", " ", "'_", "+_", "str_", "(_", "n", "\\u", "slice", "s", "\\u", "model_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "slice", "\\u", "dice_", "in_", "gm", "\\u", "dice", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target", "\\u", "slice_", ",_", "gm", "\\u", "dice_", "=_", "slice", "\\u", "dice_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "int_", "(_", "target", "\\u", "slice_", ")_", "<_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "0", "'_", "+_", "target", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "'_", "+_", "target", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slice", "\\u", "level_", "=_", "subject", "\\u", "slice", "s", "\\u", "levels_", "[_", "target", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm", "\\u", "dice", "\\u", "file_", "._", "write_", "(_", "subject", "\\u", "dir_", "+_", "'", " ", "'_", "+_", "target", "\\u", "slice_", "+_", "'", " ", "'_", "+_", "slice", "\\u", "level_", "+_", "':", " ", "'_", "+_", "gm", "\\u", "dice_", "+_", "'", " ", ";", " ", "nsl", "ices", ":", " ", "'_", "+_", "str_", "(_", "n", "\\u", "slice", "s", "\\u", "model_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "haus", "dor", "ff", " ", "distance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subject", "\\u", "hd_", "=_", "open_", "(_", "full", "\\u", "gm", "seg_", "._", "haus", "dor", "ff", "\\u", "name_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd", "\\u", "res", "\\u", "list_", "=_", "subject", "\\u", "hd_", "._", "readlines_", "(_", ")_", "[_", "1_", ":_", "-_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "hd", "\\u", "res", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "n", "\\u", "slice_", ",_", "res", "\\u", "slice_", "=_", "line_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd_", ",_", "med", "1_", ",_", "med", "2_", "=_", "res", "\\u", "slice_", "._", "split_", "(_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "slice_", "=_", "n", "\\u", "slice_", "[_", "-_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "med", "1_", "=_", "float_", "(_", "med", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "med", "2_", "=_", "float_", "(_", "med", "2_", "[_", ":_", "-_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "int_", "(_", "n", "\\u", "slice_", ")_", "<_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "0", "'_", "+_", "n", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "'_", "+_", "n", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slice", "\\u", "level_", "=_", "subject", "\\u", "slice", "s", "\\u", "levels_", "[_", "target", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd", "\\u", "file_", "._", "write_", "(_", "subject", "\\u", "dir_", "+_", "'", " ", "'_", "+_", "target", "\\u", "slice_", "+_", "'", " ", "'_", "+_", "slice", "\\u", "level_", "+_", "':", " ", "'_", "+_", "str_", "(_", "hd_", ")_", "+_", "'", " ", "-", " ", "'_", "+_", "str_", "(_", "max_", "(_", "med", "1_", ",_", "med", "2_", ")_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "ERROR", " ", "MAP", " ", "BY", " ", "LE", "VEL", " ", "COMP", "UT", "ATION", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "validation_", "=_", "full", "\\u", "gm", "seg_", "._", "tmp", "\\u", "dir_", "+_", "'/", "validation", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "gm", "\\u", "seg", "\\u", "im_", "=_", "Image_", "(_", "path", "\\u", "validation_", "+_", "'", "ref", "\\u", "gm", "\\u", "seg", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "wm", "\\u", "seg", "\\u", "im_", "=_", "Image_", "(_", "path", "\\u", "validation_", "+_", "'", "ref", "\\u", "wm", "\\u", "seg", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "gm", "\\u", "seg", "\\u", "im_", "=_", "Image_", "(_", "path", "\\u", "validation_", "+_", "'", "res", "\\u", "gm", "\\u", "seg", "\\u", "bin", "\\u", "RP", "I", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "wm", "\\u", "seg", "\\u", "im_", "=_", "Image_", "(_", "path", "\\u", "validation_", "+_", "'", "res", "\\u", "wm", "\\u", "seg", "\\u", "bin", "\\u", "RP", "I", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "\\u", "gm", "\\u", "seg", "\\u", "im_", "._", "change", "\\u", "orientation_", "(_", "'", "IR", "P", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "wm", "\\u", "seg", "\\u", "im_", "._", "change", "\\u", "orientation_", "(_", "'", "IR", "P", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "gm", "\\u", "seg", "\\u", "im_", "._", "change", "\\u", "orientation_", "(_", "'", "IR", "P", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "wm", "\\u", "seg", "\\u", "im_", "._", "change", "\\u", "orientation_", "(_", "'", "IR", "P", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "\\u", "slice_", "in_", "range_", "(_", "len_", "(_", "ref", "\\u", "gm", "\\u", "seg", "\\u", "im_", "._", "data_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "slice", "\\u", "gm", "\\u", "error_", "=_", "abs_", "(_", "ref", "\\u", "gm", "\\u", "seg", "\\u", "im_", "._", "data_", "[_", "i", "\\u", "slice_", "]_", "-_", "res", "\\u", "gm", "\\u", "seg", "\\u", "im_", "._", "data_", "[_", "i", "\\u", "slice_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "wm", "\\u", "error_", "=_", "abs_", "(_", "ref", "\\u", "wm", "\\u", "seg", "\\u", "im_", "._", "data_", "[_", "i", "\\u", "slice_", "]_", "-_", "res", "\\u", "wm", "\\u", "seg", "\\u", "im_", "._", "data_", "[_", "i", "\\u", "slice_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "i", "\\u", "slice_", ")_", "<_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "0", "'_", "+_", "str_", "(_", "i", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "'_", "+_", "str_", "(_", "i", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slice", "\\u", "level_", "=_", "subject", "\\u", "slice", "s", "\\u", "levels_", "[_", "target", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm", "\\u", "diff", "\\u", "by", "\\u", "level_", "[_", "slice", "\\u", "level_", "]_", "._", "append_", "(_", "slice", "\\u", "gm", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "diff", "\\u", "by", "\\u", "level_", "[_", "slice", "\\u", "level_", "]_", "._", "append_", "(_", "slice", "\\u", "wm", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "csa", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "process", "\\u", "segmentation", " ", "-", "i", " ", "'_", "+_", "full", "\\u", "gm", "seg_", "._", "res", "\\u", "names_", "[_", "'", "corrected", "\\u", "wm", "\\u", "seg", "'_", "]_", "+_", "'", " ", "-", "p", " ", "csa", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "csa", "\\u", "file_", "=_", "open_", "(_", "'", "csa", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csa", "\\u", "lines_", "=_", "tmp", "\\u", "csa", "\\u", "file_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "csa", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "slice", "\\u", "csa", "_", "in_", "csa", "\\u", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target", "\\u", "slice_", ",_", "wm", "\\u", "csa", "_", "=_", "slice", "\\u", "csa", "_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "target", "\\u", "slice_", ")_", "<_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "0", "'_", "+_", "target", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "'_", "+_", "target", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slice", "\\u", "level_", "=_", "subject", "\\u", "slice", "s", "\\u", "levels_", "[_", "target", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "csa", "\\u", "file_", "._", "write_", "(_", "subject", "\\u", "dir_", "+_", "'", " ", "'_", "+_", "target", "\\u", "slice_", "+_", "'", " ", "'_", "+_", "slice", "\\u", "level_", "+_", "':", " ", "'_", "+_", "wm", "\\u", "csa", "_", "[_", ":_", "-_", "1_", "]_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "mv", " ", "csa", ".", "txt", " ", "csa", "\\u", "corrected", "\\u", "wm", "\\u", "seg", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "process", "\\u", "segmentation", " ", "-", "i", " ", "'_", "+_", "full", "\\u", "gm", "seg_", "._", "res", "\\u", "names_", "[_", "'", "gm", "\\u", "seg", "'_", "]_", "+_", "'", " ", "-", "p", " ", "csa", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "csa", "\\u", "file_", "=_", "open_", "(_", "'", "csa", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csa", "\\u", "lines_", "=_", "tmp", "\\u", "csa", "\\u", "file_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "csa", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "slice", "\\u", "csa", "_", "in_", "csa", "\\u", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target", "\\u", "slice_", ",_", "gm", "\\u", "csa", "_", "=_", "slice", "\\u", "csa", "_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "target", "\\u", "slice_", ")_", "<_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "0", "'_", "+_", "target", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "\\u", "slice_", "=_", "'", "slice", "'_", "+_", "target", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slice", "\\u", "level_", "=_", "subject", "\\u", "slice", "s", "\\u", "levels_", "[_", "target", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm", "\\u", "csa", "\\u", "file_", "._", "write_", "(_", "subject", "\\u", "dir_", "+_", "'", " ", "'_", "+_", "target", "\\u", "slice_", "+_", "'", " ", "'_", "+_", "slice", "\\u", "level_", "+_", "':", " ", "'_", "+_", "gm", "\\u", "csa", "_", "[_", ":_", "-_", "1_", "]_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "mv", " ", "csa", ".", "txt", " ", "csa", "\\u", "gm", "\\u", "seg", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "'..'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", ":", " ", "an", " ", "error", " ", "occur", "red", " ", "...'_", ",_", "1_", ",_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "sct", ".", "run", "('", "rm", " ", "-", "rf", " ", "'", " ", "+", " ", "tmp", "\\u", "dir", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "l_", ",_", "level", "\\u", "error_", "in_", "gm", "\\u", "diff", "\\u", "by", "\\u", "level_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "len_", "(_", "level", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image_", "(_", "param_", "=_", "sum_", "(_", "level", "\\u", "error_", ")_", "/_", "n_", ",_", "abs", "olute", "path_", "=_", "'", "error", "\\u", "map", "\\u", "gm", "\\u'_", "+_", "str_", "(_", "l_", ")_", "+_", "'.", "ni", "i", ".", "gz", "'_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", ":", " ", "no", " ", "data", " ", "for", " ", "level", " ", "'_", "+_", "str_", "(_", "l_", ")_", ",_", "1_", ",_", "'", "warn", "ing", "'_", ")_", "\\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_", "l_", ",_", "level", "\\u", "error_", "in_", "wm", "\\u", "diff", "\\u", "by", "\\u", "level_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "len_", "(_", "level", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image_", "(_", "param_", "=_", "sum_", "(_", "level", "\\u", "error_", ")_", "/_", "n_", ",_", "abs", "olute", "path_", "=_", "'", "error", "\\u", "map", "\\u", "wm", "\\u'_", "+_", "str_", "(_", "l_", ")_", "+_", "'.", "ni", "i", ".", "gz", "'_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'", "WARN", "ING", ":", " ", "no", " ", "data", " ", "for", " ", "level", " ", "'_", "+_", "str_", "(_", "l_", ")_", ",_", "1_", ",_", "'", "warn", "ing", "'_", ")_", "\\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_", "e_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wm", "\\u", "dice", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm", "\\u", "dice", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wm", "\\u", "csa", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm", "\\u", "csa", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Image", "(", "param", "=", "error", "\\u", "map", "\\u", "abs", "\\u", "sum", "/", "n", "\\u", "slice", "s", ",", " ", "abs", "olute", "path", "='", "error", "\\u", "map", "\\u", "abs", ".", "ni", "i", ".", "gz", "')", ".", "save", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "init_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Don", "e", " ", "in", " ", "'_", "+_", "str_", "(_", "t_", ")_", "+_", "'", " ", "sec", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ProgVal/Limnoria/plugins/News/config.py
[ { "content": "###\n# Copyright (c) 2003-2005, Daniel DiPaolo\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#\n# * Redistributions of source code must retain the above copyright notice,\n# this list of conditions, and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright notice,\n# this list of conditions, and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n# * Neither the name of the author of this software nor the name of\n# contributors to this software may be used to endorse or promote products\n# derived from this software without specific prior written consent.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n###\n\nimport supybot.conf as conf\nimport supybot.registry as registry\nfrom supybot.i18n import PluginInternationalization, internationalizeDocstring\n_ = PluginInternationalization('News')\n\n\n\nNews = conf.registerPlugin('News')\n# This is where your configuration variables (if any) should go. For example:\n# conf.registerGlobalValue(News, 'someConfigVariableName',\n# registry.Boolean(False, _(\"\"\"Help for someConfigVariableName.\"\"\")))\n\n\n# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def configure(advanced):\n # This will be called by supybot to configure this module. advanced is\n # a bool that specifies whether the user identified themself as an advanced\n # user or not. You should effect your configuration by manipulating the\n # registry as appropriate.\n from supybot.questions import expect, anything, something, yn\n conf.registerPlugin('News', True)", "metadata": "root.configure", "header": "['module', '___EOS___']", "index": 34 } ]
[ { "span": "import supybot.registry as registry", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 35 }, { "span": "from supybot.i18n import PluginInternationalization, internationalizeDocstring", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 78 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2003", "-", "2005", ",", " ", "Dan", "iel", " ", "Di", "Pa", "olo", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", ",", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", ",", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "author", " ", "of", " ", "this", " ", "software", " ", "nor", " ", "the", " ", "name", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "consent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "conf_", "as_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "registry_", "as_", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sup", "ybo", "t_", "._", "i18n_", "import_", "Plug", "in", "Intern", "ation", "ali", "zation_", ",_", "international", "ize", "Docs", "tring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", "=_", "Plug", "in", "Intern", "ation", "ali", "zation_", "(_", "'", "News", "'_", ")_", "\\u\\u\\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_", "News", "_", "=_", "conf_", "._", "register", "Plugin_", "(_", "'", "News", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "where", " ", "your", " ", "configura", "tion", " ", "variab", "les", " ", "(", "if", " ", "any", ")", " ", "shou", "ld", " ", "go", ".", " ", " ", "For", " ", "example", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "conf", ".", "register", "Global", "Value", "(", "News", ",", " ", "'", "some", "Config", "Varia", "ble", "Name", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "registr", "y", ".", "Boo", "lean", "(", "Fal", "se", ",", " ", "\\u(", "\"\"\"", "Help", " ", "for", " ", "some", "Config", "Varia", "ble", "Name", ".\"", "\"\"", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "set", " ", "shift", "widt", "h", "=", "4", " ", "soft", "tabs", "top", "=", "4", " ", "expand", "tab", " ", "text", "widt", "h", "=", "7", "9", ":_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "configure_", "(_", "advanced", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "be", " ", "call", "ed", " ", "by", " ", "sup", "ybo", "t", " ", "to", " ", "configur", "e", " ", "this", " ", "module", ".", " ", " ", "advanced", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "bool", " ", "tha", "t", " ", "speci", "fie", "s", " ", "whe", "ther", " ", "the", " ", "user", " ", "identifi", "ed", " ", "them", "self", " ", "as", " ", "an", " ", "advanced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", " ", "or", " ", "not", ".", " ", " ", "You", " ", "shou", "ld", " ", "effect", " ", "your", " ", "configura", "tion", " ", "by", " ", "manipulati", "ng", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "registr", "y", " ", "as", " ", "appropr", "iate", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sup", "ybo", "t_", "._", "questions_", "import_", "expect_", ",_", "anyt", "hing_", ",_", "something_", ",_", "yn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Plugin_", "(_", "'", "News", "'_", ",_", "True_", ")_", "\\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, 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om django.utils import six\n\n# backport of Python 3.4's glob.escape\n\nif six.PY3:\n from glob import escape as glob_escape\nelse:\n _magic_check = re.compile('([*?[])')\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def glob_escape(pathname):\n \"\"\"\n Escape all special characters.\n \"\"\"\n drive, pathname = os.path.splitdrive(pathname)\n pathname = _magic_check.sub(r'[\\1]', pathname)\n return drive + pathname", "metadata": "root.glob_escape", "header": "['module', '___EOS___']", "index": 14 } ]
[ { "span": "from glob import escape as glob_escape", "start_line": 10, "start_column": 4, "end_line": 10, "end_column": 42 } ]
[]
1
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_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "backp", "ort", " ", "of", " ", "Pyth", "on", " ", "3.4", "'", "s", " ", "glob", ".", "escape_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "glob_", "import_", "escape_", "as_", "glob", "\\u", "escape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "magic", "\\u", "check_", "=_", "re_", "._", "compile_", "(_", "'(", "[", "*?", "[]", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "glob", "\\u", "escape_", "(_", "pathname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Esc", "ape", " ", "all", " ", "special", " ", "character", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drive_", ",_", "pathname_", "=_", "os_", "._", "path_", "._", "split", "drive_", "(_", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pathname_", "=_", "\\u", "magic", "\\u", "check_", "._", "sub_", "(_", "r", "'[", "\\\\", "1", "]'_", ",_", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "drive_", "+_", "pathname_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]