query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
sequence
label_sequence
sequence
Unused local variable
rizar/attention-lvcsr/libs/Theano/theano/tests/test_pickle_unpickle_theano_fn.py
[ { "content": "def test_pickle_unpickle_with_reoptimization():\n mode = theano.config.mode\n if mode in [\"DEBUG_MODE\", \"DebugMode\"]:\n mode = \"FAST_RUN\"\n x1 = T.fmatrix('x1')\n x2 = T.fmatrix('x2')\n x3 = theano.shared(numpy.ones((10, 10), dtype=floatX))\n x4 = theano.shared(numpy.ones((10, 10), dtype=floatX))\n y = T.sum(T.sum(T.sum(x1 ** 2 + x2) + x3) + x4)\n\n updates = OrderedDict()\n updates[x3] = x3 + 1\n updates[x4] = x4 + 1\n f = theano.function([x1, x2], y, updates=updates, mode=mode)\n\n # now pickle the compiled theano fn\n string_pkl = pickle.dumps(f, -1)\n\n in1 = numpy.ones((10, 10), dtype=floatX)\n in2 = numpy.ones((10, 10), dtype=floatX)\n\n # test unpickle with optimization\n default = theano.config.reoptimize_unpickled_function\n try:\n # the default is True\n theano.config.reoptimize_unpickled_function = True\n f_ = pickle.loads(string_pkl)\n assert f(in1, in2) == f_(in1, in2)\n finally:\n theano.config.reoptimize_unpickled_function = default", "metadata": "root.test_pickle_unpickle_with_reoptimization", "header": "['module', '___EOS___']", "index": 23 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "pickle", "\\u", "unpickle", "\\u", "with", "\\u", "reo", "pti", "mi", "zation_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "theano_", "._", "config_", "._", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mode_", "in_", "[_", "\"", "DEBU", "G", "\\u", "MODE", "\"_", ",_", "\"", "Deb", "ug", "Mode", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "\"", "FAST", "\\u", "RUN", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x1_", "=_", "T_", "._", "fma", "trix_", "(_", "'", "x1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", "=_", "T_", "._", "fma", "trix_", "(_", "'", "x2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x3_", "=_", "theano_", "._", "shared_", "(_", "numpy_", "._", "ones_", "(_", "(_", "10_", ",_", "10_", ")_", ",_", "dtype_", "=_", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x4_", "=_", "theano_", "._", "shared_", "(_", "numpy_", "._", "ones_", "(_", "(_", "10_", ",_", "10_", ")_", ",_", "dtype_", "=_", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "T_", "._", "sum_", "(_", "T_", "._", "sum_", "(_", "T_", "._", "sum_", "(_", "x1_", "**_", "2_", "+_", "x2_", ")_", "+_", "x3_", ")_", "+_", "x4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "updates_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updates_", "[_", "x3_", "]_", "=_", "x3_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updates_", "[_", "x4_", "]_", "=_", "x4_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "theano_", "._", "function_", "(_", "[_", "x1_", ",_", "x2_", "]_", ",_", "y_", ",_", "updates_", "=_", "updates_", ",_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "pickle", " ", "the", " ", "compile", "d", " ", "theano", " ", "fn_", "\\u\\u\\uNL\\u\\u\\u_", "string", "\\u", "pkl", "_", "=_", "pickle_", "._", "dumps_", "(_", "f_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in1", "_", "=_", "numpy_", "._", "ones_", "(_", "(_", "10_", ",_", "10_", ")_", ",_", "dtype_", "=_", "float", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "2_", "=_", "numpy_", "._", "ones_", "(_", "(_", "10_", ",_", "10_", ")_", ",_", "dtype_", "=_", "float", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "unpickle", " ", "with", " ", "optimization", "_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "theano_", "._", "config_", "._", "reo", "pti", "mi", "ze", "\\u", "unpickle", "d\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "default", " ", "is", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "theano_", "._", "config_", "._", "reo", "pti", "mi", "ze", "\\u", "unpickle", "d\\u", "function_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u_", "=_", "pickle_", "._", "loads_", "(_", "string", "\\u", "pkl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "f_", "(_", "in1", "_", ",_", "in", "2_", ")_", "==_", "f", "\\u_", "(_", "in1", "_", ",_", "in", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\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 ]
Unused local variable
trademob/anna-molly/lib/plugins/tukeys_filter.py
[ { "content": " def read(self):\n quantile_25 = self.params['quantile_25']\n quantile_75 = self.params['quantile_75']\n metrics = self.params['metrics']\n delay = self.params.get('offset', 0)\n maximum_delay = self.params.get('maximum_delay', 600)\n\n # read metrics from metric_sink\n quantile_25 = [i for i in self.metric_sink.iread(quantile_25)]\n quantile_75 = [i for i in self.metric_sink.iread(quantile_75)]\n metrics = [i for i in self.metric_sink.iread(metrics)]\n if not (len(quantile_25) * len(quantile_75) * len(metrics)):\n self.logger.error(\n 'No data found for quantile/to be checked metrics. Exiting')\n return None\n\n # sort TimeSeriesTuples by timestamp\n quantile_25 = sorted(quantile_25, key=lambda tup: tup.timestamp)\n quantile_75 = sorted(quantile_75, key=lambda tup: tup.timestamp)\n metrics = sorted(metrics, key=lambda tup: (tup.name, tup.timestamp))\n\n # find closest datapoint to now() (corrected by delay) if not too old\n time_now = time() - delay\n quantile_25 = get_closest_datapoint(quantile_25, time_now)\n if time_now - quantile_25.timestamp > maximum_delay:\n self.logger.error('Quantile25 Value is too old (Timestamp: %d) of: %s. Exiting' % (\n quantile_25.timestamp, quantile_25.name))\n return None\n quantile_25 = quantile_25.value\n quantile_75 = get_closest_datapoint(quantile_75, time_now)\n if time_now - quantile_75.timestamp > maximum_delay:\n self.logger.error('Quantile75 Value is too old (Timestamp: %d) of: %s. Exiting' % (\n quantile_75.timestamp, quantile_75.name))\n return None\n quantile_75 = quantile_75.value\n if quantile_25 > quantile_75:\n self.logger.error('Inconsistent Quantile Values (Q25: %f, Q75: %f). Exiting' % (\n quantile_25, quantile_75))\n return None\n\n # group by metric (e.g. instance) first and find then closest datapoint\n distribution = {}\n grouped = itertools.groupby(metrics, key=lambda tup: tup.name)\n for key, metrics in grouped:\n closest_datapoint = get_closest_datapoint(\n [metric for metric in metrics], time_now)\n if time_now - closest_datapoint.timestamp < maximum_delay:\n distribution[key] = closest_datapoint.value\n if len(distribution) == 0:\n self.logger.error('No Distribution Values. Exiting')\n return None\n\n return quantile_25, quantile_75, distribution", "metadata": "root.TukeysFilter.read", "header": "['class', 'TukeysFilter', '(', 'BaseTask', ')', ':', '___EOS___']", "index": 21 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Tu", "keys", "Filter_", "(_", "Base", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quantile", "\\u", "25_", "=_", "self_", "._", "params_", "[_", "'", "quantile", "\\u", "25", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quantile", "\\u", "75_", "=_", "self_", "._", "params_", "[_", "'", "quantile", "\\u", "7", "5", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metrics_", "=_", "self_", "._", "params_", "[_", "'", "metric", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "offset", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxim", "um", "\\u", "delay_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "maxim", "um", "\\u", "dela", "y", "'_", ",_", "600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "metric", "s", " ", "from", " ", "metric", "\\u", "sink_", "\\u\\u\\uNL\\u\\u\\u_", "quantile", "\\u", "25_", "=_", "[_", "i_", "for_", "i_", "in_", "self_", "._", "metric", "\\u", "sink_", "._", "ire", "ad_", "(_", "quantile", "\\u", "25_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quantile", "\\u", "75_", "=_", "[_", "i_", "for_", "i_", "in_", "self_", "._", "metric", "\\u", "sink_", "._", "ire", "ad_", "(_", "quantile", "\\u", "75_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metrics_", "=_", "[_", "i_", "for_", "i_", "in_", "self_", "._", "metric", "\\u", "sink_", "._", "ire", "ad_", "(_", "metrics_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "len_", "(_", "quantile", "\\u", "25_", ")_", "*_", "len_", "(_", "quantile", "\\u", "75_", ")_", "*_", "len_", "(_", "metrics_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "No", " ", "data", " ", "found", " ", "for", " ", "quantile", "/", "to", " ", "be", " ", "checke", "d", " ", "metric", "s", ".", " ", "Exi", "ting", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sort", " ", "Time", "Serie", "s", "Tuples", " ", "by", " ", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "quantile", "\\u", "25_", "=_", "sorted_", "(_", "quantile", "\\u", "25_", ",_", "key_", "=_", "lambda_", "tup_", ":_", "tup_", "._", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quantile", "\\u", "75_", "=_", "sorted_", "(_", "quantile", "\\u", "75_", ",_", "key_", "=_", "lambda_", "tup_", ":_", "tup_", "._", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metrics_", "=_", "sorted_", "(_", "metrics_", ",_", "key_", "=_", "lambda_", "tup_", ":_", "(_", "tup_", "._", "name_", ",_", "tup_", "._", "timestamp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "closest", " ", "datapoint", " ", "to", " ", "now", "()", " ", "(", "corrected", " ", "by", " ", "dela", "y", ")", " ", "if", " ", "not", " ", "too", " ", "old_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "now_", "=_", "time_", "(_", ")_", "-_", "delay_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quantile", "\\u", "25_", "=_", "get", "\\u", "closest", "\\u", "datapoint", "_", "(_", "quantile", "\\u", "25_", ",_", "time", "\\u", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "time", "\\u", "now_", "-_", "quantile", "\\u", "25_", "._", "timestamp_", ">_", "maxim", "um", "\\u", "delay_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "'", "Quanti", "le2", "5", " ", "Value", " ", "is", " ", "too", " ", "old", " ", "(", "Timest", "amp", ":", " ", "%", "d", ")", " ", "of", ":", " ", "%", "s", ".", " ", "Exi", "ting", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "quantile", "\\u", "25_", "._", "timestamp_", ",_", "quantile", "\\u", "25_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "quantile", "\\u", "25_", "=_", "quantile", "\\u", "25_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quantile", "\\u", "75_", "=_", "get", "\\u", "closest", "\\u", "datapoint", "_", "(_", "quantile", "\\u", "75_", ",_", "time", "\\u", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "time", "\\u", "now_", "-_", "quantile", "\\u", "75_", "._", "timestamp_", ">_", "maxim", "um", "\\u", "delay_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "'", "Quanti", "le", "7", "5", " ", "Value", " ", "is", " ", "too", " ", "old", " ", "(", "Timest", "amp", ":", " ", "%", "d", ")", " ", "of", ":", " ", "%", "s", ".", " ", "Exi", "ting", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "quantile", "\\u", "75_", "._", "timestamp_", ",_", "quantile", "\\u", "75_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "quantile", "\\u", "75_", "=_", "quantile", "\\u", "75_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "quantile", "\\u", "25_", ">_", "quantile", "\\u", "75_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "'", "Inco", "nsis", "tent", " ", "Quanti", "le", " ", "Value", "s", " ", "(", "Q2", "5", ":", " ", "%", "f", ",", " ", "Q", "7", "5", ":", " ", "%", "f", ").", " ", "Exi", "ting", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "quantile", "\\u", "25_", ",_", "quantile", "\\u", "75_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "group", " ", "by", " ", "metric", " ", "(", "e", ".", "g", ".", " ", "instance", ")", " ", "first", " ", "and", " ", "find", " ", "then", " ", "closest", " ", "datapoint", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "distribution_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grouped_", "=_", "itertools_", "._", "groupby_", "(_", "metrics_", ",_", "key_", "=_", "lambda_", "tup_", ":_", "tup_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "metrics_", "in_", "grouped_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "closest", "\\u", "datapoint", "_", "=_", "get", "\\u", "closest", "\\u", "datapoint", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "metric_", "for_", "metric_", "in_", "metrics_", "]_", ",_", "time", "\\u", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "time", "\\u", "now_", "-_", "closest", "\\u", "datapoint", "_", "._", "timestamp_", "<_", "maxim", "um", "\\u", "delay_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "distribution_", "[_", "key_", "]_", "=_", "closest", "\\u", "datapoint", "_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "distribution_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "'", "No", " ", "Distribut", "ion", " ", "Value", "s", ".", " ", "Exi", "ting", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_",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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 ]
Unused local variable
tomatohater/django-unfriendly/unfriendly/views.py
[ { "content": "def deobfuscate(request, key, juice=None):\n \"\"\"\n Deobfuscates the URL and returns HttpResponse from source view.\n SEO juice is mostly ignored as it is intended for display purposes only.\n \"\"\"\n try:\n url = decrypt(str(key),\n settings.UNFRIENDLY_SECRET,\n settings.UNFRIENDLY_IV,\n checksum=settings.UNFRIENDLY_ENFORCE_CHECKSUM)\n except (CheckSumError, InvalidKeyError):\n return HttpResponseNotFound()\n\n url_parts = urlparse(unquote(url))\n path = url_parts.path\n query = url_parts.query\n\n try:\n view, args, kwargs = resolve(path)\n except Resolver404:\n return HttpResponseNotFound()\n\n # fix-up the environ object\n environ = request.environ.copy()\n environ['PATH_INFO'] = path[len(environ['SCRIPT_NAME']):]\n environ['QUERY_STRING'] = query\n\n # init a new request\n patched_request = request.__class__(environ)\n\n # copy over any missing request attributes - this feels hackish\n missing_items = set(dir(request)) - set(dir(patched_request))\n while missing_items:\n missing_item = missing_items.pop()\n patched_request.__setattr__(missing_item,\n request.__getattribute__(missing_item))\n\n # mark this request as obfuscated\n patched_request.META['obfuscated'] = True\n\n response = view(patched_request, *args, **kwargs)\n\n # offer up a friendlier juice-powered filename if downloaded\n if juice and not response.has_header('Content-Disposition'):\n response['Content-Disposition'] = 'inline; filename=%s' % juice\n\n return response", "metadata": "root.deobfuscate", "header": "['module', '___EOS___']", "index": 12 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "deo", "bf", "usc", "ate_", "(_", "request_", ",_", "key_", ",_", "ju", "ice_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "De", "obf", "usc", "ates", " ", "the", " ", "URL", " ", "and", " ", "return", "s", " ", "Http", "Respons", "e", " ", "from", " ", "source", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "SE", "O", " ", "ju", "ice", " ", "is", " ", "most", "ly", " ", "ignore", "d", " ", "as", " ", "it", " ", "is", " ", "inten", "ded", " ", "for", " ", "display", " ", "purpose", "s", " ", "only", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "decrypt_", "(_", "str_", "(_", "key_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "UN", "FRI", "END", "LY", "\\u", "SECRET_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "UN", "FRI", "END", "LY", "\\u", "IV", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "checksum_", "=_", "settings_", "._", "UN", "FRI", "END", "LY", "\\u", "EN", "FORCE", "\\u", "CHECKS", "UM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Check", "Sum", "Error_", ",_", "Inva", "lid", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Not", "Found_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url", "\\u", "parts_", "=_", "urlparse_", "(_", "unquote_", "(_", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "url", "\\u", "parts_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "url", "\\u", "parts_", "._", "query_", "\\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 ", " _", "view_", ",_", "args_", ",_", "kwargs_", "=_", "resolve_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Resolv", "er", "404_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Not", "Found_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fix", "-", "up", " ", "the", " ", "environ", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "environ_", "=_", "request_", "._", "environ_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", "=_", "path_", "[_", "len_", "(_", "environ_", "[_", "'", "SCRIPT", "\\u", "NAME", "'_", "]_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "[_", "'", "QUE", "RY", "\\u", "STRING", "'_", "]_", "=_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "init", " ", "a", " ", "new", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "patche", "d\\u", "request_", "=_", "request_", "._", "\\u\\u", "class\\u\\u_", "(_", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copy", " ", "over", " ", "any", " ", "missi", "ng", " ", "request", " ", "attribute", "s", " ", "-", " ", "this", " ", "feel", "s", " ", "hack", "ish_", "\\u\\u\\uNL\\u\\u\\u_", "missi", "ng", "\\u", "items_", "=_", "set_", "(_", "dir_", "(_", "request_", ")_", ")_", "-_", "set_", "(_", "dir_", "(_", "patche", "d\\u", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "missi", "ng", "\\u", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "missi", "ng", "\\u", "item_", "=_", "missi", "ng", "\\u", "items_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patche", "d\\u", "request_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "missi", "ng", "\\u", "item_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "\\u\\u", "getattribute\\u\\u_", "(_", "missi", "ng", "\\u", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mark", " ", "this", " ", "request", " ", "as", " ", "obf", "usc", "ated", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "patche", "d\\u", "request_", "._", "META_", "[_", "'", "obf", "usc", "ated", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "view_", "(_", "patche", "d\\u", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "off", "er", " ", "up", " ", "a", " ", "frie", "ndl", "ier", " ", "ju", "ice", "-", "powered", " ", "filename", " ", "if", " ", "downloaded_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ju", "ice_", "and_", "not_", "response_", "._", "has", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "[_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", "]_", "=_", "'", "inline", ";", " ", "filename", "=", "%", "s", "'_", "%_", "ju", "ice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
azoft-dev-team/imagrium/env/Lib/distutils/unixccompiler.py
[ { "content": " def preprocess(self, source,\n output_file=None, macros=None, include_dirs=None,\n extra_preargs=None, extra_postargs=None):\n ignore, macros, include_dirs = \\\n self._fix_compile_args(None, macros, include_dirs)\n pp_opts = gen_preprocess_options(macros, include_dirs)\n pp_args = self.preprocessor + pp_opts\n if output_file:\n pp_args.extend(['-o', output_file])\n if extra_preargs:\n pp_args[:0] = extra_preargs\n if extra_postargs:\n pp_args.extend(extra_postargs)\n pp_args.append(source)\n\n # We need to preprocess: either we're being forced to, or we're\n # generating output to stdout, or there's a target output file and\n # the source file is newer than the target (or the target doesn't\n # exist).\n if self.force or output_file is None or newer(source, output_file):\n if output_file:\n self.mkpath(os.path.dirname(output_file))\n try:\n self.spawn(pp_args)\n except DistutilsExecError, msg:\n raise CompileError, msg", "metadata": "root.UnixCCompiler.preprocess", "header": "['class', 'UnixCCompiler', '(', 'CCompiler', ')', ':', '___EOS___']", "index": 144 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Uni", "x", "CC", "omp", "iler", "_", "(_", "CC", "omp", "iler", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "preprocess_", "(_", "self_", ",_", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "file_", "=_", "None_", ",_", "macros_", "=_", "None_", ",_", "include", "\\u", "dirs_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "prea", "rgs_", "=_", "None_", ",_", "extra", "\\u", "posta", "rgs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ignore_", ",_", "macros_", ",_", "include", "\\u", "dirs_", "=_", "self_", "._", "\\u", "fix", "\\u", "compile", "\\u", "args_", "(_", "None_", ",_", "macros_", ",_", "include", "\\u", "dirs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp", "\\u", "opts_", "=_", "gen", "\\u", "preproc", "ess", "\\u", "options_", "(_", "macros_", ",_", "include", "\\u", "dirs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp", "\\u", "args_", "=_", "self_", "._", "preprocessor_", "+_", "pp", "\\u", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pp", "\\u", "args_", "._", "extend_", "(_", "[_", "'-", "o", "'_", ",_", "output", "\\u", "file_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extra", "\\u", "prea", "rgs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pp", "\\u", "args_", "[_", ":_", "0_", "]_", "=_", "extra", "\\u", "prea", "rgs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extra", "\\u", "posta", "rgs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pp", "\\u", "args_", "._", "extend_", "(_", "extra", "\\u", "posta", "rgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pp", "\\u", "args_", "._", "append_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "preproc", "ess", ":", " ", "eit", "her", " ", "we", "'", "re", " ", "bei", "ng", " ", "forced", " ", "to", ",", " ", "or", " ", "we", "'", "re_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "ing", " ", "output", " ", "to", " ", "stdout", ",", " ", "or", " ", "there", "'", "s", " ", "a", " ", "target", " ", "output", " ", "file", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "source", " ", "file", " ", "is", " ", "newe", "r", " ", "than", " ", "the", " ", "target", " ", "(", "or", " ", "the", " ", "target", " ", "doe", "sn", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "force_", "or_", "output", "\\u", "file_", "is_", "None_", "or_", "newe", "r_", "(_", "source_", ",_", "output", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "output", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mk", "path_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "output", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "spawn_", "(_", "pp", "\\u", "args_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
darcyliu/storyboard/markdown/postprocessors.py
[ { "content": "\"\"\"\nPOST-PROCESSORS\n=============================================================================\n\nMarkdown also allows post-processors, which are similar to preprocessors in\nthat they need to implement a \"run\" method. However, they are run after core\nprocessing.\n\n\"\"\"\n\nimport re\nimport util\nimport odict\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def build_postprocessors(md_instance, **kwargs):\n \"\"\" Build the default postprocessors for Markdown. \"\"\"\n postprocessors = odict.OrderedDict()\n postprocessors[\"raw_html\"] = RawHtmlPostprocessor(md_instance)\n postprocessors[\"amp_substitute\"] = AndSubstitutePostprocessor()\n postprocessors[\"unescape\"] = UnescapePostprocessor()\n return postprocessors", "metadata": "root.build_postprocessors", "header": "['module', '___EOS___']", "index": 14 }, { "content": "class Postprocessor(util.Processor):\n \"\"\"\n Postprocessors are run after the ElementTree it converted back into text.\n\n Each Postprocessor implements a \"run\" method that takes a pointer to a\n text string, modifies it as necessary and returns a text string.\n\n Postprocessors must extend markdown.Postprocessor.\n\n \"\"\"\n", "metadata": "root.Postprocessor", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def run(self, text):\n \"\"\"\n Subclasses of Postprocessor should implement a `run` method, which\n takes the html document as a single text string and returns a\n (possibly modified) string.\n\n \"\"\"\n pass", "metadata": "root.Postprocessor.run", "header": "['class', 'Postprocessor', '(', 'util', '.', 'Processor', ')', ':', '___EOS___']", "index": 34 }, { "content": "class RawHtmlPostprocessor(Postprocessor):\n \"\"\" Restore raw html to the document. \"\"\"\n\n\n", "metadata": "root.RawHtmlPostprocessor", "header": "['module', '___EOS___']", "index": 44 }, { "content": " def run(self, text):\n \"\"\" Iterate over html stash and restore \"safe\" html. \"\"\"\n for i in range(self.markdown.htmlStash.html_counter):\n html, safe = self.markdown.htmlStash.rawHtmlBlocks[i]\n if self.markdown.safeMode and not safe:\n if str(self.markdown.safeMode).lower() == 'escape':\n html = self.escape(html)\n elif str(self.markdown.safeMode).lower() == 'remove':\n html = ''\n else:\n html = self.markdown.html_replacement_text\n if self.isblocklevel(html) and (safe or not self.markdown.safeMode):\n text = text.replace(\"<p>%s</p>\" % \n (self.markdown.htmlStash.get_placeholder(i)),\n html + \"\\n\")\n text = text.replace(self.markdown.htmlStash.get_placeholder(i), \n html)\n return text", "metadata": "root.RawHtmlPostprocessor.run", "header": "['class', 'RawHtmlPostprocessor', '(', 'Postprocessor', ')', ':', '___EOS___']", "index": 47 }, { "content": " def escape(self, html):\n \"\"\" Basic html escaping \"\"\"\n html = html.replace('&', '&amp;')\n html = html.replace('<', '&lt;')\n html = html.replace('>', '&gt;')\n return html.replace('\"', '&quot;')", "metadata": "root.RawHtmlPostprocessor.escape", "header": "['class', 'RawHtmlPostprocessor', '(', 'Postprocessor', ')', ':', '___EOS___']", "index": 66 }, { "content": " def isblocklevel(self, html):\n m = re.match(r'^\\<\\/?([^ ]+)', html)\n if m:\n if m.group(1)[0] in ('!', '?', '@', '%'):\n # Comment, php etc...\n return True\n return util.isBlockLevel(m.group(1))\n return False", "metadata": "root.RawHtmlPostprocessor.isblocklevel", "header": "['class', 'RawHtmlPostprocessor', '(', 'Postprocessor', ')', ':', '___EOS___']", "index": 73 }, { "content": "class AndSubstitutePostprocessor(Postprocessor):\n \"\"\" Restore valid entities \"\"\"\n", "metadata": "root.AndSubstitutePostprocessor", "header": "['module', '___EOS___']", "index": 83 }, { "content": " def run(self, text):\n text = text.replace(util.AMP_SUBSTITUTE, \"&\")\n return text", "metadata": "root.AndSubstitutePostprocessor.run", "header": "['class', 'AndSubstitutePostprocessor', '(', 'Postprocessor', ')', ':', '___EOS___']", "index": 86 }, { "content": "class UnescapePostprocessor(Postprocessor):\n \"\"\" Restore escaped chars \"\"\"\n\n RE = re.compile('%s(\\d+)%s' % (util.STX, util.ETX))\n\n", "metadata": "root.UnescapePostprocessor", "header": "['module', '___EOS___']", "index": 91 }, { "content": " def unescape(self, m):\n return unichr(int(m.group(1)))", "metadata": "root.UnescapePostprocessor.unescape", "header": "['class', 'UnescapePostprocessor', '(', 'Postprocessor', ')', ':', '___EOS___']", "index": 96 }, { "content": " def run(self, text):\n return self.RE.sub(self.unescape, text)", "metadata": "root.UnescapePostprocessor.run", "header": "['class', 'UnescapePostprocessor', '(', 'Postprocessor', ')', ':', '___EOS___']", "index": 99 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "POST", "-", "PROCESSOR", "S", "\\", "10", ";", "==============", "==============", "==============", "==============", "==============", "=======", "\\", "10", ";", "\\", "10", ";", "Markdown", " ", "als", "o", " ", "allow", "s", " ", "post", "-", "process", "ors", ",", " ", "whi", "ch", " ", "are", " ", "similar", " ", "to", " ", "preprocessor", "s", " ", "in", "\\", "10", ";", "tha", "t", " ", "the", "y", " ", "need", " ", "to", " ", "implement", " ", "a", " ", "\"", "run", "\"", " ", "method", ".", " ", "Ho", "we", "ver", ",", " ", "the", "y", " ", "are", " ", "run", " ", "after", " ", "core", "\\", "10", ";", "process", "ing", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "odict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "build", "\\u", "postprocess", "ors_", "(_", "md", "\\u", "instance_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Build", " ", "the", " ", "default", " ", "postprocess", "ors", " ", "for", " ", "Markdown", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "postprocess", "ors_", "=_", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "postprocess", "ors_", "[_", "\"", "raw", "\\u", "html", "\"_", "]_", "=_", "Ra", "w", "Ht", "ml", "Post", "processor_", "(_", "md", "\\u", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "postprocess", "ors_", "[_", "\"", "amp", "\\u", "substitute", "\"_", "]_", "=_", "And", "Subst", "itut", "e", "Post", "processor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "postprocess", "ors_", "[_", "\"", "unescape", "\"_", "]_", "=_", "Une", "scap", "e", "Post", "processor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "postprocess", "ors_", "\\u\\u\\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_", "Post", "processor_", "(_", "util_", "._", "Processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Post", "process", "ors", " ", "are", " ", "run", " ", "after", " ", "the", " ", "Element", "Tree", " ", "it", " ", "convert", "ed", " ", "back", " ", "int", "o", " ", "text", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "Post", "process", "or", " ", "implement", "s", " ", "a", " ", "\"", "run", "\"", " ", "method", " ", "tha", "t", " ", "take", "s", " ", "a", " ", "point", "er", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "text", " ", "string", ",", " ", "modifi", "es", " ", "it", " ", "as", " ", "necessar", "y", " ", "and", " ", "return", "s", " ", "a", " ", "text", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Post", "process", "ors", " ", "must", " ", "extend", " ", "mark", "down", ".", "Post", "process", "or", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Post", "processor_", "(_", "util_", "._", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Subc", "lasse", "s", " ", "of", " ", "Post", "process", "or", " ", "shou", "ld", " ", "implement", " ", "a", " ", "`", "run", "`", " ", "method", ",", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "take", "s", " ", "the", " ", "html", " ", "document", " ", "as", " ", "a", " ", "single", " ", "text", " ", "string", " ", "and", " ", "return", "s", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "(", "possib", "ly", " ", "modifi", "ed", ")", " ", "string", ".", "\\", "10", ";", "\\", "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_", "Ra", "w", "Ht", "ml", "Post", "processor_", "(_", "Post", "processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Restor", "e", " ", "raw", " ", "html", " ", "to", " ", "the", " ", "document", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Ra", "w", "Ht", "ml", "Post", "processor_", "(_", "Post", "processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Iterat", "e", " ", "over", " ", "html", " ", "stash", " ", "and", " ", "restore", " ", "\"", "safe", "\"", " ", "html", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "markdown_", "._", "html", "Stash_", "._", "html", "\\u", "counter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", ",_", "safe_", "=_", "self_", "._", "markdown_", "._", "html", "Stash_", "._", "raw", "Ht", "ml", "Blocks_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "markdown_", "._", "safe", "Mode_", "and_", "not_", "safe_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "str_", "(_", "self_", "._", "markdown_", "._", "safe", "Mode_", ")_", "._", "lower_", "(_", ")_", "==_", "'", "escape", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "html_", "=_", "self_", "._", "escape_", "(_", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "str_", "(_", "self_", "._", "markdown_", "._", "safe", "Mode_", ")_", "._", "lower_", "(_", ")_", "==_", "'", "remove", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "html_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "html_", "=_", "self_", "._", "markdown_", "._", "html", "\\u", "replace", "ment", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "isb", "lock", "level_", "(_", "html_", ")_", "and_", "(_", "safe_", "or_", "not_", "self_", "._", "markdown_", "._", "safe", "Mode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "text_", "._", "replace_", "(_", "\"<", "p", ">", "%", "s", "</", "p", ">\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "markdown_", "._", "html", "Stash_", "._", "get", "\\u", "placeholder_", "(_", "i_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "text_", "._", "replace_", "(_", "self_", "._", "markdown_", "._", "html", "Stash_", "._", "get", "\\u", "placeholder_", "(_", "i_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ra", "w", "Ht", "ml", "Post", "processor_", "(_", "Post", "processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "escape_", "(_", "self_", ",_", "html_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Basic", " ", "html", " ", "esca", "ping", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "html_", "._", "replace_", "(_", "'&'_", ",_", "'&", "amp", ";'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "html_", "._", "replace_", "(_", "'<'_", ",_", "'&", "lt", ";'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "html_", "._", "replace_", "(_", "'>'_", ",_", "'&", "gt", ";'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "html_", "._", "replace_", "(_", "'\"'_", ",_", "'&", "quot", ";'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ra", "w", "Ht", "ml", "Post", "processor_", "(_", "Post", "processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "isb", "lock", "level_", "(_", "self_", ",_", "html_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "match_", "(_", "r", "'", "^", "\\\\", "<\\\\", "/?", "([", "^", " ", "]+)'_", ",_", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "m_", "._", "group_", "(_", "1_", ")_", "[_", "0_", "]_", "in_", "(_", "'!'_", ",_", "'?'_", ",_", "'@'_", ",_", "'%'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Comme", "nt", ",", " ", "php", " ", "etc", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "util_", "._", "is", "Block", "Level_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "And", "Subst", "itut", "e", "Post", "processor_", "(_", "Post", "processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Restor", "e", " ", "valid", " ", "entit", "ies", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "And", "Subst", "itut", "e", "Post", "processor_", "(_", "Post", "processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "text_", "._", "replace_", "(_", "util_", "._", "AMP", "\\u", "SUBST", "ITU", "TE_", ",_", "\"&\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Une", "scap", "e", "Post", "processor_", "(_", "Post", "processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Restor", "e", " ", "escaped", " ", "char", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RE_", "=_", "re_", "._", "compile_", "(_", "'%", "s", "(\\\\", "d", "+)", "%", "s", "'_", "%_", "(_", "util_", "._", "ST", "X_", ",_", "util_", "._", "ET", "X_", ")_", ")_", "\\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_", "Une", "scap", "e", "Post", "processor_", "(_", "Post", "processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "unescape_", "(_", "self_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unichr_", "(_", "int_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Une", "scap", "e", "Post", "processor_", "(_", "Post", "processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "RE_", "._", "sub_", "(_", "self_", "._", "unescape_", ",_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/src/oscar/core/customisation.py
[ { "content": "def fork_app(label, folder_path, logger=None):\n \"\"\"\n Create a custom version of one of Oscar's apps\n\n The first argument isn't strictly an app label as we allow things like\n 'catalogue' or 'dashboard.ranges'.\n \"\"\"\n if logger is None:\n logger = logging.getLogger(__name__)\n\n # Check label is valid\n valid_labels = [x.replace('oscar.apps.', '') for x in oscar.OSCAR_CORE_APPS\n if x.startswith('oscar')]\n if label not in valid_labels:\n raise ValueError(\"There is no Oscar app that matches '%s'\" % label)\n\n # Check folder_path is current catalog\n if folder_path == '.':\n folder_path = ''\n\n # Create folder\n label_folder = label.replace('.', '/') # eg 'dashboard/ranges'\n local_app_path = join(folder_path, label_folder)\n logger.info(\"Creating package %s\" % local_app_path)\n create_local_app_folder(local_app_path)\n\n # Create minimum app files\n app_package = local_app_path.replace('/', '.')\n\n oscar_app_path = join(oscar.__path__[0], 'apps', label_folder)\n if exists(os.path.join(oscar_app_path, 'admin.py')):\n logger.info(\"Creating admin.py\")\n create_file(join(local_app_path, 'admin.py'),\n \"from oscar.apps.%s.admin import * # noqa\\n\" % label)\n\n logger.info(\"Creating app config\")\n inherit_app_config(local_app_path, app_package, label)\n\n # Only create models.py and migrations if it exists in the Oscar app\n oscar_models_path = join(oscar_app_path, 'models.py')\n if exists(oscar_models_path):\n logger.info(\"Creating models.py\")\n create_file(\n join(local_app_path, 'models.py'),\n \"from oscar.apps.%s.models import * # noqa\\n\" % label)\n\n migrations_path = 'migrations'\n source = join(oscar_app_path, migrations_path)\n if exists(source):\n logger.info(\"Creating %s folder\", migrations_path)\n destination = join(local_app_path, migrations_path)\n shutil.copytree(source, destination)\n\n # Final step needs to be done by hand\n msg = (\n \"The final step is to add '%s' to INSTALLED_APPS \"\n \"(replacing the equivalent Oscar app). This can be \"\n \"achieved using Oscar's get_core_apps function - e.g.:\"\n ) % app_package\n snippet = (\n \" # settings.py\\n\"\n \" ...\\n\"\n \" INSTALLED_APPS = [\\n\"\n \" 'django.contrib.auth',\\n\"\n \" ...\\n\"\n \" ]\\n\"\n \" from oscar import get_core_apps\\n\"\n \" INSTALLED_APPS = INSTALLED_APPS + get_core_apps(\\n\"\n \" ['%s'])\"\n ) % app_package\n record = \"\\n%s\\n\\n%s\" % (\n \"\\n\".join(textwrap.wrap(msg)), snippet)\n logger.info(record)", "metadata": "root.fork_app", "header": "['module', '___EOS___']", "index": 60 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fork", "\\u", "app_", "(_", "label_", ",_", "folder", "\\u", "path_", ",_", "logger_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "custom", " ", "version", " ", "of", " ", "one", " ", "of", " ", "Osc", "ar", "'", "s", " ", "apps", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "first", " ", "argu", "ment", " ", "isn", "'", "t", " ", "strict", "ly", " ", "an", " ", "app", " ", "label", " ", "as", " ", "we", " ", "allow", " ", "thing", "s", " ", "like", "\\", "10", ";", " ", " ", " ", " ", "'", "catalogue", "'", " ", "or", " ", "'", "dash", "board", ".", "ranges", "'.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "logger_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "label", " ", "is", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "valid", "\\u", "labels_", "=_", "[_", "x_", "._", "replace_", "(_", "'", "osc", "ar", ".", "apps", ".'_", ",_", "''_", ")_", "for_", "x_", "in_", "osc", "ar_", "._", "OSC", "AR", "\\u", "CORE", "\\u", "APPS_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x_", "._", "startswith_", "(_", "'", "osc", "ar", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "label_", "not_", "in_", "valid", "\\u", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "There", " ", "is", " ", "no", " ", "Osc", "ar", " ", "app", " ", "tha", "t", " ", "matche", "s", " ", "'%", "s", "'\"_", "%_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "folder", "\\u", "path", " ", "is", " ", "current", " ", "catalog_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "folder", "\\u", "path_", "==_", "'.'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder", "\\u", "path_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "label", "\\u", "folder_", "=_", "label_", "._", "replace_", "(_", "'.'_", ",_", "'/'_", ")_", "#", " ", "eg", " ", "'", "dash", "board", "/", "ranges", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "app", "\\u", "path_", "=_", "join_", "(_", "folder", "\\u", "path_", ",_", "label", "\\u", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Creat", "ing", " ", "package", " ", "%", "s", "\"_", "%_", "local", "\\u", "app", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "local", "\\u", "app", "\\u", "folder_", "(_", "local", "\\u", "app", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "minim", "um", " ", "app", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "package_", "=_", "local", "\\u", "app", "\\u", "path_", "._", "replace_", "(_", "'/'_", ",_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "osc", "ar", "\\u", "app", "\\u", "path_", "=_", "join_", "(_", "osc", "ar_", "._", "\\u\\u", "path\\u\\u_", "[_", "0_", "]_", ",_", "'", "apps", "'_", ",_", "label", "\\u", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "osc", "ar", "\\u", "app", "\\u", "path_", ",_", "'", "admin", ".", "py", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "Creat", "ing", " ", "admin", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "file_", "(_", "join_", "(_", "local", "\\u", "app", "\\u", "path_", ",_", "'", "admin", ".", "py", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "from", " ", "osc", "ar", ".", "apps", ".", "%", "s", ".", "admin", " ", "import", " ", "*", " ", " ", "#", " ", "no", "qa", "\\\\", "n", "\"_", "%_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Creat", "ing", " ", "app", " ", "config", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inherit", "\\u", "app", "\\u", "config_", "(_", "local", "\\u", "app", "\\u", "path_", ",_", "app", "\\u", "package_", ",_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "create", " ", "model", "s", ".", "py", " ", "and", " ", "migrati", "ons", " ", "if", " ", "it", " ", "exist", "s", " ", "in", " ", "the", " ", "Osc", "ar", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "osc", "ar", "\\u", "model", "s", "\\u", "path_", "=_", "join_", "(_", "osc", "ar", "\\u", "app", "\\u", "path_", ",_", "'", "model", "s", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exists_", "(_", "osc", "ar", "\\u", "model", "s", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "Creat", "ing", " ", "model", "s", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "join_", "(_", "local", "\\u", "app", "\\u", "path_", ",_", "'", "model", "s", ".", "py", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "from", " ", "osc", "ar", ".", "apps", ".", "%", "s", ".", "model", "s", " ", "import", " ", "*", " ", " ", "#", " ", "no", "qa", "\\\\", "n", "\"_", "%_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "ons", "\\u", "path_", "=_", "'", "migrati", "ons", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "join_", "(_", "osc", "ar", "\\u", "app", "\\u", "path_", ",_", "migrati", "ons", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exists_", "(_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "Creat", "ing", " ", "%", "s", " ", "folder", "\"_", ",_", "migrati", "ons", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destination_", "=_", "join_", "(_", "local", "\\u", "app", "\\u", "path_", ",_", "migrati", "ons", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copytree_", "(_", "source_", ",_", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", " ", "step", " ", "need", "s", " ", "to", " ", "be", " ", "don", "e", " ", "by", " ", "hand_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "final", " ", "step", " ", "is", " ", "to", " ", "add", " ", "'%", "s", "'", " ", "to", " ", "INSTALLE", "D", "\\u", "APP", "S", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "repla", "cing", " ", "the", " ", "equivalent", " ", "Osc", "ar", " ", "app", ").", " ", "Thi", "s", " ", "can", " ", "be", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "achieve", "d", " ", "usi", "ng", " ", "Osc", "ar", "'", "s", " ", "get", "\\u", "core", "\\u", "apps", " ", "function", " ", "-", " ", "e", ".", "g", ".:", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "%_", "app", "\\u", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snippet_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "#", " ", "settings", ".", "py", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "...", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "INSTALLE", "D", "\\u", "APP", "S", " ", "=", " ", "[\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "'", "django", ".", "contrib", ".", "auth", "',", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "...", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "from", " ", "osc", "ar", " ", "import", " ", "get", "\\u", "core", "\\u", "apps", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "INSTALLE", "D", "\\u", "APP", "S", " ", "=", " ", "INSTALLE", "D", "\\u", "APP", "S", " ", "+", " ", "get", "\\u", "core", "\\u", "apps", "(\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", "['", "%", "s", "'])", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "%_", "app", "\\u", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record_", "=_", "\"\\\\", "n", "%", "s", "\\\\",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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported more than once
danirus/django-comments-xtd/django_comments_xtd/demos/multiple/projects/views.py
[ { "content": "from django.core.urlresolvers import reverse\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom django.views.generic import DetailView, ListView\n\nfrom multiple.projects.models import Project, Release\n\n\n\n\n\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "generic_", "import_", "Det", "ail", "View_", ",_", "List", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "multiple_", "._", "projects_", "._", "models_", "import_", "Project_", ",_", "Release_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
EricssonResearch/calvin-base/calvin/actorstore/tests/test_actors.py
[ { "content": " def read(self):\n data = self.buffer\n self.buffer = \"\"\n return data", "metadata": "root.FDMock.read", "header": "['class', 'FDMock', '(', 'object', ')', ':', '___EOS___']", "index": 114 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "FD", "Mock_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "buffer_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_", "\\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 ]
Unused import
Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/test/api_tests/vpnaas_tests.py
[ { "content": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2013, Mirantis Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n#\n# @author: Tatiana Mazur\n\nfrom openstack_dashboard import api\nfrom openstack_dashboard.test import helpers as test\n\nfrom neutronclient.v2_0 import client\n\nneutronclient = client.Client\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class VPNaasApiTests(test.APITestCase):\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.VPNaasApiTests", "header": "['module', '___EOS___']", "index": 26 }, { "content": " @test.create_stubs({neutronclient: ('create_vpnservice',)})\n def test_vpnservice_create(self):\n vpnservice1 = self.api_vpnservices.first()\n form_data = {\n 'name': vpnservice1['name'],\n 'description': vpnservice1['description'],\n 'subnet_id': vpnservice1['subnet_id'],\n 'router_id': vpnservice1['router_id'],\n 'admin_state_up': vpnservice1['admin_state_up']\n }\n\n vpnservice = {'vpnservice': self.api_vpnservices.first()}\n neutronclient.create_vpnservice(\n {'vpnservice': form_data}).AndReturn(vpnservice)\n self.mox.ReplayAll()\n\n ret_val = api.vpn.vpnservice_create(self.request, **form_data)\n self.assertIsInstance(ret_val, api.vpn.VPNService)", "metadata": "root.VPNaasApiTests.test_vpnservice_create", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " @test.create_stubs({neutronclient: ('list_vpnservices',)})\n def test_vpnservices_get(self):\n vpnservices = {'vpnservices': self.vpnservices.list()}\n vpnservices_dict = {'vpnservices': self.api_vpnservices.list()}\n\n neutronclient.list_vpnservices().AndReturn(vpnservices_dict)\n\n self.mox.ReplayAll()\n\n ret_val = api.vpn.vpnservices_get(self.request)\n for (v, d) in zip(ret_val, vpnservices['vpnservices']):\n self.assertIsInstance(v, api.vpn.VPNService)\n self.assertTrue(v.name, d.name)\n self.assertTrue(v.id)", "metadata": "root.VPNaasApiTests.test_vpnservices_get", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " @test.create_stubs({neutronclient: ('show_vpnservice',)})\n def test_vpnservice_get(self):\n vpnservice1 = self.api_vpnservices.first()\n vpnservice = {'vpnservice': vpnservice1}\n\n neutronclient.show_vpnservice(\n vpnservice['vpnservice']['id']).AndReturn(vpnservice)\n\n self.mox.ReplayAll()\n\n ret_val = api.vpn.vpnservice_get(self.request,\n vpnservice['vpnservice']['id'])\n self.assertIsInstance(ret_val, api.vpn.VPNService)", "metadata": "root.VPNaasApiTests.test_vpnservice_get", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 61 }, { "content": " @test.create_stubs({neutronclient: ('create_ikepolicy',)})\n def test_ikepolicy_create(self):\n ikepolicy1 = self.api_ikepolicies.first()\n form_data = {\n 'name': ikepolicy1['name'],\n 'description': ikepolicy1['description'],\n 'auth_algorithm': ikepolicy1['auth_algorithm'],\n 'encryption_algorithm': ikepolicy1['encryption_algorithm'],\n 'ike_version': ikepolicy1['ike_version'],\n 'lifetime': ikepolicy1['lifetime'],\n 'phase1_negotiation_mode': ikepolicy1['phase1_negotiation_mode'],\n 'pfs': ikepolicy1['pfs']\n }\n\n ikepolicy = {'ikepolicy': self.api_ikepolicies.first()}\n neutronclient.create_ikepolicy(\n {'ikepolicy': form_data}).AndReturn(ikepolicy)\n self.mox.ReplayAll()\n\n ret_val = api.vpn.ikepolicy_create(self.request, **form_data)\n self.assertIsInstance(ret_val, api.vpn.IKEPolicy)", "metadata": "root.VPNaasApiTests.test_ikepolicy_create", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " @test.create_stubs({neutronclient: ('list_ikepolicies',)})\n def test_ikepolicies_get(self):\n ikepolicies = {'ikepolicies': self.ikepolicies.list()}\n ikepolicies_dict = {'ikepolicies': self.api_ikepolicies.list()}\n\n neutronclient.list_ikepolicies().AndReturn(ikepolicies_dict)\n\n self.mox.ReplayAll()\n\n ret_val = api.vpn.ikepolicies_get(self.request)\n for (v, d) in zip(ret_val, ikepolicies['ikepolicies']):\n self.assertIsInstance(v, api.vpn.IKEPolicy)\n self.assertTrue(v.name, d.name)\n self.assertTrue(v.id)", "metadata": "root.VPNaasApiTests.test_ikepolicies_get", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 97 }, { "content": " @test.create_stubs({neutronclient: ('show_ikepolicy',)})\n def test_ikepolicy_get(self):\n ikepolicy1 = self.api_ikepolicies.first()\n ikepolicy = {'ikepolicy': ikepolicy1}\n\n neutronclient.show_ikepolicy(\n ikepolicy['ikepolicy']['id']).AndReturn(ikepolicy)\n\n self.mox.ReplayAll()\n\n ret_val = api.vpn.ikepolicy_get(self.request,\n ikepolicy['ikepolicy']['id'])\n self.assertIsInstance(ret_val, api.vpn.IKEPolicy)", "metadata": "root.VPNaasApiTests.test_ikepolicy_get", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 112 }, { "content": " @test.create_stubs({neutronclient: ('create_ipsecpolicy',)})\n def test_ipsecpolicy_create(self):\n ipsecpolicy1 = self.api_ipsecpolicies.first()\n form_data = {\n 'name': ipsecpolicy1['name'],\n 'description': ipsecpolicy1['description'],\n 'auth_algorithm': ipsecpolicy1['auth_algorithm'],\n 'encryption_algorithm': ipsecpolicy1['encryption_algorithm'],\n 'encapsulation_mode': ipsecpolicy1['encapsulation_mode'],\n 'lifetime': ipsecpolicy1['lifetime'],\n 'pfs': ipsecpolicy1['pfs'],\n 'transform_protocol': ipsecpolicy1['transform_protocol']\n }\n\n ipsecpolicy = {'ipsecpolicy': self.api_ipsecpolicies.first()}\n neutronclient.create_ipsecpolicy(\n {'ipsecpolicy': form_data}).AndReturn(ipsecpolicy)\n self.mox.ReplayAll()\n\n ret_val = api.vpn.ipsecpolicy_create(self.request, **form_data)\n self.assertIsInstance(ret_val, api.vpn.IPSecPolicy)", "metadata": "root.VPNaasApiTests.test_ipsecpolicy_create", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 126 }, { "content": " @test.create_stubs({neutronclient: ('list_ipsecpolicies',)})\n def test_ipsecpolicies_get(self):\n ipsecpolicies = {'ipsecpolicies': self.ipsecpolicies.list()}\n ipsecpolicies_dict = {'ipsecpolicies': self.api_ipsecpolicies.list()}\n\n neutronclient.list_ipsecpolicies().AndReturn(ipsecpolicies_dict)\n\n self.mox.ReplayAll()\n\n ret_val = api.vpn.ipsecpolicies_get(self.request)\n for (v, d) in zip(ret_val, ipsecpolicies['ipsecpolicies']):\n self.assertIsInstance(v, api.vpn.IPSecPolicy)\n self.assertTrue(v.name, d.name)\n self.assertTrue(v.id)", "metadata": "root.VPNaasApiTests.test_ipsecpolicies_get", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 148 }, { "content": " @test.create_stubs({neutronclient: ('show_ipsecpolicy',)})\n def test_ipsecpolicy_get(self):\n ipsecpolicy1 = self.api_ipsecpolicies.first()\n ipsecpolicy = {'ipsecpolicy': ipsecpolicy1}\n\n neutronclient.show_ipsecpolicy(\n ipsecpolicy['ipsecpolicy']['id']).AndReturn(ipsecpolicy)\n\n self.mox.ReplayAll()\n\n ret_val = api.vpn.ipsecpolicy_get(self.request,\n ipsecpolicy['ipsecpolicy']['id'])\n self.assertIsInstance(ret_val, api.vpn.IPSecPolicy)", "metadata": "root.VPNaasApiTests.test_ipsecpolicy_get", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 163 }, { "content": " @test.create_stubs({neutronclient: ('create_ipsec_site_connection',)})\n def test_ipsecsiteconnection_create(self):\n ipsecsiteconnection1 = self.api_ipsecsiteconnections.first()\n form_data = {\n 'name': ipsecsiteconnection1['name'],\n 'description': ipsecsiteconnection1['description'],\n 'dpd': ipsecsiteconnection1['dpd'],\n 'ikepolicy_id': ipsecsiteconnection1['ikepolicy_id'],\n 'initiator': ipsecsiteconnection1['initiator'],\n 'ipsecpolicy_id': ipsecsiteconnection1['ipsecpolicy_id'],\n 'mtu': ipsecsiteconnection1['mtu'],\n 'peer_address': ipsecsiteconnection1['peer_address'],\n 'peer_cidrs': ipsecsiteconnection1['peer_cidrs'],\n 'peer_id': ipsecsiteconnection1['peer_id'],\n 'psk': ipsecsiteconnection1['psk'],\n 'vpnservice_id': ipsecsiteconnection1['vpnservice_id'],\n 'admin_state_up': ipsecsiteconnection1['admin_state_up']\n }\n\n ipsecsiteconnection = {'ipsec_site_connection':\n self.api_ipsecsiteconnections.first()}\n neutronclient.create_ipsec_site_connection(\n {'ipsec_site_connection':\n form_data}).AndReturn(ipsecsiteconnection)\n self.mox.ReplayAll()\n\n ret_val = api.vpn.ipsecsiteconnection_create(\n self.request, **form_data)\n self.assertIsInstance(ret_val, api.vpn.IPSecSiteConnection)", "metadata": "root.VPNaasApiTests.test_ipsecsiteconnection_create", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 177 }, { "content": " @test.create_stubs({neutronclient: ('list_ipsec_site_connections',)})\n def test_ipsecsiteconnections_get(self):\n ipsecsiteconnections = {\n 'ipsec_site_connections': self.ipsecsiteconnections.list()}\n ipsecsiteconnections_dict = {\n 'ipsec_site_connections': self.api_ipsecsiteconnections.list()}\n\n neutronclient.list_ipsec_site_connections().AndReturn(\n ipsecsiteconnections_dict)\n\n self.mox.ReplayAll()\n\n ret_val = api.vpn.ipsecsiteconnections_get(self.request)\n for (v, d) in zip(ret_val,\n ipsecsiteconnections['ipsec_site_connections']):\n self.assertIsInstance(v, api.vpn.IPSecSiteConnection)\n self.assertTrue(v.name, d.name)\n self.assertTrue(v.id)", "metadata": "root.VPNaasApiTests.test_ipsecsiteconnections_get", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 207 }, { "content": " @test.create_stubs({neutronclient: ('show_ipsec_site_connection',)})\n def test_ipsecsiteconnection_get(self):\n ipsecsiteconnection1 = self.api_ipsecsiteconnections.first()\n ipsecsiteconnection = {'ipsec_site_connection': ipsecsiteconnection1}\n\n neutronclient.show_ipsec_site_connection(\n ipsecsiteconnection['ipsec_site_connection']['id']).AndReturn(\n ipsecsiteconnection)\n\n self.mox.ReplayAll()\n\n ret_val = api.vpn.ipsecsiteconnection_get(self.request,\n ipsecsiteconnection['ipsec_site_connection']['id'])\n self.assertIsInstance(ret_val, api.vpn.IPSecSiteConnection)", "metadata": "root.VPNaasApiTests.test_ipsecsiteconnection_get", "header": "['class', 'VPNaasApiTests', '(', 'test', '.', 'APITestCase', ')', ':', '___EOS___']", "index": 226 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "vim", ":", " ", "tabs", "top", "=", "4", " ", "shift", "widt", "h", "=", "4", " ", "soft", "tabs", "top", "=", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", ",", " ", "Mir", "anti", "s", " ", "Inc", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "author", ":", " ", "Ta", "tia", "na", " ", "Ma", "zu", "r_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openst", "ack", "\\u", "dashboard_", "import_", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openst", "ack", "\\u", "dashboard_", "._", "test_", "import_", "helpers_", "as_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "neutronclient_", "._", "v2", "\\u", "0_", "import_", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "neutronclient_", "=_", "client_", "._", "Client_", "\\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_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "create", "\\u", "vpn", "service", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "vpn", "service", "\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vpn", "service", "1_", "=_", "self_", "._", "api", "\\u", "vpn", "services_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "vpn", "service", "1_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "vpn", "service", "1_", "[_", "'", "description", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subnet", "\\u", "id", "'_", ":_", "vpn", "service", "1_", "[_", "'", "subnet", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "router", "\\u", "id", "'_", ":_", "vpn", "service", "1_", "[_", "'", "router", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "admin", "\\u", "state", "\\u", "up", "'_", ":_", "vpn", "service", "1_", "[_", "'", "admin", "\\u", "state", "\\u", "up", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vpn", "service_", "=_", "{_", "'", "vpn", "service", "'_", ":_", "self_", "._", "api", "\\u", "vpn", "services_", "._", "first_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neutronclient_", "._", "create", "\\u", "vpn", "service_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "vpn", "service", "'_", ":_", "form", "\\u", "data_", "}_", ")_", "._", "And", "Return_", "(_", "vpn", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "vpn", "service", "\\u", "create_", "(_", "self_", "._", "request_", ",_", "**_", "form", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "ret", "\\u", "val_", ",_", "api_", "._", "vpn_", "._", "VP", "NS", "ervice", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "list", "\\u", "vpn", "service", "s", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "vpn", "service", "s", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vpn", "services_", "=_", "{_", "'", "vpn", "service", "s", "'_", ":_", "self_", "._", "vpn", "services_", "._", "list_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpn", "service", "s", "\\u", "dict_", "=_", "{_", "'", "vpn", "service", "s", "'_", ":_", "self_", "._", "api", "\\u", "vpn", "services_", "._", "list_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "neutronclient_", "._", "list", "\\u", "vpn", "services_", "(_", ")_", "._", "And", "Return_", "(_", "vpn", "service", "s", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "vpn", "service", "s", "\\u", "get_", "(_", "self_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "v_", ",_", "d_", ")_", "in_", "zip_", "(_", "ret", "\\u", "val_", ",_", "vpn", "services_", "[_", "'", "vpn", "service", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is", "Instance_", "(_", "v_", ",_", "api_", "._", "vpn_", "._", "VP", "NS", "ervice", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "v_", "._", "name_", ",_", "d_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "v_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "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_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "show", "\\u", "vpn", "service", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "vpn", "service", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vpn", "service", "1_", "=_", "self_", "._", "api", "\\u", "vpn", "services_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpn", "service_", "=_", "{_", "'", "vpn", "service", "'_", ":_", "vpn", "service", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "neutronclient_", "._", "show", "\\u", "vpn", "service_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "vpn", "service_", "[_", "'", "vpn", "service", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "._", "And", "Return_", "(_", "vpn", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "vpn", "service", "\\u", "get_", "(_", "self_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vpn", "service_", "[_", "'", "vpn", "service", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "ret", "\\u", "val_", ",_", "api_", "._", "vpn_", "._", "VP", "NS", "ervice", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "create", "\\u", "ike", "policy", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ike", "policy", "\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ike", "policy", "1_", "=_", "self_", "._", "api", "\\u", "ike", "policies_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "ike", "policy", "1_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "ike", "policy", "1_", "[_", "'", "description", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "\\u", "algo", "rit", "hm", "'_", ":_", "ike", "policy", "1_", "[_", "'", "auth", "\\u", "algo", "rit", "hm", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "encrypt", "ion", "\\u", "algo", "rit", "hm", "'_", ":_", "ike", "policy", "1_", "[_", "'", "encrypt", "ion", "\\u", "algo", "rit", "hm", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ike", "\\u", "version", "'_", ":_", "ike", "policy", "1_", "[_", "'", "ike", "\\u", "version", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "life", "time", "'_", ":_", "ike", "policy", "1_", "[_", "'", "life", "time", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phase", "1", "\\u", "negotiat", "ion", "\\u", "mode", "'_", ":_", "ike", "policy", "1_", "[_", "'", "phase", "1", "\\u", "negotiat", "ion", "\\u", "mode", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pf", "s", "'_", ":_", "ike", "policy", "1_", "[_", "'", "pf", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ike", "policy_", "=_", "{_", "'", "ike", "policy", "'_", ":_", "self_", "._", "api", "\\u", "ike", "policies_", "._", "first_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neutronclient_", "._", "create", "\\u", "ike", "policy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "ike", "policy", "'_", ":_", "form", "\\u", "data_", "}_", ")_", "._", "And", "Return_", "(_", "ike", "policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "ike", "policy", "\\u", "create_", "(_", "self_", "._", "request_", ",_", "**_", "form", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "ret", "\\u", "val_", ",_", "api_", "._", "vpn_", "._", "IK", "EP", "olic", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "list", "\\u", "ike", "poli", "cies", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ike", "poli", "cies", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ike", "policies_", "=_", "{_", "'", "ike", "poli", "cies", "'_", ":_", "self_", "._", "ike", "policies_", "._", "list_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ike", "poli", "cies", "\\u", "dict_", "=_", "{_", "'", "ike", "poli", "cies", "'_", ":_", "self_", "._", "api", "\\u", "ike", "policies_", "._", "list_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "neutronclient_", "._", "list", "\\u", "ike", "policies_", "(_", ")_", "._", "And", "Return_", "(_", "ike", "poli", "cies", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "ike", "poli", "cies", "\\u", "get_", "(_", "self_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "v_", ",_", "d_", ")_", "in_", "zip_", "(_", "ret", "\\u", "val_", ",_", "ike", "policies_", "[_", "'", "ike", "poli", "cies", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is", "Instance_", "(_", "v_", ",_", "api_", "._", "vpn_", "._", "IK", "EP", "olic", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "v_", "._", "name_", ",_", "d_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "v_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "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_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "show", "\\u", "ike", "policy", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ike", "policy", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ike", "policy", "1_", "=_", "self_", "._", "api", "\\u", "ike", "policies_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ike", "policy_", "=_", "{_", "'", "ike", "policy", "'_", ":_", "ike", "policy", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "neutronclient_", "._", "show", "\\u", "ike", "policy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ike", "policy_", "[_", "'", "ike", "policy", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "._", "And", "Return_", "(_", "ike", "policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "ike", "policy", "\\u", "get_", "(_", "self_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ike", "policy_", "[_", "'", "ike", "policy", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "ret", "\\u", "val_", ",_", "api_", "._", "vpn_", "._", "IK", "EP", "olic", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "create", "\\u", "ipsec", "policy", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ipsec", "policy", "\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipsec", "policy", "1_", "=_", "self_", "._", "api", "\\u", "ipsec", "policies_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "ipsec", "policy", "1_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "ipsec", "policy", "1_", "[_", "'", "description", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "\\u", "algo", "rit", "hm", "'_", ":_", "ipsec", "policy", "1_", "[_", "'", "auth", "\\u", "algo", "rit", "hm", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "encrypt", "ion", "\\u", "algo", "rit", "hm", "'_", ":_", "ipsec", "policy", "1_", "[_", "'", "encrypt", "ion", "\\u", "algo", "rit", "hm", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "encapsulat", "ion", "\\u", "mode", "'_", ":_", "ipsec", "policy", "1_", "[_", "'", "encapsulat", "ion", "\\u", "mode", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "life", "time", "'_", ":_", "ipsec", "policy", "1_", "[_", "'", "life", "time", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pf", "s", "'_", ":_", "ipsec", "policy", "1_", "[_", "'", "pf", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "transform", "\\u", "protoc", "ol", "'_", ":_", "ipsec", "policy", "1_", "[_", "'", "transform", "\\u", "protoc", "ol", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ipsec", "policy_", "=_", "{_", "'", "ipsec", "policy", "'_", ":_", "self_", "._", "api", "\\u", "ipsec", "policies_", "._", "first_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neutronclient_", "._", "create", "\\u", "ipsec", "policy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "ipsec", "policy", "'_", ":_", "form", "\\u", "data_", "}_", ")_", "._", "And", "Return_", "(_", "ipsec", "policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "ipsec", "policy", "\\u", "create_", "(_", "self_", "._", "request_", ",_", "**_", "form", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "ret", "\\u", "val_", ",_", "api_", "._", "vpn_", "._", "IPS", "ec", "Policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "list", "\\u", "ipsec", "poli", "cies", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ipsec", "poli", "cies", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipsec", "policies_", "=_", "{_", "'", "ipsec", "poli", "cies", "'_", ":_", "self_", "._", "ipsec", "policies_", "._", "list_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipsec", "poli", "cies", "\\u", "dict_", "=_", "{_", "'", "ipsec", "poli", "cies", "'_", ":_", "self_", "._", "api", "\\u", "ipsec", "policies_", "._", "list_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "neutronclient_", "._", "list", "\\u", "ipsec", "policies_", "(_", ")_", "._", "And", "Return_", "(_", "ipsec", "poli", "cies", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "ipsec", "poli", "cies", "\\u", "get_", "(_", "self_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "v_", ",_", "d_", ")_", "in_", "zip_", "(_", "ret", "\\u", "val_", ",_", "ipsec", "policies_", "[_", "'", "ipsec", "poli", "cies", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is", "Instance_", "(_", "v_", ",_", "api_", "._", "vpn_", "._", "IPS", "ec", "Policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "v_", "._", "name_", ",_", "d_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "v_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "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_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "show", "\\u", "ipsec", "policy", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ipsec", "policy", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipsec", "policy", "1_", "=_", "self_", "._", "api", "\\u", "ipsec", "policies_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipsec", "policy_", "=_", "{_", "'", "ipsec", "policy", "'_", ":_", "ipsec", "policy", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "neutronclient_", "._", "show", "\\u", "ipsec", "policy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ipsec", "policy_", "[_", "'", "ipsec", "policy", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "._", "And", "Return_", "(_", "ipsec", "policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "ipsec", "policy", "\\u", "get_", "(_", "self_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ipsec", "policy_", "[_", "'", "ipsec", "policy", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "ret", "\\u", "val_", ",_", "api_", "._", "vpn_", "._", "IPS", "ec", "Policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "create", "\\u", "ipsec", "\\u", "site", "\\u", "connecti", "on", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ipsec", "site", "connecti", "on", "\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipsec", "site", "connecti", "on1", "_", "=_", "self_", "._", "api", "\\u", "ipsec", "site", "connections_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "description", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dpd", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "dpd", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ike", "policy", "\\u", "id", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "ike", "policy", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "initiator", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "initiator", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ipsec", "policy", "\\u", "id", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "ipsec", "policy", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mtu", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "mtu", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "peer", "\\u", "address", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "peer", "\\u", "address", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "peer", "\\u", "cid", "rs", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "peer", "\\u", "cid", "rs", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "peer", "\\u", "id", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "peer", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "psk", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "psk", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vpn", "service", "\\u", "id", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "vpn", "service", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "admin", "\\u", "state", "\\u", "up", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "[_", "'", "admin", "\\u", "state", "\\u", "up", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ipsec", "site", "connection_", "=_", "{_", "'", "ipsec", "\\u", "site", "\\u", "connecti", "on", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "api", "\\u", "ipsec", "site", "connections_", "._", "first_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neutronclient_", "._", "create", "\\u", "ipsec", "\\u", "site", "\\u", "connection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "ipsec", "\\u", "site", "\\u", "connecti", "on", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "data_", "}_", ")_", "._", "And", "Return_", "(_", "ipsec", "site", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "ipsec", "site", "connecti", "on", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", ",_", "**_", "form", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "ret", "\\u", "val_", ",_", "api_", "._", "vpn_", "._", "IPS", "ec", "Site", "Connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "list", "\\u", "ipsec", "\\u", "site", "\\u", "connections", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ipsec", "site", "connections", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipsec", "site", "connections_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ipsec", "\\u", "site", "\\u", "connections", "'_", ":_", "self_", "._", "ipsec", "site", "connections_", "._", "list_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipsec", "site", "connections", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ipsec", "\\u", "site", "\\u", "connections", "'_", ":_", "self_", "._", "api", "\\u", "ipsec", "site", "connections_", "._", "list_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "neutronclient_", "._", "list", "\\u", "ipsec", "\\u", "site", "\\u", "connections_", "(_", ")_", "._", "And", "Return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ipsec", "site", "connections", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "ipsec", "site", "connections", "\\u", "get_", "(_", "self_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "v_", ",_", "d_", ")_", "in_", "zip_", "(_", "ret", "\\u", "val_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ipsec", "site", "connections_", "[_", "'", "ipsec", "\\u", "site", "\\u", "connections", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is", "Instance_", "(_", "v_", ",_", "api_", "._", "vpn_", "._", "IPS", "ec", "Site", "Connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "v_", "._", "name_", ",_", "d_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "v_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VP", "Na", "as", "Ap", "i", "Tests_", "(_", "test_", "._", "API", "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_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "neutronclient_", ":_", "(_", "'", "show", "\\u", "ipsec", "\\u", "site", "\\u", "connecti", "on", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ipsec", "site", "connecti", "on", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipsec", "site", "connecti", "on1", "_", "=_", "self_", "._", "api", "\\u", "ipsec", "site", "connections_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipsec", "site", "connection_", "=_", "{_", "'", "ipsec", "\\u", "site", "\\u", "connecti", "on", "'_", ":_", "ipsec", "site", "connecti", "on1", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "neutronclient_", "._", "show", "\\u", "ipsec", "\\u", "site", "\\u", "connection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ipsec", "site", "connection_", "[_", "'", "ipsec", "\\u", "site", "\\u", "connecti", "on", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "._", "And", "Return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ipsec", "site", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret", "\\u", "val_", "=_", "api_", "._", "vpn_", "._", "ipsec", "site", "connecti", "on", "\\u", "get_", "(_", "self_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ipsec", "site", "connection_", "[_", "'", "ipsec", "\\u", "site", "\\u", "connecti", "on", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "ret", "\\u", "val_", ",_", "api_", "._", "vpn_", "._", "IPS", "ec", "Site", "Connection_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
pyokagan/gyp/test/analyzer/gyptest-analyzer.py
[ { "content": "def EnsureContains(targets=set(), matched=False, build_targets=set()):\n \"\"\"Verifies output contains |targets|.\"\"\"\n result = _ReadOutputFileContents()\n if result.get('error', None):\n print 'unexpected error', result.get('error')\n test.fail_test()\n\n if result.get('invalid_targets', None):\n print 'unexpected invalid_targets', result.get('invalid_targets')\n test.fail_test()\n\n actual_targets = set(result['targets'])\n if actual_targets != targets:\n print 'actual targets:', actual_targets, '\\nexpected targets:', targets\n test.fail_test()\n\n actual_build_targets = set(result['build_targets'])\n if actual_build_targets != build_targets:\n print 'actual build_targets:', actual_build_targets, \\\n '\\nexpected build_targets:', build_targets\n test.fail_test()\n\n if matched and result['status'] != found:\n print 'expected', found, 'got', result['status']\n test.fail_test()\n elif not matched and result['status'] != not_found:\n print 'expected', not_found, 'got', result['status']\n test.fail_test()", "metadata": "root.EnsureContains", "header": "['module', '___EOS___']", "index": 71 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Ensur", "e", "Contains_", "(_", "targets_", "=_", "set_", "(_", ")_", ",_", "matched_", "=_", "False_", ",_", "build", "\\u", "targets_", "=_", "set_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Verifie", "s", " ", "output", " ", "contain", "s", " ", "|", "target", "s", "|.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "\\u", "Read", "Output", "File", "Contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "._", "get_", "(_", "'", "error", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "unexpected", " ", "error", "'_", ",_", "result_", "._", "get_", "(_", "'", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "fail", "\\u", "test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result_", "._", "get_", "(_", "'", "invalid", "\\u", "target", "s", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "unexpected", " ", "invalid", "\\u", "target", "s", "'_", ",_", "result_", "._", "get_", "(_", "'", "invalid", "\\u", "target", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "fail", "\\u", "test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actual", "\\u", "targets_", "=_", "set_", "(_", "result_", "[_", "'", "target", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "actual", "\\u", "targets_", "!=_", "targets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "actual", " ", "target", "s", ":'_", ",_", "actual", "\\u", "targets_", ",_", "'\\\\", "nex", "pect", "ed", " ", "target", "s", ":'_", ",_", "targets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "fail", "\\u", "test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actual", "\\u", "build", "\\u", "targets_", "=_", "set_", "(_", "result_", "[_", "'", "build", "\\u", "target", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "actual", "\\u", "build", "\\u", "targets_", "!=_", "build", "\\u", "targets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "actual", " ", "build", "\\u", "target", "s", ":'_", ",_", "actual", "\\u", "build", "\\u", "targets_", ",_", "'\\\\", "nex", "pect", "ed", " ", "build", "\\u", "target", "s", ":'_", ",_", "build", "\\u", "targets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "fail", "\\u", "test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "matched_", "and_", "result_", "[_", "'", "status", "'_", "]_", "!=_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "expected", "'_", ",_", "found_", ",_", "'", "got", "'_", ",_", "result_", "[_", "'", "status", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "fail", "\\u", "test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "matched_", "and_", "result_", "[_", "'", "status", "'_", "]_", "!=_", "not", "\\u", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "expected", "'_", ",_", "not", "\\u", "found_", ",_", "'", "got", "'_", ",_", "result_", "[_", "'", "status", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "fail", "\\u", "test_", "(_", ")_", "\\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 ]
Illegal raise
mining/django-report/report/backends/mining.py
[ { "content": " def get_queryset(self):\n if not getattr(self, \"model\", None):\n raise NotImplementedError(\"You must provide a 'model' method for \"\n \"the '%r' Open Mining.\" % self)", "metadata": "root.Mining.get_queryset", "header": "['class', 'Mining', '(', 'object', ')', ':', '___EOS___']", "index": 2 } ]
[]
[]
0
true
[ "[CLS]_", "Il", "lega", "l_", "raise_", "[SEP]_", "class_", "Mini", "ng_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "queryset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "getattr_", "(_", "self_", ",_", "\"", "model", "\"_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "You", " ", "must", " ", "provide", " ", "a", " ", "'", "model", "'", " ", "method", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "the", " ", "'%", "r", "'", " ", "Open", " ", "Mini", "ng", ".\"_", "%_", "self_", ")_" ]
[ 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 ]
Except block handles 'BaseException'
kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/intelc.py
[ { "content": "def get_all_compiler_versions():\n \"\"\"Returns a sorted list of strings, like \"70\" or \"80\" or \"9.0\"\n with most recent compiler version first.\n \"\"\"\n versions=[]\n if is_windows:\n if is_win64:\n keyname = 'Software\\\\WoW6432Node\\\\Intel\\\\Compilers\\\\C++'\n else:\n keyname = 'Software\\\\Intel\\\\Compilers\\\\C++'\n try:\n k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,\n keyname)\n except WindowsError:\n # For version 13 or later, check for default instance UUID\n if is_win64:\n keyname = 'Software\\\\WoW6432Node\\\\Intel\\\\Suites'\n else:\n keyname = 'Software\\\\Intel\\\\Suites'\n try:\n k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,\n keyname)\n except WindowsError:\n return []\n i = 0\n versions = []\n try:\n while i < 100:\n subkey = SCons.Util.RegEnumKey(k, i) # raises EnvironmentError\n # Check that this refers to an existing dir.\n # This is not 100% perfect but should catch common\n # installation issues like when the compiler was installed\n # and then the install directory deleted or moved (rather\n # than uninstalling properly), so the registry values\n # are still there.\n if subkey == 'Defaults': # Ignore default instances\n i = i + 1\n continue\n ok = False\n for try_abi in ('IA32', 'IA32e', 'IA64', 'EM64T'):\n try:\n d = get_intel_registry_value('ProductDir', subkey, try_abi)\n except MissingRegistryError:\n continue # not found in reg, keep going\n if os.path.exists(d): ok = True\n if ok:\n versions.append(subkey)\n else:\n try:\n # Registry points to nonexistent dir. Ignore this\n # version.\n value = get_intel_registry_value('ProductDir', subkey, 'IA32')\n except MissingRegistryError, e:\n\n # Registry key is left dangling (potentially\n # after uninstalling).\n\n print \\\n \"scons: *** Ignoring the registry key for the Intel compiler version %s.\\n\" \\\n \"scons: *** It seems that the compiler was uninstalled and that the registry\\n\" \\\n \"scons: *** was not cleaned up properly.\\n\" % subkey\n else:\n print \"scons: *** Ignoring \"+str(value)\n\n i = i + 1\n except EnvironmentError:\n # no more subkeys\n pass\n elif is_linux or is_mac:\n for d in glob.glob('/opt/intel_cc_*'):\n # Typical dir here is /opt/intel_cc_80.\n m = re.search(r'cc_(.*)$', d)\n if m:\n versions.append(m.group(1))\n for d in glob.glob('/opt/intel/cc*/*'):\n # Typical dir here is /opt/intel/cc/9.0 for IA32,\n # /opt/intel/cce/9.0 for EMT64 (AMD64)\n m = re.search(r'([0-9][0-9.]*)$', d)\n if m:\n versions.append(m.group(1))\n for d in glob.glob('/opt/intel/Compiler/*'):\n # Typical dir here is /opt/intel/Compiler/11.1\n m = re.search(r'([0-9][0-9.]*)$', d)\n if m:\n versions.append(m.group(1))\n for d in glob.glob('/opt/intel/composerxe-*'):\n # Typical dir here is /opt/intel/composerxe-2011.4.184\n m = re.search(r'([0-9][0-9.]*)$', d)\n if m:\n versions.append(m.group(1))\n for d in glob.glob('/opt/intel/composer_xe_*'):\n # Typical dir here is /opt/intel/composer_xe_2011_sp1.11.344\n # The _sp1 is useless, the installers are named 2011.9.x, 2011.10.x, 2011.11.x\n m = re.search(r'([0-9]{0,4})(?:_sp\\d*)?\\.([0-9][0-9.]*)$', d)\n if m:\n versions.append(\"%s.%s\"%(m.group(1), m.group(2)))\n def keyfunc(str):\n \"\"\"Given a dot-separated version string, return a tuple of ints representing it.\"\"\"\n return [int(x) for x in str.split('.')]\n # split into ints, sort, then remove dups\n return sorted(uniquify(versions), key=keyfunc, reverse=True)", "metadata": "root.get_all_compiler_versions", "header": "['module', '___EOS___']", "index": 204 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "compiler", "\\u", "versions_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "sorte", "d", " ", "list", " ", "of", " ", "string", "s", ",", " ", "like", " ", "\"", "7", "0", "\"", " ", "or", " ", "\"", "80", "\"", " ", "or", " ", "\"", "9.0", "\"", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "most", " ", "recent", " ", "compiler", " ", "version", " ", "first", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "versions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "windows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "win", "64_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyname_", "=_", "'", "Sof", "twa", "re", "\\\\\\\\", "Wo", "W", "643", "2", "Node", "\\\\\\\\", "Intel", "\\\\\\\\", "Compil", "ers", "\\\\\\\\", "C", "++'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyname_", "=_", "'", "Sof", "twa", "re", "\\\\\\\\", "Intel", "\\\\\\\\", "Compil", "ers", "\\\\\\\\", "C", "++'_", "\\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 ", " _", "k_", "=_", "SC", "ons_", "._", "Util_", "._", "Reg", "Open", "Key", "Ex_", "(_", "SC", "ons_", "._", "Util_", "._", "HKEY", "\\u", "LOCAL", "\\u", "MACHINE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Window", "s", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "version", " ", "13", " ", "or", " ", "late", "r", ",", " ", "check", " ", "for", " ", "default", " ", "instance", " ", "UUID_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "win", "64_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyname_", "=_", "'", "Sof", "twa", "re", "\\\\\\\\", "Wo", "W", "643", "2", "Node", "\\\\\\\\", "Intel", "\\\\\\\\", "Suit", "es", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyname_", "=_", "'", "Sof", "twa", "re", "\\\\\\\\", "Intel", "\\\\\\\\", "Suit", "es", "'_", "\\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 ", " _", "k_", "=_", "SC", "ons_", "._", "Util_", "._", "Reg", "Open", "Key", "Ex_", "(_", "SC", "ons_", "._", "Util_", "._", "HKEY", "\\u", "LOCAL", "\\u", "MACHINE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Window", "s", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "versions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "i_", "<_", "100_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subkey", "_", "=_", "SC", "ons_", "._", "Util_", "._", "Reg", "Enum", "Key_", "(_", "k_", ",_", "i_", ")_", "#", " ", "raise", "s", " ", "Environ", "ment", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "this", " ", "refer", "s", " ", "to", " ", "an", " ", "exist", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "not", " ", "100", "%", " ", "perfect", " ", "but", " ", "shou", "ld", " ", "catch", " ", "common_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "installation", " ", "issue", "s", " ", "like", " ", "whe", "n", " ", "the", " ", "compiler", " ", "was", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "then", " ", "the", " ", "install", " ", "director", "y", " ", "delete", "d", " ", "or", " ", "moved", " ", "(", "rat", "her_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "than", " ", "uninstall", "ing", " ", "proper", "ly", "),", " ", "so", " ", "the", " ", "registr", "y", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "still", " ", "there", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "subkey", "_", "==_", "'", "Default", "s", "'_", ":_", "#", " ", "Ignor", "e", " ", "default", " ", "instances_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "i_", "=_", "i_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ok_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "try", "\\u", "abi", "_", "in_", "(_", "'", "IA", "32", "'_", ",_", "'", "IA", "32", "e", "'_", ",_", "'", "IA", "64", "'_", ",_", "'", "EM", "64", "T", "'_", ")_", ":_", "\\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 ", " ", " _", "d_", "=_", "get", "\\u", "intel", "\\u", "registr", "y", "\\u", "value_", "(_", "'", "Product", "Dir", "'_", ",_", "subkey", "_", ",_", "try", "\\u", "abi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Missing", "Regi", "stry", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "#", " ", "not", " ", "found", " ", "in", " ", "reg", ",", " ", "keep", " ", "goi", "ng_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "d_", ")_", ":_", "ok_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "versions_", "._", "append_", "(_", "subkey", "_", ")_", "\\u\\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_", "#", " ", "Regi", "stry", " ", "points", " ", "to", " ", "nonexist", "ent", " ", "dir", ".", " ", " ", "Ignor", "e", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "get", "\\u", "intel", "\\u", "registr", "y", "\\u", "value_", "(_", "'", "Product", "Dir", "'_", ",_", "subkey", "_", ",_", "'", "IA", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Missing", "Regi", "stry", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Regi", "stry", " ", "key", " ", "is", " ", "left", " ", "dan", "glin", "g", " ", "(", "potenti", "ally", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "after", " ", "uninstall", "ing", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "scons", ":", " ", "***", " ", "Ignor", "ing", " ", "the", " ", "registr", "y", " ", "key", " ", "for", " ", "the", " ", "Intel", " ", "compiler", " ", "version", " ", "%", "s", ".\\\\", "n", "\"_", "\"", "scons", ":", " ", "***", " ", "It", " ", "see", "ms", " ", "tha", "t", " ", "the", " ", "compiler", " ", "was", " ", "uninstall", "ed", " ", "and", " ", "tha", "t", " ", "the", " ", "registr", "y", "\\\\", "n", "\"_", "\"", "scons", ":", " ", "***", " ", "was", " ", "not", " ", "clean", "ed", " ", "up", " ", "proper", "ly", ".\\\\", "n", "\"_", "%_", "subkey", "_", "\\u\\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_", "\"", "scons", ":", " ", "***", " ", "Ignor", "ing", " ", "\"_", "+_", "str_", "(_", "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_", "i_", "=_", "i_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Environ", "ment", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "more", " ", "subkey", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "linux_", "or_", "is", "\\u", "mac_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "d_", "in_", "glob_", "._", "glob_", "(_", "'/", "opt", "/", "intel", "\\u", "cc", "\\u*", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Typical", " ", "dir", " ", "here", " ", "is", " ", "/", "opt", "/", "intel", "\\u", "cc", "\\u", "80.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "search_", "(_", "r", "'", "cc", "\\u(", ".*)", "$'_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "versions_", "._", "append_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "d_", "in_", "glob_", "._", "glob_", "(_", "'/", "opt", "/", "intel", "/", "cc", "*/", "*'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Typical", " ", "dir", " ", "here", " ", "is", " ", "/", "opt", "/", "intel", "/", "cc", "/", "9.0", " ", "for", " ", "IA", "32", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "opt", "/", "intel", "/", "cce", "/", "9.0", " ", "for", " ", "EM", "T64", " ", "(", "AMD", "64", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "search_", "(_", "r", "'(", "[", "0", "-", "9", "][", "0", "-", "9", ".]", "*)", "$'_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "versions_", "._", "append_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "d_", "in_", "glob_", "._", "glob_", "(_", "'/", "opt", "/", "intel", "/", "Compil", "er", "/*'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Typical", " ", "dir", " ", "here", " ", "is", " ", "/", "opt", "/", "intel", "/", "Compil", "er", "/", "11.", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "search_", "(_", "r", "'(", "[", "0", "-", "9", "][", "0", "-", "9", ".]", "*)", "$'_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "versions_", "._", "append_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "d_", "in_", "glob_", "._", "glob_", "(_", "'/", "opt", "/", "intel", "/", "composer", "xe", "-*", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Typical", " ", "dir", " ", "here", " ", "is", " ", "/", "opt", "/", "intel", "/", "composer", "xe", "-", "2011", ".4", ".1", "84_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "search_", "(_", "r", "'(", "[", "0", "-", "9", "][", "0", "-", "9", ".]", "*)", "$'_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "versions_", "._", "append_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "d_", "in_", "glob_", "._", "glob_", "(_", "'/", "opt", "/", "intel", "/", "composer", "\\u", "xe", "\\u*", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Typical", " ", "dir", " ", "here", " ", "is", " ", "/", "opt", "/", "intel", "/", "composer", "\\u", "xe", "\\u", "2011", "\\u", "sp", "1.1", "1.3", "44_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "\\u", "sp", "1", " ", "is", " ", "usel", "ess", ",", " ", "the", " ", "installer", "s", " ", "are", " ", "named", " ", "2011", ".9", ".", "x", ",", " ", "2011", ".1", "0.", "x", ",", " ", "2011", ".1", "1", ".", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "search_", "(_", "r", "'(", "[", "0", "-", "9", "]{", "0", ",", "4", "})(", "?:", "\\u", "sp", "\\\\", "d", "*)", "?\\\\", ".(", "[", "0", "-", "9", "][", "0", "-", "9", ".]", "*)", "$'_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "versions_", "._", "append_", "(_", "\"%", "s", ".", "%", "s", "\"_", "%_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ",_", "m_", "._", "group_", "(_", "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_", "def_", "key", "func_", "(_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "n", " ", "a", " ", "dot", "-", "separate", "d", " ", "version", " ", "string", ",", " ", "return", " ", "a", " ", "tuple", " ", "of", " ", "ints", " ", "represent", "ing", " ", "it", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "int_", "(_", "x_", ")_", "for_", "x_", "in_", "str_", "._", "split_", "(_", "'.'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "split", " ", "int", "o", " ", "ints", ",", " ", "sort", ",", " ", "then", " ", "remove", " ", "dup", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sorted_", "(_", "uniq", "ui", "fy_", "(_", "versions_", ")_", ",_", "key_", "=_", "key", "func_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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django-user-sessions/user_sessions/templatetags/user_sessions.py
[ { "content": "import re\nimport warnings\n\nfrom django import template\nfrom django.contrib.gis.geoip import HAS_GEOIP\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import ugettext_lazy as _, ugettext\n\nregister = template.Library()\n\nBROWSERS = (\n (re.compile('Chrome'), _('Chrome')),\n (re.compile('Safari'), _('Safari')),\n (re.compile('Firefox'), _('Firefox')),\n (re.compile('Opera'), _('Opera')),\n (re.compile('IE'), _('Internet Explorer')),\n)\nDEVICES = (\n (re.compile('Android'), _('Android')),\n (re.compile('Linux'), _('Linux')),\n (re.compile('iPhone'), _('iPhone')),\n (re.compile('iPad'), _('iPad')),\n (re.compile('(Mac OS X)'), _('OS X')),\n (re.compile('NT 5.1'), _('Windows XP')),\n (re.compile('NT 6.0'), _('Windows Vista')),\n (re.compile('NT 6.1'), _('Windows 7')),\n (re.compile('NT 6.2'), _('Windows 8')),\n (re.compile('NT 6.3'), _('Windows 8.1')),\n (re.compile('Windows'), _('Windows')),\n)\n\n\n\n\n\n_geoip = None\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@register.filter\ndef device(value):\n \"\"\"\n Transform a User Agent into a human readable text.\n\n Example output:\n\n * Safari on iPhone\n * Chrome on Windows 8.1\n * Safari on OS X\n \"\"\"\n\n for regex, name in BROWSERS:\n if regex.search(value):\n browser = name\n break\n else:\n browser = 'unknown'\n for regex, name in DEVICES:\n if regex.search(value):\n device = name\n break\n else:\n device = 'unknown'\n return _('%(browser)s on %(device)s') % {'browser': browser,\n 'device': device}", "metadata": "root.device", "header": "['module', '___EOS___']", "index": 32 }, { "content": "@register.filter\ndef location(value):\n \"\"\"\n Transform an IP address into an approximate location.\n\n Example output:\n\n * Zwolle, The Netherlands\n * ``<i>unknown</i>``\n \"\"\"\n location = geoip() and geoip().city(value)\n if location and location['country_name']:\n if location['city']:\n return '%s, %s' % (location['city'], location['country_name'])\n else:\n return location['country_name']\n return mark_safe('<i>%s</i>' % ugettext('unknown'))", "metadata": "root.location", "header": "['module', '___EOS___']", "index": 60 }, { "content": "def geoip():\n global _geoip\n if _geoip is None and HAS_GEOIP:\n from django.contrib.gis.geoip import GeoIP\n try:\n _geoip = GeoIP()\n except Exception as e:\n warnings.warn(str(e))\n return _geoip", "metadata": "root.geoip", "header": "['module', '___EOS___']", "index": 81 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "geoi", "p_", "import_", "HAS", "\\u", "GEO", "IP_", "\\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_", ",_", "ugettext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register_", "=_", "template_", "._", "Library_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "BROWSER", "S_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "Chrom", "e", "'_", ")_", ",_", "\\u_", "(_", "'", "Chrom", "e", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "Saf", "ari", "'_", ")_", ",_", "\\u_", "(_", "'", "Saf", "ari", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "Fire", "fox", "'_", ")_", ",_", "\\u_", "(_", "'", "Fire", "fox", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "Opera", "'_", ")_", ",_", "\\u_", "(_", "'", "Opera", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "IE", "'_", ")_", ",_", "\\u_", "(_", "'", "Intern", "et", " ", "Explorer", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEVICES", "_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "And", "roid", "'_", ")_", ",_", "\\u_", "(_", "'", "And", "roid", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "Lin", "ux", "'_", ")_", ",_", "\\u_", "(_", "'", "Lin", "ux", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "i", "Phone", "'_", ")_", ",_", "\\u_", "(_", "'", "i", "Phone", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "i", "Pad", "'_", ")_", ",_", "\\u_", "(_", "'", "i", "Pad", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'(", "Mac", " ", "OS", " ", "X", ")'_", ")_", ",_", "\\u_", "(_", "'", "OS", " ", "X", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "NT", " ", "5.1", "'_", ")_", ",_", "\\u_", "(_", "'", "Window", "s", " ", "XP", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "NT", " ", "6.0", "'_", ")_", ",_", "\\u_", "(_", "'", "Window", "s", " ", "Vis", "ta", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "NT", " ", "6.1", "'_", ")_", ",_", "\\u_", "(_", "'", "Window", "s", " ", "7", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "NT", " ", "6.2", "'_", ")_", ",_", "\\u_", "(_", "'", "Window", "s", " ", "8", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "NT", " ", "6.3", "'_", ")_", ",_", "\\u_", "(_", "'", "Window", "s", " ", "8.1", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "re_", "._", "compile_", "(_", "'", "Window", "s", "'_", ")_", ",_", "\\u_", "(_", "'", "Window", "s", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "geoi", "p_", "=_", "None_", "\\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_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "device_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Transform", " ", "a", " ", "User", " ", "Agent", " ", "int", "o", " ", "a", " ", "human", " ", "reada", "ble", " ", "text", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", " ", "output", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Saf", "ari", " ", "on", " ", "i", "Phone", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Chrom", "e", " ", "on", " ", "Window", "s", " ", "8.1", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Saf", "ari", " ", "on", " ", "OS", " ", "X", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "regex_", ",_", "name_", "in_", "BROWSER", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "regex_", "._", "search_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "browser_", "=_", "name_", "\\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 ", " _", "browser_", "=_", "'", "unknown", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "regex_", ",_", "name_", "in_", "DEVICES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "regex_", "._", "search_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "device_", "=_", "name_", "\\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 ", " _", "device_", "=_", "'", "unknown", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u_", "(_", "'%", "(", "browse", "r", ")", "s", " ", "on", " ", "%", "(", "device", ")", "s", "'_", ")_", "%_", "{_", "'", "browse", "r", "'_", ":_", "browser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "device", "'_", ":_", "device_", "}_", "\\u\\u\\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_", "location_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Transform", " ", "an", " ", "IP", " ", "address", " ", "int", "o", " ", "an", " ", "approximate", " ", "location", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", " ", "output", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Zw", "olle", ",", " ", "The", " ", "Net", "her", "lands", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "<", "i", ">", "unknown", "</", "i", ">`", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "geoi", "p_", "(_", ")_", "and_", "geoi", "p_", "(_", ")_", "._", "city_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "location_", "and_", "location_", "[_", "'", "countr", "y", "\\u", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "location_", "[_", "'", "city", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", ",", " ", "%", "s", "'_", "%_", "(_", "location_", "[_", "'", "city", "'_", "]_", ",_", "location_", "[_", "'", "countr", "y", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "location_", "[_", "'", "countr", "y", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mark", "\\u", "safe_", "(_", "'<", "i", ">", "%", "s", "</", "i", ">'_", "%_", "ugettext_", "(_", "'", "unknown", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "geoi", "p_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "geoi", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "geoi", "p_", "is_", "None_", "and_", "HAS", "\\u", "GEO", "IP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "geoi", "p_", "import_", "Geo", "IP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "geoi", "p_", "=_", "Geo", "IP_", "(_", ")_", "\\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 ", " _", "warnings_", "._", "warn_", "(_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "geoi", "p_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
aldebaran/qibuild/python/qitest/test_queue.py
[ { "content": " def run(self):\n while not self._should_stop:\n try:\n test, index = self.queue.get_nowait()\n except Queue.Empty:\n return\n self.test_logger.on_start(test, index)\n result = None\n try:\n result = self.launcher.launch(test)\n except Exception, e:\n result = qitest.result.TestResult(test)\n result.ok = False\n result.message = ui.message_for_exception(e,\n \"Python exception during tests\")\n result.error = True\n if not self._should_stop:\n self.test_logger.on_completed(test, index, result.message)\n self.results[test[\"name\"]] = result\n self.queue.task_done()", "metadata": "root.TestWorker.run", "header": "['class', 'TestWorker', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 185 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Worker_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "\\u", "shou", "ld", "\\u", "stop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test_", ",_", "index_", "=_", "self_", "._", "queue_", "._", "get", "\\u", "nowait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "test\\u", "logger_", "._", "on", "\\u", "start_", "(_", "test_", ",_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "launcher_", "._", "launch_", "(_", "test_", ")_", "\\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 ", " _", "result_", "=_", "qi", "test_", "._", "result_", "._", "Test", "Result_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "ok_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "message_", "=_", "ui_", "._", "message", "\\u", "for", "\\u", "exception_", "(_", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Pyth", "on", " ", "exception", " ", "dur", "ing", " ", "tests", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "shou", "ld", "\\u", "stop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "test\\u", "logger_", "._", "on", "\\u", "completed_", "(_", "test_", ",_", "index_", ",_", "result_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "results_", "[_", "test_", "[_", "\"", "name", "\"_", "]_", "]_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "queue_", "._", "task", "\\u", "done_", "(_", ")_", "\\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 ]
Unused import
chrisdembia/agent-bicycle/randlov1998/tasks_gotorewards.py
[ { "content": "import numpy as np\n\nimport pybrain.rl.environments\nfrom pybrain.utilities import one_to_n\n\nfrom environment import Environment\n\n# The agent's actions are T and d.\n\n# TODO where do we set up the generalization?\n# TODO must pass omegadd to the learner.\n# TODO the tiling might be achieved by implementing Task.getObservation.\n# TODO states and actions are converted to int's within sarsa.py, ...what does\n# this mean?\n# TODO might need to use NFQ instead of Q or Sarsa.\n# TODO NFQ might used a fix value of alpha as 0.5.\n# TODO set epsilon for epsilon-greedy learning using learner.explorer.epsilon.\n# TODO pybrain has limited examples of doing RL using continuous states and\n# value-based learners (generalizing). Then we can use ActionValueNetwork, but\n# it's not clear to me yet how this 'discretizes'/generalizes the state space.\n\n\n\n\n\n\n\n \n\n\n \n \n ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BalanceTask(pybrain.rl.environments.EpisodicTask):\n \"\"\"The rider is to simply balance the bicycle while moving with the\n prescribed speed.\n\n This class is heavily guided by\n pybrain.rl.environments.cartpole.balancetask.BalanceTask.\n\n \"\"\"\n # See Randlov's code. Paper and thesis say 12 degrees, but his code uses\n # pi/15. These are actually equivalent.\n #max_tilt = 12.0 * np.pi / 180.0\n max_tilt = np.pi / 15.0\n\n nactions = 9\n\n\n\n\n\n\n\n", "metadata": "root.BalanceTask", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def __init__(self, butt_disturbance_amplitude=0.02, only_steer=False,\n max_time=1000.0):\n \"\"\"\n Parameters\n ----------\n butt_disturbance_amplitude : float; optional\n In meters.\n \"\"\"\n super(BalanceTask, self).__init__(Environment())\n # Keep track of time in case we want to end episodes based on number of\n # time steps.\n self._butt_disturbance_amplitude = butt_disturbance_amplitude\n self.only_steer = only_steer\n self.max_time = max_time\n self.t = 0\n\n # TODO Sensor limits to normalize the sensor readings.\n # TODO Actor limits.\n #T_limits = (-2, 2) # Newtons.\n #d_limits = (-0.02, 0.02) # meters.\n ## None for sensor limits; does not normalize sensor values.\n ## outdim should be set to the length of the sensors vector.\n #self.setScaling([None] * self.env.outdim, [T_limits, d_limits])\n self.action_history = np.zeros(self.nactions)", "metadata": "root.BalanceTask.__init__", "header": "['class', 'BalanceTask', '(', 'pybrain', '.', 'rl', '.', 'environments', '.', 'EpisodicTask', ')', ':', '___EOS___']", "index": 35 }, { "content": " @property\n def indim(self):\n return 1", "metadata": "root.BalanceTask.indim", "header": "['class', 'BalanceTask', '(', 'pybrain', '.', 'rl', '.', 'environments', '.', 'EpisodicTask', ')', ':', '___EOS___']", "index": 60 }, { "content": " @property\n def outdim(self):\n return 5", "metadata": "root.BalanceTask.outdim", "header": "['class', 'BalanceTask', '(', 'pybrain', '.', 'rl', '.', 'environments', '.', 'EpisodicTask', ')', ':', '___EOS___']", "index": 64 }, { "content": " def reset(self):\n super(BalanceTask, self).reset()\n self.t = 0", "metadata": "root.BalanceTask.reset", "header": "['class', 'BalanceTask', '(', 'pybrain', '.', 'rl', '.', 'environments', '.', 'EpisodicTask', ')', ':', '___EOS___']", "index": 68 }, { "content": " def performAction(self, action):\n \"\"\"Incoming action is an int between 0 and 8. The action we provide to\n the environment consists of a torque T in {-2 N, 0, 2 N}, and a\n displacement d in {-.02 m, 0, 0.02 m}.\n\n \"\"\"\n self.t += 1\n self.action_history += one_to_n(action[0], self.nactions)\n # Map the action integer to a torque and displacement.\n assert round(action[0]) == action[0]\n\n if self.only_steer:\n T = 2 * (action[0] / 4.0 - 1.0)\n d = 0.\n else:\n # -1 for action in {0, 1, 2}, 0 for action in {3, 4, 5}, 1 for\n # action in {6, 7, 8}\n torque_selector = np.floor(action[0] / 3.0) - 1.0\n T = 2 * torque_selector\n # Random number in [-1, 1]:\n p = 2.0 * np.random.rand() - 1.0\n # -1 for action in {0, 3, 6}, 0 for action in {1, 4, 7}, 1 for\n # action in {2, 5, 8}\n disp_selector = action[0] % 3 - 1.0\n d = 0.02 * disp_selector + self._butt_disturbance_amplitude * p\n super(BalanceTask, self).performAction([T, d])", "metadata": "root.BalanceTask.performAction", "header": "['class', 'BalanceTask', '(', 'pybrain', '.', 'rl', '.', 'environments', '.', 'EpisodicTask', ')', ':', '___EOS___']", "index": 72 }, { "content": " def getObservation(self):\n (theta, thetad, omega, omegad, omegadd,\n xf, yf, xb, yb, psi) = self.env.getSensors()\n # TODO not calling superclass to do normalization, etc.\n return self.env.getSensors()[0:5]", "metadata": "root.BalanceTask.getObservation", "header": "['class', 'BalanceTask', '(', 'pybrain', '.', 'rl', '.', 'environments', '.', 'EpisodicTask', ')', ':', '___EOS___']", "index": 99 }, { "content": " def isFinished(self):\n # Criterion for ending an episode.\n # \"When the agent can balance for 1000 seconds, the task is considered\n # learned.\"\n if np.abs(self.env.getTilt()) > self.max_tilt:\n return True\n elapsed_time = self.env.time_step * self.t\n if elapsed_time > self.max_time:\n print 'hit max time.', self.t, elapsed_time\n return True\n return False", "metadata": "root.BalanceTask.isFinished", "header": "['class', 'BalanceTask', '(', 'pybrain', '.', 'rl', '.', 'environments', '.', 'EpisodicTask', ')', ':', '___EOS___']", "index": 105 }, { "content": " def getReward(self):\n # -1 reward for falling over; no reward otherwise.\n if np.abs(self.env.getTilt()) > self.max_tilt:\n return -1.0\n return 0.0", "metadata": "root.BalanceTask.getReward", "header": "['class', 'BalanceTask', '(', 'pybrain', '.', 'rl', '.', 'environments', '.', 'EpisodicTask', ')', ':', '___EOS___']", "index": 117 }, { "content": "class GotoTask(BalanceTask):\n \"\"\" The rider is to balance the bicycle while moving toward a \n prescribed goal \n \"\"\"\n\n # Goal position and raduis\n x_goal = 20.\n y_goal = 8.\n r_goal = 10.\n\n\n\n\n\n", "metadata": "root.GotoTask", "header": "['module', '___EOS___']", "index": 124 }, { "content": " @property\n def outdim(self):\n return 8", "metadata": "root.GotoTask.outdim", "header": "['class', 'GotoTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 134 }, { "content": " def getObservation(self):\n # let the learner know about the front tire position and \n # the heading.\n (theta, thetad, omega, omegad, omegadd,\n xf, yf, xb, yb, psi) = self.env.getSensors()\n \n # TODO not calling superclass to do normalization, etc.\n return [ self.env.getSensors()[i] for i in [0, 1, 2, 3, 4, 5, 6, 9] ]", "metadata": "root.GotoTask.getObservation", "header": "['class', 'GotoTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 138 }, { "content": " def isFinished(self):\n # Criterion for ending an episode.\n # When the agent reaches the goal, the task is considered learned.\n # When the agent falls down, the episode is over.\n dist_to_goal = self.calc_dist_to_goal()\n heading = self.calc_angle_to_goal()\n heading2 = self.env.getPsi()\n\n if np.abs(self.env.getTilt()) > self.max_tilt:\n print 'distance to goal ', dist_to_goal\n return True\n\n if dist_to_goal < 1e-3:\n print 'reached goal'\n return True\n\n return False", "metadata": "root.GotoTask.isFinished", "header": "['class', 'GotoTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 147 }, { "content": " def getReward(self):\n # -1 reward for falling over\n # 0.01 reward for close to goal\n # return reward inversely proportional to heading error otherwise\n\n r_factor = 0.0001\n\n if np.abs(self.env.getTilt()) > self.max_tilt:\n return -1.0\n else:\n temp = self.calc_dist_to_goal()\n heading = self.calc_angle_to_goal()\n if (temp < 1e-3):\n return 0.01\n else:\n return (0.95 - heading**2) * r_factor", "metadata": "root.GotoTask.getReward", "header": "['class', 'GotoTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 165 }, { "content": " def calc_dist_to_goal(self):\n # ported from Randlov's C code. See bike.c for the source\n # code.\n\n # unpack variables\n x_goal = self.x_goal\n y_goal = self.y_goal\n r_goal = self.r_goal\n xf = self.env.getXF()\n yf = self.env.getYF()\n\n sqrd_dist_to_goal = ( x_goal - xf )**2 + ( y_goal -yf )**2 \n temp = np.max([0, sqrd_dist_to_goal - r_goal**2])\n\n # We probably don't need to actually compute a sqrt here if it\n # helps simulation speed.\n temp = np.sqrt(temp)\n\n return temp", "metadata": "root.GotoTask.calc_dist_to_goal", "header": "['class', 'GotoTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 182 }, { "content": " def calc_angle_to_goal(self):\n # ported from Randlov's C code. See bike.c for the source\n # code. \n\n # the following explanation of the returned angle is \n # verbatim from Randlov's C source:\n\n # These angles are neither in degrees nor radians, but \n # something strange invented in order to save CPU-time. The \n # measure is arranged same way as radians, but with a \n # slightly different negative factor\n #\n # Say the goal is to the east,\n # If the agent rides to the east then temp = 0\n # \" \" north \" \" = -1\n # \" \" west \" \" = -2 or 2\n # \" \" south \" \" = 1\n #\n # // end quote // \n\n # TODO: see the psi calculation in the environment, which is not \n # currently being used.\n\n # unpack variables\n x_goal = self.x_goal\n y_goal = self.y_goal\n xf = self.env.getXF()\n xb = self.env.getXB()\n yf = self.env.getYF()\n yb = self.env.getYB()\n\n # implement Randlov's angle computation\n temp = (xf - xb) * (x_goal - xf) + (yf - yb) * (y_goal - yf)\n scalar = temp / (1 * np.sqrt( (x_goal - xf)**2 + (y_goal - yf)**2))\n tvaer = (-yf + yb) * (x_goal - xf) + (xf - xb) * (y_goal-yf)\n\n if tvaer <= 0 :\n temp = scalar - 1\n else:\n temp = np.abs(scalar - 1)\n\n return temp", "metadata": "root.GotoTask.calc_angle_to_goal", "header": "['class', 'GotoTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 202 }, { "content": "class LinearFATileCoding3456BalanceTask(BalanceTask):\n \"\"\"An attempt to exactly implement Randlov's function approximation. He\n discretized (tiled) the input space into 3456 tiles.\n\n \"\"\"\n # From Randlov, 1998:\n theta_bounds = np.array(\n [-0.5 * np.pi, -1.0, -0.2, 0, 0.2, 1.0, 0.5 * np.pi])\n thetad_bounds = np.array(\n [-np.inf, -2.0, 0, 2.0, np.inf])\n omega_bounds = np.array(\n [-BalanceTask.max_tilt, -0.15, -0.06, 0, 0.06, 0.15,\n BalanceTask.max_tilt])\n omegad_bounds = np.array(\n [-np.inf, -0.5, -0.25, 0, 0.25, 0.5, np.inf])\n omegadd_bounds = np.array(\n [-np.inf, -2.0, 0, 2.0, np.inf])\n # http://stackoverflow.com/questions/3257619/numpy-interconversion-between-multidimensional-and-linear-indexing\n nbins_across_dims = [\n len(theta_bounds) - 1,\n len(thetad_bounds) - 1,\n len(omega_bounds) - 1,\n len(omegad_bounds) - 1,\n len(omegadd_bounds) - 1]\n # This array, when dotted with the 5-dim state vector, gives a 'linear'\n # index between 0 and 3455.\n magic_array = np.cumprod([1] + nbins_across_dims)[:-1]\n\n\n\n\n", "metadata": "root.LinearFATileCoding3456BalanceTask", "header": "['module', '___EOS___']", "index": 246 }, { "content": " def __init__(self, *args, **kwargs):\n super(LinearFATileCoding3456BalanceTask, self).__init__(*args, **kwargs)\n # Count the number of times that each state is visited.\n self.bin_count = np.zeros(self.outdim)", "metadata": "root.LinearFATileCoding3456BalanceTask.__init__", "header": "['class', 'LinearFATileCoding3456BalanceTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 274 }, { "content": " @property\n def outdim(self):\n # Used when constructing LinearFALearner's.\n return 3456", "metadata": "root.LinearFATileCoding3456BalanceTask.outdim", "header": "['class', 'LinearFATileCoding3456BalanceTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 279 }, { "content": " def getBin(self, theta, thetad, omega, omegad, omegadd):\n bin_indices = [\n np.digitize([theta], self.theta_bounds)[0] - 1,\n np.digitize([thetad], self.thetad_bounds)[0] - 1,\n np.digitize([omega], self.omega_bounds)[0] - 1,\n np.digitize([omegad], self.omegad_bounds)[0] - 1,\n np.digitize([omegadd], self.omegadd_bounds)[0] - 1,\n ]\n linear_index = np.dot(self.magic_array, bin_indices)\n if linear_index > self.outdim:\n # DEBUGGING PRINTS\n print self.isFinished()\n print self.env.getTilt()\n print np.abs(self.env.getTilt())\n print self.max_tilt\n print np.abs(self.env.getTilt()) > self.max_tilt\n print self.env.getSensors()[0:5]\n print self.magic_array\n print bin_index_for_each_dim\n print linear_index\n return linear_index", "metadata": "root.LinearFATileCoding3456BalanceTask.getBin", "header": "['class', 'LinearFATileCoding3456BalanceTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 284 }, { "content": " def getBinIndices(self, linear_index):\n \"\"\"Given a linear index (integer between 0 and outdim), returns the bin\n indices for each of the state dimensions.\n\n \"\"\"\n return linear_index / self.magic_array % self.nbins_across_dims", "metadata": "root.LinearFATileCoding3456BalanceTask.getBinIndices", "header": "['class', 'LinearFATileCoding3456BalanceTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 306 }, { "content": " def getObservation(self):\n (theta, thetad, omega, omegad, omegadd,\n xf, yf, xb, yb, psi) = self.env.getSensors()\n # TODO not calling superclass to do normalization, etc.\n state = one_to_n(self.getBin(theta, thetad, omega, omegad, omegadd),\n self.outdim)\n self.bin_count += state\n return state", "metadata": "root.LinearFATileCoding3456BalanceTask.getObservation", "header": "['class', 'LinearFATileCoding3456BalanceTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 313 }, { "content": "class LSPIBalanceTask(BalanceTask):\n \"\"\"Lagoudakis, 2002; simplified for just balancing. Also, we're still using\n all 9 possible actions.\n\n \"\"\"\n\n", "metadata": "root.LSPIBalanceTask", "header": "['module', '___EOS___']", "index": 323 }, { "content": " @property\n def outdim(self):\n # Used when constructing LinearFALearner's.\n return 14", "metadata": "root.LSPIBalanceTask.outdim", "header": "['class', 'LSPIBalanceTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 328 }, { "content": " def getPhi(self, theta, thetad, omega, omegad, omegadd):\n return np.array([\n 1, omega, omegad, omega**2, omegad**2, omega * omegad,\n theta, thetad, theta**2, thetad**2, theta * thetad,\n omega * theta, omega * theta**2, omega**2 * theta,\n ])", "metadata": "root.LSPIBalanceTask.getPhi", "header": "['class', 'LSPIBalanceTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 333 }, { "content": " def getObservation(self):\n (theta, thetad, omega, omegad, omegadd,\n xf, yf, xb, yb, psi) = self.env.getSensors()\n return self.getPhi(theta, thetad, omega, omegad, omegadd)", "metadata": "root.LSPIBalanceTask.getObservation", "header": "['class', 'LSPIBalanceTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 340 }, { "content": "class LinearFATileCoding3456GoToTask(BalanceTask):\n \"\"\"An attempt to exactly implement Randlov's function approximation. He\n discretized (tiled) the input space into 3456 tiles.\n\n \"\"\"\n # Goal position and raduis\n x_goal = 20.\n y_goal = 20.\n r_goal = 10.\n\n # From Randlov, 1998:\n theta_bounds = np.array(\n [-0.5 * np.pi, -1.0, -0.2, 0, 0.2, 1.0, 0.5 * np.pi])\n thetad_bounds = np.array(\n [-np.inf, -2.0, 0, 2.0, np.inf])\n omega_bounds = np.array(\n [-BalanceTask.max_tilt, -0.15, -0.06, 0, 0.06, 0.15,\n BalanceTask.max_tilt])\n omegad_bounds = np.array(\n [-np.inf, -0.5, -0.25, 0, 0.25, 0.5, np.inf])\n omegadd_bounds = np.array(\n [-np.inf, -2.0, 0, 2.0, np.inf])\n psi_bounds = (np.pi/180) * np.array( range(0,360,18) )\n\n # http://stackoverflow.com/questions/3257619/numpy-interconversion-between-multidimensional-and-linear-indexing\n nbins_across_dims = [ \n len(theta_bounds) - 1,\n len(thetad_bounds) - 1,\n len(omega_bounds) - 1,\n len(omegad_bounds) - 1,\n len(omegadd_bounds) - 1]\n\n # This array, when dotted with the 5-dim state vector, gives a 'linear'\n # index between 0 and 3455.\n magic_array = np.cumprod([1] + nbins_across_dims)[:-1]\n\n\n\n\n\n\n\n", "metadata": "root.LinearFATileCoding3456GoToTask", "header": "['module', '___EOS___']", "index": 346 }, { "content": " @property\n def outdim(self):\n # Used when constructing LinearFALearner's.\n return 3456 + 20", "metadata": "root.LinearFATileCoding3456GoToTask.outdim", "header": "['class', 'LinearFATileCoding3456GoToTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 382 }, { "content": " def getBin(self, theta, thetad, omega, omegad, omegadd):\n bin_indices = [\n np.digitize([theta], self.theta_bounds)[0] - 1,\n np.digitize([thetad], self.thetad_bounds)[0] - 1,\n np.digitize([omega], self.omega_bounds)[0] - 1,\n np.digitize([omegad], self.omegad_bounds)[0] - 1,\n np.digitize([omegadd], self.omegadd_bounds)[0] - 1,\n ]\n linear_index = np.dot(self.magic_array, bin_indices)\n if linear_index > self.outdim-20:\n # DEBUGGING PRINTS\n print \"DEBUG\"\n print self.isFinished()\n print self.env.getTilt()\n print np.abs(self.env.getTilt())\n print self.max_tilt\n print np.abs(self.env.getTilt()) > self.max_tilt\n print self.env.getSensors()\n print self.magic_array\n print self.getBinIndices(linear_index)\n print linear_index\n return linear_index", "metadata": "root.LinearFATileCoding3456GoToTask.getBin", "header": "['class', 'LinearFATileCoding3456GoToTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 387 }, { "content": " def getBinIndices(self, linear_index):\n \"\"\"Given a linear index (integer between 0 and outdim), returns the bin\n indices for each of the state dimensions.\n\n \"\"\"\n return linear_index / self.magic_array % self.nbins_across_dims", "metadata": "root.LinearFATileCoding3456GoToTask.getBinIndices", "header": "['class', 'LinearFATileCoding3456GoToTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 410 }, { "content": " def getObservation(self):\n (theta, thetad, omega, omegad, omegadd,\n xf, yf, xb, yb, psi) = self.env.getSensors()\n # TODO not calling superclass to do normalization, etc.\n top_half = one_to_n(self.getBin(theta, thetad, omega, omegad, omegadd),\n self.outdim - 20)\n \n bot_half = one_to_n(np.digitize([psi], self.psi_bounds)[0] - 1, 20)\n\n return np.concatenate((top_half,bot_half))", "metadata": "root.LinearFATileCoding3456GoToTask.getObservation", "header": "['class', 'LinearFATileCoding3456GoToTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 417 }, { "content": " def isFinished(self):\n # Criterion for ending an episode.\n # When the agent reaches the goal, the task is considered learned.\n # When the agent falls down, the episode is over.\n\n if np.abs(self.env.getTilt()) > self.max_tilt:\n return True\n\n dist_to_goal = self.calc_dist_to_goal()\n if dist_to_goal == 0:\n print 'reached goal'\n return True\n\n #elapsed_time = self.env.time_step * self.t\n #if elapsed_time > self.max_time:\n # print 'hit max time.', self.t, elapsed_time\n # return True \n return False", "metadata": "root.LinearFATileCoding3456GoToTask.isFinished", "header": "['class', 'LinearFATileCoding3456GoToTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 428 }, { "content": " def getReward(self):\n # -1 reward for falling over\n # 0.01 reward for close to goal\n # return reward inversely proportional to heading error otherwise\n\n r_factor = 0.0001\n\n if np.abs(self.env.getTilt()) > self.max_tilt:\n return -1.0\n else:\n temp = self.calc_dist_to_goal()\n heading = self.calc_angle_to_goal()\n if (temp < 1e-3):\n return 0.01\n else:\n return (0.95 - heading**2) * r_factor", "metadata": "root.LinearFATileCoding3456GoToTask.getReward", "header": "['class', 'LinearFATileCoding3456GoToTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 447 }, { "content": " def calc_dist_to_goal(self):\n # ported from Randlov's C code. See bike.c for the source\n # code.\n\n # unpack variables\n x_goal = self.x_goal\n y_goal = self.y_goal\n r_goal = self.r_goal\n xf = self.env.getXF()\n yf = self.env.getYF()\n\n sqrd_dist_to_goal = ( x_goal - xf )**2 + ( y_goal -yf )**2 \n temp = np.max([0, sqrd_dist_to_goal - r_goal**2])\n\n # We probably don't need to actually compute a sqrt here if it\n # helps simulation speed.\n temp = np.sqrt(temp)\n\n return temp", "metadata": "root.LinearFATileCoding3456GoToTask.calc_dist_to_goal", "header": "['class', 'LinearFATileCoding3456GoToTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 464 }, { "content": " def calc_angle_to_goal(self):\n # ported from Randlov's C code. See bike.c for the source\n # code. \n\n # the following explanation of the returned angle is \n # verbatim from Randlov's C source:\n\n # These angles are neither in degrees nor radians, but \n # something strange invented in order to save CPU-time. The \n # measure is arranged same way as radians, but with a \n # slightly different negative factor\n #\n # Say the goal is to the east,\n # If the agent rides to the east then temp = 0\n # \" \" north \" \" = -1\n # \" \" west \" \" = -2 or 2\n # \" \" south \" \" = 1\n #\n # // end quote // \n\n\n # TODO: see the psi calculation in the environment, which is not \n # currently being used.\n\n\n # unpack variables\n x_goal = self.x_goal\n y_goal = self.y_goal\n xf = self.env.getXF()\n xb = self.env.getXB()\n yf = self.env.getYF()\n yb = self.env.getYB()\n\n # implement Randlov's angle computation\n temp = (xf - xb) * (x_goal - xf) + (yf - yb) * (y_goal - yf)\n scalar = temp / (1 * np.sqrt( (x_goal - xf)**2 + (y_goal - yf)**2))\n tvaer = (-yf + yb) * (x_goal - xf) + (xf - xb) * (y_goal-yf)\n\n if tvaer <= 0 :\n temp = scalar - 1\n else:\n temp = np.abs(scalar - 1)\n\n return temp", "metadata": "root.LinearFATileCoding3456GoToTask.calc_angle_to_goal", "header": "['class', 'LinearFATileCoding3456GoToTask', '(', 'BalanceTask', ')', ':', '___EOS___']", "index": 484 }, { "content": "class Proportional3456ControlBalanceTask(LinearFATileCoding3456BalanceTask):\n", "metadata": "root.Proportional3456ControlBalanceTask", "header": "['module', '___EOS___']", "index": 529 }, { "content": " def getReward(self):\n # -1 reward for falling over; no reward otherwise.\n if np.abs(self.env.getTilt()) > self.max_tilt:\n return -1.0\n return -np.abs(self.env.getSensors()[0])", "metadata": "root.Proportional3456ControlBalanceTask.getReward", "header": "['class', 'Proportional3456ControlBalanceTask', '(', 'LinearFATileCoding3456BalanceTask', ')', ':', '___EOS___']", "index": 531 }, { "content": "class LinearFATileCoding3456GoToTaskReward1(LinearFATileCoding3456GoToTask):\n e =2.71828", "metadata": "root.LinearFATileCoding3456GoToTaskReward1", "header": "['module', '___EOS___']", "index": 537 }, { "content": " def getReward(self):\n \n r_factor = 0.0001\n x = np.abs(self.env.getTilt())\n PrevTilt = np.abs(self.env.TempTilt)\n if x>LinearFATileCoding3456BalanceTask.max_tilt:\n R = -15.0\n else:\n if x<1.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R = 5.0\n elif 1.0/3*LinearFATileCoding3456BalanceTask.max_tilt<=x and x<=2.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R = 1.0\n elif 2.0/3*LinearFATileCoding3456BalanceTask.max_tilt<=x and x<=LinearFATileCoding3456BalanceTask.max_tilt:\n R = -5.0\n if PrevTilt>x:\n R += 3000.0*(PrevTilt-x)\n if PrevTilt>2.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R *= 2\n if PrevTilt<x:\n R += 3000.0*(PrevTilt-x)\n temp = self.calc_dist_to_goal()\n heading = self.calc_angle_to_goal()\n if (temp < 1e-3):\n R *= 10.0\n else:\n R -= 3000*np.abs(heading)\n return R", "metadata": "root.LinearFATileCoding3456GoToTaskReward1.getReward", "header": "['class', 'LinearFATileCoding3456GoToTaskReward1', '(', 'LinearFATileCoding3456GoToTask', ')', ':', '___EOS___']", "index": 539 }, { "content": "class LinearFATileCoding3456GoToTaskReward2(LinearFATileCoding3456GoToTask):\n e =2.71828", "metadata": "root.LinearFATileCoding3456GoToTaskReward2", "header": "['module', '___EOS___']", "index": 567 }, { "content": " def getReward(self):\n \n r_factor = 0.0001\n x = np.abs(self.env.getTilt())\n PrevTilt = np.abs(self.env.TempTilt)\n if x>LinearFATileCoding3456BalanceTask.max_tilt:\n R = -15.0\n else:\n if x<1.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R = 5.0\n elif 1.0/3*LinearFATileCoding3456BalanceTask.max_tilt<=x and x<=2.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R = 1.0\n elif 2.0/3*LinearFATileCoding3456BalanceTask.max_tilt<=x and x<=LinearFATileCoding3456BalanceTask.max_tilt:\n R = -5.0\n if PrevTilt>x:\n R += 3000.0*(PrevTilt-x)\n if PrevTilt>2.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R *= 2\n if PrevTilt<x:\n R += 3000.0*(PrevTilt-x)\n temp = self.calc_dist_to_goal()\n heading = self.calc_angle_to_goal()\n if (temp < 1e-3):\n R *= 10.0\n else:\n R -= 200*np.abs(heading)\n return R", "metadata": "root.LinearFATileCoding3456GoToTaskReward2.getReward", "header": "['class', 'LinearFATileCoding3456GoToTaskReward2', '(', 'LinearFATileCoding3456GoToTask', ')', ':', '___EOS___']", "index": 569 }, { "content": "class LinearFATileCoding3456GoToTaskReward3(LinearFATileCoding3456GoToTask):\n e =2.71828", "metadata": "root.LinearFATileCoding3456GoToTaskReward3", "header": "['module', '___EOS___']", "index": 597 }, { "content": " def getReward(self):\n temp = self.calc_dist_to_goal()\n heading = self.calc_angle_to_goal()\n x = np.abs(self.env.getTilt())\n PrevTilt = np.abs(self.env.TempTilt)\n if x>LinearFATileCoding3456BalanceTask.max_tilt:\n R = -15.0\n else:\n if x<1.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R = 5.0\n elif 1.0/3*LinearFATileCoding3456BalanceTask.max_tilt<=x and x<=2.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R = 1.0\n elif 2.0/3*LinearFATileCoding3456BalanceTask.max_tilt<=x and x<=LinearFATileCoding3456BalanceTask.max_tilt:\n R = -5.0\n if PrevTilt>x:\n R += 3000.0*((PrevTilt-x)-np.abs(heading))\n if PrevTilt>2.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R *= 2\n if PrevTilt<x:\n R += 3000.0*(PrevTilt-x)\n if (temp < 1e-3):\n R *= 100.0\n #else:\n # R -= 200*np.abs(heading)\n return R", "metadata": "root.LinearFATileCoding3456GoToTaskReward3.getReward", "header": "['class', 'LinearFATileCoding3456GoToTaskReward3', '(', 'LinearFATileCoding3456GoToTask', ')', ':', '___EOS___']", "index": 599 }, { "content": "class LinearFATileCoding3456GoToTaskReward4(LinearFATileCoding3456GoToTask):\n e =2.71828", "metadata": "root.LinearFATileCoding3456GoToTaskReward4", "header": "['module', '___EOS___']", "index": 625 }, { "content": " def getReward(self):\n temp = self.calc_dist_to_goal()\n heading = self.calc_angle_to_goal()\n x = np.abs(self.env.getTilt())\n PrevTilt = np.abs(self.env.TempTilt)\n if x>LinearFATileCoding3456BalanceTask.max_tilt:\n R = -15.0\n else:\n if x<1.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R = 5.0\n elif 1.0/3*LinearFATileCoding3456BalanceTask.max_tilt<=x and x<=2.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R = 1.0\n elif 2.0/3*LinearFATileCoding3456BalanceTask.max_tilt<=x and x<=LinearFATileCoding3456BalanceTask.max_tilt:\n R = -5.0\n if PrevTilt>x:\n R += 3000.0*((PrevTilt-x)-1.0/10*np.abs(heading))\n if PrevTilt>2.0/3*LinearFATileCoding3456BalanceTask.max_tilt:\n R *= 2\n if PrevTilt<x:\n R += 3000.0*(PrevTilt-x)\n if (temp < 1e-3):\n R *= 100.0\n return R", "metadata": "root.LinearFATileCoding3456GoToTaskReward4.getReward", "header": "['class', 'LinearFATileCoding3456GoToTaskReward4', '(', 'LinearFATileCoding3456GoToTask', ')', ':', '___EOS___']", "index": 627 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyb", "rain_", "._", "rl_", "._", "environments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyb", "rain_", "._", "utilities_", "import_", "one", "\\u", "to", "\\u", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "environment_", "import_", "Environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "agent", "'", "s", " ", "action", "s", " ", "are", " ", "T", " ", "and", " ", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "where", " ", "do", " ", "we", " ", "set", " ", "up", " ", "the", " ", "generaliz", "ation", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "must", " ", "pass", " ", "omega", "dd", " ", "to", " ", "the", " ", "learner", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "the", " ", "tili", "ng", " ", "mig", "ht", " ", "be", " ", "achieve", "d", " ", "by", " ", "implement", "ing", " ", "Task", ".", "get", "Observation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "state", "s", " ", "and", " ", "action", "s", " ", "are", " ", "convert", "ed", " ", "to", " ", "int", "'", "s", " ", "within", " ", "sar", "sa", ".", "py", ",", " ", "...", "what", " ", "doe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "mean", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "mig", "ht", " ", "need", " ", "to", " ", "use", " ", "NF", "Q", " ", "inst", "ead", " ", "of", " ", "Q", " ", "or", " ", "Sar", "sa", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "NF", "Q", " ", "mig", "ht", " ", "used", " ", "a", " ", "fix", " ", "value", " ", "of", " ", "alpha", " ", "as", " ", "0.", "5._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "set", " ", "eps", "ilon", " ", "for", " ", "eps", "ilon", "-", "greedy", " ", "learn", "ing", " ", "usi", "ng", " ", "learner", ".", "explorer", ".", "eps", "ilon", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "pyb", "rain", " ", "has", " ", "limited", " ", "example", "s", " ", "of", " ", "doi", "ng", " ", "RL", " ", "usi", "ng", " ", "continuous", " ", "state", "s", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", "-", "based", " ", "learner", "s", " ", "(", "generaliz", "ing", ").", " ", "The", "n", " ", "we", " ", "can", " ", "use", " ", "Action", "Value", "Network", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "not", " ", "clear", " ", "to", " ", "me", " ", "ye", "t", " ", "how", " ", "this", " ", "'", "discretiz", "es", "'/", "generaliz", "es", " ", "the", " ", "state", " ", "space", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Balance", "Task_", "(_", "pyb", "rain_", "._", "rl_", "._", "environments_", "._", "Episod", "ic", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "ride", "r", " ", "is", " ", "to", " ", "simp", "ly", " ", "balance", " ", "the", " ", "bic", "ycle", " ", "whi", "le", " ", "movin", "g", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "presc", "ribe", "d", " ", "speed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "is", " ", "heav", "il", "y", " ", "guide", "d", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "pyb", "rain", ".", "rl", ".", "environ", "ment", "s", ".", "cart", "pole", ".", "balance", "task", ".", "Balance", "Task", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "Ran", "dlo", "v", "'", "s", " ", "code", ".", " ", "Pap", "er", " ", "and", " ", "thes", "is", " ", "say", " ", "1", "2", " ", "degr", "ees", ",", " ", "but", " ", "his", " ", "code", " ", "uses_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pi", "/", "15.", " ", "The", "se", " ", "are", " ", "actual", "ly", " ", "equivalent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "max", "\\u", "tilt", " ", "=", " ", "12.", "0", " ", "*", " ", "np", ".", "pi", " ", "/", " ", "180.0_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "tilt", "_", "=_", "np_", "._", "pi_", "/_", "15.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nac", "tions_", "=_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Balance", "Task_", "(_", "pyb", "rain_", "._", "rl_", "._", "environments_", "._", "Episod", "ic", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "butt", "\\u", "dist", "urban", "ce", "\\u", "amplitude_", "=_", "0.02_", ",_", "only", "\\u", "steer", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "time_", "=_", "1000.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "butt", "\\u", "dist", "urban", "ce", "\\u", "amplitude", " ", ":", " ", "float", ";", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "mete", "rs", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Balance", "Task_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "Environment_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Keep", " ", "track", " ", "of", " ", "time", " ", "in", " ", "case", " ", "we", " ", "want", " ", "to", " ", "end", " ", "episode", "s", " ", "based", " ", "on", " ", "number", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "time", " ", "step", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "butt", "\\u", "dist", "urban", "ce", "\\u", "amplitude_", "=_", "butt", "\\u", "dist", "urban", "ce", "\\u", "amplitude_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "only", "\\u", "steer", "_", "=_", "only", "\\u", "steer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "\\u", "time_", "=_", "max", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "t_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "Sen", "sor", " ", "limit", "s", " ", "to", " ", "normali", "ze", " ", "the", " ", "sensor", " ", "readings", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "Act", "or", " ", "limit", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "T", "\\u", "limit", "s", " ", "=", " ", "(-", "2", ",", " ", "2", ")", " ", "#", " ", "New", "ton", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "d\\u", "limit", "s", " ", "=", " ", "(-", "0.02", ",", " ", "0.02", ")", " ", "#", " ", "mete", "rs", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Non", "e", " ", "for", " ", "sensor", " ", "limit", "s", ";", " ", "doe", "s", " ", "not", " ", "normali", "ze", " ", "sensor", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "outd", "im", " ", "shou", "ld", " ", "be", " ", "set", " ", "to", " ", "the", " ", "length", " ", "of", " ", "the", " ", "sensor", "s", " ", "vector", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "set", "Sca", "ling", "([", "Non", "e", "]", " ", "*", " ", "self", ".", "env", ".", "outd", "im", ",", " ", "[", "T", "\\u", "limit", "s", ",", " ", "d\\u", "limit", "s", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "action", "\\u", "history_", "=_", "np_", "._", "zeros_", "(_", "self_", "._", "nac", "tions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Balance", "Task_", "(_", "pyb", "rain_", "._", "rl_", "._", "environments_", "._", "Episod", "ic", "Task_", ")_", ":_", "\\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_", "indi", "m_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Balance", "Task_", "(_", "pyb", "rain_", "._", "rl_", "._", "environments_", "._", "Episod", "ic", "Task_", ")_", ":_", "\\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_", "outd", "im_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Balance", "Task_", "(_", "pyb", "rain_", "._", "rl_", "._", "environments_", "._", "Episod", "ic", "Task_", ")_", ":_", "\\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 ", " _", "super_", "(_", "Balance", "Task_", ",_", "self_", ")_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "t_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Balance", "Task_", "(_", "pyb", "rain_", "._", "rl_", "._", "environments_", "._", "Episod", "ic", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform", "Action_", "(_", "self_", ",_", "action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Inco", "ming", " ", "action", " ", "is", " ", "an", " ", "int", " ", "bet", "ween", " ", "0", " ", "and", " ", "8", ".", " ", "The", " ", "action", " ", "we", " ", "provide", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "environ", "ment", " ", "consi", "sts", " ", "of", " ", "a", " ", "torque", " ", "T", " ", "in", " ", "{-", "2", " ", "N", ",", " ", "0", ",", " ", "2", " ", "N", "},", " ", "and", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "displacement", " ", "d", " ", "in", " ", "{-", ".02", " ", "m", ",", " ", "0", ",", " ", "0.02", " ", "m", "}.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "t_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "action", "\\u", "history_", "+=_", "one", "\\u", "to", "\\u", "n_", "(_", "action_", "[_", "0_", "]_", ",_", "self_", "._", "nac", "tions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Map", " ", "the", " ", "action", " ", "integ", "er", " ", "to", " ", "a", " ", "torque", " ", "and", " ", "displacement", "._", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "round_", "(_", "action_", "[_", "0_", "]_", ")_", "==_", "action_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "only", "\\u", "steer", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "T_", "=_", "2_", "*_", "(_", "action_", "[_", "0_", "]_", "/_", "4.0_", "-_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-1", " ", "for", " ", "action", " ", "in", " ", "{", "0", ",", " ", "1", ",", " ", "2", "},", " ", "0", " ", "for", " ", "action", " ", "in", " ", "{", "3", ",", " ", "4", ",", " ", "5", "},", " ", "1", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "action", " ", "in", " ", "{", "6", ",", " ", "7", ",", " ", "8", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "torque", "\\u", "selector_", "=_", "np_", "._", "floor_", "(_", "action_", "[_", "0_", "]_", "/_", "3.0_", ")_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "2_", "*_", "torque", "\\u", "selector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Random", " ", "number", " ", "in", " ", "[-", "1", ",", " ", "1", "]:", "_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "2.0_", "*_", "np_", "._", "random_", "._", "rand_", "(_", ")_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-1", " ", "for", " ", "action", " ", "in", " ", "{", "0", ",", " ", "3", ",", " ", "6", "},", " ", "0", " ", "for", " ", "action", " ", "in", " ", "{", "1", ",", " ", "4", ",", " ", "7", "},", " ", "1", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "action", " ", "in", " ", "{", "2", ",", " ", "5", ",", " ", "8", "}_", "\\u\\u\\uNL\\u\\u\\u_", "disp", "\\u", "selector_", "=_", "action_", "[_", "0_", "]_", "%_", "3_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "0.02_", "*_", "disp", "\\u", "selector_", "+_", "self_", "._", "\\u", "butt", "\\u", "dist", "urban", "ce", "\\u", "amplitude_", "*_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Balance", "Task_", ",_", "self_", ")_", "._", "perform", "Action_", "(_", "[_", "T_", ",_", "d_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Balance", "Task_", "(_", "pyb", "rain_", "._", "rl_", "._", "environments_", "._", "Episod", "ic", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Observation", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xf_", ",_", "yf", "_", ",_", "xb_", ",_", "yb", "_", ",_", "psi_", ")_", "=_", "self_", "._", "env_", "._", "get", "Sensors", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "not", " ", "calling", " ", "superclass", " ", "to", " ", "do", " ", "normaliza", "tion", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "env_", "._", "get", "Sensors", "_", "(_", ")_", "[_", "0_", ":_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Balance", "Task_", "(_", "pyb", "rain_", "._", "rl_", "._", "environments_", "._", "Episod", "ic", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "Finished_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Criterion", " ", "for", " ", "ending", " ", "an", " ", "episode", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "Whe", "n", " ", "the", " ", "agent", " ", "can", " ", "balance", " ", "for", " ", "1000", " ", "second", "s", ",", " ", "the", " ", "task", " ", "is", " ", "consider", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "learned", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", ">_", "self_", "._", "max", "\\u", "tilt", "_", ":_", "\\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_", "ela", "pse", "d\\u", "time_", "=_", "self_", "._", "env_", "._", "time", "\\u", "step_", "*_", "self_", "._", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ela", "pse", "d\\u", "time_", ">_", "self_", "._", "max", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "hit", " ", "max", " ", "time", ".'_", ",_", "self_", "._", "t_", ",_", "ela", "pse", "d\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Balance", "Task_", "(_", "pyb", "rain_", "._", "rl_", "._", "environments_", "._", "Episod", "ic", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Reward", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-1", " ", "reward", " ", "for", " ", "falling", " ", "over", ";", " ", "no", " ", "reward", " ", "other", "wis", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", ">_", "self_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0.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_", "Got", "o", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "The", " ", "ride", "r", " ", "is", " ", "to", " ", "balance", " ", "the", " ", "bic", "ycle", " ", "whi", "le", " ", "movin", "g", " ", "tow", "ard", " ", "a", " ", "\\", "10", ";", " ", " ", " ", " ", "presc", "ribe", "d", " ", "goal", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Goal", " ", "position", " ", "and", " ", "rad", "uis", "_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "goal_", "=_", "20._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "goal_", "=_", "8._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "goal_", "=_", "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_", "Got", "o", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "outd", "im_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Got", "o", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Observation", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "let", " ", "the", " ", "learner", " ", "know", " ", "abo", "ut", " ", "the", " ", "front", " ", "tir", "e", " ", "position", " ", "and", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "heading", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xf_", ",_", "yf", "_", ",_", "xb_", ",_", "yb", "_", ",_", "psi_", ")_", "=_", "self_", "._", "env_", "._", "get", "Sensors", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "not", " ", "calling", " ", "superclass", " ", "to", " ", "do", " ", "normaliza", "tion", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "self_", "._", "env_", "._", "get", "Sensors", "_", "(_", ")_", "[_", "i_", "]_", "for_", "i_", "in_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "6_", ",_", "9_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Got", "o", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "Finished_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Criterion", " ", "for", " ", "ending", " ", "an", " ", "episode", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "the", " ", "agent", " ", "reache", "s", " ", "the", " ", "goal", ",", " ", "the", " ", "task", " ", "is", " ", "consider", "ed", " ", "learned", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "the", " ", "agent", " ", "fall", "s", " ", "down", ",", " ", "the", " ", "episode", " ", "is", " ", "over", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dist", "\\u", "to", "\\u", "goal_", "=_", "self_", "._", "calc", "\\u", "dist", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heading_", "=_", "self_", "._", "calc", "\\u", "angle", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heading", "2_", "=_", "self_", "._", "env_", "._", "get", "Psi", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", ">_", "self_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "distance", " ", "to", " ", "goal", " ", "'_", ",_", "dist", "\\u", "to", "\\u", "goal_", "\\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_", "dist", "\\u", "to", "\\u", "goal_", "<_", "1e-3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "reache", "d", " ", "goal", "'_", "\\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]_", "class_", "Got", "o", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Reward", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-1", " ", " ", " ", " ", "reward", " ", "for", " ", "falling", " ", "over_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "0.01", " ", "reward", " ", "for", " ", "close", " ", "to", " ", "goal_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "return", " ", "reward", " ", "inv", "erse", "ly", " ", "proportional", " ", "to", " ", "heading", " ", "error", " ", "other", "wise_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\\u", "factor_", "=_", "0.0001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", ">_", "self_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "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 ", " _", "temp_", "=_", "self_", "._", "calc", "\\u", "dist", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heading_", "=_", "self_", "._", "calc", "\\u", "angle", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "temp_", "<_", "1e-3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.01_", "\\u\\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_", "(_", "0.95_", "-_", "heading_", "**_", "2_", ")_", "*_", "r", "\\u", "factor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Got", "o", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\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_", "calc", "\\u", "dist", "\\u", "to", "\\u", "goal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "porte", "d", " ", "from", " ", "Ran", "dlo", "v", "'", "s", " ", "C", " ", "code", ".", " ", "See", " ", "bike", ".", "c", " ", "for", " ", "the", " ", "source_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unpack", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "goal_", "=_", "self_", "._", "x", "\\u", "goal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "goal_", "=_", "self_", "._", "y", "\\u", "goal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "goal_", "=_", "self_", "._", "r", "\\u", "goal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xf_", "=_", "self_", "._", "env_", "._", "get", "XF", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yf", "_", "=_", "self_", "._", "env_", "._", "get", "YF", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sqr", "d\\u", "dist", "\\u", "to", "\\u", "goal_", "=_", "(_", "x", "\\u", "goal_", "-_", "xf_", ")_", "**_", "2_", "+_", "(_", "y", "\\u", "goal_", "-_", "yf", "_", ")_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "=_", "np_", "._", "max_", "(_", "[_", "0_", ",_", "sqr", "d\\u", "dist", "\\u", "to", "\\u", "goal_", "-_", "r", "\\u", "goal_", "**_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "probab", "ly", " ", "don", "'", "t", " ", "need", " ", "to", " ", "actual", "ly", " ", "compute", " ", "a", " ", "sqrt", " ", "here", " ", "if", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "helps", " ", "simulati", "on", " ", "speed", "._", "\\u\\u\\uNL\\u\\u\\u_", "temp_", "=_", "np_", "._", "sqrt_", "(_", "temp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "temp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Got", "o", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calc", "\\u", "angle", "\\u", "to", "\\u", "goal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "porte", "d", " ", "from", " ", "Ran", "dlo", "v", "'", "s", " ", "C", " ", "code", ".", " ", "See", " ", "bike", ".", "c", " ", "for", " ", "the", " ", "source_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "code", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "follow", "ing", " ", "expl", "anat", "ion", " ", "of", " ", "the", " ", "return", "ed", " ", "angle", " ", "is", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verba", "tim", " ", "from", " ", "Ran", "dlo", "v", "'", "s", " ", "C", " ", "source", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "angle", "s", " ", "are", " ", "nei", "ther", " ", "in", " ", "degr", "ees", " ", "nor", " ", "radian", "s", ",", " ", "but", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "somet", "hing", " ", "stran", "ge", " ", "inven", "ted", " ", "in", " ", "order", " ", "to", " ", "save", " ", "CPU", "-", "time", ".", " ", "The", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "measure", " ", "is", " ", "arrange", "d", " ", "same", " ", "way", " ", "as", " ", "radian", "s", ",", " ", "but", " ", "with", " ", "a", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "slight", "ly", " ", "different", " ", "negati", "ve", " ", "factor_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Say", " ", "the", " ", "goal", " ", "is", " ", "to", " ", "the", " ", "east", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "agent", " ", "ride", "s", " ", "to", " ", "the", " ", "east", " ", "then", " ", "temp", " ", "=", " ", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"", " ", "\"", " ", " ", " ", " ", " ", "north", " ", " ", " ", " ", "\"", " ", "\"", " ", " ", " ", "=", " ", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"", " ", "\"", " ", " ", " ", " ", " ", "west", " ", "\"", " ", "\"", " ", " ", " ", "=", " ", "-", "2", " ", "or", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"", " ", "\"", " ", " ", " ", " ", " ", "south", " ", " ", " ", " ", "\"", " ", "\"", " ", " ", " ", "=", " ", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "//", " ", "end", " ", "quote", " ", "//", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "see", " ", "the", " ", "psi", " ", "calculati", "on", " ", "in", " ", "the", " ", "environ", "ment", ",", " ", "whi", "ch", " ", "is", " ", "not", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "currentl", "y", " ", "bei", "ng", " ", "used", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unpack", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "goal_", "=_", "self_", "._", "x", "\\u", "goal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "goal_", "=_", "self_", "._", "y", "\\u", "goal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xf_", "=_", "self_", "._", "env_", "._", "get", "XF", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xb_", "=_", "self_", "._", "env_", "._", "get", "XB", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yf", "_", "=_", "self_", "._", "env_", "._", "get", "YF", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yb", "_", "=_", "self_", "._", "env_", "._", "get", "YB", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "implement", " ", "Ran", "dlo", "v", "'", "s", " ", "angle", " ", "computation", "_", "\\u\\u\\uNL\\u\\u\\u_", "temp_", "=_", "(_", "xf_", "-_", "xb_", ")_", "*_", "(_", "x", "\\u", "goal_", "-_", "xf_", ")_", "+_", "(_", "yf", "_", "-_", "yb", "_", ")_", "*_", "(_", "y", "\\u", "goal_", "-_", "yf", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scalar_", "=_", "temp_", "/_", "(_", "1_", "*_", "np_", "._", "sqrt_", "(_", "(_", "x", "\\u", "goal_", "-_", "xf_", ")_", "**_", "2_", "+_", "(_", "y", "\\u", "goal_", "-_", "yf", "_", ")_", "**_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tva", "er_", "=_", "(_", "-_", "yf", "_", "+_", "yb", "_", ")_", "*_", "(_", "x", "\\u", "goal_", "-_", "xf_", ")_", "+_", "(_", "xf_", "-_", "xb_", ")_", "*_", "(_", "y", "\\u", "goal_", "-_", "yf", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tva", "er_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "scalar_", "-_", "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 ", " _", "temp_", "=_", "np_", "._", "abs_", "(_", "scalar_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "temp_", "\\u\\u\\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_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "atte", "mpt", " ", "to", " ", "exact", "ly", " ", "implement", " ", "Ran", "dlo", "v", "'", "s", " ", "function", " ", "approx", "imat", "ion", ".", " ", "He", "\\", "10", ";", " ", " ", " ", " ", "discretiz", "ed", " ", "(", "tiled", ")", " ", "the", " ", "input", " ", "space", " ", "int", "o", " ", "3456", " ", "tiles", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fro", "m", " ", "Ran", "dlo", "v", ",", " ", "199", "8", ":_", "\\u\\u\\uNL\\u\\u\\u_", "theta", "\\u", "bounds_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "0.5_", "*_", "np_", "._", "pi_", ",_", "-_", "1.0_", ",_", "-_", "0.2_", ",_", "0_", ",_", "0.2_", ",_", "1.0_", ",_", "0.5_", "*_", "np_", "._", "pi_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theta", "d\\u", "bounds_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "np_", "._", "inf_", ",_", "-_", "2.0_", ",_", "0_", ",_", "2.0_", ",_", "np_", "._", "inf_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "omega", "\\u", "bounds_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ",_", "-_", "0.15_", ",_", "-_", "0.06_", ",_", "0_", ",_", "0.06_", ",_", "0.15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "omega", "d\\u", "bounds_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "np_", "._", "inf_", ",_", "-_", "0.5_", ",_", "-_", "0.25_", ",_", "0_", ",_", "0.25_", ",_", "0.5_", ",_", "np_", "._", "inf_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "omega", "dd", "\\u", "bounds_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "np_", "._", "inf_", ",_", "-_", "2.0_", ",_", "0_", ",_", "2.0_", ",_", "np_", "._", "inf_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "325", "761", "9", "/", "nump", "y", "-", "interc", "onv", "ersi", "on", "-", "bet", "ween", "-", "multid", "ime", "nsion", "al", "-", "and", "-", "linear", "-", "indexing", "_", "\\u\\u\\uNL\\u\\u\\u_", "nbin", "s", "\\u", "acro", "ss", "\\u", "dims_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "theta", "\\u", "bounds_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "theta", "d\\u", "bounds_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "omega", "\\u", "bounds_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "omega", "d\\u", "bounds_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "omega", "dd", "\\u", "bounds_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "array", ",", " ", "whe", "n", " ", "dot", "ted", " ", "with", " ", "the", " ", "5", "-", "dim", " ", "state", " ", "vector", ",", " ", "give", "s", " ", "a", " ", "'", "linear", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "index", " ", "bet", "ween", " ", "0", " ", "and", " ", "345", "5._", "\\u\\u\\uNL\\u\\u\\u_", "magic", "\\u", "array_", "=_", "np_", "._", "cum", "prod_", "(_", "[_", "1_", "]_", "+_", "nbin", "s", "\\u", "acro", "ss", "\\u", "dims_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\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_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Count", " ", "the", " ", "number", " ", "of", " ", "times", " ", "tha", "t", " ", "each", " ", "state", " ", "is", " ", "visit", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bin", "\\u", "count_", "=_", "np_", "._", "zeros_", "(_", "self_", "._", "outd", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\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_", "outd", "im_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "ed", " ", "whe", "n", " ", "constructi", "ng", " ", "Linea", "r", "FAL", "earn", "er", "'", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "3456", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Bin_", "(_", "self_", ",_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bin", "\\u", "indices_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "digit", "ize_", "(_", "[_", "theta_", "]_", ",_", "self_", "._", "theta", "\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "digit", "ize_", "(_", "[_", "theta", "d_", "]_", ",_", "self_", "._", "theta", "d\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "digit", "ize_", "(_", "[_", "omega_", "]_", ",_", "self_", "._", "omega", "\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "digit", "ize_", "(_", "[_", "omega", "d_", "]_", ",_", "self_", "._", "omega", "d\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "digit", "ize_", "(_", "[_", "omega", "dd_", "]_", ",_", "self_", "._", "omega", "dd", "\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linear", "\\u", "index_", "=_", "np_", "._", "dot_", "(_", "self_", "._", "magic", "\\u", "array_", ",_", "bin", "\\u", "indices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "linear", "\\u", "index_", ">_", "self_", "._", "outd", "im_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "DEBU", "GG", "ING", " ", "PRINT", "S_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "self_", "._", "is", "Finished_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "max", "\\u", "tilt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", ">_", "self_", "._", "max", "\\u", "tilt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "env_", "._", "get", "Sensors", "_", "(_", ")_", "[_", "0_", ":_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "magic", "\\u", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "bin", "\\u", "index", "\\u", "for", "\\u", "each", "\\u", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "linear", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "linear", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Bin", "Indices_", "(_", "self_", ",_", "linear", "\\u", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "n", " ", "a", " ", "linear", " ", "index", " ", "(", "integ", "er", " ", "bet", "ween", " ", "0", " ", "and", " ", "outd", "im", "),", " ", "return", "s", " ", "the", " ", "bin", "\\", "10", ";", " ", " ", " ", " ", "indice", "s", " ", "for", " ", "each", " ", "of", " ", "the", " ", "state", " ", "dimension", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "linear", "\\u", "index_", "/_", "self_", "._", "magic", "\\u", "array_", "%_", "self_", "._", "nbin", "s", "\\u", "acro", "ss", "\\u", "dims_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Observation", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xf_", ",_", "yf", "_", ",_", "xb_", ",_", "yb", "_", ",_", "psi_", ")_", "=_", "self_", "._", "env_", "._", "get", "Sensors", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "not", " ", "calling", " ", "superclass", " ", "to", " ", "do", " ", "normaliza", "tion", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "state_", "=_", "one", "\\u", "to", "\\u", "n_", "(_", "self_", "._", "get", "Bin_", "(_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "outd", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bin", "\\u", "count_", "+=_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "state_", "\\u\\u\\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_", "LS", "PI", "Balance", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Lag", "oud", "aki", "s", ",", " ", "2002", ";", " ", "simplified", " ", "for", " ", "just", " ", "balancing", ".", " ", "Al", "so", ",", " ", "we", "'", "re", " ", "still", " ", "usi", "ng", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "9", " ", "possib", "le", " ", "action", "s", ".", "\\", "10", ";", "\\", "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_", "LS", "PI", "Balance", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "outd", "im_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "ed", " ", "whe", "n", " ", "constructi", "ng", " ", "Linea", "r", "FAL", "earn", "er", "'", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "14_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LS", "PI", "Balance", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Phi", "_", "(_", "self_", ",_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "array_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega_", "**_", "2_", ",_", "omega", "d_", "**_", "2_", ",_", "omega_", "*_", "omega", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "theta_", ",_", "theta", "d_", ",_", "theta_", "**_", "2_", ",_", "theta", "d_", "**_", "2_", ",_", "theta_", "*_", "theta", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "omega_", "*_", "theta_", ",_", "omega_", "*_", "theta_", "**_", "2_", ",_", "omega_", "**_", "2_", "*_", "theta_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LS", "PI", "Balance", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Observation", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xf_", ",_", "yf", "_", ",_", "xb_", ",_", "yb", "_", ",_", "psi_", ")_", "=_", "self_", "._", "env_", "._", "get", "Sensors", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get", "Phi", "_", "(_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ")_", "\\u\\u\\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_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "atte", "mpt", " ", "to", " ", "exact", "ly", " ", "implement", " ", "Ran", "dlo", "v", "'", "s", " ", "function", " ", "approx", "imat", "ion", ".", " ", "He", "\\", "10", ";", " ", " ", " ", " ", "discretiz", "ed", " ", "(", "tiled", ")", " ", "the", " ", "input", " ", "space", " ", "int", "o", " ", "3456", " ", "tiles", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Goal", " ", "position", " ", "and", " ", "rad", "uis", "_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "goal_", "=_", "20._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "goal_", "=_", "20._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "goal_", "=_", "10._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fro", "m", " ", "Ran", "dlo", "v", ",", " ", "199", "8", ":_", "\\u\\u\\uNL\\u\\u\\u_", "theta", "\\u", "bounds_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "0.5_", "*_", "np_", "._", "pi_", ",_", "-_", "1.0_", ",_", "-_", "0.2_", ",_", "0_", ",_", "0.2_", ",_", "1.0_", ",_", "0.5_", "*_", "np_", "._", "pi_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theta", "d\\u", "bounds_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "np_", "._", "inf_", ",_", "-_", "2.0_", ",_", "0_", ",_", "2.0_", ",_", "np_", "._", "inf_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "omega", "\\u", "bounds_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ",_", "-_", "0.15_", ",_", "-_", "0.06_", ",_", "0_", ",_", "0.06_", ",_", "0.15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "omega", "d\\u", "bounds_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "np_", "._", "inf_", ",_", "-_", "0.5_", ",_", "-_", "0.25_", ",_", "0_", ",_", "0.25_", ",_", "0.5_", ",_", "np_", "._", "inf_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "omega", "dd", "\\u", "bounds_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "np_", "._", "inf_", ",_", "-_", "2.0_", ",_", "0_", ",_", "2.0_", ",_", "np_", "._", "inf_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "\\u", "bounds_", "=_", "(_", "np_", "._", "pi_", "/_", "180_", ")_", "*_", "np_", "._", "array_", "(_", "range_", "(_", "0_", ",_", "360_", ",_", "18_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "325", "761", "9", "/", "nump", "y", "-", "interc", "onv", "ersi", "on", "-", "bet", "ween", "-", "multid", "ime", "nsion", "al", "-", "and", "-", "linear", "-", "indexing", "_", "\\u\\u\\uNL\\u\\u\\u_", "nbin", "s", "\\u", "acro", "ss", "\\u", "dims_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "theta", "\\u", "bounds_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "theta", "d\\u", "bounds_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "omega", "\\u", "bounds_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "omega", "d\\u", "bounds_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "omega", "dd", "\\u", "bounds_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "array", ",", " ", "whe", "n", " ", "dot", "ted", " ", "with", " ", "the", " ", "5", "-", "dim", " ", "state", " ", "vector", ",", " ", "give", "s", " ", "a", " ", "'", "linear", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "index", " ", "bet", "ween", " ", "0", " ", "and", " ", "345", "5._", "\\u\\u\\uNL\\u\\u\\u_", "magic", "\\u", "array_", "=_", "np_", "._", "cum", "prod_", "(_", "[_", "1_", "]_", "+_", "nbin", "s", "\\u", "acro", "ss", "\\u", "dims_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "outd", "im_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "ed", " ", "whe", "n", " ", "constructi", "ng", " ", "Linea", "r", "FAL", "earn", "er", "'", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "3456", "_", "+_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Bin_", "(_", "self_", ",_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bin", "\\u", "indices_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "digit", "ize_", "(_", "[_", "theta_", "]_", ",_", "self_", "._", "theta", "\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "digit", "ize_", "(_", "[_", "theta", "d_", "]_", ",_", "self_", "._", "theta", "d\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "digit", "ize_", "(_", "[_", "omega_", "]_", ",_", "self_", "._", "omega", "\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "digit", "ize_", "(_", "[_", "omega", "d_", "]_", ",_", "self_", "._", "omega", "d\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "digit", "ize_", "(_", "[_", "omega", "dd_", "]_", ",_", "self_", "._", "omega", "dd", "\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linear", "\\u", "index_", "=_", "np_", "._", "dot_", "(_", "self_", "._", "magic", "\\u", "array_", ",_", "bin", "\\u", "indices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "linear", "\\u", "index_", ">_", "self_", "._", "outd", "im_", "-_", "20_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "DEBU", "GG", "ING", " ", "PRINT", "S_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "DEBU", "G", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "is", "Finished_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "max", "\\u", "tilt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", ">_", "self_", "._", "max", "\\u", "tilt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "env_", "._", "get", "Sensors", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "magic", "\\u", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "self_", "._", "get", "Bin", "Indices_", "(_", "linear", "\\u", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "linear", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "linear", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Bin", "Indices_", "(_", "self_", ",_", "linear", "\\u", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "n", " ", "a", " ", "linear", " ", "index", " ", "(", "integ", "er", " ", "bet", "ween", " ", "0", " ", "and", " ", "outd", "im", "),", " ", "return", "s", " ", "the", " ", "bin", "\\", "10", ";", " ", " ", " ", " ", "indice", "s", " ", "for", " ", "each", " ", "of", " ", "the", " ", "state", " ", "dimension", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "linear", "\\u", "index_", "/_", "self_", "._", "magic", "\\u", "array_", "%_", "self_", "._", "nbin", "s", "\\u", "acro", "ss", "\\u", "dims_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Observation", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xf_", ",_", "yf", "_", ",_", "xb_", ",_", "yb", "_", ",_", "psi_", ")_", "=_", "self_", "._", "env_", "._", "get", "Sensors", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "not", " ", "calling", " ", "superclass", " ", "to", " ", "do", " ", "normaliza", "tion", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "top", "\\u", "half_", "=_", "one", "\\u", "to", "\\u", "n_", "(_", "self_", "._", "get", "Bin_", "(_", "theta_", ",_", "theta", "d_", ",_", "omega_", ",_", "omega", "d_", ",_", "omega", "dd_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "outd", "im_", "-_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bot", "\\u", "half_", "=_", "one", "\\u", "to", "\\u", "n_", "(_", "np_", "._", "digit", "ize_", "(_", "[_", "psi_", "]_", ",_", "self_", "._", "psi", "\\u", "bounds_", ")_", "[_", "0_", "]_", "-_", "1_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "np_", "._", "concatenate_", "(_", "(_", "top", "\\u", "half_", ",_", "bot", "\\u", "half_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "Finished_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Criterion", " ", "for", " ", "ending", " ", "an", " ", "episode", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "the", " ", "agent", " ", "reache", "s", " ", "the", " ", "goal", ",", " ", "the", " ", "task", " ", "is", " ", "consider", "ed", " ", "learned", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "the", " ", "agent", " ", "fall", "s", " ", "down", ",", " ", "the", " ", "episode", " ", "is", " ", "over", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", ">_", "self_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dist", "\\u", "to", "\\u", "goal_", "=_", "self_", "._", "calc", "\\u", "dist", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dist", "\\u", "to", "\\u", "goal_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "reache", "d", " ", "goal", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "ela", "pse", "d\\u", "time", " ", "=", " ", "self", ".", "env", ".", "time", "\\u", "step", " ", "*", " ", "self", ".", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "ela", "pse", "d\\u", "time", " ", ">", " ", "self", ".", "max", "\\u", "time", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'", "hit", " ", "max", " ", "time", ".'", ",", " ", "self", ".", "t", ",", " ", "ela", "pse", "d\\u", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "Tru", "e", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Reward", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-1", " ", " ", " ", " ", "reward", " ", "for", " ", "falling", " ", "over_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "0.01", " ", "reward", " ", "for", " ", "close", " ", "to", " ", "goal_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "return", " ", "reward", " ", "inv", "erse", "ly", " ", "proportional", " ", "to", " ", "heading", " ", "error", " ", "other", "wise_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\\u", "factor_", "=_", "0.0001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", ">_", "self_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "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 ", " _", "temp_", "=_", "self_", "._", "calc", "\\u", "dist", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heading_", "=_", "self_", "._", "calc", "\\u", "angle", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "temp_", "<_", "1e-3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.01_", "\\u\\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_", "(_", "0.95_", "-_", "heading_", "**_", "2_", ")_", "*_", "r", "\\u", "factor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\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_", "calc", "\\u", "dist", "\\u", "to", "\\u", "goal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "porte", "d", " ", "from", " ", "Ran", "dlo", "v", "'", "s", " ", "C", " ", "code", ".", " ", "See", " ", "bike", ".", "c", " ", "for", " ", "the", " ", "source_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unpack", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "goal_", "=_", "self_", "._", "x", "\\u", "goal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "goal_", "=_", "self_", "._", "y", "\\u", "goal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "goal_", "=_", "self_", "._", "r", "\\u", "goal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xf_", "=_", "self_", "._", "env_", "._", "get", "XF", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yf", "_", "=_", "self_", "._", "env_", "._", "get", "YF", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sqr", "d\\u", "dist", "\\u", "to", "\\u", "goal_", "=_", "(_", "x", "\\u", "goal_", "-_", "xf_", ")_", "**_", "2_", "+_", "(_", "y", "\\u", "goal_", "-_", "yf", "_", ")_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "=_", "np_", "._", "max_", "(_", "[_", "0_", ",_", "sqr", "d\\u", "dist", "\\u", "to", "\\u", "goal_", "-_", "r", "\\u", "goal_", "**_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "probab", "ly", " ", "don", "'", "t", " ", "need", " ", "to", " ", "actual", "ly", " ", "compute", " ", "a", " ", "sqrt", " ", "here", " ", "if", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "helps", " ", "simulati", "on", " ", "speed", "._", "\\u\\u\\uNL\\u\\u\\u_", "temp_", "=_", "np_", "._", "sqrt_", "(_", "temp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "temp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", "(_", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calc", "\\u", "angle", "\\u", "to", "\\u", "goal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "porte", "d", " ", "from", " ", "Ran", "dlo", "v", "'", "s", " ", "C", " ", "code", ".", " ", "See", " ", "bike", ".", "c", " ", "for", " ", "the", " ", "source_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "code", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "follow", "ing", " ", "expl", "anat", "ion", " ", "of", " ", "the", " ", "return", "ed", " ", "angle", " ", "is", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verba", "tim", " ", "from", " ", "Ran", "dlo", "v", "'", "s", " ", "C", " ", "source", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "angle", "s", " ", "are", " ", "nei", "ther", " ", "in", " ", "degr", "ees", " ", "nor", " ", "radian", "s", ",", " ", "but", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "somet", "hing", " ", "stran", "ge", " ", "inven", "ted", " ", "in", " ", "order", " ", "to", " ", "save", " ", "CPU", "-", "time", ".", " ", "The", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "measure", " ", "is", " ", "arrange", "d", " ", "same", " ", "way", " ", "as", " ", "radian", "s", ",", " ", "but", " ", "with", " ", "a", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "slight", "ly", " ", "different", " ", "negati", "ve", " ", "factor_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Say", " ", "the", " ", "goal", " ", "is", " ", "to", " ", "the", " ", "east", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "agent", " ", "ride", "s", " ", "to", " ", "the", " ", "east", " ", "then", " ", "temp", " ", "=", " ", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"", " ", "\"", " ", " ", " ", " ", " ", "north", " ", " ", " ", " ", "\"", " ", "\"", " ", " ", " ", "=", " ", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"", " ", "\"", " ", " ", " ", " ", " ", "west", " ", "\"", " ", "\"", " ", " ", " ", "=", " ", "-", "2", " ", "or", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"", " ", "\"", " ", " ", " ", " ", " ", "south", " ", " ", " ", " ", "\"", " ", "\"", " ", " ", " ", "=", " ", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "//", " ", "end", " ", "quote", " ", "//", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "see", " ", "the", " ", "psi", " ", "calculati", "on", " ", "in", " ", "the", " ", "environ", "ment", ",", " ", "whi", "ch", " ", "is", " ", "not", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "currentl", "y", " ", "bei", "ng", " ", "used", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unpack", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "goal_", "=_", "self_", "._", "x", "\\u", "goal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "goal_", "=_", "self_", "._", "y", "\\u", "goal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xf_", "=_", "self_", "._", "env_", "._", "get", "XF", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xb_", "=_", "self_", "._", "env_", "._", "get", "XB", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yf", "_", "=_", "self_", "._", "env_", "._", "get", "YF", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yb", "_", "=_", "self_", "._", "env_", "._", "get", "YB", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "implement", " ", "Ran", "dlo", "v", "'", "s", " ", "angle", " ", "computation", "_", "\\u\\u\\uNL\\u\\u\\u_", "temp_", "=_", "(_", "xf_", "-_", "xb_", ")_", "*_", "(_", "x", "\\u", "goal_", "-_", "xf_", ")_", "+_", "(_", "yf", "_", "-_", "yb", "_", ")_", "*_", "(_", "y", "\\u", "goal_", "-_", "yf", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scalar_", "=_", "temp_", "/_", "(_", "1_", "*_", "np_", "._", "sqrt_", "(_", "(_", "x", "\\u", "goal_", "-_", "xf_", ")_", "**_", "2_", "+_", "(_", "y", "\\u", "goal_", "-_", "yf", "_", ")_", "**_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tva", "er_", "=_", "(_", "-_", "yf", "_", "+_", "yb", "_", ")_", "*_", "(_", "x", "\\u", "goal_", "-_", "xf_", ")_", "+_", "(_", "xf_", "-_", "xb_", ")_", "*_", "(_", "y", "\\u", "goal_", "-_", "yf", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tva", "er_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "scalar_", "-_", "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 ", " _", "temp_", "=_", "np_", "._", "abs_", "(_", "scalar_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "temp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Prop", "ortion", "al", "3456", "Control", "Balance", "Task_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Prop", "ortion", "al", "3456", "Control", "Balance", "Task_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "Reward", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-1", " ", "reward", " ", "for", " ", "falling", " ", "over", ";", " ", "no", " ", "reward", " ", "other", "wis", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", ">_", "self_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "-_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Sensors", "_", "(_", ")_", "[_", "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_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task", "Reward", "1_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "2.7", "182", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task", "Reward", "1_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Reward", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\\u", "factor_", "=_", "0.0001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Prev", "Til", "t_", "=_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "Temp", "Til", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", ">_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "-_", "15.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_", "x_", "<_", "1.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "1.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", "<=_", "x_", "and_", "x_", "<=_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", "<=_", "x_", "and_", "x_", "<=_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "-_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Prev", "Til", "t_", ">_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "+=_", "3000", ".0_", "*_", "(_", "Prev", "Til", "t_", "-_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Prev", "Til", "t_", ">_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "*=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Prev", "Til", "t_", "<_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "+=_", "3000", ".0_", "*_", "(_", "Prev", "Til", "t_", "-_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp_", "=_", "self_", "._", "calc", "\\u", "dist", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heading_", "=_", "self_", "._", "calc", "\\u", "angle", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "temp_", "<_", "1e-3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "*=_", "10.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 ", " _", "R_", "-=_", "3000_", "*_", "np_", "._", "abs_", "(_", "heading_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task", "Reward", "2_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "2.7", "182", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task", "Reward", "2_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Reward", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\\u", "factor_", "=_", "0.0001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Prev", "Til", "t_", "=_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "Temp", "Til", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", ">_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "-_", "15.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_", "x_", "<_", "1.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "1.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", "<=_", "x_", "and_", "x_", "<=_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", "<=_", "x_", "and_", "x_", "<=_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "-_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Prev", "Til", "t_", ">_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "+=_", "3000", ".0_", "*_", "(_", "Prev", "Til", "t_", "-_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Prev", "Til", "t_", ">_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "*=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Prev", "Til", "t_", "<_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "+=_", "3000", ".0_", "*_", "(_", "Prev", "Til", "t_", "-_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp_", "=_", "self_", "._", "calc", "\\u", "dist", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heading_", "=_", "self_", "._", "calc", "\\u", "angle", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "temp_", "<_", "1e-3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "*=_", "10.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 ", " _", "R_", "-=_", "200_", "*_", "np_", "._", "abs_", "(_", "heading_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task", "Reward", "3_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "2.7", "182", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task", "Reward", "3_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Reward", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "self_", "._", "calc", "\\u", "dist", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heading_", "=_", "self_", "._", "calc", "\\u", "angle", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Prev", "Til", "t_", "=_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "Temp", "Til", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", ">_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "-_", "15.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_", "x_", "<_", "1.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "1.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", "<=_", "x_", "and_", "x_", "<=_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", "<=_", "x_", "and_", "x_", "<=_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "-_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Prev", "Til", "t_", ">_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "+=_", "3000", ".0_", "*_", "(_", "(_", "Prev", "Til", "t_", "-_", "x_", ")_", "-_", "np_", "._", "abs_", "(_", "heading_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Prev", "Til", "t_", ">_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "*=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Prev", "Til", "t_", "<_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "+=_", "3000", ".0_", "*_", "(_", "Prev", "Til", "t_", "-_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "temp_", "<_", "1e-3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "*=_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "R", " ", "-=", " ", "200", "*", "np", ".", "abs", "(", "heading", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task", "Reward", "4_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "2.7", "182", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task", "Reward", "4_", "(_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Go", "To", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Reward", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "self_", "._", "calc", "\\u", "dist", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heading_", "=_", "self_", "._", "calc", "\\u", "angle", "\\u", "to", "\\u", "goal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "get", "Til", "t_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Prev", "Til", "t_", "=_", "np_", "._", "abs_", "(_", "self_", "._", "env_", "._", "Temp", "Til", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", ">_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "-_", "15.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_", "x_", "<_", "1.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "1.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", "<=_", "x_", "and_", "x_", "<=_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", "<=_", "x_", "and_", "x_", "<=_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "-_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Prev", "Til", "t_", ">_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "+=_", "3000", ".0_", "*_", "(_", "(_", "Prev", "Til", "t_", "-_", "x_", ")_", "-_", "1.0_", "/_", "10_", "*_", "np_", "._", "abs_", "(_", "heading_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Prev", "Til", "t_", ">_", "2.0_", "/_", "3_", "*_", "Linea", "r", "FA", "Til", "e", "Codi", "ng", "3456", "Balance", "Task_", "._", "max", "\\u", "tilt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "*=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Prev", "Til", "t_", "<_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "+=_", "3000", ".0_", "*_", "(_", "Prev", "Til", "t_", "-_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "temp_", "<_", "1e-3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "*=_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "R_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
byashimov/django-controlcenter/controlcenter/utils.py
[ { "content": "# coding: utf-8\n\nimport collections\n\nfrom django.utils.text import camel_case_to_spaces, capfirst\n\n__all__ = ['captitle', 'deepmerge']\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def captitle(title):\n return capfirst(camel_case_to_spaces(title))", "metadata": "root.captitle", "header": "['module', '___EOS___']", "index": 9 }, { "content": "def deepmerge(*dicts):\n merged = {}\n for dct in dicts:\n for key, value in dct.items():\n if not isinstance(value, dict):\n merged[key] = value\n else:\n origin = merged.get(key, {})\n merged[key] = deepmerge(origin, value)\n return merged", "metadata": "root.deepmerge", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def indexonly(obj):\n # Checks if given object is a sequence but not a namedtuple\n # If your custom class instance passed this, then why did you do that?\n return (isinstance(obj, collections.Sequence) and not\n hasattr(obj, '_make') and not hasattr(obj, '_replace'))", "metadata": "root.indexonly", "header": "['module', '___EOS___']", "index": 25 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "text_", "import_", "camel", "\\u", "case", "\\u", "to", "\\u", "spaces_", ",_", "cap", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "capt", "itle", "'_", ",_", "'", "deep", "merge", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "capt", "itle_", "(_", "title_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cap", "first_", "(_", "camel", "\\u", "case", "\\u", "to", "\\u", "spaces_", "(_", "title_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deep", "merge_", "(_", "*_", "dicts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "merged_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dct_", "in_", "dicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "dct_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "merged_", "[_", "key_", "]_", "=_", "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 ", " _", "origin_", "=_", "merged_", "._", "get_", "(_", "key_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merged_", "[_", "key_", "]_", "=_", "deep", "merge_", "(_", "origin_", ",_", "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_", "return_", "merged_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "index", "only_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", "s", " ", "if", " ", "give", "n", " ", "object", " ", "is", " ", "a", " ", "sequence", " ", "but", " ", "not", " ", "a", " ", "namedtuple_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "custom", " ", "class", " ", "instance", " ", "pass", "ed", " ", "this", ",", " ", "then", " ", "wh", "y", " ", "did", " ", "you", " ", "do", " ", "tha", "t", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "isinstance_", "(_", "obj_", ",_", "collections_", "._", "Sequence_", ")_", "and_", "not_", "\\u\\u\\uNL\\u\\u\\u_", "hasattr_", "(_", "obj_", ",_", "'\\u", "make", "'_", ")_", "and_", "not_", "hasattr_", "(_", "obj_", ",_", "'\\u", "replace", "'_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
zynga/jasy/jasy/test/js/meta.py
[ { "content": "#!/usr/bin/env python3\n\nimport sys, os, unittest, logging\n\n# Extend PYTHONPATH with local 'lib' folder\nif __name__ == \"__main__\":\n jasyroot = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir, os.pardir, os.pardir))\n sys.path.insert(0, jasyroot)\n print(\"Running from %s...\" % jasyroot)\n\nimport jasy.js.parse.Parser as Parser\nfrom jasy.js.MetaData import MetaData\n\n \n\n\n\nif __name__ == '__main__':\n logging.getLogger().setLevel(logging.ERROR)\n suite = unittest.TestLoader().loadTestsFromTestCase(Tests)\n unittest.TextTestRunner(verbosity=2).run(suite)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Tests(unittest.TestCase):\n\n \n \n \n \n \n \n\n\n \n \n \n \n \n ", "metadata": "root.Tests", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def process(self, code):\n tree = Parser.parse(code)\n meta = MetaData(tree)\n return meta", "metadata": "root.Tests.process", "header": "['class', 'Tests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_other(self):\n \n meta = self.process('''\n \n /**\n * Hello World\n *\n * #deprecated #public #use(future) #use(current)\n */\n \n ''')\n \n self.assertIsInstance(meta, MetaData)\n self.assertEqual(meta.name, None)\n self.assertIsInstance(meta.requires, set)\n self.assertIsInstance(meta.optionals, set)\n self.assertIsInstance(meta.breaks, set)\n self.assertIsInstance(meta.assets, set)\n self.assertEqual(len(meta.requires), 0)\n self.assertEqual(len(meta.optionals), 0)\n self.assertEqual(len(meta.breaks), 0)\n self.assertEqual(len(meta.assets), 0)", "metadata": "root.Tests.test_other", "header": "['class', 'Tests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_name(self):\n\n meta = self.process('''\n\n /**\n * Hello World\n *\n * #name(my.main.Class)\n */\n\n ''')\n\n self.assertIsInstance(meta, MetaData)\n self.assertEqual(meta.name, \"my.main.Class\")\n self.assertIsInstance(meta.requires, set)\n self.assertIsInstance(meta.optionals, set)\n self.assertIsInstance(meta.breaks, set)\n self.assertIsInstance(meta.assets, set)\n self.assertEqual(len(meta.requires), 0)\n self.assertEqual(len(meta.optionals), 0)\n self.assertEqual(len(meta.breaks), 0)\n self.assertEqual(len(meta.assets), 0)", "metadata": "root.Tests.test_name", "header": "['class', 'Tests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def test_classes(self):\n\n meta = self.process('''\n\n /**\n * Hello World\n *\n * #require(my.other.Class)\n * #optional(no.dep.to.Class)\n * #break(depedency.to.Class)\n */\n\n ''')\n\n self.assertIsInstance(meta, MetaData)\n self.assertEqual(meta.name, None)\n self.assertIsInstance(meta.requires, set)\n self.assertIsInstance(meta.optionals, set)\n self.assertIsInstance(meta.breaks, set)\n self.assertIsInstance(meta.assets, set)\n self.assertEqual(len(meta.requires), 1)\n self.assertEqual(len(meta.optionals), 1)\n self.assertEqual(len(meta.breaks), 1)\n self.assertEqual(len(meta.assets), 0)\n self.assertEqual(meta.requires, set([\"my.other.Class\"]))\n self.assertEqual(meta.breaks, set([\"depedency.to.Class\"]))\n self.assertEqual(meta.optionals, set([\"no.dep.to.Class\"]))", "metadata": "root.Tests.test_classes", "header": "['class', 'Tests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_assets(self):\n\n meta = self.process('''\n\n /**\n * Hello World\n *\n * #asset(projectx/*)\n * #asset(projectx/some/local/url.png)\n * #asset(icons/*post/home.png)\n */\n\n ''')\n\n self.assertIsInstance(meta, MetaData)\n self.assertEqual(meta.name, None)\n self.assertIsInstance(meta.requires, set)\n self.assertIsInstance(meta.optionals, set)\n self.assertIsInstance(meta.breaks, set)\n self.assertIsInstance(meta.assets, set)\n self.assertEqual(len(meta.requires), 0)\n self.assertEqual(len(meta.optionals), 0)\n self.assertEqual(len(meta.breaks), 0)\n self.assertEqual(len(meta.assets), 3)\n self.assertEqual(meta.assets, set([\"projectx/*\", \"projectx/some/local/url.png\", \"icons/*post/home.png\"]))", "metadata": "root.Tests.test_assets", "header": "['class', 'Tests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 99 }, { "content": " def test_asset_escape(self):\n\n meta = self.process('''\n\n /**\n * Hello World\n *\n * #asset(icons/*\\/home.png)\n */\n\n ''')\n\n self.assertIsInstance(meta, MetaData)\n \n # Test unescaping\n self.assertEqual(meta.assets, set([\"icons/*/home.png\"]))", "metadata": "root.Tests.test_asset_escape", "header": "['class', 'Tests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 127 }, { "content": " def test_structured(self):\n\n meta = self.process('''\n\n (function(global) {\n \n global.my.Class = function() {\n \n /**\n * #asset(projectx/some/local/url.png)\n */\n var uri = core.io.Asset.toUri(\"projectx/some/local/url.png\");\n \n };\n \n })(this);\n\n ''')\n\n self.assertIsInstance(meta, MetaData)\n self.assertEqual(meta.assets, set([\"projectx/some/local/url.png\"])) ", "metadata": "root.Tests.test_structured", "header": "['class', 'Tests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 146 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", ",_", "unittest_", ",_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Extend", " ", "PYTHON", "PATH", " ", "with", " ", "local", " ", "'", "lib", "'", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jas", "yro", "ot_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", ",_", "os_", "._", "pardir_", ",_", "os_", "._", "pardir_", ",_", "os_", "._", "pardir_", ",_", "os_", "._", "pardir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "jas", "yro", "ot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "from", " ", "%", "s", "...\"_", "%_", "jas", "yro", "ot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "jas", "y_", "._", "js_", "._", "parse_", "._", "Parser_", "as_", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "jas", "y_", "._", "js_", "._", "Meta", "Data_", "import_", "Meta", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "set", "Level_", "(_", "logging_", "._", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "=_", "unittest_", "._", "Test", "Loader_", "(_", ")_", "._", "load", "Test", "s", "Fro", "m", "Test", "Case_", "(_", "Tests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unittest_", "._", "Text", "Test", "Runner_", "(_", "verbosity_", "=_", "2_", ")_", "._", "run_", "(_", "suite_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "process_", "(_", "self_", ",_", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tree_", "=_", "Parser_", "._", "parse_", "(_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "Meta", "Data_", "(_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "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", "other_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "self_", "._", "process_", "(_", "'''", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "/**", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "Hell", "o", " ", "Wor", "ld", "\\", "10", ";", " ", " ", " ", " ", " ", "*", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "#", "depre", "cated", " ", "#", "public", " ", "#", "use", "(", "future", ")", " ", "#", "use", "(", "current", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", ",_", "Meta", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "meta_", "._", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "requires_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "option", "als_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "breaks_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "assets_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "requires_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "option", "als_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "breaks_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "assets_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "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", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "self_", "._", "process_", "(_", "'''", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/**", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "Hell", "o", " ", "Wor", "ld", "\\", "10", ";", " ", " ", " ", " ", " ", "*", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "#", "name", "(", "my", ".", "main", ".", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*/", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", ",_", "Meta", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "meta_", "._", "name_", ",_", "\"", "my", ".", "main", ".", "Class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "requires_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "option", "als_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "breaks_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "assets_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "requires_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "option", "als_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "breaks_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "assets_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "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", "classes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "self_", "._", "process_", "(_", "'''", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/**", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "Hell", "o", " ", "Wor", "ld", "\\", "10", ";", " ", " ", " ", " ", " ", "*", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "#", "require", "(", "my", ".", "other", ".", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "#", "option", "al", "(", "no", ".", "dep", ".", "to", ".", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "#", "break", "(", "dep", "eden", "cy", ".", "to", ".", "Class", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*/", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", ",_", "Meta", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "meta_", "._", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "requires_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "option", "als_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "breaks_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "assets_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "requires_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "option", "als_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "breaks_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "assets_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "meta_", "._", "requires_", ",_", "set_", "(_", "[_", "\"", "my", ".", "other", ".", "Class", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "meta_", "._", "breaks_", ",_", "set_", "(_", "[_", "\"", "dep", "eden", "cy", ".", "to", ".", "Class", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "meta_", "._", "option", "als_", ",_", "set_", "(_", "[_", "\"", "no", ".", "dep", ".", "to", ".", "Class", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "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", "assets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "self_", "._", "process_", "(_", "'''", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/**", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "Hell", "o", " ", "Wor", "ld", "\\", "10", ";", " ", " ", " ", " ", " ", "*", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "#", "asset", "(", "project", "x", "/*", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "#", "asset", "(", "project", "x", "/", "some", "/", "local", "/", "url", ".", "png", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "#", "asset", "(", "icons", "/*", "post", "/", "home", ".", "png", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*/", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", ",_", "Meta", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "meta_", "._", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "requires_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "option", "als_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "breaks_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", "._", "assets_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "requires_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "option", "als_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "breaks_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "meta_", "._", "assets_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "meta_", "._", "assets_", ",_", "set_", "(_", "[_", "\"", "project", "x", "/*\"_", ",_", "\"", "project", "x", "/", "some", "/", "local", "/", "url", ".", "png", "\"_", ",_", "\"", "icons", "/*", "post", "/", "home", ".", "png", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "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", "asset", "\\u", "escape_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "self_", "._", "process_", "(_", "'''", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "/**", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "Hell", "o", " ", "Wor", "ld", "\\", "10", ";", " ", " ", " ", " ", " ", "*", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "#", "asset", "(", "icons", "/*", "\\\\/", "home", ".", "png", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*/", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", ",_", "Meta", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "une", "scap", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "meta_", "._", "assets_", ",_", "set_", "(_", "[_", "\"", "icons", "/*", "/", "home", ".", "png", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "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", "structure", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "self_", "._", "process_", "(_", "'''", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "function", "(", "global", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", "global", ".", "my", ".", "Class", " ", "=", " ", "function", "()", " ", "{", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "/**", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "#", "asset", "(", "project", "x", "/", "some", "/", "local", "/", "url", ".", "png", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "var", " ", "uri", " ", "=", " ", "core", ".", "io", ".", "Asset", ".", "to", "Ur", "i", "(\"", "project", "x", "/", "some", "/", "local", "/", "url", ".", "png", "\");", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "})(", "this", ");", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "meta_", ",_", "Meta", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "meta_", "._", "assets_", ",_", "set_", "(_", "[_", "\"", "project", "x", "/", "some", "/", "local", "/", "url", ".", "png", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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_feature='winner',\n exclude_ties=True, duplicate_with_reversed=True,\n recent_years=2):\n if input_features is None:\n input_features = (\n 'year',\n 'years_played_all_time_1',\n 'years_played_all_time_2',\n 'matches_played_all_time_1',\n 'matches_played_all_time_2',\n 'matches_played_recent_1',\n 'matches_played_recent_2',\n 'matches_won_recent_1',\n 'matches_won_recent_2',\n 'matches_won_all_time_1',\n 'matches_won_all_time_2',\n 'matches_won_percent_recent_1',\n 'matches_won_percent_recent_2',\n 'matches_won_percent_all_time_1',\n 'matches_won_percent_all_time_2',\n )\n\n self.input_features = input_features\n self.output_feature = output_feature\n self.exclude_ties = exclude_ties\n self.duplicate_with_reversed = duplicate_with_reversed\n\n self.recent_years = recent_years", "metadata": "root.CrystalBall.__init__", "header": "['class', 'CrystalBall', '(', 'object', ')', ':', '___EOS___']", "index": 33 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Cry", "stal", "Ball", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "input", "\\u", "features_", "=_", "None_", ",_", "output", "\\u", "feature_", "=_", "'", "winner", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "ties_", "=_", "True_", ",_", "duplicat", "e\\u", "with", "\\u", "reversed_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recent", "\\u", "years_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "input", "\\u", "features_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "features_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "s", "\\u", "played", "\\u", "all", "\\u", "time", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "s", "\\u", "played", "\\u", "all", "\\u", "time", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "played", "\\u", "all", "\\u", "time", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "played", "\\u", "all", "\\u", "time", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "played", "\\u", "recent", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "played", "\\u", "recent", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "won", "\\u", "recent", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "won", "\\u", "recent", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "won", "\\u", "all", "\\u", "time", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "won", "\\u", "all", "\\u", "time", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "won", "\\u", "percent", "\\u", "recent", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "won", "\\u", "percent", "\\u", "recent", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "won", "\\u", "percent", "\\u", "all", "\\u", "time", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "s", "\\u", "won", "\\u", "percent", "\\u", "all", "\\u", "time", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "input", "\\u", "features_", "=_", "input", "\\u", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "output", "\\u", "feature_", "=_", "output", "\\u", "feature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exclu", "de", "\\u", "ties_", "=_", "exclu", "de", "\\u", "ties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "duplicat", "e\\u", "with", "\\u", "reversed_", "=_", "duplicat", "e\\u", "with", "\\u", "reversed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "recent", "\\u", "years_", "=_", "recent", "\\u", "years_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
bread-and-pepper/django-userena/demo/manage.py
[ { "content": "#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n cwd = os.path.dirname(__file__)\n sys.path.append(os.path.join(os.path.abspath(os.path.dirname(cwd)), '../'))\n\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"demo.settings\")\n\n from django.core.management import execute_from_command_line\n\n execute_from_command_line(sys.argv)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cwd_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "cwd_", ")_", ")_", ",_", "'../", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "setdefault_", "(_", "\"", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "\"_", ",_", "\"", "demo", ".", "settings", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "import_", "execute", "\\u", "from", "\\u", "command", "\\u", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "execute", "\\u", "from", "\\u", "command", "\\u", "line_", "(_", "sys_", "._", "argv_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison of constants
softlayer/jumpgate/jumpgate/compute/drivers/sl/servers.py
[ { "content": " def on_post(self, req, resp, tenant_id, instance_id):\n body = json.loads(req.stream.read().decode())\n\n if len(body) == 0:\n return error_handling.bad_request(resp,\n message=\"Malformed request body\")\n\n vg_client = req.env['sl_client']['Virtual_Guest']\n cci = SoftLayer.CCIManager(req.env['sl_client'])\n\n try:\n instance_id = int(instance_id)\n except Exception:\n return error_handling.not_found(resp,\n \"Invalid instance ID specified.\")\n\n instance = cci.get_instance(instance_id)\n\n if 'pause' in body or 'suspend' in body:\n try:\n vg_client.pause(id=instance_id)\n except SoftLayer.SoftLayerAPIError as e:\n if 'Unable to pause instance' in e.faultString:\n return error_handling.duplicate(resp, e.faultString)\n raise\n resp.status = 202\n return\n elif 'unpause' in body or 'resume' in body:\n vg_client.resume(id=instance_id)\n resp.status = 202\n return\n elif 'reboot' in body:\n if body['reboot'].get('type') == 'SOFT':\n vg_client.rebootSoft(id=instance_id)\n elif body['reboot'].get('type') == 'HARD':\n vg_client.rebootHard(id=instance_id)\n else:\n vg_client.rebootDefault(id=instance_id)\n resp.status = 202\n return\n elif 'os-stop' in body:\n vg_client.powerOff(id=instance_id)\n resp.status = 202\n return\n elif 'os-start' in body:\n vg_client.powerOn(id=instance_id)\n resp.status = 202\n return\n elif 'createImage' in body:\n image_name = body['createImage']['name']\n disks = []\n\n for disk in filter(lambda x: x['device'] == '0',\n instance['blockDevices']):\n disks.append(disk)\n\n try:\n vg_client.createArchiveTransaction(\n image_name,\n disks,\n \"Auto-created by OpenStack compatibility layer\",\n id=instance_id,\n )\n # Workaround for not having an image guid until the image is\n # fully created. TODO(nbeitenmiller): Fix this\n cci.wait_for_transaction(instance_id, 300)\n _filter = {\n 'privateBlockDeviceTemplateGroups': {\n 'name': {'operation': image_name},\n 'createDate': {\n 'operation': 'orderBy',\n 'options': [{'name': 'sort', 'value': ['DESC']}],\n }\n }}\n\n acct = req.env['sl_client']['Account']\n matching_image = acct.getPrivateBlockDeviceTemplateGroups(\n mask='id, globalIdentifier', filter=_filter, limit=1)\n image_guid = matching_image.get('globalIdentifier')\n\n url = self.app.get_endpoint_url('image', req, 'v2_image',\n image_guid=image_guid)\n\n resp.status = 202\n resp.set_header('location', url)\n except SoftLayer.SoftLayerAPIError as e:\n error_handling.compute_fault(resp, e.faultString)\n return\n elif 'os-getConsoleOutput' in body:\n resp.status = 501\n return\n elif 'resize' in body:\n flavor_id = int(body['resize'].get('flavorRef'))\n for flavor in self.flavors:\n if str(flavor_id) == flavor['id']:\n vg_client.setTags('{\"flavor_id\": ' + str(flavor_id) + '}',\n id=instance_id)\n cci.upgrade(instance_id, cpus=flavor['cpus'],\n memory=flavor['ram'] / 1024)\n resp.status = 202\n return\n return error_handling.bad_request(resp, message=\"Invalid flavor \"\n \"id in the request body\")\n elif 'confirmResize' in body:\n resp.status = 204\n return\n\n return error_handling.bad_request(\n resp,\n message=\"There is no such action: %s\" % list(body.keys()),\n code=400)", "metadata": "root.ServerActionV2.on_post", "header": "['class', 'ServerActionV2', '(', 'object', ')', ':', '___EOS___']", "index": 33 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Server", "Action", "V2_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "post_", "(_", "self_", ",_", "req_", ",_", "resp_", ",_", "tenan", "t", "\\u", "id_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "json_", "._", "loads_", "(_", "req_", "._", "stream_", "._", "read_", "(_", ")_", "._", "decode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "body_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "error", "\\u", "handling", "_", "._", "bad", "\\u", "request_", "(_", "resp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "\"", "Mal", "formed", " ", "request", " ", "body", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vg", "\\u", "client_", "=_", "req_", "._", "env_", "[_", "'", "sl", "\\u", "client", "'_", "]_", "[_", "'", "Virt", "ual", "\\u", "Gue", "st", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cci", "_", "=_", "Sof", "t", "Layer_", "._", "CC", "IM", "anager", "_", "(_", "req_", "._", "env_", "[_", "'", "sl", "\\u", "client", "'_", "]_", ")_", "\\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 ", " _", "instance", "\\u", "id_", "=_", "int_", "(_", "instance", "\\u", "id_", ")_", "\\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 ", " _", "return_", "error", "\\u", "handling", "_", "._", "not", "\\u", "found_", "(_", "resp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inva", "lid", " ", "instance", " ", "ID", " ", "specified", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "instance_", "=_", "cci", "_", "._", "get", "\\u", "instance_", "(_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "paus", "e", "'_", "in_", "body_", "or_", "'", "suspend", "'_", "in_", "body_", ":_", "\\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 ", " _", "vg", "\\u", "client_", "._", "pause_", "(_", "id_", "=_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sof", "t", "Layer_", "._", "Sof", "t", "Layer", "API", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "Una", "ble", " ", "to", " ", "paus", "e", " ", "instance", "'_", "in_", "e_", "._", "fault", "String_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "error", "\\u", "handling", "_", "._", "duplicate_", "(_", "resp_", ",_", "e_", "._", "fault", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "._", "status_", "=_", "202_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "unpa", "use", "'_", "in_", "body_", "or_", "'", "resum", "e", "'_", "in_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vg", "\\u", "client_", "._", "resume_", "(_", "id_", "=_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "status_", "=_", "202_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "rebo", "ot", "'_", "in_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "body_", "[_", "'", "rebo", "ot", "'_", "]_", "._", "get_", "(_", "'", "type", "'_", ")_", "==_", "'", "SOFT", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vg", "\\u", "client_", "._", "rebo", "ot", "Sof", "t_", "(_", "id_", "=_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "body_", "[_", "'", "rebo", "ot", "'_", "]_", "._", "get_", "(_", "'", "type", "'_", ")_", "==_", "'", "HARD", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vg", "\\u", "client_", "._", "rebo", "ot", "Hard", "_", "(_", "id_", "=_", "instance", "\\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 ", " _", "vg", "\\u", "client_", "._", "rebo", "ot", "Default_", "(_", "id_", "=_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "._", "status_", "=_", "202_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "os", "-", "stop", "'_", "in_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vg", "\\u", "client_", "._", "power", "Off_", "(_", "id_", "=_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "status_", "=_", "202_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "os", "-", "start", "'_", "in_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vg", "\\u", "client_", "._", "power", "On_", "(_", "id_", "=_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "status_", "=_", "202_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "create", "Image", "'_", "in_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "\\u", "name_", "=_", "body_", "[_", "'", "create", "Image", "'_", "]_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "disk_", "in_", "filter_", "(_", "lambda_", "x_", ":_", "x_", "[_", "'", "device", "'_", "]_", "==_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", "[_", "'", "block", "Dev", "ices", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "disks_", "._", "append_", "(_", "disk_", ")_", "\\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 ", " _", "vg", "\\u", "client_", "._", "create", "Archive", "Transaction_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Auto", "-", "created", " ", "by", " ", "Open", "Stack", " ", "compatibility", " ", "layer", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Work", "aro", "und", " ", "for", " ", "not", " ", "hav", "ing", " ", "an", " ", "image", " ", "guid", " ", "unti", "l", " ", "the", " ", "image", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "full", "y", " ", "created", ".", " ", "TOD", "O", "(", "nbe", "ite", "nmi", "ller", "):", " ", "Fix", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "cci", "_", "._", "wait", "\\u", "for", "\\u", "transaction_", "(_", "instance", "\\u", "id_", ",_", "300_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "filter_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "private", "Block", "Dev", "ice", "Templa", "te", "Group", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "{_", "'", "operati", "on", "'_", ":_", "image", "\\u", "name_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "create", "Date", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "operati", "on", "'_", ":_", "'", "order", "By", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "options", "'_", ":_", "[_", "{_", "'", "name", "'_", ":_", "'", "sort", "'_", ",_", "'", "value", "'_", ":_", "[_", "'", "DESC", "'_", "]_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "acct", "_", "=_", "req_", "._", "env_", "[_", "'", "sl", "\\u", "client", "'_", "]_", "[_", "'", "Account", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matchi", "ng", "\\u", "image_", "=_", "acct", "_", "._", "get", "Priva", "te", "Block", "Dev", "ice", "Templa", "te", "Groups_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mask_", "=_", "'", "id", ",", " ", "global", "Identifie", "r", "'_", ",_", "filter_", "=_", "\\u", "filter_", ",_", "limit_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "guid_", "=_", "matchi", "ng", "\\u", "image_", "._", "get_", "(_", "'", "global", "Identifie", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "self_", "._", "app_", "._", "get", "\\u", "endpoint", "\\u", "url_", "(_", "'", "image", "'_", ",_", "req_", ",_", "'", "v2", "\\u", "image", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "guid_", "=_", "image", "\\u", "guid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "._", "status_", "=_", "202_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "set\\u", "header_", "(_", "'", "location", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sof", "t", "Layer_", "._", "Sof", "t", "Layer", "API", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "handling", "_", "._", "compute", "\\u", "fault_", "(_", "resp_", ",_", "e_", "._", "fault", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "os", "-", "get", "Cons", "ole", "Output", "'_", "in_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "._", "status_", "=_", "501_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "resiz", "e", "'_", "in_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flavor", "\\u", "id_", "=_", "int_", "(_", "body_", "[_", "'", "resiz", "e", "'_", "]_", "._", "get_", "(_", "'", "flavor", "Ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "flavor_", "in_", "self_", "._", "flavors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "str_", "(_", "flavor", "\\u", "id_", ")_", "==_", "flavor_", "[_", "'", "id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "vg", "\\u", "client_", "._", "set", "Tags_", "(_", "'{", "\"", "flavor", "\\u", "id", "\":", " ", "'_", "+_", "str_", "(_", "flavor", "\\u", "id_", ")_", "+_", "'}'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cci", "_", "._", "upgrade_", "(_", "instance", "\\u", "id_", ",_", "cpus_", "=_", "flavor_", "[_", "'", "cpus", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory_", "=_", "flavor_", "[_", "'", "ram", "'_", "]_", "/_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "._", "status_", "=_", "202_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "error", "\\u", "handling", "_", "._", "bad", "\\u", "request_", "(_", "resp_", ",_", "message_", "=_", "\"", "Inva", "lid", " ", "flavor", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", " ", "in", " ", "the", " ", "request", " ", "body", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "confirm", "Resize", "'_", "in_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "._", "status_", "=_", "204_", "\\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_", "return_", "error", "\\u", "handling", "_", "._", "bad", "\\u", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "\"", "There", " ", "is", " ", "no", " ", "suc", "h", " ", "action", ":", " ", "%", "s", "\"_", "%_", "list_", "(_", "body_", "._", "keys_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "400_", ")_", "\\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,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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 ]
Module is imported with 'import' and 'import from'
fp7-ofelia/ocf/vt_manager/src/python/vt_manager/tests/provisioning/temp.py
[ { "content": "import os\nimport sys\nimport uuid, random \nfrom os.path import dirname, join\n\nPYTHON_DIR = join(dirname(__file__), '/opt/ofelia/vt_manager/src/python/')\n\n# This is needed because wsgi disallows using stdout\nsys.stdout = sys.stderr\n\nos.environ['DJANGO_SETTINGS_MODULE'] = 'vt_manager.settings'\n\nsys.path.insert(0,PYTHON_DIR)\n\n\nfrom vt_manager.models.VTServer import VTServer\nfrom vt_manager.communication.utils.XmlHelper import *\nfrom vt_manager.communication.XmlRpcClient import XmlRpcClient\n\nrspec = XmlHelper.parseXmlString(xmlFileToString('createVM.xml'))\n#rspec.query.provisioning.action[0].id=uuid.uuid4()\nrspec.query.provisioning.action[0].virtual_machine.uuid=uuid.uuid4()\nrspec.query.provisioning.action[0].virtual_machine.name=random.randint(0,1000)\n\nXmlRpcClient.callRPCMethodBasicAuth(\"https://192.168.254.193:8445/xmlrpc/plugin\",\"expedient\",\"expedient\",\"send\",\"https://expedient:[email protected]/vt_plugin/xmlrpc/vt_am/\",XmlHelper.craftXmlClass(rspec))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", ",_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "dirname_", ",_", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PYTHON", "\\u", "DIR_", "=_", "join_", "(_", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'/", "opt", "/", "of", "eli", "a", "/", "vt", "\\u", "manage", "r", "/", "src", "/", "python", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "need", "ed", " ", "bec", "aus", "e", " ", "wsgi", " ", "disallow", "s", " ", "usi", "ng", " ", "stdout_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "sys_", "._", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "'_", "]_", "=_", "'", "vt", "\\u", "manage", "r", ".", "settings", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "PYTHON", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "vt", "\\u", "manager_", "._", "models_", "._", "VT", "Server_", "import_", "VT", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vt", "\\u", "manager_", "._", "communication", "_", "._", "utils_", "._", "Xm", "l", "Helper_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vt", "\\u", "manager_", "._", "communication", "_", "._", "Xm", "l", "Rp", "c", "Client_", "import_", "Xm", "l", "Rp", "c", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rsp", "ec_", "=_", "Xm", "l", "Helper_", "._", "parse", "Xm", "l", "String_", "(_", "xml", "File", "To", "String_", "(_", "'", "create", "VM", ".", "xml", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "rsp", "ec", ".", "query", ".", "provision", "ing", ".", "action", "[", "0", "].", "id", "=", "uuid", ".", "uuid", "4", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "rsp", "ec_", "._", "query_", "._", "provision", "ing_", "._", "action_", "[_", "0_", "]_", "._", "virtual", "\\u", "machine_", "._", "uuid_", "=_", "uuid_", "._", "uuid4_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsp", "ec_", "._", "query_", "._", "provision", "ing_", "._", "action_", "[_", "0_", "]_", "._", "virtual", "\\u", "machine_", "._", "name_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Xm", "l", "Rp", "c", "Client_", "._", "call", "RP", "CM", "ethod", "Basic", "Auth_", "(_", "\"", "https", "://", "192", ".1", "68.", "254", ".1", "9", "3", ":", "844", "5", "/", "xmlrpc", "/", "plugin", "\"_", ",_", "\"", "expe", "die", "nt", "\"_", ",_", "\"", "expe", "die", "nt", "\"_", ",_", "\"", "send", "\"_", ",_", "\"", "https", "://", "expe", "die", "nt", ":", "expe", "die", "nt", "@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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
NervanaSystems/neon/examples/convnet-benchmarks/overfeat.py
[ { "content": "#!/usr/bin/env python\n# ----------------------------------------------------------------------------\n# Copyright 2015 Nervana Systems Inc.\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ----------------------------------------------------------------------------\n\"\"\"\nOverfeat Benchmark\nhttps://github.com/soumith/convnet-benchmarks\n\n./overfeat.py\n./overfeat.py -d f16\n\"\"\"\n\nfrom neon import NervanaObject\nfrom neon.util.argparser import NeonArgparser\nfrom neon.initializers import Gaussian\nfrom neon.layers import Conv, Pooling, GeneralizedCost, Affine\nfrom neon.optimizers import GradientDescentMomentum, MultiOptimizer, Schedule\nfrom neon.transforms import Rectlin, Softmax, CrossEntropyMulti\nfrom neon.models import Model\nfrom neon.data import ArrayIterator\nimport numpy as np\nparser = NeonArgparser(__doc__)\nargs = parser.parse_args()\n\nNervanaObject.be.enable_winograd = 4\n\n# setup data provider\nX_train = np.random.uniform(-1, 1, (128, 3*231*231))\ny_train = np.random.uniform(-1, 1, (128, 1000))\ntrain = ArrayIterator(X_train, y_train, nclass=1000, lshape=(3, 231, 231))\n\nlayers = [Conv((11, 11, 96), init=Gaussian(scale=0.01),\n activation=Rectlin(), padding=0, strides=4),\n Pooling(2, strides=2),\n Conv((5, 5, 256), init=Gaussian(scale=0.01), activation=Rectlin(), padding=0),\n Pooling(2, strides=2),\n Conv((3, 3, 512), init=Gaussian(scale=0.01), activation=Rectlin(), padding=1),\n Conv((3, 3, 1024), init=Gaussian(scale=0.01), activation=Rectlin(), padding=1),\n Conv((3, 3, 1024), init=Gaussian(scale=0.01), activation=Rectlin(), padding=1),\n Pooling(2, strides=2),\n Affine(nout=3072, init=Gaussian(scale=0.01), activation=Rectlin()),\n Affine(nout=4096, init=Gaussian(scale=0.01), activation=Rectlin()),\n Affine(nout=1000, init=Gaussian(scale=0.01), activation=Softmax())]\nmodel = Model(layers=layers)\n\nweight_sched = Schedule([22, 44, 65], (1/250.)**(1/3.))\nopt_gdm = GradientDescentMomentum(0.01, 0.0, wdecay=0.0005, schedule=weight_sched)\nopt = MultiOptimizer({'default': opt_gdm})\ncost = GeneralizedCost(costfunc=CrossEntropyMulti())\n\nmodel.benchmark(train, cost=cost, optimizer=opt, niterations=10, nskip=1)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "Ne", "rva", "na", " ", "System", "s", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Over", "feat", " ", "Benchmark", "\\", "10", ";", "https", "://", "git", "hub", ".", "com", "/", "sou", "mit", "h", "/", "conv", "net", "-", "benchmarks", "\\", "10", ";", "\\", "10", ";", "./", "over", "feat", ".", "py", "\\", "10", ";", "./", "over", "feat", ".", "py", " ", "-", "d", " ", "f1", "6", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "neon", "_", "import_", "Ne", "rva", "na", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neon", "_", "._", "util_", "._", "argparser_", "import_", "Neo", "n", "Arg", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neon", "_", "._", "initializers_", "import_", "Gaussian", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neon", "_", "._", "layers_", "import_", "Conv", "_", ",_", "Pooling", "_", ",_", "General", "ize", "d", "Cost_", ",_", "Affi", "ne_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neon", "_", "._", "optimizers_", "import_", "Grad", "ient", "Descen", "t", "Moment", "um_", ",_", "Multi", "Optimizer_", ",_", "Schedule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neon", "_", "._", "transforms_", "import_", "Rect", "lin_", ",_", "Softmax", "_", ",_", "Cross", "Entr", "opy", "Multi", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neon", "_", "._", "models_", "import_", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neon", "_", "._", "data_", "import_", "Array", "Iterator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "Neo", "n", "Arg", "parser_", "(_", "\\u\\u", "doc\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ne", "rva", "na", "Object_", "._", "be_", "._", "enable", "\\u", "win", "ogr", "ad_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "data", " ", "provider_", "\\u\\u\\uNL\\u\\u\\u_", "X", "\\u", "train_", "=_", "np_", "._", "random_", "._", "uniform_", "(_", "-_", "1_", ",_", "1_", ",_", "(_", "128_", ",_", "3_", "*_", "231_", "*_", "231_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "train_", "=_", "np_", "._", "random_", "._", "uniform_", "(_", "-_", "1_", ",_", "1_", ",_", "(_", "128_", ",_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train_", "=_", "Array", "Iterator_", "(_", "X", "\\u", "train_", ",_", "y", "\\u", "train_", ",_", "ncla", "ss_", "=_", "1000_", ",_", "lsh", "ape_", "=_", "(_", "3_", ",_", "231_", ",_", "231_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layers_", "=_", "[_", "Conv", "_", "(_", "(_", "11_", ",_", "11_", ",_", "96_", ")_", ",_", "init_", "=_", "Gaussian", "_", "(_", "scale_", "=_", "0.01_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "activation_", "=_", "Rect", "lin_", "(_", ")_", ",_", "padding_", "=_", "0_", ",_", "strides_", "=_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pooling", "_", "(_", "2_", ",_", "strides_", "=_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Conv", "_", "(_", "(_", "5_", ",_", "5_", ",_", "256_", ")_", ",_", "init_", "=_", "Gaussian", "_", "(_", "scale_", "=_", "0.01_", ")_", ",_", "activation_", "=_", "Rect", "lin_", "(_", ")_", ",_", "padding_", "=_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pooling", "_", "(_", "2_", ",_", "strides_", "=_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Conv", "_", "(_", "(_", "3_", ",_", "3_", ",_", "512_", ")_", ",_", "init_", "=_", "Gaussian", "_", "(_", "scale_", "=_", "0.01_", ")_", ",_", "activation_", "=_", "Rect", "lin_", "(_", ")_", ",_", "padding_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Conv", "_", "(_", "(_", "3_", ",_", "3_", ",_", "1024_", ")_", ",_", "init_", "=_", "Gaussian", "_", "(_", "scale_", "=_", "0.01_", ")_", ",_", "activation_", "=_", "Rect", "lin_", "(_", ")_", ",_", "padding_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Conv", "_", "(_", "(_", "3_", ",_", "3_", ",_", "1024_", ")_", ",_", "init_", "=_", "Gaussian", "_", "(_", "scale_", "=_", "0.01_", ")_", ",_", "activation_", "=_", "Rect", "lin_", "(_", ")_", ",_", "padding_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pooling", "_", "(_", "2_", ",_", "strides_", "=_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Affi", "ne_", "(_", "nou", "t_", "=_", "307", "2_", ",_", "init_", "=_", "Gaussian", "_", "(_", "scale_", "=_", "0.01_", ")_", ",_", "activation_", "=_", "Rect", "lin_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Affi", "ne_", "(_", "nou", "t_", "=_", "4096_", ",_", "init_", "=_", "Gaussian", "_", "(_", "scale_", "=_", "0.01_", ")_", ",_", "activation_", "=_", "Rect", "lin_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Affi", "ne_", "(_", "nou", "t_", "=_", "1000_", ",_", "init_", "=_", "Gaussian", "_", "(_", "scale_", "=_", "0.01_", ")_", ",_", "activation_", "=_", "Softmax", "_", "(_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Model_", "(_", "layers_", "=_", "layers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "sched_", "=_", "Schedule_", "(_", "[_", "22_", ",_", "44_", ",_", "65_", "]_", ",_", "(_", "1_", "/_", "250", "._", ")_", "**_", "(_", "1_", "/_", "3._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "\\u", "gd", "m_", "=_", "Grad", "ient", "Descen", "t", "Moment", "um_", "(_", "0.01_", ",_", "0.0_", ",_", "wd", "eca", "y_", "=_", "0.0005", "_", ",_", "schedule_", "=_", "weight", "\\u", "sched_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt_", "=_", "Multi", "Optimizer_", "(_", "{_", "'", "default", "'_", ":_", "opt", "\\u", "gd", "m_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cost_", "=_", "General", "ize", "d", "Cost_", "(_", "cost", "func_", "=_", "Cross", "Entr", "opy", "Multi", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "benchmark_", "(_", "train_", ",_", "cost_", "=_", "cost_", ",_", "optimizer_", "=_", "opt_", ",_", "nite", "ration", "s_", "=_", "10_", ",_", "ns", "kip", "_", "=_", "1_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
internetarchive/umbra/setup.py
[ { "content": "def full_version_bytes():\n import subprocess, time\n try:\n commit_bytes = subprocess.check_output(['git', 'log', '-1', '--pretty=format:%h'])\n t_bytes = subprocess.check_output(['git', 'log', '-1', '--pretty=format:%ct'])\n t = int(t_bytes.strip().decode('utf-8'))\n tm = time.gmtime(t)\n timestamp_utc = time.strftime(\"%Y%m%d%H%M%S\", time.gmtime(t))\n return VERSION_BYTES + b'-' + timestamp_utc.encode('utf-8') + b'-' + commit_bytes.strip()\n except subprocess.CalledProcessError:\n return VERSION_BYTES", "metadata": "root.full_version_bytes", "header": "['module', '___EOS___']", "index": 7 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "full", "\\u", "version", "\\u", "bytes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "subprocess_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "commit", "\\u", "bytes_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "'", "git", "'_", ",_", "'", "log", "'_", ",_", "'-", "1", "'_", ",_", "'--", "pretty", "=", "format", ":", "%", "h", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "bytes_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "'", "git", "'_", ",_", "'", "log", "'_", ",_", "'-", "1", "'_", ",_", "'--", "pretty", "=", "format", ":", "%", "ct", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "int_", "(_", "t", "\\u", "bytes_", "._", "strip_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tm_", "=_", "time_", "._", "gmtime_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamp", "\\u", "utc_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "%", "m", "%", "d", "%", "H", "%", "M", "%", "S", "\"_", ",_", "time_", "._", "gmtime_", "(_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "VERSI", "ON", "\\u", "BYTES_", "+_", "b", "'-'_", "+_", "timestamp", "\\u", "utc_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "+_", "b", "'-'_", "+_", "commit", "\\u", "bytes_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "subprocess_", "._", "Call", "ed", "Process", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "VERSI", "ON", "\\u", "BYTES_", "\\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 ]
Comparison of constants
SuperCowPowers/workbench/workbench/server/plugin_manager.py
[ { "content": " def add_plugin(self, f):\n \"\"\"Adding and verifying plugin.\n\n Args:\n f: the filepath for the plugin.\n \"\"\"\n if f.endswith('.py'):\n\n # Just the basename without extension\n plugin_name = os.path.splitext(os.path.basename(f))[0]\n\n # It's possible the plugin has been modified and needs to be reloaded\n if plugin_name in sys.modules:\n try:\n handler = reload(sys.modules[plugin_name])\n print'\\t- %s %sRELOAD%s' % (plugin_name, color.Yellow, color.Normal)\n except ImportError, error:\n print 'Failed to import plugin: %s (%s)' % (plugin_name, error)\n return\n else:\n # Not already loaded so try to import it\n try:\n handler = __import__(plugin_name, globals(), locals(), [], -1)\n except ImportError, error:\n print 'Failed to import plugin: %s (%s)' % (plugin_name, error)\n return\n\n # Run the handler through plugin validation\n plugin = self.validate(handler)\n print '\\t- %s %sOK%s' % (plugin_name, color.Green, color.Normal)\n if plugin:\n\n # Okay must be successfully loaded so capture the plugin meta-data,\n # modification time and register the plugin through the callback\n plugin['name'] = plugin_name\n plugin['dependencies'] = plugin['class'].dependencies\n plugin['docstring'] = plugin['class'].__doc__\n plugin['mod_time'] = datetime.utcfromtimestamp(os.path.getmtime(f))\n\n # Plugin may accept sample_sets as input\n try:\n plugin['sample_set_input'] = getattr(plugin['class'], 'sample_set_input')\n except AttributeError:\n plugin['sample_set_input'] = False\n\n # Now pass the plugin back to workbench\n self.plugin_callback(plugin)", "metadata": "root.PluginManager.add_plugin", "header": "['class', 'PluginManager', '(', 'object', ')', ':', '___EOS___']", "index": 89 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Plug", "in", "Manager_", "(_", "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_", "add", "\\u", "plugin_", "(_", "self_", ",_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "ing", " ", "and", " ", "verify", "ing", " ", "plugin", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "f", ":", " ", "the", " ", "filepath", " ", "for", " ", "the", " ", "plugin", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "._", "endswith_", "(_", "'.", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ju", "st", " ", "the", " ", "basen", "ame", " ", "with", "out", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plugin", "\\u", "name_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "f_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "possib", "le", " ", "the", " ", "plugin", " ", "has", " ", "bee", "n", " ", "modifi", "ed", " ", "and", " ", "need", "s", " ", "to", " ", "be", " ", "reloade", "d_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "plugin", "\\u", "name_", "in_", "sys_", "._", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handler_", "=_", "reload_", "(_", "sys_", "._", "modules_", "[_", "plugin", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "-", " ", "%", "s", " ", "%", "s", "REL", "OAD", "%", "s", "'_", "%_", "(_", "plugin", "\\u", "name_", ",_", "color_", "._", "Ye", "llow", "_", ",_", "color_", "._", "Normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "Fail", "ed", " ", "to", " ", "import", " ", "plugin", ":", " ", "%", "s", " ", "(%", "s", ")'_", "%_", "(_", "plugin", "\\u", "name_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "alr", "ead", "y", " ", "load", "ed", " ", "so", " ", "try", " ", "to", " ", "import", " ", "it_", "\\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 ", " ", "_", "handler_", "=_", "\\u\\u", "import\\u\\u_", "(_", "plugin", "\\u", "name_", ",_", "globals_", "(_", ")_", ",_", "locals_", "(_", ")_", ",_", "[_", "]_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "Fail", "ed", " ", "to", " ", "import", " ", "plugin", ":", " ", "%", "s", " ", "(%", "s", ")'_", "%_", "(_", "plugin", "\\u", "name_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "the", " ", "handler", " ", "through", " ", "plugin", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plugin_", "=_", "self_", "._", "validate_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "-", " ", "%", "s", " ", "%", "s", "OK", "%", "s", "'_", "%_", "(_", "plugin", "\\u", "name_", ",_", "color_", "._", "Green", "_", ",_", "color_", "._", "Normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ok", "ay", " ", "must", " ", "be", " ", "success", "full", "y", " ", "load", "ed", " ", "so", " ", "captur", "e", " ", "the", " ", "plugin", " ", "meta", "-", "data", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", " ", "time", " ", "and", " ", "register", " ", "the", " ", "plugin", " ", "through", " ", "the", " ", "callback_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plugin_", "[_", "'", "name", "'_", "]_", "=_", "plugin", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plugin_", "[_", "'", "dependen", "cies", "'_", "]_", "=_", "plugin_", "[_", "'", "class", "'_", "]_", "._", "dependencies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plugin_", "[_", "'", "docstr", "ing", "'_", "]_", "=_", "plugin_", "[_", "'", "class", "'_", "]_", "._", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plugin_", "[_", "'", "mod", "\\u", "time", "'_", "]_", "=_", "datetime_", "._", "utc", "fromtimestamp_", "(_", "os_", "._", "path_", "._", "getmtime_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Plug", "in", " ", "may", " ", "accept", " ", "sample", "\\u", "sets", " ", "as", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "plugin_", "[_", "'", "sample", "\\u", "set\\u", "input", "'_", "]_", "=_", "getattr_", "(_", "plugin_", "[_", "'", "class", "'_", "]_", ",_", "'", "sample", "\\u", "set\\u", "input", "'_", ")_", "\\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 ", " ", "_", "plugin_", "[_", "'", "sample", "\\u", "set\\u", "input", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "pass", " ", "the", " ", "plugin", " ", "back", " ", "to", " ", "work", "bench_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "plugin", "\\u", "callback_", "(_", "plugin_", ")_", "\\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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
nucleic/enaml/enaml/qt/qt_flow_item.py
[ { "content": "#------------------------------------------------------------------------------\n# Copyright (c) 2013, Nucleic Development Team.\n#\n# Distributed under the terms of the Modified BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#------------------------------------------------------------------------------\nfrom atom.api import Typed\n\nfrom enaml.widgets.flow_item import ProxyFlowItem\n\nfrom .QtCore import QSize, QEvent\nfrom .QtGui import QFrame, QLayout\n\nfrom .q_flow_layout import QFlowLayout, AbstractFlowWidget, FlowLayoutData\nfrom .q_single_widget_layout import QSingleWidgetLayout\nfrom .qt_container import QtContainer\nfrom .qt_widget import QtWidget\n\n\n_ALIGN_MAP = {\n 'leading': QFlowLayout.AlignLeading,\n 'trailing': QFlowLayout.AlignTrailing,\n 'center': QFlowLayout.AlignCenter,\n}\n\n\n\n\nAbstractFlowWidget.register(QFlowItem)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class QFlowItem(QFrame):\n \"\"\" A QFrame subclass which acts as an item in a QFlowArea.\n\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.QFlowItem", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def __init__(self, parent=None):\n \"\"\" Initialize a QFlowItem.\n\n Parameters\n ----------\n parent : QWidget, optional\n The parent of the flow item.\n\n \"\"\"\n super(QFlowItem, self).__init__(parent)\n self._flow_widget = None\n self._layout_data = FlowLayoutData()\n self.setLayout(QSingleWidgetLayout())\n self.layout().setSizeConstraint(QLayout.SetMinAndMaxSize)", "metadata": "root.QFlowItem.__init__", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 31 }, { "content": " def layoutData(self):\n \"\"\" Get the layout data associate with this flow item.\n\n This method implements the AbstractFlowWidget interface.\n\n Returns\n -------\n result : FlowLayoutData\n The layout data for this flow item.\n\n \"\"\"\n return self._layout_data", "metadata": "root.QFlowItem.layoutData", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 46 }, { "content": " def preferredSize(self):\n \"\"\" Get the preferred size for this widget.\n\n Returns\n -------\n result : QSize\n The preferred size of this flow item.\n\n \"\"\"\n return self._layout_data.preferred_size", "metadata": "root.QFlowItem.preferredSize", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 59 }, { "content": " def setPreferredSize(self, size):\n \"\"\" Set the preferred size for this flow item.\n\n This will trigger an invalidation of the layout data.\n\n Parameters\n ----------\n size : QSize\n The preferred size for the flow item.\n\n \"\"\"\n d = self._layout_data\n d.preferred_size = size\n d.dirty = True\n self.updateGeometry()", "metadata": "root.QFlowItem.setPreferredSize", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 70 }, { "content": " def alignment(self):\n \"\"\" Get the alignment for the flow item.\n\n Returns\n -------\n result : QFlowLayout alignment\n The alignment for the flow item in the layout.\n\n \"\"\"\n return self._layout_data.alignment", "metadata": "root.QFlowItem.alignment", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 86 }, { "content": " def setAlignment(self, alignment):\n \"\"\" Set the alignment for the flow item.\n\n This will trigger an invalidation of the layout data.\n\n Parameters\n ----------\n alignment : QFlowLayout alignment\n The alignment for the flow item in the layout.\n\n \"\"\"\n d = self._layout_data\n d.alignment = alignment\n d.dirty = True\n self.updateGeometry()", "metadata": "root.QFlowItem.setAlignment", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 97 }, { "content": " def stretch(self):\n \"\"\" Get the stretch factor for the flow item.\n\n Returns\n -------\n result : int\n The stretch factor for the flow item in the direction of\n the layout flow.\n\n \"\"\"\n return self._layout_data.stretch", "metadata": "root.QFlowItem.stretch", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 113 }, { "content": " def setStretch(self, stretch):\n \"\"\" Set the stretch factor for the flow item.\n\n This will trigger an invalidation of the layout data.\n\n Parameters\n ----------\n stretch : int\n The stretch factor for the flow item in the direction of\n the layout flow.\n\n \"\"\"\n d = self._layout_data\n d.stretch = stretch\n d.dirty = True\n self.updateGeometry()", "metadata": "root.QFlowItem.setStretch", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 125 }, { "content": " def orthoStretch(self):\n \"\"\" Get the ortho stretch factor for the flow item.\n\n Returns\n -------\n result : int\n The stretch factor for the flow item in the direction\n orthogonal to the layout flow.\n\n \"\"\"\n return self._layout_data.stretch", "metadata": "root.QFlowItem.orthoStretch", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 142 }, { "content": " def setOrthoStretch(self, stretch):\n \"\"\" Set the ortho stretch factor for the flow item.\n\n This will trigger an invalidation of the layout data.\n\n Parameters\n ----------\n stretch : int\n The stretch factor for the flow item in the direction\n orthogonal to the layout flow.\n\n \"\"\"\n d = self._layout_data\n d.ortho_stretch = stretch\n d.dirty = True\n self.updateGeometry()", "metadata": "root.QFlowItem.setOrthoStretch", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 154 }, { "content": " def flowWidget(self):\n \"\"\" Get the flow widget for this flow item.\n\n Returns\n -------\n result : QWidget or None\n The flow widget being managed by this item.\n\n \"\"\"\n return self._flow_widget", "metadata": "root.QFlowItem.flowWidget", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 171 }, { "content": " def setFlowWidget(self, widget):\n \"\"\" Set the flow widget for this flow item.\n\n Parameters\n ----------\n widget : QWidget\n The QWidget to use as the flow widget in this item.\n\n \"\"\"\n self._flow_widget = widget\n self.layout().setWidget(widget)", "metadata": "root.QFlowItem.setFlowWidget", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 182 }, { "content": " def event(self, event):\n \"\"\" A custom event handler which handles LayoutRequest events.\n\n When a LayoutRequest event is posted to this widget, it will\n emit the `layoutRequested` signal. This allows an external\n consumer of this widget to update their external layout.\n\n \"\"\"\n if event.type() == QEvent.LayoutRequest:\n self._layout_data.dirty = True\n return super(QFlowItem, self).event(event)", "metadata": "root.QFlowItem.event", "header": "['class', 'QFlowItem', '(', 'QFrame', ')', ':', '___EOS___']", "index": 194 }, { "content": "class QtFlowItem(QtWidget, ProxyFlowItem):\n \"\"\" A Qt implementation of an Enaml ProxyFlowItem.\n\n \"\"\"\n #: A reference to the widget created by the proxy.\n widget = Typed(QFlowItem)\n\n #--------------------------------------------------------------------------\n # Initialization API\n #--------------------------------------------------------------------------\n\n\n\n #--------------------------------------------------------------------------\n # Utility Methods\n #--------------------------------------------------------------------------\n\n #--------------------------------------------------------------------------\n # Child Events\n #--------------------------------------------------------------------------\n\n\n #--------------------------------------------------------------------------\n # ProxyFlowItem API\n #--------------------------------------------------------------------------\n\n\n", "metadata": "root.QtFlowItem", "header": "['module', '___EOS___']", "index": 210 }, { "content": " def create_widget(self):\n \"\"\" Create the underlying QFlowItem widget.\n\n \"\"\"\n self.widget = QFlowItem(self.parent_widget())", "metadata": "root.QtFlowItem.create_widget", "header": "['class', 'QtFlowItem', '(', 'QtWidget', ',', 'ProxyFlowItem', ')', ':', '___EOS___']", "index": 220 }, { "content": " def init_widget(self):\n \"\"\" Iitialize the underlying control.\n\n \"\"\"\n super(QtFlowItem, self).init_widget()\n d = self.declaration\n self.set_preferred_size(d.preferred_size)\n self.set_align(d.align)\n self.set_stretch(d.stretch)\n self.set_ortho_stretch(d.ortho_stretch)", "metadata": "root.QtFlowItem.init_widget", "header": "['class', 'QtFlowItem', '(', 'QtWidget', ',', 'ProxyFlowItem', ')', ':', '___EOS___']", "index": 226 }, { "content": " def init_layout(self):\n \"\"\" Initialize the layout for the underyling widget.\n\n \"\"\"\n super(QtFlowItem, self).init_layout()\n self.widget.setFlowWidget(self.flow_widget())", "metadata": "root.QtFlowItem.init_layout", "header": "['class', 'QtFlowItem', '(', 'QtWidget', ',', 'ProxyFlowItem', ')', ':', '___EOS___']", "index": 237 }, { "content": " def flow_widget(self):\n \"\"\" Find and return the flow widget child for this widget.\n\n Returns\n -------\n result : QWidget or None\n The flow widget defined for this widget, or None if one is\n not defined.\n\n \"\"\"\n d = self.declaration.flow_widget()\n if d is not None:\n return d.proxy.widget", "metadata": "root.QtFlowItem.flow_widget", "header": "['class', 'QtFlowItem', '(', 'QtWidget', ',', 'ProxyFlowItem', ')', ':', '___EOS___']", "index": 247 }, { "content": " def child_added(self, child):\n \"\"\" Handle the child added event for a QtFlowItem.\n\n \"\"\"\n super(QtFlowItem, self).child_added(child)\n if isinstance(child, QtContainer):\n self.widget.setFlowWidget(self.flow_widget())", "metadata": "root.QtFlowItem.child_added", "header": "['class', 'QtFlowItem', '(', 'QtWidget', ',', 'ProxyFlowItem', ')', ':', '___EOS___']", "index": 264 }, { "content": " def child_removed(self, child):\n \"\"\" Handle the child added event for a QtFlowItem.\n\n \"\"\"\n super(QtFlowItem, self).child_removed(child)\n if isinstance(child, QtContainer):\n self.widget.setFlowWidget(self.flow_widget())", "metadata": "root.QtFlowItem.child_removed", "header": "['class', 'QtFlowItem', '(', 'QtWidget', ',', 'ProxyFlowItem', ')', ':', '___EOS___']", "index": 272 }, { "content": " def set_preferred_size(self, size):\n \"\"\" Set the preferred size of the underlying widget.\n\n \"\"\"\n self.widget.setPreferredSize(QSize(*size))", "metadata": "root.QtFlowItem.set_preferred_size", "header": "['class', 'QtFlowItem', '(', 'QtWidget', ',', 'ProxyFlowItem', ')', ':', '___EOS___']", "index": 283 }, { "content": " def set_align(self, align):\n \"\"\" Set the alignment of the underlying widget.\n\n \"\"\"\n self.widget.setAlignment(_ALIGN_MAP[align])", "metadata": "root.QtFlowItem.set_align", "header": "['class', 'QtFlowItem', '(', 'QtWidget', ',', 'ProxyFlowItem', ')', ':', '___EOS___']", "index": 289 }, { "content": " def set_stretch(self, stretch):\n \"\"\" Set the stretch factor of the underlying widget.\n\n \"\"\"\n self.widget.setStretch(stretch)", "metadata": "root.QtFlowItem.set_stretch", "header": "['class', 'QtFlowItem', '(', 'QtWidget', ',', 'ProxyFlowItem', ')', ':', '___EOS___']", "index": 295 }, { "content": " def set_ortho_stretch(self, stretch):\n \"\"\" Set the ortho stretch factor of the underling widget.\n\n \"\"\"\n self.widget.setOrthoStretch(stretch)", "metadata": "root.QtFlowItem.set_ortho_stretch", "header": "['class', 'QtFlowItem', '(', 'QtWidget', ',', 'ProxyFlowItem', ')', ':', '___EOS___']", "index": 301 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", ",", " ", "Nucle", "ic", " ", "Dev", "elo", "pme", "nt", " ", "Tea", "m", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Distribut", "ed", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "Modifie", "d", " ", "BS", "D", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "license", " ", "is", " ", "in", " ", "the", " ", "file", " ", "COPY", "ING", ".", "txt", ",", " ", "distributed", " ", "with", " ", "this", " ", "software", "._", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "atom_", "._", "api_", "import_", "Type", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ena", "ml_", "._", "widgets_", "._", "flow", "\\u", "item_", "import_", "Pro", "xy", "Flow", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "Qt", "Core_", "import_", "QS", "ize_", ",_", "QE", "vent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "Qt", "Gui_", "import_", "QF", "rame_", ",_", "QL", "ayout", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "q", "\\u", "flow", "\\u", "layout_", "import_", "QF", "low", "Layout_", ",_", "Abstract", "Flow", "Widget_", ",_", "Flow", "Lay", "out", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "q", "\\u", "single", "\\u", "widget", "\\u", "layout_", "import_", "QS", "ingl", "e", "Wid", "get", "Layout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "qt", "\\u", "container_", "import_", "Qt", "Container_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "qt", "\\u", "widget_", "import_", "Qt", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "ALIGN", "\\u", "MAP_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lead", "ing", "'_", ":_", "QF", "low", "Layout_", "._", "Align", "Lead", "ing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trail", "ing", "'_", ":_", "QF", "low", "Layout_", "._", "Align", "Trailing", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "center", "'_", ":_", "QF", "low", "Layout_", "._", "Align", "Center_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Abstract", "Flow", "Widget_", "._", "register_", "(_", "QF", "low", "Item_", ")_", "\\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_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "QF", "rame", " ", "subclass", " ", "whi", "ch", " ", "acts", " ", "as", " ", "an", " ", "item", " ", "in", " ", "a", " ", "QF", "low", "Area", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Initializ", "e", " ", "a", " ", "QF", "low", "Item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "parent", " ", ":", " ", "QW", "idge", "t", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "parent", " ", "of", " ", "the", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "QF", "low", "Item_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flow", "\\u", "widget_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "layout", "\\u", "data_", "=_", "Flow", "Lay", "out", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Layout_", "(_", "QS", "ingl", "e", "Wid", "get", "Layout_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "layout_", "(_", ")_", "._", "set", "Size", "Constraint_", "(_", "QL", "ayout", "_", "._", "Set", "Min", "And", "Max", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "layout", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "layout", " ", "data", " ", "associate", " ", "with", " ", "this", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "implement", "s", " ", "the", " ", "Abstract", "Flow", "Wid", "get", " ", "interface", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "result", " ", ":", " ", "Flow", "Lay", "out", "Data", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "layout", " ", "data", " ", "for", " ", "this", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "layout", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prefer", "red", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "prefer", "red", " ", "size", " ", "for", " ", "this", " ", "widget", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "result", " ", ":", " ", "QS", "ize", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "prefer", "red", " ", "size", " ", "of", " ", "this", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "layout", "\\u", "data_", "._", "prefer", "red", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Prefe", "rre", "d", "Size_", "(_", "self_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", " ", "the", " ", "prefer", "red", " ", "size", " ", "for", " ", "this", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "trigger", " ", "an", " ", "invalid", "ation", " ", "of", " ", "the", " ", "layout", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "size", " ", ":", " ", "QS", "ize", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "prefer", "red", " ", "size", " ", "for", " ", "the", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "\\u", "layout", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "prefer", "red", "\\u", "size_", "=_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "Geometry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "alignment_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "alignme", "nt", " ", "for", " ", "the", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "result", " ", ":", " ", "QF", "low", "Lay", "out", " ", "alignme", "nt", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "alignme", "nt", " ", "for", " ", "the", " ", "flow", " ", "item", " ", "in", " ", "the", " ", "layout", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "layout", "\\u", "data_", "._", "alignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Alignment_", "(_", "self_", ",_", "alignment_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", " ", "the", " ", "alignme", "nt", " ", "for", " ", "the", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "trigger", " ", "an", " ", "invalid", "ation", " ", "of", " ", "the", " ", "layout", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "alignme", "nt", " ", ":", " ", "QF", "low", "Lay", "out", " ", "alignme", "nt", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "alignme", "nt", " ", "for", " ", "the", " ", "flow", " ", "item", " ", "in", " ", "the", " ", "layout", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "\\u", "layout", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "alignment_", "=_", "alignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "Geometry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stretch", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "stretch", " ", "factor", " ", "for", " ", "the", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "result", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "stretch", " ", "factor", " ", "for", " ", "the", " ", "flow", " ", "item", " ", "in", " ", "the", " ", "direction", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "layout", " ", "flow", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "layout", "\\u", "data_", "._", "stretch", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Stretch_", "(_", "self_", ",_", "stretch", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", " ", "the", " ", "stretch", " ", "factor", " ", "for", " ", "the", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "trigger", " ", "an", " ", "invalid", "ation", " ", "of", " ", "the", " ", "layout", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "stretch", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "stretch", " ", "factor", " ", "for", " ", "the", " ", "flow", " ", "item", " ", "in", " ", "the", " ", "direction", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "layout", " ", "flow", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "\\u", "layout", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "stretch", "_", "=_", "stretch", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "Geometry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ortho", "Stretch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "ortho", " ", "stretch", " ", "factor", " ", "for", " ", "the", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "result", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "stretch", " ", "factor", " ", "for", " ", "the", " ", "flow", " ", "item", " ", "in", " ", "the", " ", "direction", "\\", "10", ";", " ", " ", " ", " ", "orthogonal", " ", "to", " ", "the", " ", "layout", " ", "flow", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "layout", "\\u", "data_", "._", "stretch", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Ortho", "Stretch_", "(_", "self_", ",_", "stretch", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", " ", "the", " ", "ortho", " ", "stretch", " ", "factor", " ", "for", " ", "the", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "trigger", " ", "an", " ", "invalid", "ation", " ", "of", " ", "the", " ", "layout", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "stretch", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "stretch", " ", "factor", " ", "for", " ", "the", " ", "flow", " ", "item", " ", "in", " ", "the", " ", "direction", "\\", "10", ";", " ", " ", " ", " ", "orthogonal", " ", "to", " ", "the", " ", "layout", " ", "flow", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "\\u", "layout", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "ortho", "\\u", "stretch", "_", "=_", "stretch", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "Geometry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flow", "Widget_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "flow", " ", "widget", " ", "for", " ", "this", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "result", " ", ":", " ", "QW", "idge", "t", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "flow", " ", "widget", " ", "bei", "ng", " ", "manage", "d", " ", "by", " ", "this", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "flow", "\\u", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Flow", "Widget_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", " ", "the", " ", "flow", " ", "widget", " ", "for", " ", "this", " ", "flow", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "widget", " ", ":", " ", "QW", "idge", "t", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "QW", "idge", "t", " ", "to", " ", "use", " ", "as", " ", "the", " ", "flow", " ", "widget", " ", "in", " ", "this", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flow", "\\u", "widget_", "=_", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "layout_", "(_", ")_", "._", "set", "Widget_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QF", "low", "Item_", "(_", "QF", "rame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "custom", " ", "event", " ", "handler", " ", "whi", "ch", " ", "handle", "s", " ", "Lay", "out", "Request", " ", "events", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "a", " ", "Lay", "out", "Request", " ", "event", " ", "is", " ", "poste", "d", " ", "to", " ", "this", " ", "widget", ",", " ", "it", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "emit", " ", "the", " ", "`", "layout", "Requeste", "d", "`", " ", "signal", ".", " ", "Thi", "s", " ", "allow", "s", " ", "an", " ", "external", "\\", "10", ";", " ", " ", " ", " ", "consume", "r", " ", "of", " ", "this", " ", "widget", " ", "to", " ", "update", " ", "thei", "r", " ", "external", " ", "layout", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "._", "type_", "(_", ")_", "==_", "QE", "vent_", "._", "Lay", "out", "Request_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "layout", "\\u", "data_", "._", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "QF", "low", "Item_", ",_", "self_", ")_", "._", "event_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "Qt", " ", "implementation", " ", "of", " ", "an", " ", "En", "aml", " ", "Pro", "xy", "Flow", "Item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "A", " ", "reference", " ", "to", " ", "the", " ", "widget", " ", "created", " ", "by", " ", "the", " ", "proxy", "._", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "Type", "d_", "(_", "QF", "low", "Item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "ation", " ", "API_", "\\u\\u\\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_", "#", " ", "Utili", "ty", " ", "Methods_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Chil", "d", " ", "Events_", "\\u\\u\\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_", "#", " ", "Pro", "xy", "Flow", "Item", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create", "\\u", "widget_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "e", " ", "the", " ", "underl", "ying", " ", "QF", "low", "Item", " ", "widget", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "=_", "QF", "low", "Item_", "(_", "self_", "._", "parent", "\\u", "widget_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "widget_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Ii", "tial", "ize", " ", "the", " ", "underl", "ying", " ", "control", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Qt", "Flow", "Item_", ",_", "self_", ")_", "._", "init", "\\u", "widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "declaration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "prefer", "red", "\\u", "size_", "(_", "d_", "._", "prefer", "red", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "align_", "(_", "d_", "._", "align_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "stretch", "_", "(_", "d_", "._", "stretch", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "ortho", "\\u", "stretch", "_", "(_", "d_", "._", "ortho", "\\u", "stretch", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "layout_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Initializ", "e", " ", "the", " ", "layout", " ", "for", " ", "the", " ", "under", "yli", "ng", " ", "widget", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Qt", "Flow", "Item_", ",_", "self_", ")_", "._", "init", "\\u", "layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "set", "Flow", "Widget_", "(_", "self_", "._", "flow", "\\u", "widget_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flow", "\\u", "widget_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Fin", "d", " ", "and", " ", "return", " ", "the", " ", "flow", " ", "widget", " ", "child", " ", "for", " ", "this", " ", "widget", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "result", " ", ":", " ", "QW", "idge", "t", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "flow", " ", "widget", " ", "defin", "ed", " ", "for", " ", "this", " ", "widget", ",", " ", "or", " ", "Non", "e", " ", "if", " ", "one", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "defin", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "declaration_", "._", "flow", "\\u", "widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d_", "._", "proxy_", "._", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "child", "\\u", "added_", "(_", "self_", ",_", "child_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Handle", " ", "the", " ", "child", " ", "adde", "d", " ", "event", " ", "for", " ", "a", " ", "Qt", "Flow", "Item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Qt", "Flow", "Item_", ",_", "self_", ")_", "._", "child", "\\u", "added_", "(_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "child_", ",_", "Qt", "Container_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widget_", "._", "set", "Flow", "Widget_", "(_", "self_", "._", "flow", "\\u", "widget_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "child", "\\u", "removed_", "(_", "self_", ",_", "child_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Handle", " ", "the", " ", "child", " ", "adde", "d", " ", "event", " ", "for", " ", "a", " ", "Qt", "Flow", "Item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Qt", "Flow", "Item_", ",_", "self_", ")_", "._", "child", "\\u", "removed_", "(_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "child_", ",_", "Qt", "Container_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widget_", "._", "set", "Flow", "Widget_", "(_", "self_", "._", "flow", "\\u", "widget_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "prefer", "red", "\\u", "size_", "(_", "self_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", " ", "the", " ", "prefer", "red", " ", "size", " ", "of", " ", "the", " ", "underl", "ying", " ", "widget", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "set", "Prefe", "rre", "d", "Size_", "(_", "QS", "ize_", "(_", "*_", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "align_", "(_", "self_", ",_", "align_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", " ", "the", " ", "alignme", "nt", " ", "of", " ", "the", " ", "underl", "ying", " ", "widget", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "set", "Alignment_", "(_", "\\u", "ALIGN", "\\u", "MAP_", "[_", "align_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "stretch", "_", "(_", "self_", ",_", "stretch", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", " ", "the", " ", "stretch", " ", "factor", " ", "of", " ", "the", " ", "underl", "ying", " ", "widget", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "set", "Stretch_", "(_", "stretch", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qt", "Flow", "Item_", "(_", "Qt", "Widget_", ",_", "Pro", "xy", "Flow", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "ortho", "\\u", "stretch", "_", "(_", "self_", ",_", "stretch", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", " ", "the", " ", "ortho", " ", "stretch", " ", "factor", " ", "of", " ", "the", " ", "underl", "ing", " ", "widget", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "set", "Ortho", "Stretch_", "(_", "stretch", "_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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2common/st2common/transport/consumers.py
[ { "content": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License. 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 abc\nimport eventlet\nimport six\n\nfrom kombu.mixins import ConsumerMixin\n\nfrom st2common import log as logging\nfrom st2common.util.greenpooldispatch import BufferedDispatcher\n\n\nLOG = logging.getLogger(__name__)\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class QueueConsumer(ConsumerMixin):\n\n\n\n", "metadata": "root.QueueConsumer", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def __init__(self, connection, queues, handler):\n self.connection = connection\n self._dispatcher = BufferedDispatcher()\n self._queues = queues\n self._handler = handler", "metadata": "root.QueueConsumer.__init__", "header": "['class', 'QueueConsumer', '(', 'ConsumerMixin', ')', ':', '___EOS___']", "index": 29 }, { "content": " def shutdown(self):\n self._dispatcher.shutdown()", "metadata": "root.QueueConsumer.shutdown", "header": "['class', 'QueueConsumer', '(', 'ConsumerMixin', ')', ':', '___EOS___']", "index": 35 }, { "content": " def get_consumers(self, Consumer, channel):\n consumer = Consumer(queues=self._queues, accept=['pickle'], callbacks=[self.process])\n\n # use prefetch_count=1 for fair dispatch. This way workers that finish an item get the next\n # task and the work does not get queued behind any single large item.\n consumer.qos(prefetch_count=1)\n\n return [consumer]", "metadata": "root.QueueConsumer.get_consumers", "header": "['class', 'QueueConsumer', '(', 'ConsumerMixin', ')', ':', '___EOS___']", "index": 38 }, { "content": " def process(self, body, message):\n try:\n if not isinstance(body, self._handler.message_type):\n raise TypeError('Received an unexpected type \"%s\" for payload.' % type(body))\n\n self._dispatcher.dispatch(self._process_message, body)\n except:\n LOG.exception('%s failed to process message: %s', self.__class__.__name__, body)\n finally:\n # At this point we will always ack a message.\n message.ack()", "metadata": "root.QueueConsumer.process", "header": "['class', 'QueueConsumer', '(', 'ConsumerMixin', ')', ':', '___EOS___']", "index": 47 }, { "content": " def _process_message(self, body):\n try:\n self._handler.process(body)\n except:\n LOG.exception('%s failed to process message: %s', self.__class__.__name__, body)", "metadata": "root.QueueConsumer._process_message", "header": "['class', 'QueueConsumer', '(', 'ConsumerMixin', ')', ':', '___EOS___']", "index": 59 }, { "content": "class StagedQueueConsumer(QueueConsumer):\n \"\"\"\n Used by ``StagedMessageHandler`` to effectively manage it 2 step message handling.\n \"\"\"\n", "metadata": "root.StagedQueueConsumer", "header": "['module', '___EOS___']", "index": 66 }, { "content": " def process(self, body, message):\n try:\n if not isinstance(body, self._handler.message_type):\n raise TypeError('Received an unexpected type \"%s\" for payload.' % type(body))\n response = self._handler.pre_ack_process(body)\n self._dispatcher.dispatch(self._process_message, response)\n except:\n LOG.exception('%s failed to process message: %s', self.__class__.__name__, body)\n finally:\n # At this point we will always ack a message.\n message.ack()", "metadata": "root.StagedQueueConsumer.process", "header": "['class', 'StagedQueueConsumer', '(', 'QueueConsumer', ')', ':', '___EOS___']", "index": 71 }, { "content": "@six.add_metaclass(abc.ABCMeta)\nclass MessageHandler(object):\n message_type = None\n\n\n\n\n\n", "metadata": "root.MessageHandler", "header": "['module', '___EOS___']", "index": 84 }, { "content": " def __init__(self, connection, queues):\n self._queue_consumer = self._get_queue_consumer(connection, queues)\n self._consumer_thread = None", "metadata": "root.MessageHandler.__init__", "header": "['class', 'MessageHandler', '(', 'object', ')', ':', '___EOS___']", "index": 88 }, { "content": " def start(self, wait=False):\n LOG.info('Starting %s...', self.__class__.__name__)\n self._consumer_thread = eventlet.spawn(self._queue_consumer.run)\n\n if wait:\n self.wait()", "metadata": "root.MessageHandler.start", "header": "['class', 'MessageHandler', '(', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": " def wait(self):\n self._consumer_thread.wait()", "metadata": "root.MessageHandler.wait", "header": "['class', 'MessageHandler', '(', 'object', ')', ':', '___EOS___']", "index": 99 }, { "content": " def shutdown(self):\n LOG.info('Shutting down %s...', self.__class__.__name__)\n self._queue_consumer.shutdown()", "metadata": "root.MessageHandler.shutdown", "header": "['class', 'MessageHandler', '(', 'object', ')', ':', '___EOS___']", "index": 102 }, { "content": " @abc.abstractmethod\n def process(self, message):\n pass", "metadata": "root.MessageHandler.process", "header": "['class', 'MessageHandler', '(', 'object', ')', ':', '___EOS___']", "index": 106 }, { "content": " def _get_queue_consumer(self, connection, queues):\n return QueueConsumer(connection, queues, self)", "metadata": "root.MessageHandler._get_queue_consumer", "header": "['class', 'MessageHandler', '(', 'object', ')', ':', '___EOS___']", "index": 110 }, { "content": "@six.add_metaclass(abc.ABCMeta)\nclass StagedMessageHandler(MessageHandler):\n \"\"\"\n MessageHandler to deal with messages in 2 steps.\n 1. pre_ack_process : This is called on the handler before ack-ing the message.\n 2. process: Called after ack-in the messages\n This 2 step approach provides a way for the handler to do some hadling like saving to DB etc\n before acknowleding and then performing future processing async. This way even if the handler\n or owning process is taken down system will still maintain track of the message.\n \"\"\"\n\n", "metadata": "root.StagedMessageHandler", "header": "['module', '___EOS___']", "index": 114 }, { "content": " @abc.abstractmethod\n def pre_ack_process(self, message):\n \"\"\"\n Called before acknowleding a message. Good place to track the message via a DB entry or some\n other applicable mechnism.\n\n The reponse of this method is passed into the ``process`` method. This was whatever is the\n processed version of the message can be moved forward. It is always possible to simply\n return ``message`` and have ``process`` handle the original message.\n \"\"\"\n pass", "metadata": "root.StagedMessageHandler.pre_ack_process", "header": "['class', 'StagedMessageHandler', '(', 'MessageHandler', ')', ':', '___EOS___']", "index": 125 }, { "content": " def _get_queue_consumer(self, connection, queues):\n return StagedQueueConsumer(connection, queues, self)", "metadata": "root.StagedMessageHandler._get_queue_consumer", "header": "['class', 'StagedMessageHandler', '(', 'MessageHandler', ')', ':', '___EOS___']", "index": 137 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "License", "d", " ", "to", " ", "the", " ", "Stack", "Stor", "m", ",", " ", "Inc", " ", "('", "Stack", "Stor", "m", "')", " ", "under", " ", "one", " ", "or", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contributor", " ", "license", " ", "agreement", "s", ".", " ", " ", "See", " ", "the", " ", "NOTICE", " ", "file", " ", "distributed", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "work", " ", "for", " ", "addition", "al", " ", "informati", "on", " ", "regarding", " ", "copyr", "ight", " ", "owner", "ship", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "AS", "F", " ", "license", "s", " ", "this", " ", "file", " ", "to", " ", "You", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "License", ".", " ", " ", "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_", "abc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "eventlet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kom", "bu", "_", "._", "mixins_", "import_", "Consume", "r", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "st2", "common_", "import_", "log_", "as_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "st2", "common_", "._", "util_", "._", "green", "pool", "dispatch_", "import_", "Buffer", "ed", "Dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Queue", "Consumer_", "(_", "Consume", "r", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Queue", "Consumer_", "(_", "Consume", "r", "Mixin_", ")_", ":_", "\\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_", ",_", "connection_", ",_", "queues_", ",_", "handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "connection_", "=_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dispatcher_", "=_", "Buffer", "ed", "Dispatcher_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "queues_", "=_", "queues_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "handler_", "=_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Queue", "Consumer_", "(_", "Consume", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dispatcher_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Queue", "Consumer_", "(_", "Consume", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "consumers", "_", "(_", "self_", ",_", "Consumer_", ",_", "channel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "consumer_", "=_", "Consumer_", "(_", "queues_", "=_", "self_", "._", "\\u", "queues_", ",_", "accept_", "=_", "[_", "'", "pickle", "'_", "]_", ",_", "callbacks_", "=_", "[_", "self_", "._", "process_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "prefetch", "\\u", "count", "=", "1", " ", "for", " ", "fair", " ", "dispatch", ".", " ", "Thi", "s", " ", "way", " ", "worker", "s", " ", "tha", "t", " ", "finish", " ", "an", " ", "item", " ", "get", " ", "the", " ", "next_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "task", " ", "and", " ", "the", " ", "work", " ", "doe", "s", " ", "not", " ", "get", " ", "queue", "d", " ", "beh", "ind", " ", "any", " ", "single", " ", "large", " ", "item", "._", "\\u\\u\\uNL\\u\\u\\u_", "consumer_", "._", "qos_", "(_", "prefetch", "\\u", "count_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "consumer_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Queue", "Consumer_", "(_", "Consume", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process_", "(_", "self_", ",_", "body_", ",_", "message_", ")_", ":_", "\\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_", "not_", "isinstance_", "(_", "body_", ",_", "self_", "._", "\\u", "handler_", "._", "message", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Receive", "d", " ", "an", " ", "unexpected", " ", "type", " ", "\"%", "s", "\"", " ", "for", " ", "payload", ".'_", "%_", "type_", "(_", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "dispatcher_", "._", "dispatch_", "(_", "self_", "._", "\\u", "process", "\\u", "message_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "'%", "s", " ", "fail", "ed", " ", "to", " ", "process", " ", "message", ":", " ", "%", "s", "'_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "At", " ", "this", " ", "point", " ", "we", " ", "will", " ", "alw", "ay", "s", " ", "ack", " ", "a", " ", "message", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "._", "ack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Queue", "Consumer_", "(_", "Consume", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "\\u", "message_", "(_", "self_", ",_", "body_", ")_", ":_", "\\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", "handler_", "._", "process_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "'%", "s", " ", "fail", "ed", " ", "to", " ", "process", " ", "message", ":", " ", "%", "s", "'_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "body_", ")_", "\\u\\u\\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_", "Stage", "d", "Queue", "Consumer_", "(_", "Queue", "Consumer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "by", " ", "``", "Stage", "d", "Messag", "e", "Handle", "r", "``", " ", "to", " ", "effective", "ly", " ", "manage", " ", "it", " ", "2", " ", "step", " ", "message", " ", "handling", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Stage", "d", "Queue", "Consumer_", "(_", "Queue", "Consumer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process_", "(_", "self_", ",_", "body_", ",_", "message_", ")_", ":_", "\\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_", "not_", "isinstance_", "(_", "body_", ",_", "self_", "._", "\\u", "handler_", "._", "message", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Receive", "d", " ", "an", " ", "unexpected", " ", "type", " ", "\"%", "s", "\"", " ", "for", " ", "payload", ".'_", "%_", "type_", "(_", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "handler_", "._", "pre", "\\u", "ack", "\\u", "process_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dispatcher_", "._", "dispatch_", "(_", "self_", "._", "\\u", "process", "\\u", "message_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "'%", "s", " ", "fail", "ed", " ", "to", " ", "process", " ", "message", ":", " ", "%", "s", "'_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "At", " ", "this", " ", "point", " ", "we", " ", "will", " ", "alw", "ay", "s", " ", "ack", " ", "a", " ", "message", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "._", "ack_", "(_", ")_", "\\u\\u\\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_", "@_", "six_", "._", "add", "\\u", "metaclass_", "(_", "abc_", "._", "ABC", "Meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Messag", "e", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message", "\\u", "type_", "=_", "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_", "[SEP]_", "class_", "Messag", "e", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "connection_", ",_", "queues_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "queue", "\\u", "consumer_", "=_", "self_", "._", "\\u", "get", "\\u", "queue", "\\u", "consumer_", "(_", "connection_", ",_", "queues_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "consume", "r", "\\u", "thread_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start_", "(_", "self_", ",_", "wait_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "'", "Start", "ing", " ", "%", "s", "...'_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "consume", "r", "\\u", "thread_", "=_", "eventlet_", "._", "spawn_", "(_", "self_", "._", "\\u", "queue", "\\u", "consumer_", "._", "run_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "wait_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wait_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "consume", "r", "\\u", "thread_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "'", "Shutt", "ing", " ", "down", " ", "%", "s", "...'_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "queue", "\\u", "consumer_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "process_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "queue", "\\u", "consumer_", "(_", "self_", ",_", "connection_", ",_", "queues_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Queue", "Consumer_", "(_", "connection_", ",_", "queues_", ",_", "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_", "@_", "six_", "._", "add", "\\u", "metaclass_", "(_", "abc_", "._", "ABC", "Meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Stage", "d", "Messag", "e", "Handler_", "(_", "Messag", "e", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Messag", "e", "Handle", "r", " ", "to", " ", "deal", " ", "with", " ", "message", "s", " ", "in", " ", "2", " ", "step", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "pre", "\\u", "ack", "\\u", "process", " ", ":", " ", "Thi", "s", " ", "is", " ", "call", "ed", " ", "on", " ", "the", " ", "handler", " ", "bef", "ore", " ", "ack", "-", "ing", " ", "the", " ", "message", ".", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "process", ":", " ", "Call", "ed", " ", "after", " ", "ack", "-", "in", " ", "the", " ", "message", "s", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "2", " ", "step", " ", "appro", "ach", " ", "provide", "s", " ", "a", " ", "way", " ", "for", " ", "the", " ", "handler", " ", "to", " ", "do", " ", "some", " ", "had", "ling", " ", "like", " ", "saving", " ", "to", " ", "DB", " ", "etc", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "ack", "nowl", "eding", " ", "and", " ", "then", " ", "perform", "ing", " ", "future", " ", "process", "ing", " ", "async", ".", " ", "Thi", "s", " ", "way", " ", "even", " ", "if", " ", "the", " ", "handler", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "own", "ing", " ", "process", " ", "is", " ", "take", "n", " ", "down", " ", "system", " ", "will", " ", "still", " ", "maintain", " ", "track", " ", "of", " ", "the", " ", "message", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Stage", "d", "Messag", "e", "Handler_", "(_", "Messag", "e", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pre", "\\u", "ack", "\\u", "process_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", "ed", " ", "bef", "ore", " ", "ack", "nowl", "eding", " ", "a", " ", "message", ".", " ", "Good", " ", "place", " ", "to", " ", "track", " ", "the", " ", "message", " ", "via", " ", "a", " ", "DB", " ", "entry", " ", "or", " ", "some", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "applica", "ble", " ", "mech", "nis", "m", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "repon", "se", " ", "of", " ", "this", " ", "method", " ", "is", " ", "pass", "ed", " ", "int", "o", " ", "the", " ", "``", "process", "``", " ", "method", ".", " ", "Thi", "s", " ", "was", " ", "what", "ever", " ", "is", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "process", "ed", " ", "version", " ", "of", " ", "the", " ", "message", " ", "can", " ", "be", " ", "moved", " ", "forward", ".", " ", "It", " ", "is", " ", "alw", "ay", "s", " ", "possib", "le", " ", "to", " ", "simp", "ly", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "``", "message", "``", " ", "and", " ", "have", " ", "``", "process", "``", " ", "handle", " ", "the", " ", "original", " ", "message", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stage", "d", "Messag", "e", "Handler_", "(_", "Messag", "e", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "queue", "\\u", "consumer_", "(_", "self_", ",_", "connection_", ",_", "queues_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Stage", "d", "Queue", "Consumer_", "(_", "connection_", ",_", "queues_", ",_", "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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
django-bmf/django-bmf/djangobmf/contrib/accounting/bmf_module.py
[ { "content": "#!/usr/bin/python\n# ex:set fileencoding=utf-8:\n\nfrom __future__ import unicode_literals\n\nfrom django import forms\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom djangobmf.sites import Relationship\nfrom djangobmf.sites import Module\nfrom djangobmf.sites import ViewMixin\nfrom djangobmf.sites import register\nfrom djangobmf.sites import site\n\nfrom .categories import TransactionCategory\nfrom .models import ACCOUNTING_INCOME\nfrom .models import ACCOUNTING_EXPENSE\nfrom .models import ACCOUNTING_ASSET\nfrom .models import ACCOUNTING_LIABILITY\nfrom .models import Account\nfrom .models import Transaction\nfrom .models import TransactionItem\nfrom .views import TransactionCreateView\nfrom .views import TransactionUpdateView\n\n\n\n\n\n\n\n\n\n\nsite.register_settings('bmfcontrib_accounting', {\n 'income': forms.ModelChoiceField(queryset=Account.objects.filter(type=ACCOUNTING_INCOME)),\n 'expense': forms.ModelChoiceField(queryset=Account.objects.filter(type=ACCOUNTING_EXPENSE)),\n 'customer': forms.ModelChoiceField(queryset=Account.objects.filter(type=ACCOUNTING_ASSET)),\n 'supplier': forms.ModelChoiceField(queryset=Account.objects.filter(type=ACCOUNTING_LIABILITY)),\n})\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@register\nclass AccountModule(Module):\n model = Account\n default = True", "metadata": "root.AccountModule", "header": "['module', '___EOS___']", "index": 26 }, { "content": "@register\nclass TransactionModule(Module):\n model = Transaction\n default = True\n create = TransactionCreateView\n update = TransactionUpdateView", "metadata": "root.TransactionModule", "header": "['module', '___EOS___']", "index": 32 }, { "content": "@register\nclass TransactionItemModule(Module):\n model = TransactionItem\n default = True", "metadata": "root.TransactionItemModule", "header": "['module', '___EOS___']", "index": 40 }, { "content": "@register(model=TransactionItem)\nclass AccountTransactionsRelationship(Relationship):\n name = _(\"Transactions\")\n slug = \"transactions\"\n field = \"transactions\"\n model = \"djangobmf_accounting.Account\"\n settings = \"BMF_CONTRIB_ACCOUNT\"", "metadata": "root.AccountTransactionsRelationship", "header": "['module', '___EOS___']", "index": 46 }, { "content": "@register(category=TransactionCategory)\nclass AllAccounts(ViewMixin):\n model = Account\n name = _(\"All Accounts\")\n slug = \"accounts\"", "metadata": "root.AllAccounts", "header": "['module', '___EOS___']", "index": 63 }, { "content": "@register(category=TransactionCategory)\nclass OpenTransactions(ViewMixin):\n model = Transaction\n name = _(\"Open transactions\")\n slug = \"open\"\n", "metadata": "root.OpenTransactions", "header": "['module', '___EOS___']", "index": 70 }, { "content": " def filter_queryset(self, request, queryset, view):\n return queryset.filter(draft=True).order_by('-modified')", "metadata": "root.OpenTransactions.filter_queryset", "header": "['class', 'OpenTransactions', '(', 'ViewMixin', ')', ':', '___EOS___']", "index": 76 }, { "content": "@register(category=TransactionCategory)\nclass ClosedTrancations(ViewMixin):\n model = Transaction\n name = _(\"Closed transactions\")\n slug = \"closed\"\n date_resolution = \"month\"\n", "metadata": "root.ClosedTrancations", "header": "['module', '___EOS___']", "index": 80 }, { "content": " def filter_queryset(self, request, queryset, view):\n return queryset.filter(draft=False).order_by('modified')", "metadata": "root.ClosedTrancations.filter_queryset", "header": "['class', 'ClosedTrancations', '(', 'ViewMixin', ')', ':', '___EOS___']", "index": 87 }, { "content": "@register(category=TransactionCategory)\nclass Archive(ViewMixin):\n model = TransactionItem\n name = _(\"Transaction archive\")\n slug = \"archive\"\n date_resolution = \"week\"", "metadata": "root.Archive", "header": "['module', '___EOS___']", "index": 91 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", ":", "set", " ", "file", "encoding", "=", "utf", "-", "8", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django", "bm", "f_", "._", "sites_", "import_", "Relationship", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "bm", "f_", "._", "sites_", "import_", "Module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "bm", "f_", "._", "sites_", "import_", "View", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "bm", "f_", "._", "sites_", "import_", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "bm", "f_", "._", "sites_", "import_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "categories_", "import_", "Transa", "ction", "Category_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "models_", "import_", "ACCOUNT", "ING", "\\u", "INCOM", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "models_", "import_", "ACCOUNT", "ING", "\\u", "EXP", "ENS", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "models_", "import_", "ACCOUNT", "ING", "\\u", "ASSET", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "models_", "import_", "ACCOUNT", "ING", "\\u", "LI", "ABI", "LIT", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "models_", "import_", "Account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "models_", "import_", "Transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "models_", "import_", "Transa", "ction", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "views_", "import_", "Transa", "ction", "Creat", "e", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "views_", "import_", "Transa", "ction", "Update", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "site_", "._", "register", "\\u", "settings_", "(_", "'", "bm", "fco", "ntri", "b", "\\u", "accounti", "ng", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "income", "'_", ":_", "forms_", "._", "Model", "Choi", "ce", "Field_", "(_", "queryset_", "=_", "Account_", "._", "objects_", "._", "filter_", "(_", "type_", "=_", "ACCOUNT", "ING", "\\u", "INCOM", "E_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expense", "'_", ":_", "forms_", "._", "Model", "Choi", "ce", "Field_", "(_", "queryset_", "=_", "Account_", "._", "objects_", "._", "filter_", "(_", "type_", "=_", "ACCOUNT", "ING", "\\u", "EXP", "ENS", "E_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "customer", "'_", ":_", "forms_", "._", "Model", "Choi", "ce", "Field_", "(_", "queryset_", "=_", "Account_", "._", "objects_", "._", "filter_", "(_", "type_", "=_", "ACCOUNT", "ING", "\\u", "ASSET", "_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "supplier", "'_", ":_", "forms_", "._", "Model", "Choi", "ce", "Field_", "(_", "queryset_", "=_", "Account_", "._", "objects_", "._", "filter_", "(_", "type_", "=_", "ACCOUNT", "ING", "\\u", "LI", "ABI", "LIT", "Y_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Account", "Module_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "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_", "@_", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Transa", "ction", "Module_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create_", "=_", "Transa", "ction", "Creat", "e", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update_", "=_", "Transa", "ction", "Update", "View_", "\\u\\u\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Transa", "ction", "Item", "Module_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Transa", "ction", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "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_", "@_", "register_", "(_", "model_", "=_", "Transa", "ction", "Item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Account", "Transactions", "Relationship", "_", "(_", "Relationship", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\\u_", "(_", "\"", "Transactions", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slug_", "=_", "\"", "transaction", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "=_", "\"", "transaction", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "\"", "django", "bm", "f", "\\u", "accounti", "ng", ".", "Account", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "=_", "\"", "BM", "F", "\\u", "CONTRIB", "\\u", "ACCOUNT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "register_", "(_", "category_", "=_", "Transa", "ction", "Category_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "All", "Account", "s_", "(_", "View", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "\\u_", "(_", "\"", "All", " ", "Account", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slug_", "=_", "\"", "account", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "(_", "category_", "=_", "Transa", "ction", "Category_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Open", "Transactions", "_", "(_", "View", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "\\u_", "(_", "\"", "Open", " ", "transaction", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slug_", "=_", "\"", "open", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Open", "Transactions", "_", "(_", "View", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "filter", "\\u", "queryset_", "(_", "self_", ",_", "request_", ",_", "queryset_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "queryset_", "._", "filter_", "(_", "draft_", "=_", "True_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "modifi", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "(_", "category_", "=_", "Transa", "ction", "Category_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Clos", "ed", "Tra", "nca", "tions_", "(_", "View", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "\\u_", "(_", "\"", "Clos", "ed", " ", "transaction", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slug_", "=_", "\"", "close", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date", "\\u", "resolution_", "=_", "\"", "month", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Clos", "ed", "Tra", "nca", "tions_", "(_", "View", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "filter", "\\u", "queryset_", "(_", "self_", ",_", "request_", ",_", "queryset_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "queryset_", "._", "filter_", "(_", "draft_", "=_", "False_", ")_", "._", "order", "\\u", "by_", "(_", "'", "modifi", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "(_", "category_", "=_", "Transa", "ction", "Category_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Archive_", "(_", "View", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Transa", "ction", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "\\u_", "(_", "\"", "Transa", "ction", " ", "archive", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slug_", "=_", "\"", "archive", "\"_", "\\u\\u\\uNEWL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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
girder/girder/plugins/metadata_extractor/plugin_tests/client_metadata_extractor_test.py
[ { "content": " def testClientMetadataExtractor(self):\n item = self.model('item').load(self.item['_id'], user=self.user)\n self.assertEqual(item['name'], self.name)\n self.assertNotHasKeys(item, ['meta'])\n clientPath = os.path.join(ROOT_DIR, 'clients', 'python')\n sys.path.insert(0, clientPath)\n\n from girder_client import GirderClient\n\n client = GirderClient('localhost', int(os.environ['GIRDER_PORT']))\n client.authenticate(self.user['login'], self.password)\n extractor = ClientMetadataExtractor(client, self.path, self.item['_id'])\n extractor.extractMetadata()\n sys.path.remove(clientPath)\n item = self.model('item').load(self.item['_id'], user=self.user)\n self.assertEqual(item['name'], self.name)\n self.assertHasKeys(item, ['meta'])\n self.assertEqual(item['meta']['MIME type'], self.mimeType)", "metadata": "root.ClientMetadataExtractorTestCase.testClientMetadataExtractor", "header": "['class', 'ClientMetadataExtractorTestCase', '(', 'MetadataExtractorTestCase', ')', ':', '___EOS___']", "index": 40 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Client", "Meta", "data", "Extract", "or", "Test", "Case_", "(_", "Meta", "data", "Extract", "or", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Client", "Meta", "data", "Extractor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "self_", "._", "model_", "(_", "'", "item", "'_", ")_", "._", "load_", "(_", "self_", "._", "item_", "[_", "'\\u", "id", "'_", "]_", ",_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "item_", "[_", "'", "name", "'_", "]_", ",_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Has", "Keys_", "(_", "item_", ",_", "[_", "'", "meta", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "ROO", "T", "\\u", "DIR_", ",_", "'", "clients", "'_", ",_", "'", "python", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "client", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "girder", "\\u", "client_", "import_", "Gir", "der", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "Gir", "der", "Client_", "(_", "'", "local", "host", "'_", ",_", "int_", "(_", "os_", "._", "environ_", "[_", "'", "GI", "RD", "ER", "\\u", "PORT", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "authenticate_", "(_", "self_", "._", "user_", "[_", "'", "login", "'_", "]_", ",_", "self_", "._", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extractor_", "=_", "Client", "Meta", "data", "Extractor_", "(_", "client_", ",_", "self_", "._", "path_", ",_", "self_", "._", "item_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extractor_", "._", "extract", "Metadata_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "remove_", "(_", "client", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "=_", "self_", "._", "model_", "(_", "'", "item", "'_", ")_", "._", "load_", "(_", "self_", "._", "item_", "[_", "'\\u", "id", "'_", "]_", ",_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "item_", "[_", "'", "name", "'_", "]_", ",_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Has", "Keys_", "(_", "item_", ",_", "[_", "'", "meta", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "item_", "[_", "'", "meta", "'_", "]_", "[_", "'", "MIME", " ", "type", "'_", "]_", ",_", "self_", "._", "mime", "Type_", ")_" ]
[ 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 ]
Missing call to `__init__` during object initialization
GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/api/search/query_parser.py
[ { "content": "class QueryLexerWithErrors(QueryLexer.QueryLexer):\n \"\"\"An overridden Lexer that raises exceptions.\"\"\"\n\n", "metadata": "root.QueryLexerWithErrors", "header": "['module', '___EOS___']", "index": 49 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Query", "Lex", "er", "With", "Errors_", "(_", "Query", "Lexer_", "._", "Query", "Lexer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "overrid", "den", " ", "Lex", "er", " ", "tha", "t", " ", "raise", "s", " ", "exception", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
jkbrzt/httpie/tests/test_cli.py
[ { "content": " def test_query_string_params_items(self, httpbin):\n r = http('--print=Hhb', 'GET', httpbin.url + '/get', 'a==1')\n path = '/get?a=1'\n url = httpbin.url + path\n assert HTTP_OK in r\n assert 'GET %s HTTP/1.1' % path in r\n assert '\"url\": \"%s\"' % url in r", "metadata": "root.TestQuerystring.test_query_string_params_items", "header": "['class', 'TestQuerystring', ':', '___EOS___']", "index": 137 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Query", "string_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "query", "\\u", "string", "\\u", "params", "\\u", "items_", "(_", "self_", ",_", "http", "bin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "http_", "(_", "'--", "print", "=", "Hh", "b", "'_", ",_", "'", "GET", "'_", ",_", "http", "bin_", "._", "url_", "+_", "'/", "get", "'_", ",_", "'", "a", "==", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "'/", "get", "?", "a", "=", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "http", "bin_", "._", "url_", "+_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "HTTP", "\\u", "OK_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "GET", " ", "%", "s", " ", "HTTP", "/", "1.1", "'_", "%_", "path_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'\"", "url", "\":", " ", "\"%", "s", "\"'_", "%_", "url_", "in_", "r_", "\\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 ]
Unreachable code
zbyte64/django-dockit/dockit/backends/djangodocument/models.py
[ { "content": "class RegisteredIndex(models.Model):\n name = models.CharField(max_length=128, db_index=True)\n collection = models.CharField(max_length=128, db_index=True)\n query_hash = models.CharField(max_length=128)\n \n objects = RegisteredIndexManager()\n \n \n class Meta:\n unique_together = [('name', 'collection')]", "metadata": "root.RegisteredIndex", "header": "['module', '___EOS___']", "index": 19 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Register", "ed", "Index_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "128_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collection_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "128_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "hash_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "128_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "objects_", "=_", "Register", "ed", "Index", "Manager_", "(_", ")_", "\\u\\u\\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_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unique", "\\u", "together_", "=_", "[_", "(_", "'", "name", "'_", ",_", "'", "collection", "'_", ")_", "]_", "\\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 ]
Variable defined multiple times
mozilla/addons-server/src/olympia/bandwagon/models.py
[ { "content": " def publishable_by(self, user):\n \"\"\"Collections that are publishable by a user.\"\"\"\n owned_by = models.Q(author=user.id)\n publishable_by = models.Q(users=user.id)\n collections = self.filter(owned_by | publishable_by)\n return collections.distinct().order_by('name__localized_string')", "metadata": "root.CollectionManager.publishable_by", "header": "['class', 'CollectionManager', '(', 'ManagerBase', ')', ':', '___EOS___']", "index": 81 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Collecti", "on", "Manager_", "(_", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "publi", "sha", "ble", "\\u", "by_", "(_", "self_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collections", " ", "tha", "t", " ", "are", " ", "publi", "sha", "ble", " ", "by", " ", "a", " ", "user", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "owned", "\\u", "by_", "=_", "models_", "._", "Q_", "(_", "author_", "=_", "user_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publi", "sha", "ble", "\\u", "by_", "=_", "models_", "._", "Q_", "(_", "users_", "=_", "user_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collections_", "=_", "self_", "._", "filter_", "(_", "owned", "\\u", "by_", "|_", "publi", "sha", "ble", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "collections_", "._", "distinct_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "name", "\\u\\u", "localized", "\\u", "string", "'_", ")_", "\\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 ]
Unused import
crossbario/autobahn-python/autobahn/twisted/test/test_protocol.py
[ { "content": "###############################################################################\n#\n# The MIT License (MIT)\n#\n# Copyright (c) Tavendo GmbH\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\nfrom __future__ import absolute_import, print_function\n\nimport unittest2 as unittest\nfrom mock import Mock\n\nfrom autobahn.twisted.websocket import WebSocketServerFactory\nfrom autobahn.twisted.websocket import WebSocketServerProtocol\nfrom twisted.python.failure import Failure\nfrom twisted.internet.error import ConnectionDone, ConnectionAborted, \\\n ConnectionLost\nfrom autobahn.test import FakeTransport\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ExceptionHandlingTests(unittest.TestCase):\n \"\"\"\n Tests that we format various exception variations properly during\n connectionLost\n \"\"\"\n\n\n\n\n\n", "metadata": "root.ExceptionHandlingTests", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def setUp(self):\n self.factory = WebSocketServerFactory()\n self.proto = WebSocketServerProtocol()\n self.proto.factory = self.factory\n self.proto.log = Mock()", "metadata": "root.ExceptionHandlingTests.setUp", "header": "['class', 'ExceptionHandlingTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def tearDown(self):\n for call in [\n self.proto.autoPingPendingCall,\n self.proto.autoPingTimeoutCall,\n self.proto.openHandshakeTimeoutCall,\n self.proto.closeHandshakeTimeoutCall,\n ]:\n if call is not None:\n call.cancel()", "metadata": "root.ExceptionHandlingTests.tearDown", "header": "['class', 'ExceptionHandlingTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def test_connection_done(self):\n # pretend we connected\n self.proto._connectionMade()\n\n self.proto.connectionLost(Failure(ConnectionDone()))\n\n messages = ' '.join([str(x[1]) for x in self.proto.log.mock_calls])\n self.assertTrue('closed cleanly' in messages)", "metadata": "root.ExceptionHandlingTests.test_connection_done", "header": "['class', 'ExceptionHandlingTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 61 }, { "content": " def test_connection_aborted(self):\n # pretend we connected\n self.proto._connectionMade()\n\n self.proto.connectionLost(Failure(ConnectionAborted()))\n\n messages = ' '.join([str(x[1]) for x in self.proto.log.mock_calls])\n self.assertTrue(' aborted ' in messages)", "metadata": "root.ExceptionHandlingTests.test_connection_aborted", "header": "['class', 'ExceptionHandlingTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_connection_lost(self):\n # pretend we connected\n self.proto._connectionMade()\n\n self.proto.connectionLost(Failure(ConnectionLost()))\n\n messages = ' '.join([str(x[1]) for x in self.proto.log.mock_calls])\n self.assertTrue(' was lost ' in messages)", "metadata": "root.ExceptionHandlingTests.test_connection_lost", "header": "['class', 'ExceptionHandlingTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_connection_lost_arg(self):\n # pretend we connected\n self.proto._connectionMade()\n\n self.proto.connectionLost(Failure(ConnectionLost(\"greetings\")))\n\n messages = ' '.join([str(x[1]) + str(x[2]) for x in self.proto.log.mock_calls])\n self.assertTrue(' was lost ' in messages)\n self.assertTrue('greetings' in messages)", "metadata": "root.ExceptionHandlingTests.test_connection_lost_arg", "header": "['class', 'ExceptionHandlingTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 88 }, { "content": "class Hixie76RejectionTests(unittest.TestCase):\n \"\"\"\n Hixie-76 should not be accepted by an Autobahn server.\n \"\"\"", "metadata": "root.Hixie76RejectionTests", "header": "['module', '___EOS___']", "index": 99 }, { "content": " def test_handshake_fails(self):\n \"\"\"\n A handshake from a client only supporting Hixie-76 will fail.\n \"\"\"\n t = FakeTransport()\n f = WebSocketServerFactory()\n p = WebSocketServerProtocol()\n p.factory = f\n p.transport = t\n\n # from http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76\n http_request = b\"GET /demo HTTP/1.1\\r\\nHost: example.com\\r\\nConnection: Upgrade\\r\\nSec-WebSocket-Key2: 12998 5 Y3 1 .P00\\r\\nSec-WebSocket-Protocol: sample\\r\\nUpgrade: WebSocket\\r\\nSec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\\r\\nOrigin: http://example.com\\r\\n\\r\\n^n:ds[4U\"\n\n p.openHandshakeTimeout = 0\n p._connectionMade()\n p.data = http_request\n p.processHandshake()\n self.assertIn(b\"HTTP/1.1 400\", t._written)\n self.assertIn(b\"Hixie76 protocol not supported\", t._written)", "metadata": "root.Hixie76RejectionTests.test_handshake_fails", "header": "['class', 'Hixie76RejectionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 103 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "MIT", " ", "License", " ", "(", "MIT", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Ta", "vend", "o", " ", "Gm", "b", "H_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest2_", "as_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "Mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "autob", "ah", "n_", "._", "twisted_", "._", "websocket_", "import_", "Web", "Sock", "et", "Server", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "autob", "ah", "n_", "._", "twisted_", "._", "websocket_", "import_", "Web", "Sock", "et", "Server", "Protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "._", "failure_", "import_", "Failure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "._", "error_", "import_", "Connect", "ion", "Done_", ",_", "Connect", "ion", "Abo", "rted", "_", ",_", "Connect", "ion", "Lost", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "autob", "ah", "n_", "._", "test_", "import_", "Fake", "Transport_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Except", "ion", "Hand", "ling", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "tha", "t", " ", "we", " ", "format", " ", "vari", "ous", " ", "exception", " ", "variations", " ", "proper", "ly", " ", "dur", "ing", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", "Lost", "\\", "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_", "Except", "ion", "Hand", "ling", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "factory_", "=_", "Web", "Sock", "et", "Server", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proto_", "=_", "Web", "Sock", "et", "Server", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proto_", "._", "factory_", "=_", "self_", "._", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proto_", "._", "log_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Except", "ion", "Hand", "ling", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "call_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "proto_", "._", "auto", "Ping", "Pend", "ing", "Call_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "proto_", "._", "auto", "Ping", "Time", "out", "Call_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "proto_", "._", "open", "Handsha", "ke", "Time", "out", "Call_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "proto_", "._", "close", "Handsha", "ke", "Time", "out", "Call_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "call_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call_", "._", "cancel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Except", "ion", "Hand", "ling", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "connecti", "on", "\\u", "done_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prete", "nd", " ", "we", " ", "connected_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "proto_", "._", "\\u", "connecti", "on", "Made", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "proto_", "._", "connecti", "on", "Lost", "_", "(_", "Failure_", "(_", "Connect", "ion", "Done_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "messages_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "str_", "(_", "x_", "[_", "1_", "]_", ")_", "for_", "x_", "in_", "self_", "._", "proto_", "._", "log_", "._", "mock", "\\u", "calls_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "close", "d", " ", "clean", "ly", "'_", "in_", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Except", "ion", "Hand", "ling", "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", "connecti", "on", "\\u", "abort", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prete", "nd", " ", "we", " ", "connected_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "proto_", "._", "\\u", "connecti", "on", "Made", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "proto_", "._", "connecti", "on", "Lost", "_", "(_", "Failure_", "(_", "Connect", "ion", "Abo", "rted", "_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "messages_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "str_", "(_", "x_", "[_", "1_", "]_", ")_", "for_", "x_", "in_", "self_", "._", "proto_", "._", "log_", "._", "mock", "\\u", "calls_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", " ", "abort", "ed", " ", "'_", "in_", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Except", "ion", "Hand", "ling", "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", "connecti", "on", "\\u", "lost_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prete", "nd", " ", "we", " ", "connected_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "proto_", "._", "\\u", "connecti", "on", "Made", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "proto_", "._", "connecti", "on", "Lost", "_", "(_", "Failure_", "(_", "Connect", "ion", "Lost", "_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "messages_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "str_", "(_", "x_", "[_", "1_", "]_", ")_", "for_", "x_", "in_", "self_", "._", "proto_", "._", "log_", "._", "mock", "\\u", "calls_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", " ", "was", " ", "lost", " ", "'_", "in_", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Except", "ion", "Hand", "ling", "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", "connecti", "on", "\\u", "lost", "\\u", "arg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prete", "nd", " ", "we", " ", "connected_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "proto_", "._", "\\u", "connecti", "on", "Made", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "proto_", "._", "connecti", "on", "Lost", "_", "(_", "Failure_", "(_", "Connect", "ion", "Lost", "_", "(_", "\"", "greeting", "s", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "messages_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "str_", "(_", "x_", "[_", "1_", "]_", ")_", "+_", "str_", "(_", "x_", "[_", "2_", "]_", ")_", "for_", "x_", "in_", "self_", "._", "proto_", "._", "log_", "._", "mock", "\\u", "calls_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", " ", "was", " ", "lost", " ", "'_", "in_", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "greeting", "s", "'_", "in_", "messages_", ")_", "\\u\\u\\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_", "Hi", "xi", "e7", "6", "Reject", "ion", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hi", "xi", "e-", "7", "6", " ", "shou", "ld", " ", "not", " ", "be", " ", "accept", "ed", " ", "by", " ", "an", " ", "Auto", "bah", "n", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "xi", "e7", "6", "Reject", "ion", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "handshake", "\\u", "fails_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "handshake", " ", "from", " ", "a", " ", "client", " ", "only", " ", "support", "ing", " ", "Hi", "xi", "e-", "7", "6", " ", "will", " ", "fail", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "Fake", "Transport_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "Web", "Sock", "et", "Server", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Web", "Sock", "et", "Server", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "factory_", "=_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "transport_", "=_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "http", "://", "tool", "s", ".", "iet", "f", ".", "org", "/", "html", "/", "draft", "-", "hi", "xi", "e-", "the", "websocket", "protoc", "ol", "-", "76_", "\\u\\u\\uNL\\u\\u\\u_", "http", "\\u", "request_", "=_", "b", "\"", "GET", " ", "/", "demo", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "example", ".", "com", "\\\\", "r", "\\\\", "n", "Connect", "ion", ":", " ", "Upgrade", "\\\\", "r", "\\\\", "n", "Sec", "-", "Web", "Sock", "et", "-", "Key", "2", ":", " ", "129", "98", " ", "5", " ", "Y", "3", " ", "1", " ", " ", ".", "P0", "0", "\\\\", "r", "\\\\", "n", "Sec", "-", "Web", "Sock", "et", "-", "Proto", "col", ":", " ", "sample", "\\\\", "r", "\\\\", "n", "Upgrade", ":", " ", "Web", "Sock", "et", "\\\\", "r", "\\\\", "n", "Sec", "-", "Web", "Sock", "et", "-", "Key", "1", ":", " ", "4", " ", "@", "1", " ", " ", "465", "4", "6", "x", "W", "%", "0", "l", " ", "1", " ", "5", "\\\\", "r", "\\\\", "n", "Orig", "in", ":", " ", "http", "://", "example", ".", "com", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "^", "n", ":", "ds", "[", "4", "U", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "open", "Handsha", "ke", "Timeout_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "\\u", "connecti", "on", "Made", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "data_", "=_", "http", "\\u", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "process", "Handsha", "ke_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "b", "\"", "HTTP", "/", "1.1", " ", "400", "\"_", ",_", "t_", "._", "\\u", "written_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "b", "\"", "Hi", "xi", "e7", "6", " ", "protoc", "ol", " ", "not", " ", "support", "ed", "\"_", ",_", "t_", "._", "\\u", "written_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
brosner/django-mailer/mailer/engine.py
[ { "content": "def send_all():\n \"\"\"\n Send all eligible messages in the queue.\n \"\"\"\n \n lock = FileLock(\"send_mail\")\n \n logging.debug(\"acquiring lock...\")\n try:\n lock.acquire(LOCK_WAIT_TIMEOUT)\n except AlreadyLocked:\n logging.debug(\"lock already in place. quitting.\")\n return\n except LockTimeout:\n logging.debug(\"waiting for the lock timed out. quitting.\")\n return\n logging.debug(\"acquired.\")\n \n start_time = time.time()\n \n dont_send = 0\n deferred = 0\n sent = 0\n \n try:\n for message in prioritize():\n if DontSendEntry.objects.has_address(message.to_address):\n logging.info(\"skipping email to %s as on don't send list \" % message.to_address.encode(\"utf-8\"))\n MessageLog.objects.log(message, 2) # @@@ avoid using literal result code\n message.delete()\n dont_send += 1\n else:\n try:\n logging.info(\"sending message '%s' to %s\" % (message.subject.encode(\"utf-8\"), message.to_address.encode(\"utf-8\")))\n core_send_mail(message.subject, message.message_body, message.from_address, [message.to_address])\n MessageLog.objects.log(message, 1) # @@@ avoid using literal result code\n message.delete()\n sent += 1\n except (socket_error, smtplib.SMTPSenderRefused, smtplib.SMTPRecipientsRefused, smtplib.SMTPAuthenticationError), err:\n message.defer()\n logging.info(\"message deferred due to failure: %s\" % err)\n MessageLog.objects.log(message, 3, log_message=str(err)) # @@@ avoid using literal result code\n deferred += 1\n finally:\n logging.debug(\"releasing lock...\")\n lock.release()\n logging.debug(\"released.\")\n \n logging.info(\"\")\n logging.info(\"%s sent; %s deferred; %s don't send\" % (sent, deferred, dont_send))\n logging.info(\"done in %.2f seconds\" % (time.time() - start_time))", "metadata": "root.send_all", "header": "['module', '___EOS___']", "index": 37 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "all", " ", "eligible", " ", "message", "s", " ", "in", " ", "the", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lock_", "=_", "File", "Lock_", "(_", "\"", "send", "\\u", "mail", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "acquir", "ing", " ", "lock", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock_", "._", "acquire_", "(_", "LOCK", "\\u", "WAIT", "\\u", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Al", "read", "y", "Locke", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "\"", "lock", " ", "alr", "ead", "y", " ", "in", " ", "place", ".", " ", "quit", "ting", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Lock", "Timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "\"", "wait", "ing", " ", "for", " ", "the", " ", "lock", " ", "timed", " ", "out", ".", " ", "quit", "ting", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "acquired", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "don", "t", "\\u", "send_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deferred_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "message_", "in_", "priorit", "ize_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Don", "t", "Sen", "d", "Entry_", "._", "objects_", "._", "has", "\\u", "address_", "(_", "message_", "._", "to", "\\u", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "skip", "ping", " ", "email", " ", "to", " ", "%", "s", " ", "as", " ", "on", " ", "don", "'", "t", " ", "send", " ", "list", " ", "\"_", "%_", "message_", "._", "to", "\\u", "address_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Messag", "e", "Log_", "._", "objects_", "._", "log_", "(_", "message_", ",_", "2_", ")_", "#", " ", "@@", "@", " ", "avoid", " ", "usi", "ng", " ", "literal", " ", "result", " ", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "t", "\\u", "send_", "+=_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logging_", "._", "info_", "(_", "\"", "sendin", "g", " ", "message", " ", "'%", "s", "'", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "message_", "._", "subject_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", ",_", "message_", "._", "to", "\\u", "address_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "core", "\\u", "send", "\\u", "mail_", "(_", "message_", "._", "subject_", ",_", "message_", "._", "message", "\\u", "body_", ",_", "message_", "._", "from", "\\u", "address_", ",_", "[_", "message_", "._", "to", "\\u", "address_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Messag", "e", "Log_", "._", "objects_", "._", "log_", "(_", "message_", ",_", "1_", ")_", "#", " ", "@@", "@", " ", "avoid", " ", "usi", "ng", " ", "literal", " ", "result", " ", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "socket", "\\u", "error_", ",_", "smtplib_", "._", "SMT", "PS", "ender", "Refu", "sed_", ",_", "smtplib_", "._", "SMT", "PR", "eci", "pie", "nts", "Refu", "sed_", ",_", "smtplib_", "._", "SMT", "PA", "uth", "entica", "tion", "Error_", ")_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "message_", "._", "defer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "message", " ", "defer", "red", " ", "due", " ", "to", " ", "fail", "ure", ":", " ", "%", "s", "\"_", "%_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Messag", "e", "Log_", "._", "objects_", "._", "log_", "(_", "message_", ",_", "3_", ",_", "log", "\\u", "message_", "=_", "str_", "(_", "err_", ")_", ")_", "#", " ", "@@", "@", " ", "avoid", " ", "usi", "ng", " ", "literal", " ", "result", " ", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deferred_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "\"", "rele", "asin", "g", " ", "lock", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "released", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"%", "s", " ", "sent", ";", " ", "%", "s", " ", "defer", "red", ";", " ", "%", "s", " ", "don", "'", "t", " ", "send", "\"_", "%_", "(_", "sent_", ",_", "deferred_", ",_", "don", "t", "\\u", "send_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "don", "e", " ", "in", " ", "%", ".2", "f", " ", "second", "s", "\"_", "%_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "start", "\\u", "time_", ")_", ")_", "\\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,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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 local variable
darcyliu/storyboard/boto/ec2/instance.py
[ { "content": " def terminate(self):\n \"\"\"\n Terminate the instance\n \"\"\"\n rs = self.connection.terminate_instances([self.id])\n if len(rs) > 0:\n self._update(rs[0])", "metadata": "root.Instance.terminate", "header": "['class', 'Instance', '(', 'TaggedEC2Object', ')', ':', '___EOS___']", "index": 295 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Instance_", "(_", "Tagg", "ed", "EC", "2", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "terminate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Terminate", " ", "the", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs_", "=_", "self_", "._", "connection_", "._", "terminate", "\\u", "instances_", "(_", "[_", "self_", "._", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "rs_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "update_", "(_", "rs_", "[_", "0_", "]_", ")_", "\\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 ]
Unused import
graphql-python/graphene/graphene/utils/tests/test_resolve_only_args.py
[ { "content": "from ..resolve_only_args import resolve_only_args\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_resolve_only_args():\n\n def resolver(*args, **kwargs):\n return kwargs\n\n my_data = {'one': 1, 'two': 2}\n\n wrapped = resolve_only_args(resolver)\n assert wrapped(None, my_data, None) == my_data", "metadata": "root.test_resolve_only_args", "header": "['module', '___EOS___']", "index": 3 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "._", "._", "resolve", "\\u", "only", "\\u", "args_", "import_", "resolve", "\\u", "only", "\\u", "args_", "\\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", "resolve", "\\u", "only", "\\u", "args_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "resolver_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "my", "\\u", "data_", "=_", "{_", "'", "one", "'_", ":_", "1_", ",_", "'", "two", "'_", ":_", "2_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wrapped_", "=_", "resolve", "\\u", "only", "\\u", "args_", "(_", "resolver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "wrapped_", "(_", "None_", ",_", "my", "\\u", "data_", ",_", "None_", ")_", "==_", "my", "\\u", "data_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
mne-tools/mne-python/examples/inverse/plot_covariance_whitening_dspm.py
[ { "content": "# doc:slow-example\n\"\"\"\n===================================================\nDemonstrate impact of whitening on source estimates\n===================================================\n\nThis example demonstrates the relationship between the noise covariance\nestimate and the MNE / dSPM source amplitudes. It computes source estimates for\nthe SPM faces data and compares proper regularization with insufficient\nregularization based on the methods described in [1]_. The example demonstrates\nthat improper regularization can lead to overestimation of source amplitudes.\nThis example makes use of the previous, non-optimized code path that was used\nbefore implementing the suggestions presented in [1]_. Please do not copy the\npatterns presented here for your own analysis, this is example is purely\nillustrative.\n\n.. note:: This example does quite a bit of processing, so even on a\n fast machine it can take a couple of minutes to complete.\n\nReferences\n----------\n.. [1] Engemann D. and Gramfort A. (2015) Automated model selection in\n covariance estimation and spatial whitening of MEG and EEG signals,\n vol. 108, 328-342, NeuroImage.\n\"\"\"\n# Author: Denis A. Engemann <[email protected]>\n#\n# License: BSD (3-clause)\n\nimport os\nimport os.path as op\n\nimport numpy as np\nfrom scipy.misc import imread\nimport matplotlib.pyplot as plt\n\nimport mne\nfrom mne import io\nfrom mne.datasets import spm_face\nfrom mne.minimum_norm import apply_inverse, make_inverse_operator\nfrom mne.cov import compute_covariance\n\nprint(__doc__)\n\n##############################################################################\n# Get data\n\ndata_path = spm_face.data_path()\nsubjects_dir = data_path + '/subjects'\n\nraw_fname = data_path + '/MEG/spm/SPM_CTF_MEG_example_faces%d_3D.ds'\n\nraw = io.read_raw_ctf(raw_fname % 1) # Take first run\n# To save time and memory for this demo, we'll just use the first\n# 2.5 minutes (all we need to get 30 total events) and heavily\n# resample 480->60 Hz (usually you wouldn't do either of these!)\nraw = raw.crop(0, 150.).load_data().resample(60, npad='auto')\n\npicks = mne.pick_types(raw.info, meg=True, exclude='bads')\nraw.filter(1, None, method='iir', n_jobs=1)\n\nevents = mne.find_events(raw, stim_channel='UPPT001')\n\nevent_ids = {\"faces\": 1, \"scrambled\": 2}\ntmin, tmax = -0.2, 0.5\nbaseline = None # no baseline as high-pass is applied\nreject = dict(mag=3e-12)\n\n# Make source space\n\ntrans = data_path + '/MEG/spm/SPM_CTF_MEG_example_faces1_3D_raw-trans.fif'\nsrc = mne.setup_source_space('spm', fname=None, spacing='oct6',\n subjects_dir=subjects_dir, add_dist=False)\nbem = data_path + '/subjects/spm/bem/spm-5120-5120-5120-bem-sol.fif'\nforward = mne.make_forward_solution(raw.info, trans, src, bem)\nforward = mne.convert_forward_solution(forward, surf_ori=True)\ndel src\n\n# inverse parameters\nconditions = 'faces', 'scrambled'\nsnr = 3.0\nlambda2 = 1.0 / snr ** 2\nmethod = 'dSPM'\nclim = dict(kind='value', lims=[0, 2.5, 5])\n\n###############################################################################\n# Estimate covariances\n\nsamples_epochs = 5, 15,\nmethod = 'empirical', 'shrunk'\ncolors = 'steelblue', 'red'\n\nevokeds = list()\nstcs = list()\nmethods_ordered = list()\nfor n_train in samples_epochs:\n # estimate covs based on a subset of samples\n # make sure we have the same number of conditions.\n events_ = np.concatenate([events[events[:, 2] == id_][:n_train]\n for id_ in [event_ids[k] for k in conditions]])\n epochs_train = mne.Epochs(raw, events_, event_ids, tmin, tmax, picks=picks,\n baseline=baseline, preload=True, reject=reject)\n epochs_train.equalize_event_counts(event_ids, copy=False)\n assert len(epochs_train) == 2 * n_train\n\n noise_covs = compute_covariance(\n epochs_train, method=method, tmin=None, tmax=0, # baseline only\n return_estimators=True) # returns list\n # prepare contrast\n evokeds = [epochs_train[k].average() for k in conditions]\n del epochs_train, events_\n # do contrast\n\n # We skip empirical rank estimation that we introduced in response to\n # the findings in reference [1] to use the naive code path that\n # triggered the behavior described in [1]. The expected true rank is\n # 274 for this dataset. Please do not do this with your data but\n # rely on the default rank estimator that helps regularizing the\n # covariance.\n stcs.append(list())\n methods_ordered.append(list())\n for cov in noise_covs:\n inverse_operator = make_inverse_operator(evokeds[0].info, forward,\n cov, loose=0.2, depth=0.8,\n rank=274)\n stc_a, stc_b = (apply_inverse(e, inverse_operator, lambda2, \"dSPM\",\n pick_ori=None) for e in evokeds)\n stc = stc_a - stc_b\n methods_ordered[-1].append(cov['method'])\n stcs[-1].append(stc)\n del inverse_operator, evokeds, cov, noise_covs, stc, stc_a, stc_b\ndel raw, forward # save some memory\n\n\n##############################################################################\n# Show the resulting source estimates\n\nfig, (axes1, axes2) = plt.subplots(2, 3, figsize=(9.5, 6))\n\n\n\n\nfor ni, (n_train, axes) in enumerate(zip(samples_epochs, (axes1, axes2))):\n # compute stc based on worst and best\n ax_dynamics = axes[1]\n for stc, ax, method, kind, color in zip(stcs[ni],\n axes[::2],\n methods_ordered[ni],\n ['best', 'worst'],\n colors):\n brain = stc.plot(subjects_dir=subjects_dir, hemi='both', clim=clim)\n brain.set_time(175)\n\n im = brain_to_mpl(brain)\n brain.close()\n del brain\n ax.axis('off')\n ax.get_xaxis().set_visible(False)\n ax.get_yaxis().set_visible(False)\n ax.imshow(im)\n ax.set_title('{0} ({1} epochs)'.format(kind, n_train * 2))\n\n # plot spatial mean\n stc_mean = stc.data.mean(0)\n ax_dynamics.plot(stc.times * 1e3, stc_mean,\n label='{0} ({1})'.format(method, kind),\n color=color)\n # plot spatial std\n stc_var = stc.data.std(0)\n ax_dynamics.fill_between(stc.times * 1e3, stc_mean - stc_var,\n stc_mean + stc_var, alpha=0.2, color=color)\n\n # signal dynamics worst and best\n ax_dynamics.set_title('{0} epochs'.format(n_train * 2))\n ax_dynamics.set_xlabel('Time (ms)')\n ax_dynamics.set_ylabel('Source Activation (dSPM)')\n ax_dynamics.set_xlim(tmin * 1e3, tmax * 1e3)\n ax_dynamics.set_ylim(-3, 3)\n ax_dynamics.legend(loc='upper left', fontsize=10)\n\nfig.subplots_adjust(hspace=0.4, left=0.03, right=0.98, wspace=0.07)\nfig.canvas.draw()\nfig.show()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def brain_to_mpl(brain):\n \"\"\"convert image to be usable with matplotlib\"\"\"\n tmp_path = op.abspath(op.join(op.curdir, 'my_tmp'))\n brain.save_imageset(tmp_path, views=['ven'])\n im = imread(tmp_path + '_ven.png')\n os.remove(tmp_path + '_ven.png')\n return im", "metadata": "root.brain_to_mpl", "header": "['module', '___EOS___']", "index": 140 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "doc", ":", "slow", "-", "example_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "==============", "==============", "==============", "=========", "\\", "10", ";", "Demo", "nstr", "ate", " ", "impact", " ", "of", " ", "whiten", "ing", " ", "on", " ", "source", " ", "estimate", "s", "\\", "10", ";", "==============", "==============", "==============", "=========", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "example", " ", "demonstrat", "es", " ", "the", " ", "relation", "ship", " ", "bet", "ween", " ", "the", " ", "noise", " ", "covariance", "\\", "10", ";", "estimate", " ", "and", " ", "the", " ", "MN", "E", " ", "/", " ", "d", "SP", "M", " ", "source", " ", "amplitude", "s", ".", " ", "It", " ", "compute", "s", " ", "source", " ", "estimate", "s", " ", "for", "\\", "10", ";", "the", " ", "SP", "M", " ", "face", "s", " ", "data", " ", "and", " ", "compare", "s", " ", "proper", " ", "regularization", " ", "with", " ", "insuf", "ficient", "\\", "10", ";", "regularization", " ", "based", " ", "on", " ", "the", " ", "method", "s", " ", "descri", "bed", " ", "in", " ", "[", "1", "]\\u", ".", " ", "The", " ", "example", " ", "demonstrat", "es", "\\", "10", ";", "tha", "t", " ", "impro", "per", " ", "regularization", " ", "can", " ", "lead", " ", "to", " ", "over", "estimati", "on", " ", "of", " ", "source", " ", "amplitude", "s", ".", "\\", "10", ";", "Thi", "s", " ", "example", " ", "make", "s", " ", "use", " ", "of", " ", "the", " ", "previ", "ous", ",", " ", "non", "-", "optimize", "d", " ", "code", " ", "path", " ", "tha", "t", " ", "was", " ", "used", "\\", "10", ";", "bef", "ore", " ", "implement", "ing", " ", "the", " ", "suggestions", " ", "presente", "d", " ", "in", " ", "[", "1", "]\\u", ".", " ", "Ple", "ase", " ", "do", " ", "not", " ", "copy", " ", "the", "\\", "10", ";", "pattern", "s", " ", "presente", "d", " ", "here", " ", "for", " ", "your", " ", "own", " ", "analys", "is", ",", " ", "this", " ", "is", " ", "example", " ", "is", " ", "pure", "ly", "\\", "10", ";", "illust", "rati", "ve", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "note", "::", " ", "Thi", "s", " ", "example", " ", "doe", "s", " ", "quite", " ", "a", " ", "bit", " ", "of", " ", "process", "ing", ",", " ", "so", " ", "even", " ", "on", " ", "a", "\\", "10", ";", " ", " ", "fast", " ", "machine", " ", "it", " ", "can", " ", "take", " ", "a", " ", "couple", " ", "of", " ", "minute", "s", " ", "to", " ", "complete", ".", "\\", "10", ";", "\\", "10", ";", "Reference", "s", "\\", "10", ";", "----------", "\\", "10", ";", "..", " ", "[", "1", "]", " ", "Eng", "eman", "n", " ", "D", ".", " ", "and", " ", "Gram", "fort", " ", "A", ".", " ", "(", "201", "5", ")", " ", "Automat", "ed", " ", "model", " ", "selection", " ", "in", "\\", "10", ";", " ", " ", " ", "covariance", " ", "estimati", "on", " ", "and", " ", "spat", "ial", " ", "whiten", "ing", " ", "of", " ", "ME", "G", " ", "and", " ", "EE", "G", " ", "signal", "s", ",", "\\", "10", ";", " ", " ", " ", "vol", ".", " ", "108", ",", " ", "328", "-", "342", ",", " ", "Neu", "ro", "Image", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Author", ":", " ", "Den", "is", " ", "A", ".", " ", "Eng", "eman", "n", " ", "<", "deni", "s", ".", "enge", "man", "n", "@", "gma", "il", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "BS", "D", " ", "(", "3", "-", "clause", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "as_", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "misc_", "import_", "imread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mne", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mne", "_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mne", "_", "._", "datasets_", "import_", "spm", "\\u", "face_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mne", "_", "._", "minim", "um", "\\u", "norm_", "import_", "appl", "y", "\\u", "inverse_", ",_", "make", "\\u", "inv", "erse", "\\u", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mne", "_", "._", "cov_", "import_", "compute", "\\u", "covariance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\\u\\u", "doc\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "path_", "=_", "spm", "\\u", "face_", "._", "data\\u", "path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject", "s", "\\u", "dir_", "=_", "data\\u", "path_", "+_", "'/", "subject", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raw", "\\u", "fname_", "=_", "data\\u", "path_", "+_", "'/", "ME", "G", "/", "spm", "/", "SP", "M", "\\u", "CT", "F", "\\u", "ME", "G", "\\u", "example", "\\u", "face", "s", "%", "d\\u", "3", "D", ".", "ds", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raw_", "=_", "io_", "._", "read", "\\u", "raw", "\\u", "ctf", "_", "(_", "raw", "\\u", "fname_", "%_", "1_", ")_", "#", " ", "Tak", "e", " ", "first", " ", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "To", " ", "save", " ", "time", " ", "and", " ", "memory", " ", "for", " ", "this", " ", "demo", ",", " ", "we", "'", "ll", " ", "just", " ", "use", " ", "the", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2.5", " ", "minute", "s", " ", "(", "all", " ", "we", " ", "need", " ", "to", " ", "get", " ", "30", " ", "total", " ", "events", ")", " ", "and", " ", "heav", "il", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "resample", " ", "480", "->", "60", " ", "H", "z", " ", "(", "usual", "ly", " ", "you", " ", "wou", "ld", "n", "'", "t", " ", "do", " ", "eit", "her", " ", "of", " ", "these", "!)", "_", "\\u\\u\\uNL\\u\\u\\u_", "raw_", "=_", "raw_", "._", "crop_", "(_", "0_", ",_", "150", "._", ")_", "._", "load", "\\u", "data_", "(_", ")_", "._", "resample_", "(_", "60_", ",_", "npa", "d_", "=_", "'", "auto", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "picks", "_", "=_", "mne", "_", "._", "pick", "\\u", "types_", "(_", "raw_", "._", "info_", ",_", "me", "g_", "=_", "True_", ",_", "exclude_", "=_", "'", "bad", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw_", "._", "filter_", "(_", "1_", ",_", "None_", ",_", "method_", "=_", "'", "ii", "r", "'_", ",_", "n", "\\u", "jobs_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "events_", "=_", "mne", "_", "._", "find", "\\u", "events_", "(_", "raw_", ",_", "stim", "\\u", "channel_", "=_", "'", "UP", "PT", "001", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "ids_", "=_", "{_", "\"", "face", "s", "\"_", ":_", "1_", ",_", "\"", "scra", "mble", "d", "\"_", ":_", "2_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmin_", ",_", "tmax_", "=_", "-_", "0.2_", ",_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baseline_", "=_", "None_", "#", " ", "no", " ", "baseline", " ", "as", " ", "high", "-", "pass", " ", "is", " ", "applied", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reject_", "=_", "dict_", "(_", "mag_", "=_", "3e", "-1", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "source", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trans_", "=_", "data\\u", "path_", "+_", "'/", "ME", "G", "/", "spm", "/", "SP", "M", "\\u", "CT", "F", "\\u", "ME", "G", "\\u", "example", "\\u", "face", "s1", "\\u", "3", "D", "\\u", "raw", "-", "trans", ".", "fi", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "mne", "_", "._", "setup", "\\u", "source", "\\u", "space_", "(_", "'", "spm", "'_", ",_", "fname_", "=_", "None_", ",_", "spacing_", "=_", "'", "oct", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subject", "s", "\\u", "dir_", "=_", "subject", "s", "\\u", "dir_", ",_", "add", "\\u", "dist_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bem", "_", "=_", "data\\u", "path_", "+_", "'/", "subject", "s", "/", "spm", "/", "bem", "/", "spm", "-", "512", "0", "-", "512", "0", "-", "512", "0", "-", "bem", "-", "sol", ".", "fi", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forward_", "=_", "mne", "_", "._", "make", "\\u", "forward", "\\u", "solution_", "(_", "raw_", "._", "info_", ",_", "trans_", ",_", "src_", ",_", "bem", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forward_", "=_", "mne", "_", "._", "convert", "\\u", "forward", "\\u", "solution_", "(_", "forward_", ",_", "surf", "\\u", "ori_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "src_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inv", "erse", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "conditions_", "=_", "'", "face", "s", "'_", ",_", "'", "scra", "mble", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snr_", "=_", "3.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lambda", "2_", "=_", "1.0_", "/_", "snr_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "'", "d", "SP", "M", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clim", "_", "=_", "dict_", "(_", "kind_", "=_", "'", "value", "'_", ",_", "lims_", "=_", "[_", "0_", ",_", "2.5_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Estimat", "e", " ", "covariance", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "samples", "\\u", "epochs_", "=_", "5_", ",_", "15_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "'", "empir", "ical", "'_", ",_", "'", "shr", "unk", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "'", "steel", "blue", "'_", ",_", "'", "red", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "evo", "ked", "s_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stc", "s_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "s", "\\u", "ordered_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n", "\\u", "train_", "in_", "samples", "\\u", "epochs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "estimate", " ", "cov", "s", " ", "based", " ", "on", " ", "a", " ", "subse", "t", " ", "of", " ", "samples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", " ", "have", " ", "the", " ", "same", " ", "number", " ", "of", " ", "condition", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events", "\\u_", "=_", "np_", "._", "concatenate_", "(_", "[_", "events_", "[_", "events_", "[_", ":_", ",_", "2_", "]_", "==_", "id\\u_", "]_", "[_", ":_", "n", "\\u", "train_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "id\\u_", "in_", "[_", "event", "\\u", "ids_", "[_", "k_", "]_", "for_", "k_", "in_", "conditions_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epoch", "s", "\\u", "train_", "=_", "mne", "_", "._", "Epoch", "s_", "(_", "raw_", ",_", "events", "\\u_", ",_", "event", "\\u", "ids_", ",_", "tmin_", ",_", "tmax_", ",_", "picks", "_", "=_", "picks", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "baseline_", "=_", "baseline_", ",_", "prelo", "ad_", "=_", "True_", ",_", "reject_", "=_", "reject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epoch", "s", "\\u", "train_", "._", "equal", "ize", "\\u", "event", "\\u", "counts_", "(_", "event", "\\u", "ids_", ",_", "copy_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "epoch", "s", "\\u", "train_", ")_", "==_", "2_", "*_", "n", "\\u", "train_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "noise", "\\u", "cov", "s_", "=_", "compute", "\\u", "covariance_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "epoch", "s", "\\u", "train_", ",_", "method_", "=_", "method_", ",_", "tmin_", "=_", "None_", ",_", "tmax_", "=_", "0_", ",_", "#", " ", "baseline", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "estimators_", "=_", "True_", ")_", "#", " ", "return", "s", " ", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prepar", "e", " ", "contrast", "_", "\\u\\u\\uNL\\u\\u\\u_", "evo", "ked", "s_", "=_", "[_", "epoch", "s", "\\u", "train_", "[_", "k_", "]_", "._", "average_", "(_", ")_", "for_", "k_", "in_", "conditions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "epoch", "s", "\\u", "train_", ",_", "events", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "contrast", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "skip", " ", "empir", "ical", " ", "rank", " ", "estimati", "on", " ", "tha", "t", " ", "we", " ", "introduce", "d", " ", "in", " ", "response", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "finding", "s", " ", "in", " ", "reference", " ", "[", "1", "]", " ", "to", " ", "use", " ", "the", " ", "naive", " ", "code", " ", "path", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trigger", "ed", " ", "the", " ", "behavior", " ", "descri", "bed", " ", "in", " ", "[", "1", "].", " ", "The", " ", "expected", " ", "true", " ", "rank", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "274", " ", "for", " ", "this", " ", "dataset", ".", " ", "Ple", "ase", " ", "do", " ", "not", " ", "do", " ", "this", " ", "with", " ", "your", " ", "data", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rely", " ", "on", " ", "the", " ", "default", " ", "rank", " ", "esti", "mat", "or", " ", "tha", "t", " ", "helps", " ", "regulari", "zin", "g", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "covariance", "._", "\\u\\u\\uNL\\u\\u\\u_", "stc", "s_", "._", "append_", "(_", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "s", "\\u", "ordered_", "._", "append_", "(_", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cov_", "in_", "noise", "\\u", "cov", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inv", "erse", "\\u", "operator_", "=_", "make", "\\u", "inv", "erse", "\\u", "operator_", "(_", "evo", "ked", "s_", "[_", "0_", "]_", "._", "info_", ",_", "forward_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cov_", ",_", "loose", "_", "=_", "0.2_", ",_", "depth_", "=_", "0.8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rank_", "=_", "274", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stc", "\\u", "a_", ",_", "stc", "\\u", "b_", "=_", "(_", "appl", "y", "\\u", "inverse_", "(_", "e_", ",_", "inv", "erse", "\\u", "operator_", ",_", "lambda", "2_", ",_", "\"", "d", "SP", "M", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pick", "\\u", "ori_", "=_", "None_", ")_", "for_", "e_", "in_", "evo", "ked", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stc_", "=_", "stc", "\\u", "a_", "-_", "stc", "\\u", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "s", "\\u", "ordered_", "[_", "-_", "1_", "]_", "._", "append_", "(_", "cov_", "[_", "'", "method", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stc", "s_", "[_", "-_", "1_", "]_", "._", "append_", "(_", "stc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "inv", "erse", "\\u", "operator_", ",_", "evo", "ked", "s_", ",_", "cov_", ",_", "noise", "\\u", "cov", "s_", ",_", "stc_", ",_", "stc", "\\u", "a_", ",_", "stc", "\\u", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "raw_", ",_", "forward_", "#", " ", "save", " ", "some", " ", "memory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", " ", "the", " ", "result", "ing", " ", "source", " ", "estimate", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "(_", "axes", "1_", ",_", "axes", "2_", ")_", "=_", "plt_", "._", "subplots_", "(_", "2_", ",_", "3_", ",_", "figsize_", "=_", "(_", "9.5", "_", ",_", "6_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "for_", "ni_", ",_", "(_", "n", "\\u", "train_", ",_", "axes_", ")_", "in_", "enumerate_", "(_", "zip_", "(_", "samples", "\\u", "epochs_", ",_", "(_", "axes", "1_", ",_", "axes", "2_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "compute", " ", "stc", " ", "based", " ", "on", " ", "worst", " ", "and", " ", "best_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax", "\\u", "dynamics", "_", "=_", "axes_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "stc_", ",_", "ax_", ",_", "method_", ",_", "kind_", ",_", "color_", "in_", "zip_", "(_", "stc", "s_", "[_", "ni_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axes_", "[_", ":_", ":_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method", "s", "\\u", "ordered_", "[_", "ni_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "best", "'_", ",_", "'", "worst", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "brain_", "=_", "stc_", "._", "plot_", "(_", "subject", "s", "\\u", "dir_", "=_", "subject", "s", "\\u", "dir_", ",_", "hemi", "_", "=_", "'", "bot", "h", "'_", ",_", "clim", "_", "=_", "clim", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "brain_", "._", "set\\u", "time_", "(_", "175_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "im_", "=_", "brain", "\\u", "to", "\\u", "mpl_", "(_", "brain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "brain_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "brain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "axis_", "(_", "'", "off", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "get", "\\u", "xaxis_", "(_", ")_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "get", "\\u", "yaxis_", "(_", ")_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "imshow_", "(_", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "title_", "(_", "'{", "0", "}", " ", "({", "1", "}", " ", "epoch", "s", ")'_", "._", "format_", "(_", "kind_", ",_", "n", "\\u", "train_", "*_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plot", " ", "spat", "ial", " ", "mean_", "\\u\\u\\uNL\\u\\u\\u_", "stc", "\\u", "mean_", "=_", "stc_", "._", "data_", "._", "mean_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "\\u", "dynamics", "_", "._", "plot_", "(_", "stc_", "._", "times_", "*_", "1e3_", ",_", "stc", "\\u", "mean_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "'{", "0", "}", " ", "({", "1", "})'_", "._", "format_", "(_", "method_", ",_", "kind_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plot", " ", "spat", "ial", " ", "std_", "\\u\\u\\uNL\\u\\u\\u_", "stc", "\\u", "var_", "=_", "stc_", "._", "data_", "._", "std_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "\\u", "dynamics", "_", "._", "fill", "\\u", "between_", "(_", "stc_", "._", "times_", "*_", "1e3_", ",_", "stc", "\\u", "mean_", "-_", "stc", "\\u", "var_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stc", "\\u", "mean_", "+_", "stc", "\\u", "var_", ",_", "alpha_", "=_", "0.2_", ",_", "color_", "=_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "signal", " ", "dynamics", " ", "worst", " ", "and", " ", "best_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ax", "\\u", "dynamics", "_", "._", "set\\u", "title_", "(_", "'{", "0", "}", " ", "epoch", "s", "'_", "._", "format_", "(_", "n", "\\u", "train_", "*_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "\\u", "dynamics", "_", "._", "set\\u", "xlabel_", "(_", "'", "Time", " ", "(", "ms", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "\\u", "dynamics", "_", "._", "set\\u", "ylabel_", "(_", "'", "Sou", "rce", " ", "Activat", "ion", " ", "(", "d", "SP", "M", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "\\u", "dynamics", "_", "._", "set\\u", "xlim_", "(_", "tmin_", "*_", "1e3_", ",_", "tmax_", "*_", "1e3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "\\u", "dynamics", "_", "._", "set\\u", "ylim_", "(_", "-_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "\\u", "dynamics", "_", "._", "legend_", "(_", "loc_", "=_", "'", "upper", " ", "left", "'_", ",_", "fontsize_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fig_", "._", "subplot", "s", "\\u", "adjust_", "(_", "hspace", "_", "=_", "0.4_", ",_", "left_", "=_", "0.03_", ",_", "right_", "=_", "0.98", "_", ",_", "wsp", "ace_", "=_", "0.07_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "._", "canvas_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "._", "show_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "brain", "\\u", "to", "\\u", "mpl_", "(_", "brain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "convert", " ", "image", " ", "to", " ", "be", " ", "usable", " ", "with", " ", "mat", "plotlib", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "path_", "=_", "op_", "._", "abspath_", "(_", "op_", "._", "join_", "(_", "op_", "._", "curdir_", ",_", "'", "my", "\\u", "tmp", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "brain_", "._", "save", "\\u", "images", "et_", "(_", "tmp", "\\u", "path_", ",_", "views_", "=_", "[_", "'", "ven", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im_", "=_", "imread_", "(_", "tmp", "\\u", "path_", "+_", "'\\u", "ven", ".", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "tmp", "\\u", "path_", "+_", "'\\u", "ven", ".", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "im_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Except block handles 'BaseException'
AmmsA/theresumator/scripts/create_baseuser.py
[ { "content": "from django.db.utils import OperationalError\nfrom solo.admin import SingletonModelAdmin\n\nfrom resumator.models import BasicInformation\nfrom resumator.models import Settings\n\n# make BasicInformation singleton if it does not already exist\ntry:\n basic_information = BasicInformation.get_solo()\nexcept OperationalError:\n pass\n\n# make setting singleton if it does not already exist\ntry:\n settings = Settings.get_solo()\nexcept OperationalError:\n pass\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "utils_", "import_", "Opera", "tion", "al", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "solo", "_", "._", "admin_", "import_", "Singleton", "Model", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "resum", "ator_", "._", "models_", "import_", "Basic", "Information_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "resum", "ator_", "._", "models_", "import_", "Settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "Basic", "Information", " ", "singleton", " ", "if", " ", "it", " ", "doe", "s", " ", "not", " ", "alr", "ead", "y", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basic", "\\u", "information_", "=_", "Basic", "Information_", "._", "get", "\\u", "solo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Opera", "tion", "al", "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_", "#", " ", "make", " ", "setti", "ng", " ", "singleton", " ", "if", " ", "it", " ", "doe", "s", " ", "not", " ", "alr", "ead", "y", " ", "exist_", "\\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 ", " _", "settings_", "=_", "Settings_", "._", "get", "\\u", "solo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Opera", "tion", "al", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
arista-eosplus/pyeapi/pyeapi/eapilib.py
[ { "content": " def execute(self, commands, encoding='json', **kwargs):\n \"\"\"Executes the list of commands on the destination node\n\n This method takes a list of commands and sends them to the\n destination node, returning the results. The execute method handles\n putting the destination node in enable mode and will pass the\n enable password, if required.\n\n Args:\n commands (list): A list of commands to execute on the remote node\n encoding (string): The encoding to send along with the request\n message to the destination node. Valid values include 'json'\n or 'text'. This argument will influence the response object\n encoding\n **kwargs: Arbitrary keyword arguments\n\n Returns:\n A decoded response message as a native Python dictionary object\n that has been deserialized from JSON.\n\n Raises:\n CommandError: A CommandError is raised that includes the error\n code, error message along with the list of commands that were\n sent to the node. The exception instance is also stored in\n the error property and is availble until the next request is\n sent\n \"\"\"\n if encoding not in ('json', 'text'):\n raise TypeError('encoding must be one of [json, text]')\n\n try:\n self.error = None\n request = self.request(commands, encoding=encoding, **kwargs)\n response = self.send(request)\n return response\n\n except(ConnectionError, CommandError, TypeError) as exc:\n exc.commands = commands\n self.error = exc\n raise", "metadata": "root.EapiConnection.execute", "header": "['class', 'EapiConnection', '(', 'object', ')', ':', '___EOS___']", "index": 441 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Ea", "pi", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "commands_", ",_", "encoding_", "=_", "'", "json", "'_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Execut", "es", " ", "the", " ", "list", " ", "of", " ", "command", "s", " ", "on", " ", "the", " ", "destinat", "ion", " ", "node", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "take", "s", " ", "a", " ", "list", " ", "of", " ", "command", "s", " ", "and", " ", "send", "s", " ", "them", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "destinat", "ion", " ", "node", ",", " ", "return", "ing", " ", "the", " ", "results", ".", " ", " ", "The", " ", "execute", " ", "method", " ", "handle", "s", "\\", "10", ";", " ", " ", " ", " ", "put", "ting", " ", "the", " ", "destinat", "ion", " ", "node", " ", "in", " ", "enable", " ", "mode", " ", "and", " ", "will", " ", "pass", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "enable", " ", "password", ",", " ", "if", " ", "require", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "command", "s", " ", "(", "list", "):", " ", "A", " ", "list", " ", "of", " ", "command", "s", " ", "to", " ", "execute", " ", "on", " ", "the", " ", "remote", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "encoding", " ", "(", "string", "):", " ", "The", " ", "encoding", " ", "to", " ", "send", " ", "along", " ", "with", " ", "the", " ", "request", "\\", "10", ";", " ", " ", " ", " ", "message", " ", "to", " ", "the", " ", "destinat", "ion", " ", "node", ".", " ", " ", "Valid", " ", "values", " ", "include", " ", "'", "json", "'", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "'", "text", "'.", " ", " ", "Thi", "s", " ", "argu", "ment", " ", "will", " ", "influence", " ", "the", " ", "response", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "**", "kwarg", "s", ":", " ", "Arbit", "rar", "y", " ", "keyw", "ord", " ", "argu", "ment", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "decode", "d", " ", "response", " ", "message", " ", "as", " ", "a", " ", "nativ", "e", " ", "Pyth", "on", " ", "dictionar", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "has", " ", "bee", "n", " ", "deserialized", " ", "from", " ", "JSO", "N", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Command", "Error", ":", " ", " ", "A", " ", "Command", "Error", " ", "is", " ", "raise", "d", " ", "tha", "t", " ", "include", "s", " ", "the", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "code", ",", " ", "error", " ", "message", " ", "along", " ", "with", " ", "the", " ", "list", " ", "of", " ", "command", "s", " ", "tha", "t", " ", "wer", "e", "\\", "10", ";", " ", " ", " ", " ", "sent", " ", "to", " ", "the", " ", "node", ".", " ", " ", "The", " ", "exception", " ", "instance", " ", "is", " ", "als", "o", " ", "store", "d", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "error", " ", "property", " ", "and", " ", "is", " ", "avail", "ble", " ", "unti", "l", " ", "the", " ", "next", " ", "request", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "sent", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "encoding_", "not_", "in_", "(_", "'", "json", "'_", ",_", "'", "text", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "encoding", " ", "must", " ", "be", " ", "one", " ", "of", " ", "[", "json", ",", " ", "text", "]'_", ")_", "\\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_", "._", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "request_", "(_", "commands_", ",_", "encoding_", "=_", "encoding_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "send_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Connect", "ion", "Error_", ",_", "Command", "Error_", ",_", "Type", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc_", "._", "commands_", "=_", "commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error_", "=_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
adamb70/CSGO-Market-Float-Finder/pysteamkit/vdf.py
[ { "content": "def _parse(stream, ptr = 0):\n\ti = ptr\n\tlaststr = None\n\tlasttok = None\n\tdeserialized = {}\n\n\twhile i < len(stream):\n\t\tc = stream[i]\n\n\t\tif c == STRING:\n\t\t\tstring, i = _symtostr(stream, i)\n\t\t\tif lasttok == STRING:\n\t\t\t\tdeserialized[laststr] = string\n\t\t\tlaststr = string\n\t\telif c == NODE_OPEN:\n\t\t\tdeserialized[laststr], i = _parse(stream, i + 1)\n\t\telif c == NODE_CLOSE:\n\t\t\treturn deserialized, i\n\t\telif c == COMMENT:\n\t\t\tif (i + 1) < len(stream) and stream[i + 1] == '/':\n\t\t\t\ti = stream.find('\\n', i)\n\t\telif c == CR or c == LF:\n\t\t\tni = i + 1\n\t\t\tif ni < len(stream) and stream[ni] == LF:\n\t\t\t\ti = ni\n\t\t\tif lasttok != LF:\n\t\t\t\tc = LF\n\t\telse:\n\t\t\tc = lasttok\n\n\t\tlasttok = c\n\t\ti += 1\n\n\treturn deserialized, i", "metadata": "root._parse", "header": "['module', '___EOS___']", "index": 55 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse_", "(_", "stream_", ",_", "ptr_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "i_", "=_", "ptr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lasts", "tr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "tok_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deserialized_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "i_", "<_", "len_", "(_", "stream_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "c_", "=_", "stream_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "c_", "==_", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "string_", ",_", "i_", "=_", "\\u", "symt", "ostr", "_", "(_", "stream_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "tok_", "==_", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "deserialized_", "[_", "lasts", "tr_", "]_", "=_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lasts", "tr_", "=_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "c_", "==_", "NODE", "\\u", "OPEN_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "deserialized_", "[_", "lasts", "tr_", "]_", ",_", "i_", "=_", "\\u", "parse_", "(_", "stream_", ",_", "i_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "c_", "==_", "NODE", "\\u", "CLOSE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "deserialized_", ",_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "c_", "==_", "COMMENT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "(_", "i_", "+_", "1_", ")_", "<_", "len_", "(_", "stream_", ")_", "and_", "stream_", "[_", "i_", "+_", "1_", "]_", "==_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "i_", "=_", "stream_", "._", "find_", "(_", "'\\\\", "n", "'_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "c_", "==_", "CR", "_", "or_", "c_", "==_", "LF", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ni_", "=_", "i_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ni_", "<_", "len_", "(_", "stream_", ")_", "and_", "stream_", "[_", "ni_", "]_", "==_", "LF", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "i_", "=_", "ni_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "last", "tok_", "!=_", "LF", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "c_", "=_", "LF", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "c_", "=_", "last", "tok_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "tok_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "deserialized_", ",_", "i_", "\\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 ]
Unused import
AppScale/appscale-tools/test/test_factory.py
[ { "content": "#!/usr/bin/env python\n# Programmer: Chris Bunch ([email protected])\n\n\n# General-purpose Python library imports\nimport os\nimport sys\nimport unittest\n\n\n# AppScale import, the library that we're testing here\nlib = os.path.dirname(__file__) + os.sep + \"..\" + os.sep + \"lib\"\nsys.path.append(lib)\nfrom agents.factory import InfrastructureAgentFactory\nfrom custom_exceptions import UnknownInfrastructureException\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestFactory(unittest.TestCase):\n\n", "metadata": "root.TestFactory", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def test_bad_agent_name(self):\n # Passing in an invalid agent name should raise an exception.\n self.assertRaises(UnknownInfrastructureException,\n InfrastructureAgentFactory.create_agent, 'bad agent name')", "metadata": "root.TestFactory.test_bad_agent_name", "header": "['class', 'TestFactory', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 20 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Programm", "er", ":", " ", "Chr", "is", " ", "Bun", "ch", " ", "(", "chris", "@", "apps", "cale", ".", "com", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", "-", "purpose", " ", "Pyth", "on", " ", "librar", "y", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "App", "Scale", " ", "import", ",", " ", "the", " ", "librar", "y", " ", "tha", "t", " ", "we", "'", "re", " ", "testi", "ng", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "lib_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "+_", "os_", "._", "sep_", "+_", "\"..\"_", "+_", "os_", "._", "sep_", "+_", "\"", "lib", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "agents_", "._", "factory_", "import_", "Infra", "structure", "Agent", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom", "\\u", "exceptions_", "import_", "Un", "know", "n", "Infra", "structure", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Factory_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Factory_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "bad", "\\u", "agent", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Passi", "ng", " ", "in", " ", "an", " ", "invalid", " ", "agent", " ", "name", " ", "shou", "ld", " ", "raise", " ", "an", " ", "exception", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Un", "know", "n", "Infra", "structure", "Exception_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Infra", "structure", "Agent", "Factory_", "._", "create", "\\u", "agent_", ",_", "'", "bad", " ", "agent", " ", "name", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ralphm/idavoll/idavoll/pgsql_storage.py
[ { "content": "# Copyright (c) Ralph Meijer.\n# See LICENSE for details.\n\nimport copy\n\nfrom zope.interface import implements\n\nfrom twisted.words.protocols.jabber import jid\n\nfrom wokkel.generic import parseXml, stripNamespace\nfrom wokkel.pubsub import Subscription\n\nfrom idavoll import error, iidavoll\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Storage:\n\n implements(iidavoll.IStorage)\n\n defaultConfig = {\n 'leaf': {\n \"pubsub#persist_items\": True,\n \"pubsub#deliver_payloads\": True,\n \"pubsub#send_last_published_item\": 'on_sub',\n },\n 'collection': {\n \"pubsub#deliver_payloads\": True,\n \"pubsub#send_last_published_item\": 'on_sub',\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.Storage", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __init__(self, dbpool):\n self.dbpool = dbpool", "metadata": "root.Storage.__init__", "header": "['class', 'Storage', ':', '___EOS___']", "index": 30 }, { "content": " def getNode(self, nodeIdentifier):\n return self.dbpool.runInteraction(self._getNode, nodeIdentifier)", "metadata": "root.Storage.getNode", "header": "['class', 'Storage', ':', '___EOS___']", "index": 34 }, { "content": " def _getNode(self, cursor, nodeIdentifier):\n configuration = {}\n cursor.execute(\"\"\"SELECT node_type,\n persist_items,\n deliver_payloads,\n send_last_published_item\n FROM nodes\n WHERE node=%s\"\"\",\n (nodeIdentifier,))\n row = cursor.fetchone()\n\n if not row:\n raise error.NodeNotFound()\n\n if row.node_type == 'leaf':\n configuration = {\n 'pubsub#persist_items': row.persist_items,\n 'pubsub#deliver_payloads': row.deliver_payloads,\n 'pubsub#send_last_published_item':\n row.send_last_published_item}\n node = LeafNode(nodeIdentifier, configuration)\n node.dbpool = self.dbpool\n return node\n elif row.node_type == 'collection':\n configuration = {\n 'pubsub#deliver_payloads': row.deliver_payloads,\n 'pubsub#send_last_published_item':\n row.send_last_published_item}\n node = CollectionNode(nodeIdentifier, configuration)\n node.dbpool = self.dbpool\n return node", "metadata": "root.Storage._getNode", "header": "['class', 'Storage', ':', '___EOS___']", "index": 38 }, { "content": " def getNodeIds(self):\n d = self.dbpool.runQuery(\"\"\"SELECT node from nodes\"\"\")\n d.addCallback(lambda results: [r[0] for r in results])\n return d", "metadata": "root.Storage.getNodeIds", "header": "['class', 'Storage', ':', '___EOS___']", "index": 72 }, { "content": " def createNode(self, nodeIdentifier, owner, config):\n return self.dbpool.runInteraction(self._createNode, nodeIdentifier,\n owner, config)", "metadata": "root.Storage.createNode", "header": "['class', 'Storage', ':', '___EOS___']", "index": 78 }, { "content": " def _createNode(self, cursor, nodeIdentifier, owner, config):\n if config['pubsub#node_type'] != 'leaf':\n raise error.NoCollections()\n\n owner = owner.userhost()\n try:\n cursor.execute(\"\"\"INSERT INTO nodes\n (node, node_type, persist_items,\n deliver_payloads, send_last_published_item)\n VALUES\n (%s, 'leaf', %s, %s, %s)\"\"\",\n (nodeIdentifier,\n config['pubsub#persist_items'],\n config['pubsub#deliver_payloads'],\n config['pubsub#send_last_published_item']))\n except cursor._pool.dbapi.IntegrityError:\n raise error.NodeExists()\n\n cursor.execute(\"\"\"SELECT 1 as bool from entities where jid=%s\"\"\",\n (owner,))\n\n if not cursor.fetchone():\n cursor.execute(\"\"\"INSERT INTO entities (jid) VALUES (%s)\"\"\",\n (owner,))\n\n cursor.execute(\"\"\"INSERT INTO affiliations\n (node_id, entity_id, affiliation)\n SELECT node_id, entity_id, 'owner' FROM\n (SELECT node_id FROM nodes WHERE node=%s) as n\n CROSS JOIN\n (SELECT entity_id FROM entities\n WHERE jid=%s) as e\"\"\",\n (nodeIdentifier, owner))", "metadata": "root.Storage._createNode", "header": "['class', 'Storage', ':', '___EOS___']", "index": 83 }, { "content": " def deleteNode(self, nodeIdentifier):\n return self.dbpool.runInteraction(self._deleteNode, nodeIdentifier)", "metadata": "root.Storage.deleteNode", "header": "['class', 'Storage', ':', '___EOS___']", "index": 118 }, { "content": " def _deleteNode(self, cursor, nodeIdentifier):\n cursor.execute(\"\"\"DELETE FROM nodes WHERE node=%s\"\"\",\n (nodeIdentifier,))\n\n if cursor.rowcount != 1:\n raise error.NodeNotFound()", "metadata": "root.Storage._deleteNode", "header": "['class', 'Storage', ':', '___EOS___']", "index": 122 }, { "content": " def getAffiliations(self, entity):\n d = self.dbpool.runQuery(\"\"\"SELECT node, affiliation FROM entities\n NATURAL JOIN affiliations\n NATURAL JOIN nodes\n WHERE jid=%s\"\"\",\n (entity.userhost(),))\n d.addCallback(lambda results: [tuple(r) for r in results])\n return d", "metadata": "root.Storage.getAffiliations", "header": "['class', 'Storage', ':', '___EOS___']", "index": 130 }, { "content": " def getSubscriptions(self, entity):\n def toSubscriptions(rows):\n subscriptions = []\n for row in rows:\n subscriber = jid.internJID('%s/%s' % (row.jid,\n row.resource))\n subscription = Subscription(row.node, subscriber, row.state)\n subscriptions.append(subscription)\n return subscriptions\n\n d = self.dbpool.runQuery(\"\"\"SELECT node, jid, resource, state\n FROM entities\n NATURAL JOIN subscriptions\n NATURAL JOIN nodes\n WHERE jid=%s\"\"\",\n (entity.userhost(),))\n d.addCallback(toSubscriptions)\n return d", "metadata": "root.Storage.getSubscriptions", "header": "['class', 'Storage', ':', '___EOS___']", "index": 140 }, { "content": " def getDefaultConfiguration(self, nodeType):\n return self.defaultConfig[nodeType]", "metadata": "root.Storage.getDefaultConfiguration", "header": "['class', 'Storage', ':', '___EOS___']", "index": 160 }, { "content": "class Node:\n\n implements(iidavoll.INode)\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.Node", "header": "['module', '___EOS___']", "index": 165 }, { "content": " def __init__(self, nodeIdentifier, config):\n self.nodeIdentifier = nodeIdentifier\n self._config = config", "metadata": "root.Node.__init__", "header": "['class', 'Node', ':', '___EOS___']", "index": 169 }, { "content": " def _checkNodeExists(self, cursor):\n cursor.execute(\"\"\"SELECT node_id FROM nodes WHERE node=%s\"\"\",\n (self.nodeIdentifier,))\n if not cursor.fetchone():\n raise error.NodeNotFound()", "metadata": "root.Node._checkNodeExists", "header": "['class', 'Node', ':', '___EOS___']", "index": 174 }, { "content": " def getType(self):\n return self.nodeType", "metadata": "root.Node.getType", "header": "['class', 'Node', ':', '___EOS___']", "index": 181 }, { "content": " def getConfiguration(self):\n return self._config", "metadata": "root.Node.getConfiguration", "header": "['class', 'Node', ':', '___EOS___']", "index": 185 }, { "content": " def setConfiguration(self, options):\n config = copy.copy(self._config)\n\n for option in options:\n if option in config:\n config[option] = options[option]\n\n d = self.dbpool.runInteraction(self._setConfiguration, config)\n d.addCallback(self._setCachedConfiguration, config)\n return d", "metadata": "root.Node.setConfiguration", "header": "['class', 'Node', ':', '___EOS___']", "index": 189 }, { "content": " def _setConfiguration(self, cursor, config):\n self._checkNodeExists(cursor)\n cursor.execute(\"\"\"UPDATE nodes SET persist_items=%s,\n deliver_payloads=%s,\n send_last_published_item=%s\n WHERE node=%s\"\"\",\n (config[\"pubsub#persist_items\"],\n config[\"pubsub#deliver_payloads\"],\n config[\"pubsub#send_last_published_item\"],\n self.nodeIdentifier))", "metadata": "root.Node._setConfiguration", "header": "['class', 'Node', ':', '___EOS___']", "index": 201 }, { "content": " def _setCachedConfiguration(self, void, config):\n self._config = config", "metadata": "root.Node._setCachedConfiguration", "header": "['class', 'Node', ':', '___EOS___']", "index": 213 }, { "content": " def getMetaData(self):\n config = copy.copy(self._config)\n config[\"pubsub#node_type\"] = self.nodeType\n return config", "metadata": "root.Node.getMetaData", "header": "['class', 'Node', ':', '___EOS___']", "index": 217 }, { "content": " def getAffiliation(self, entity):\n return self.dbpool.runInteraction(self._getAffiliation, entity)", "metadata": "root.Node.getAffiliation", "header": "['class', 'Node', ':', '___EOS___']", "index": 223 }, { "content": " def _getAffiliation(self, cursor, entity):\n self._checkNodeExists(cursor)\n cursor.execute(\"\"\"SELECT affiliation FROM affiliations\n NATURAL JOIN nodes\n NATURAL JOIN entities\n WHERE node=%s AND jid=%s\"\"\",\n (self.nodeIdentifier,\n entity.userhost()))\n\n try:\n return cursor.fetchone()[0]\n except TypeError:\n return None", "metadata": "root.Node._getAffiliation", "header": "['class', 'Node', ':', '___EOS___']", "index": 227 }, { "content": " def getSubscription(self, subscriber):\n return self.dbpool.runInteraction(self._getSubscription, subscriber)", "metadata": "root.Node.getSubscription", "header": "['class', 'Node', ':', '___EOS___']", "index": 242 }, { "content": " def _getSubscription(self, cursor, subscriber):\n self._checkNodeExists(cursor)\n\n userhost = subscriber.userhost()\n resource = subscriber.resource or ''\n\n cursor.execute(\"\"\"SELECT state FROM subscriptions\n NATURAL JOIN nodes\n NATURAL JOIN entities\n WHERE node=%s AND jid=%s AND resource=%s\"\"\",\n (self.nodeIdentifier,\n userhost,\n resource))\n\n row = cursor.fetchone()\n if not row:\n return None\n else:\n return Subscription(self.nodeIdentifier, subscriber, row.state)", "metadata": "root.Node._getSubscription", "header": "['class', 'Node', ':', '___EOS___']", "index": 246 }, { "content": " def getSubscriptions(self, state=None):\n return self.dbpool.runInteraction(self._getSubscriptions, state)", "metadata": "root.Node.getSubscriptions", "header": "['class', 'Node', ':', '___EOS___']", "index": 267 }, { "content": " def _getSubscriptions(self, cursor, state):\n self._checkNodeExists(cursor)\n\n query = \"\"\"SELECT jid, resource, state,\n subscription_type, subscription_depth\n FROM subscriptions\n NATURAL JOIN nodes\n NATURAL JOIN entities\n WHERE node=%s\"\"\"\n values = [self.nodeIdentifier]\n\n if state:\n query += \" AND state=%s\"\n values.append(state)\n\n cursor.execute(query, values)\n rows = cursor.fetchall()\n\n subscriptions = []\n for row in rows:\n subscriber = jid.JID('%s/%s' % (row.jid, row.resource))\n\n options = {}\n if row.subscription_type:\n options['pubsub#subscription_type'] = row.subscription_type\n if row.subscription_depth:\n options['pubsub#subscription_depth'] = row.subscription_depth\n\n subscriptions.append(Subscription(self.nodeIdentifier, subscriber,\n row.state, options))\n\n return subscriptions", "metadata": "root.Node._getSubscriptions", "header": "['class', 'Node', ':', '___EOS___']", "index": 271 }, { "content": " def addSubscription(self, subscriber, state, config):\n return self.dbpool.runInteraction(self._addSubscription, subscriber,\n state, config)", "metadata": "root.Node.addSubscription", "header": "['class', 'Node', ':', '___EOS___']", "index": 305 }, { "content": " def _addSubscription(self, cursor, subscriber, state, config):\n self._checkNodeExists(cursor)\n\n userhost = subscriber.userhost()\n resource = subscriber.resource or ''\n\n subscription_type = config.get('pubsub#subscription_type')\n subscription_depth = config.get('pubsub#subscription_depth')\n\n try:\n cursor.execute(\"\"\"INSERT INTO entities (jid) VALUES (%s)\"\"\",\n (userhost,))\n except cursor._pool.dbapi.IntegrityError:\n cursor.connection.rollback()\n\n try:\n cursor.execute(\"\"\"INSERT INTO subscriptions\n (node_id, entity_id, resource, state,\n subscription_type, subscription_depth)\n SELECT node_id, entity_id, %s, %s, %s, %s FROM\n (SELECT node_id FROM nodes\n WHERE node=%s) as n\n CROSS JOIN\n (SELECT entity_id FROM entities\n WHERE jid=%s) as e\"\"\",\n (resource,\n state,\n subscription_type,\n subscription_depth,\n self.nodeIdentifier,\n userhost))\n except cursor._pool.dbapi.IntegrityError:\n raise error.SubscriptionExists()", "metadata": "root.Node._addSubscription", "header": "['class', 'Node', ':', '___EOS___']", "index": 310 }, { "content": " def removeSubscription(self, subscriber):\n return self.dbpool.runInteraction(self._removeSubscription,\n subscriber)", "metadata": "root.Node.removeSubscription", "header": "['class', 'Node', ':', '___EOS___']", "index": 345 }, { "content": " def _removeSubscription(self, cursor, subscriber):\n self._checkNodeExists(cursor)\n\n userhost = subscriber.userhost()\n resource = subscriber.resource or ''\n\n cursor.execute(\"\"\"DELETE FROM subscriptions WHERE\n node_id=(SELECT node_id FROM nodes\n WHERE node=%s) AND\n entity_id=(SELECT entity_id FROM entities\n WHERE jid=%s) AND\n resource=%s\"\"\",\n (self.nodeIdentifier,\n userhost,\n resource))\n if cursor.rowcount != 1:\n raise error.NotSubscribed()\n\n return None", "metadata": "root.Node._removeSubscription", "header": "['class', 'Node', ':', '___EOS___']", "index": 350 }, { "content": " def isSubscribed(self, entity):\n return self.dbpool.runInteraction(self._isSubscribed, entity)", "metadata": "root.Node.isSubscribed", "header": "['class', 'Node', ':', '___EOS___']", "index": 371 }, { "content": " def _isSubscribed(self, cursor, entity):\n self._checkNodeExists(cursor)\n\n cursor.execute(\"\"\"SELECT 1 as bool FROM entities\n NATURAL JOIN subscriptions\n NATURAL JOIN nodes\n WHERE entities.jid=%s\n AND node=%s AND state='subscribed'\"\"\",\n (entity.userhost(),\n self.nodeIdentifier))\n\n return cursor.fetchone() is not None", "metadata": "root.Node._isSubscribed", "header": "['class', 'Node', ':', '___EOS___']", "index": 375 }, { "content": " def getAffiliations(self):\n return self.dbpool.runInteraction(self._getAffiliations)", "metadata": "root.Node.getAffiliations", "header": "['class', 'Node', ':', '___EOS___']", "index": 389 }, { "content": " def _getAffiliations(self, cursor):\n self._checkNodeExists(cursor)\n\n cursor.execute(\"\"\"SELECT jid, affiliation FROM nodes\n NATURAL JOIN affiliations\n NATURAL JOIN entities\n WHERE node=%s\"\"\",\n (self.nodeIdentifier,))\n result = cursor.fetchall()\n\n return [(jid.internJID(r[0]), r[1]) for r in result]", "metadata": "root.Node._getAffiliations", "header": "['class', 'Node', ':', '___EOS___']", "index": 393 }, { "content": "class LeafNode(Node):\n\n implements(iidavoll.ILeafNode)\n\n nodeType = 'leaf'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.LeafNode", "header": "['module', '___EOS___']", "index": 407 }, { "content": " def storeItems(self, items, publisher):\n return self.dbpool.runInteraction(self._storeItems, items, publisher)", "metadata": "root.LeafNode.storeItems", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 413 }, { "content": " def _storeItems(self, cursor, items, publisher):\n self._checkNodeExists(cursor)\n for item in items:\n self._storeItem(cursor, item, publisher)", "metadata": "root.LeafNode._storeItems", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 417 }, { "content": " def _storeItem(self, cursor, item, publisher):\n data = item.toXml()\n cursor.execute(\"\"\"UPDATE items SET date=now(), publisher=%s, data=%s\n FROM nodes\n WHERE nodes.node_id = items.node_id AND\n nodes.node = %s and items.item=%s\"\"\",\n (publisher.full(),\n data,\n self.nodeIdentifier,\n item[\"id\"]))\n if cursor.rowcount == 1:\n return\n\n cursor.execute(\"\"\"INSERT INTO items (node_id, item, publisher, data)\n SELECT node_id, %s, %s, %s FROM nodes\n WHERE node=%s\"\"\",\n (item[\"id\"],\n publisher.full(),\n data,\n self.nodeIdentifier))", "metadata": "root.LeafNode._storeItem", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 423 }, { "content": " def removeItems(self, itemIdentifiers):\n return self.dbpool.runInteraction(self._removeItems, itemIdentifiers)", "metadata": "root.LeafNode.removeItems", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 445 }, { "content": " def _removeItems(self, cursor, itemIdentifiers):\n self._checkNodeExists(cursor)\n\n deleted = []\n\n for itemIdentifier in itemIdentifiers:\n cursor.execute(\"\"\"DELETE FROM items WHERE\n node_id=(SELECT node_id FROM nodes\n WHERE node=%s) AND\n item=%s\"\"\",\n (self.nodeIdentifier,\n itemIdentifier))\n\n if cursor.rowcount:\n deleted.append(itemIdentifier)\n\n return deleted", "metadata": "root.LeafNode._removeItems", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 449 }, { "content": " def getItems(self, maxItems=None):\n return self.dbpool.runInteraction(self._getItems, maxItems)", "metadata": "root.LeafNode.getItems", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 468 }, { "content": " def _getItems(self, cursor, maxItems):\n self._checkNodeExists(cursor)\n query = \"\"\"SELECT data FROM nodes\n NATURAL JOIN items\n WHERE node=%s ORDER BY date DESC\"\"\"\n if maxItems:\n cursor.execute(query + \" LIMIT %s\",\n (self.nodeIdentifier,\n maxItems))\n else:\n cursor.execute(query, (self.nodeIdentifier,))\n\n result = cursor.fetchall()\n items = [stripNamespace(parseXml(r[0])) for r in result]\n return items", "metadata": "root.LeafNode._getItems", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 472 }, { "content": " def getItemsById(self, itemIdentifiers):\n return self.dbpool.runInteraction(self._getItemsById, itemIdentifiers)", "metadata": "root.LeafNode.getItemsById", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 489 }, { "content": " def _getItemsById(self, cursor, itemIdentifiers):\n self._checkNodeExists(cursor)\n items = []\n for itemIdentifier in itemIdentifiers:\n cursor.execute(\"\"\"SELECT data FROM nodes\n NATURAL JOIN items\n WHERE node=%s AND item=%s\"\"\",\n (self.nodeIdentifier,\n itemIdentifier))\n result = cursor.fetchone()\n if result:\n items.append(parseXml(result[0]))\n return items", "metadata": "root.LeafNode._getItemsById", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 493 }, { "content": " def purge(self):\n return self.dbpool.runInteraction(self._purge)", "metadata": "root.LeafNode.purge", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 508 }, { "content": " def _purge(self, cursor):\n self._checkNodeExists(cursor)\n\n cursor.execute(\"\"\"DELETE FROM items WHERE\n node_id=(SELECT node_id FROM nodes WHERE node=%s)\"\"\",\n (self.nodeIdentifier,))", "metadata": "root.LeafNode._purge", "header": "['class', 'LeafNode', '(', 'Node', ')', ':', '___EOS___']", "index": 512 }, { "content": "class CollectionNode(Node):\n\n nodeType = 'collection'", "metadata": "root.CollectionNode", "header": "['module', '___EOS___']", "index": 520 }, { "content": "class GatewayStorage(object):\n \"\"\"\n Memory based storage facility for the XMPP-HTTP gateway.\n \"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.GatewayStorage", "header": "['module', '___EOS___']", "index": 526 }, { "content": " def __init__(self, dbpool):\n self.dbpool = dbpool", "metadata": "root.GatewayStorage.__init__", "header": "['class', 'GatewayStorage', '(', 'object', ')', ':', '___EOS___']", "index": 531 }, { "content": " def _countCallbacks(self, cursor, service, nodeIdentifier):\n \"\"\"\n Count number of callbacks registered for a node.\n \"\"\"\n cursor.execute(\"\"\"SELECT count(*) FROM callbacks\n WHERE service=%s and node=%s\"\"\",\n (service.full(),\n nodeIdentifier))\n results = cursor.fetchall()\n return results[0][0]", "metadata": "root.GatewayStorage._countCallbacks", "header": "['class', 'GatewayStorage', '(', 'object', ')', ':', '___EOS___']", "index": 535 }, { "content": " def addCallback(self, service, nodeIdentifier, callback):\n def interaction(cursor):\n cursor.execute(\"\"\"SELECT 1 as bool FROM callbacks\n WHERE service=%s and node=%s and uri=%s\"\"\",\n (service.full(),\n nodeIdentifier,\n callback))\n if cursor.fetchall():\n return\n\n cursor.execute(\"\"\"INSERT INTO callbacks\n (service, node, uri) VALUES\n (%s, %s, %s)\"\"\",\n (service.full(),\n nodeIdentifier,\n callback))\n\n return self.dbpool.runInteraction(interaction)", "metadata": "root.GatewayStorage.addCallback", "header": "['class', 'GatewayStorage', '(', 'object', ')', ':', '___EOS___']", "index": 547 }, { "content": " def removeCallback(self, service, nodeIdentifier, callback):\n def interaction(cursor):\n cursor.execute(\"\"\"DELETE FROM callbacks\n WHERE service=%s and node=%s and uri=%s\"\"\",\n (service.full(),\n nodeIdentifier,\n callback))\n\n if cursor.rowcount != 1:\n raise error.NotSubscribed()\n\n last = not self._countCallbacks(cursor, service, nodeIdentifier)\n return last\n\n return self.dbpool.runInteraction(interaction)", "metadata": "root.GatewayStorage.removeCallback", "header": "['class', 'GatewayStorage', '(', 'object', ')', ':', '___EOS___']", "index": 567 }, { "content": " def getCallbacks(self, service, nodeIdentifier):\n def interaction(cursor):\n cursor.execute(\"\"\"SELECT uri FROM callbacks\n WHERE service=%s and node=%s\"\"\",\n (service.full(),\n nodeIdentifier))\n results = cursor.fetchall()\n\n if not results:\n raise error.NoCallbacks()\n\n return [result[0] for result in results]\n\n return self.dbpool.runInteraction(interaction)", "metadata": "root.GatewayStorage.getCallbacks", "header": "['class', 'GatewayStorage', '(', 'object', ')', ':', '___EOS___']", "index": 583 }, { "content": " def hasCallbacks(self, service, nodeIdentifier):\n def interaction(cursor):\n return bool(self._countCallbacks(cursor, service, nodeIdentifier))\n\n return self.dbpool.runInteraction(interaction)", "metadata": "root.GatewayStorage.hasCallbacks", "header": "['class', 'GatewayStorage', '(', 'object', ')', ':', '___EOS___']", "index": 599 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Ra", "lph", " ", "Me", "ij", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zope_", "._", "interface_", "import_", "implements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "words_", "._", "protocols_", "._", "jab", "ber_", "import_", "jid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wo", "kk", "el_", "._", "generic_", "import_", "parse", "Xml_", ",_", "strip", "Namespace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wo", "kk", "el_", "._", "pubsub_", "import_", "Subscription_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ida", "vol", "l_", "import_", "error_", ",_", "iid", "avo", "ll_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Storage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "implements_", "(_", "iid", "avo", "ll_", "._", "IS", "tora", "ge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "Config_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "leaf", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pubs", "ub", "#", "persist", "\\u", "items", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pubs", "ub", "#", "deliver", "\\u", "payload", "s", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pubs", "ub", "#", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item", "\"_", ":_", "'", "on", "\\u", "sub", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pubs", "ub", "#", "deliver", "\\u", "payload", "s", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pubs", "ub", "#", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item", "\"_", ":_", "'", "on", "\\u", "sub", "'_", ",_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Storage_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "dbp", "ool_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dbp", "ool_", "=_", "dbp", "ool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Storage_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Node_", "(_", "self_", ",_", "node", "Identifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "get", "Node_", ",_", "node", "Identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Storage_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Node_", "(_", "self_", ",_", "cursor_", ",_", "node", "Identifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "configuration_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "node", "\\u", "type", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "persist", "\\u", "items", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "deliver", "\\u", "payload", "s", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "node", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "node", "Identifier_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "._", "Node", "Not", "Found_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row_", "._", "node", "\\u", "type_", "==_", "'", "leaf", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "configuration_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pubs", "ub", "#", "persist", "\\u", "items", "'_", ":_", "row_", "._", "persist", "\\u", "items_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pubs", "ub", "#", "deliver", "\\u", "payload", "s", "'_", ":_", "row_", "._", "deliver", "\\u", "payloads_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pubs", "ub", "#", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "row_", "._", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "Lea", "f", "Node_", "(_", "node", "Identifier_", ",_", "configuration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "dbp", "ool_", "=_", "self_", "._", "dbp", "ool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "row_", "._", "node", "\\u", "type_", "==_", "'", "collection", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "configuration_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pubs", "ub", "#", "deliver", "\\u", "payload", "s", "'_", ":_", "row_", "._", "deliver", "\\u", "payloads_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pubs", "ub", "#", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "row_", "._", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "Collecti", "on", "Node_", "(_", "node", "Identifier_", ",_", "configuration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "dbp", "ool_", "=_", "self_", "._", "dbp", "ool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Storage_", ":_", "\\u\\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", "Node", "Ids_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "dbp", "ool_", "._", "run", "Query_", "(_", "\"\"\"", "SELECT", " ", "node", " ", "from", " ", "nodes", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "results_", ":_", "[_", "r_", "[_", "0_", "]_", "for_", "r_", "in_", "results_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Storage_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Node_", "(_", "self_", ",_", "node", "Identifier_", ",_", "owner_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "create", "Node_", ",_", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "owner_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Storage_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "Node_", "(_", "self_", ",_", "cursor_", ",_", "node", "Identifier_", ",_", "owner_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "config_", "[_", "'", "pubs", "ub", "#", "node", "\\u", "type", "'_", "]_", "!=_", "'", "leaf", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "._", "No", "Collections", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "owner_", "=_", "owner_", "._", "user", "host_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "INSERT", " ", "INT", "O", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "(", "node", ",", " ", "node", "\\u", "type", ",", " ", "persist", "\\u", "items", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "deliver", "\\u", "payload", "s", ",", " ", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item", ")", "\\", "10", ";", " ", " ", " ", " ", "VALU", "ES", "\\", "10", ";", " ", " ", " ", " ", "(%", "s", ",", " ", "'", "leaf", "',", " ", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ")\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "'", "pubs", "ub", "#", "persist", "\\u", "items", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "'", "pubs", "ub", "#", "deliver", "\\u", "payload", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "'", "pubs", "ub", "#", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cursor_", "._", "\\u", "pool_", "._", "dbapi_", "._", "Int", "egr", "it", "y", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "._", "Node", "Exists_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "1", " ", "as", " ", "bool", " ", "from", " ", "entit", "ies", " ", "where", " ", "ji", "d", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "owner_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "cursor_", "._", "fetchone_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "INSERT", " ", "INT", "O", " ", "entit", "ies", " ", "(", "ji", "d", ")", " ", "VALU", "ES", " ", "(%", "s", ")\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "owner_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "INSERT", " ", "INT", "O", " ", "affiliation", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "node", "\\u", "id", ",", " ", "entity", "\\u", "id", ",", " ", "affiliation", ")", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "node", "\\u", "id", ",", " ", "entity", "\\u", "id", ",", " ", "'", "owner", "'", " ", "FROM", "\\", "10", ";", " ", " ", " ", " ", "(", "SELECT", " ", "node", "\\u", "id", " ", "FROM", " ", "nodes", " ", "WHE", "RE", " ", "node", "=", "%", "s", ")", " ", "as", " ", "n", "\\", "10", ";", " ", " ", " ", " ", "CROSS", " ", "JOIN", "\\", "10", ";", " ", " ", " ", " ", "(", "SELECT", " ", "entity", "\\u", "id", " ", "FROM", " ", "entit", "ies", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ji", "d", "=", "%", "s", ")", " ", "as", " ", "e", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "node", "Identifier_", ",_", "owner_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Storage_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "Node_", "(_", "self_", ",_", "node", "Identifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "delete", "Node_", ",_", "node", "Identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Storage_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "delete", "Node_", "(_", "self_", ",_", "cursor_", ",_", "node", "Identifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "DELET", "E", " ", "FROM", " ", "nodes", " ", "WHE", "RE", " ", "node", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "node", "Identifier_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cursor_", "._", "rowcount_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "._", "Node", "Not", "Found_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Storage_", ":_", "\\u\\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", "Affi", "liat", "ions_", "(_", "self_", ",_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "dbp", "ool_", "._", "run", "Query_", "(_", "\"\"\"", "SELECT", " ", "node", ",", " ", "affiliation", " ", "FROM", " ", "entit", "ies", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "affiliation", "s", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ji", "d", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "entity_", "._", "user", "host_", "(_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "results_", ":_", "[_", "tuple_", "(_", "r_", ")_", "for_", "r_", "in_", "results_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Storage_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Subscription", "s_", "(_", "self_", ",_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "to", "Subscription", "s_", "(_", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriptions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriber_", "=_", "jid_", "._", "intern", "JID", "_", "(_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "row_", "._", "jid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "row_", "._", "resource_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscription_", "=_", "Subscription_", "(_", "row_", "._", "node_", ",_", "subscriber_", ",_", "row_", "._", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscriptions_", "._", "append_", "(_", "subscription_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "subscriptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "self_", "._", "dbp", "ool_", "._", "run", "Query_", "(_", "\"\"\"", "SELECT", " ", "node", ",", " ", "ji", "d", ",", " ", "resource", ",", " ", "state", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "FROM", " ", "entit", "ies", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "subscript", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "ji", "d", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "entity_", "._", "user", "host_", "(_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "to", "Subscription", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Storage_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Default", "Configuration_", "(_", "self_", ",_", "node", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "default", "Config_", "[_", "node", "Type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "implements_", "(_", "iid", "avo", "ll_", "._", "IN", "ode_", ")_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "node", "Identifier_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "node", "Identifier_", "=_", "node", "Identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "config_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "Node", "Exists_", "(_", "self_", ",_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "node", "\\u", "id", " ", "FROM", " ", "nodes", " ", "WHE", "RE", " ", "node", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "node", "Identifier_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "cursor_", "._", "fetchone_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "._", "Node", "Not", "Found_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "node", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Configuration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Configuration_", "(_", "self_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "copy_", "._", "copy_", "(_", "self_", "._", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "option_", "in_", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "option_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "[_", "option_", "]_", "=_", "options_", "[_", "option_", "]_", "\\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_", "=_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "set", "Configuration_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "self_", "._", "\\u", "set", "Cache", "d", "Configuration_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set", "Configuration_", "(_", "self_", ",_", "cursor_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "UPDATE", " ", "nodes", " ", "SET", " ", "persist", "\\u", "items", "=", "%", "s", ",", "\\", "10", ";", " ", " ", " ", "deliver", "\\u", "payload", "s", "=", "%", "s", ",", "\\", "10", ";", " ", " ", " ", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item", "=", "%", "s", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "node", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "config_", "[_", "\"", "pubs", "ub", "#", "persist", "\\u", "items", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "\"", "pubs", "ub", "#", "deliver", "\\u", "payload", "s", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "\"", "pubs", "ub", "#", "send", "\\u", "last", "\\u", "publi", "shed", "\\u", "item", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "node", "Identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set", "Cache", "d", "Configuration_", "(_", "self_", ",_", "void_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "config_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Meta", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "copy_", "._", "copy_", "(_", "self_", "._", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "[_", "\"", "pubs", "ub", "#", "node", "\\u", "type", "\"_", "]_", "=_", "self_", "._", "node", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Affi", "liat", "ion_", "(_", "self_", ",_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "get", "Affi", "liat", "ion_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Affi", "liat", "ion_", "(_", "self_", ",_", "cursor_", ",_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "affiliation", " ", "FROM", " ", "affiliation", "s", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "entit", "ies", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "node", "=", "%", "s", " ", "AND", " ", "ji", "d", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "._", "user", "host_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cursor_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Subscription_", "(_", "self_", ",_", "subscriber_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "get", "Subscription_", ",_", "subscriber_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Subscription_", "(_", "self_", ",_", "cursor_", ",_", "subscriber_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "host_", "=_", "subscriber_", "._", "user", "host_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "=_", "subscriber_", "._", "resource_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "state", " ", "FROM", " ", "subscript", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "entit", "ies", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "node", "=", "%", "s", " ", "AND", " ", "ji", "d", "=", "%", "s", " ", "AND", " ", "resource", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "row_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Subscription_", "(_", "self_", "._", "node", "Identifier_", ",_", "subscriber_", ",_", "row_", "._", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Subscription", "s_", "(_", "self_", ",_", "state_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "get", "Subscription", "s_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Subscription", "s_", "(_", "self_", ",_", "cursor_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "\"\"\"", "SELECT", " ", "ji", "d", ",", " ", "resource", ",", " ", "state", ",", "\\", "10", ";", " ", " ", " ", " ", "subscript", "ion", "\\u", "type", ",", " ", "subscript", "ion", "\\u", "depth", "\\", "10", ";", " ", "FROM", " ", "subscript", "ion", "s", "\\", "10", ";", " ", "NAT", "URA", "L", " ", "JOIN", " ", "nodes", "\\", "10", ";", " ", "NAT", "URA", "L", " ", "JOIN", " ", "entit", "ies", "\\", "10", ";", " ", "WHE", "RE", " ", "node", "=", "%", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "[_", "self_", "._", "node", "Identifier_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "+=_", "\"", " ", "AND", " ", "state", "=", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "._", "append_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "query_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "cursor_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subscriptions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subscriber_", "=_", "jid_", "._", "JID", "_", "(_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "row_", "._", "jid_", ",_", "row_", "._", "resource_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", "._", "subscript", "ion", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "pubs", "ub", "#", "subscript", "ion", "\\u", "type", "'_", "]_", "=_", "row_", "._", "subscript", "ion", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row_", "._", "subscript", "ion", "\\u", "depth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "[_", "'", "pubs", "ub", "#", "subscript", "ion", "\\u", "depth", "'_", "]_", "=_", "row_", "._", "subscript", "ion", "\\u", "depth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subscriptions_", "._", "append_", "(_", "Subscription_", "(_", "self_", "._", "node", "Identifier_", ",_", "subscriber_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "row_", "._", "state_", ",_", "options_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "subscriptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Subscription_", "(_", "self_", ",_", "subscriber_", ",_", "state_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "add", "Subscription_", ",_", "subscriber_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "state_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "add", "Subscription_", "(_", "self_", ",_", "cursor_", ",_", "subscriber_", ",_", "state_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "host_", "=_", "subscriber_", "._", "user", "host_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "=_", "subscriber_", "._", "resource_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subscript", "ion", "\\u", "type_", "=_", "config_", "._", "get_", "(_", "'", "pubs", "ub", "#", "subscript", "ion", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscript", "ion", "\\u", "depth_", "=_", "config_", "._", "get_", "(_", "'", "pubs", "ub", "#", "subscript", "ion", "\\u", "depth", "'_", ")_", "\\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 ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "INSERT", " ", "INT", "O", " ", "entit", "ies", " ", "(", "ji", "d", ")", " ", "VALU", "ES", " ", "(%", "s", ")\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "user", "host_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cursor_", "._", "\\u", "pool_", "._", "dbapi_", "._", "Int", "egr", "it", "y", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "connection_", "._", "rollback_", "(_", ")_", "\\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 ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "INSERT", " ", "INT", "O", " ", "subscript", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "node", "\\u", "id", ",", " ", "entity", "\\u", "id", ",", " ", "resource", ",", " ", "state", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "subscript", "ion", "\\u", "type", ",", " ", "subscript", "ion", "\\u", "depth", ")", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "node", "\\u", "id", ",", " ", "entity", "\\u", "id", ",", " ", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", " ", "FROM", "\\", "10", ";", " ", " ", " ", " ", "(", "SELECT", " ", "node", "\\u", "id", " ", "FROM", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "node", "=", "%", "s", ")", " ", "as", " ", "n", "\\", "10", ";", " ", " ", " ", " ", "CROSS", " ", "JOIN", "\\", "10", ";", " ", " ", " ", " ", "(", "SELECT", " ", "entity", "\\u", "id", " ", "FROM", " ", "entit", "ies", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "ji", "d", "=", "%", "s", ")", " ", "as", " ", "e", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subscript", "ion", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subscript", "ion", "\\u", "depth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "host_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cursor_", "._", "\\u", "pool_", "._", "dbapi_", "._", "Int", "egr", "it", "y", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "._", "Subscription", "Exists_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "Subscription_", "(_", "self_", ",_", "subscriber_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "remove", "Subscription_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subscriber_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "remove", "Subscription_", "(_", "self_", ",_", "cursor_", ",_", "subscriber_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "host_", "=_", "subscriber_", "._", "user", "host_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "=_", "subscriber_", "._", "resource_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "DELET", "E", " ", "FROM", " ", "subscript", "ion", "s", " ", "WHE", "RE", "\\", "10", ";", " ", " ", " ", " ", "node", "\\u", "id", "=(", "SELECT", " ", "node", "\\u", "id", " ", "FROM", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "node", "=", "%", "s", ")", " ", "AND", "\\", "10", ";", " ", " ", " ", " ", "entity", "\\u", "id", "=(", "SELECT", " ", "entity", "\\u", "id", " ", "FROM", " ", "entit", "ies", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "ji", "d", "=", "%", "s", ")", " ", "AND", "\\", "10", ";", " ", " ", " ", " ", "resource", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cursor_", "._", "rowcount_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "._", "Not", "Subscrib", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "Subscrib", "ed_", "(_", "self_", ",_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "is", "Subscrib", "ed_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "is", "Subscrib", "ed_", "(_", "self_", ",_", "cursor_", ",_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "1", " ", "as", " ", "bool", " ", "FROM", " ", "entit", "ies", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "subscript", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "entit", "ies", ".", "ji", "d", "=", "%", "s", "\\", "10", ";", " ", " ", " ", " ", "AND", " ", "node", "=", "%", "s", " ", "AND", " ", "state", "='", "subscribed", "'\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "entity_", "._", "user", "host_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "node", "Identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cursor_", "._", "fetchone_", "(_", ")_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Affi", "liat", "ions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "get", "Affi", "liat", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Affi", "liat", "ions_", "(_", "self_", ",_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "ji", "d", ",", " ", "affiliation", " ", "FROM", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "affiliation", "s", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "entit", "ies", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "node", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "node", "Identifier_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "cursor_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "(_", "jid_", "._", "intern", "JID", "_", "(_", "r_", "[_", "0_", "]_", ")_", ",_", "r_", "[_", "1_", "]_", ")_", "for_", "r_", "in_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "implements_", "(_", "iid", "avo", "ll_", "._", "IL", "ea", "f", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node", "Type_", "=_", "'", "leaf", "'_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "store", "Items_", "(_", "self_", ",_", "items_", ",_", "publisher_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "store", "Items_", ",_", "items_", ",_", "publisher_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "store", "Items_", "(_", "self_", ",_", "cursor_", ",_", "items_", ",_", "publisher_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "store", "Item_", "(_", "cursor_", ",_", "item_", ",_", "publisher_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "store", "Item_", "(_", "self_", ",_", "cursor_", ",_", "item_", ",_", "publisher_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "item_", "._", "to", "Xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "UPDATE", " ", "items", " ", "SET", " ", "date", "=", "now", "()", ",", " ", "publi", "sher", "=", "%", "s", ",", " ", "data", "=", "%", "s", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "nodes", ".", "node", "\\u", "id", " ", "=", " ", "items", ".", "node", "\\u", "id", " ", "AND", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "nodes", ".", "node", " ", "=", " ", "%", "s", " ", "and", " ", "items", ".", "item", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "publisher_", "._", "full_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item_", "[_", "\"", "id", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cursor_", "._", "rowcount_", "==_", "1_", ":_", "\\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_", "cursor_", "._", "execute_", "(_", "\"\"\"", "INSERT", " ", "INT", "O", " ", "items", " ", "(", "node", "\\u", "id", ",", " ", "item", ",", " ", "publi", "sher", ",", " ", "data", ")", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "node", "\\u", "id", ",", " ", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", " ", "FROM", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", " ", "WHE", "RE", " ", "node", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "item_", "[_", "\"", "id", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "publisher_", "._", "full_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "node", "Identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "Items_", "(_", "self_", ",_", "item", "Identifiers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "remove", "Items_", ",_", "item", "Identifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "remove", "Items_", "(_", "self_", ",_", "cursor_", ",_", "item", "Identifiers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "deleted_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item", "Identifier_", "in_", "item", "Identifiers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "DELET", "E", " ", "FROM", " ", "items", " ", "WHE", "RE", "\\", "10", ";", " ", " ", " ", " ", "node", "\\u", "id", "=(", "SELECT", " ", "node", "\\u", "id", " ", "FROM", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "WHE", "RE", " ", "node", "=", "%", "s", ")", " ", "AND", "\\", "10", ";", " ", " ", " ", " ", "item", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item", "Identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cursor_", "._", "rowcount_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deleted_", "._", "append_", "(_", "item", "Identifier_", ")_", "\\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_", "deleted_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Items_", "(_", "self_", ",_", "max", "Items_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "get", "Items_", ",_", "max", "Items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Items_", "(_", "self_", ",_", "cursor_", ",_", "max", "Items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "\"\"\"", "SELECT", " ", "data", " ", "FROM", " ", "nodes", "\\", "10", ";", " ", "NAT", "URA", "L", " ", "JOIN", " ", "items", "\\", "10", ";", " ", "WHE", "RE", " ", "node", "=", "%", "s", " ", "ORDE", "R", " ", "BY", " ", "date", " ", "DESC", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "Items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "query_", "+_", "\"", " ", "LIMIT", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Items_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "query_", ",_", "(_", "self_", "._", "node", "Identifier_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "cursor_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "=_", "[_", "strip", "Namespace_", "(_", "parse", "Xml_", "(_", "r_", "[_", "0_", "]_", ")_", ")_", "for_", "r_", "in_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Item", "s", "By", "Id_", "(_", "self_", ",_", "item", "Identifiers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "get", "Item", "s", "By", "Id_", ",_", "item", "Identifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Item", "s", "By", "Id_", "(_", "self_", ",_", "cursor_", ",_", "item", "Identifiers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item", "Identifier_", "in_", "item", "Identifiers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "data", " ", "FROM", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "NAT", "URA", "L", " ", "JOIN", " ", "items", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "node", "=", "%", "s", " ", "AND", " ", "item", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item", "Identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items_", "._", "append_", "(_", "parse", "Xml_", "(_", "result_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "purge_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "\\u", "purge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lea", "f", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "purge_", "(_", "self_", ",_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "Node", "Exists_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "DELET", "E", " ", "FROM", " ", "items", " ", "WHE", "RE", "\\", "10", ";", " ", " ", " ", " ", "node", "\\u", "id", "=(", "SELECT", " ", "node", "\\u", "id", " ", "FROM", " ", "nodes", " ", "WHE", "RE", " ", "node", "=", "%", "s", ")\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "node", "Identifier_", ",_", ")_", ")_", "\\u\\u\\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_", "Collecti", "on", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "Type_", "=_", "'", "collection", "'_", "\\u\\u\\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_", "Gat", "ewa", "y", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Memo", "ry", " ", "based", " ", "storage", " ", "facilit", "y", " ", "for", " ", "the", " ", "XMPP", "-", "HTTP", " ", "gateway", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Gat", "ewa", "y", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "dbp", "ool_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dbp", "ool_", "=_", "dbp", "ool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gat", "ewa", "y", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "count", "Callbacks_", "(_", "self_", ",_", "cursor_", ",_", "service_", ",_", "node", "Identifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Count", " ", "number", " ", "of", " ", "callback", "s", " ", "register", "ed", " ", "for", " ", "a", " ", "node", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "count", "(*", ")", " ", "FROM", " ", "callback", "s", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "service", "=", "%", "s", " ", "and", " ", "node", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "service_", "._", "full_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "Identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "cursor_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "results_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gat", "ewa", "y", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Callback_", "(_", "self_", ",_", "service_", ",_", "node", "Identifier_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "interaction_", "(_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "1", " ", "as", " ", "bool", " ", "FROM", " ", "callback", "s", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "service", "=", "%", "s", " ", "and", " ", "node", "=", "%", "s", " ", "and", " ", "uri", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "service_", "._", "full_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cursor_", "._", "fetchall_", "(_", ")_", ":_", "\\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_", "cursor_", "._", "execute_", "(_", "\"\"\"", "INSERT", " ", "INT", "O", " ", "callback", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "service", ",", " ", "node", ",", " ", "uri", ")", " ", "VALU", "ES", "\\", "10", ";", " ", " ", " ", " ", "(%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ")\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "service_", "._", "full_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "interaction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gat", "ewa", "y", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "Callback_", "(_", "self_", ",_", "service_", ",_", "node", "Identifier_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "interaction_", "(_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "DELET", "E", " ", "FROM", " ", "callback", "s", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "service", "=", "%", "s", " ", "and", " ", "node", "=", "%", "s", " ", "and", " ", "uri", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "service_", "._", "full_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "Identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cursor_", "._", "rowcount_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "._", "Not", "Subscrib", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last_", "=_", "not_", "self_", "._", "\\u", "count", "Callbacks_", "(_", "cursor_", ",_", "service_", ",_", "node", "Identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "last_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "interaction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gat", "ewa", "y", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Callbacks_", "(_", "self_", ",_", "service_", ",_", "node", "Identifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "interaction_", "(_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "uri", " ", "FROM", " ", "callback", "s", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "service", "=", "%", "s", " ", "and", " ", "node", "=", "%", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "service_", "._", "full_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "Identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "cursor_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "._", "No", "Callbacks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "result_", "[_", "0_", "]_", "for_", "result_", "in_", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "interaction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gat", "ewa", "y", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "Callbacks_", "(_", "self_", ",_", "service_", ",_", "node", "Identifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "interaction_", "(_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "(_", "self_", "._", "\\u", "count", "Callbacks_", "(_", "cursor_", ",_", "service_", ",_", "node", "Identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "interaction_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
google/cauliflowervest/src/tests/cauliflowervest/server/cron/group_sync_test.py
[ { "content": " @mock.patch.object(group_sync.db.Key, 'from_path')\n @mock.patch.object(group_sync.models.User, 'all')\n def testGet(self, all_mock, from_path_mock):\n self.g._BatchDatastoreOp = mock.Mock()\n self.g._GetGroupMembersAndPermissions = mock.Mock()\n self.g._MakeUserEntity = mock.Mock()\n\n group_users = {\n '[email protected]': {'type1': set(['read', 'write'])},\n '[email protected]': {'type1': set(['read', 'write'])},\n '[email protected]': {'type1': set(['read', 'write', 'list']),\n 'type2': set(['read', 'write'])},\n }\n\n to_del_user = '[email protected]'\n\n self.g._GetGroupMembersAndPermissions.return_value = group_users\n\n mock_key_to_del = mock.MagicMock()\n mock_key_u1 = mock.MagicMock()\n\n all_mock.return_value = [mock_key_to_del, mock_key_u1]\n\n mock_key_to_del.name.return_value = to_del_user\n mock_key_u1.name.return_value = '[email protected]'\n\n from_path_mock.return_value = 'todeluserkey'\n\n to_add = []\n\n calls = []\n for u, p in group_users.iteritems():\n calls.append((u, p, 'toadd-%s' % u))\n to_add.append('toadd-%s' % u)\n\n def MatchCallSideEffect(a1, a2):\n for u, p, r in calls:\n if u != a1 or p != a2:\n continue\n return r\n raise ValueError\n self.g._MakeUserEntity.side_effect = MatchCallSideEffect\n\n self.g.get()\n\n from_path_mock.assert_called_once_with(\n group_sync.models.User.__name__, to_del_user)\n\n self.g._BatchDatastoreOp.assert_has_calls([\n mock.call(group_sync.db.delete, ['todeluserkey']),\n mock.call(group_sync.db.put, to_add)])", "metadata": "root.GroupSyncTest.testGet", "header": "['class', 'GroupSyncTest', '(', 'basetest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 114 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Group", "Sync", "Test_", "(_", "base", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "group", "\\u", "sync_", "._", "db_", "._", "Key_", ",_", "'", "from", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "group", "\\u", "sync_", "._", "models_", "._", "User_", ",_", "'", "all", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Get_", "(_", "self_", ",_", "all", "\\u", "mock_", ",_", "from", "\\u", "path", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "g_", "._", "\\u", "Bat", "ch", "Datas", "tore", "Op_", "=_", "mock_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "g_", "._", "\\u", "Get", "Group", "Mem", "bers", "And", "Permissions_", "=_", "mock_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "g_", "._", "\\u", "Make", "User", "Entity_", "=_", "mock_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "users_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "u2", "@", "example", ".", "com", "'_", ":_", "{_", "'", "type", "1", "'_", ":_", "set_", "(_", "[_", "'", "read", "'_", ",_", "'", "write", "'_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "u", "3", "@", "example", ".", "com", "'_", ":_", "{_", "'", "type", "1", "'_", ":_", "set_", "(_", "[_", "'", "read", "'_", ",_", "'", "write", "'_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "u1", "@", "example", ".", "com", "'_", ":_", "{_", "'", "type", "1", "'_", ":_", "set_", "(_", "[_", "'", "read", "'_", ",_", "'", "write", "'_", ",_", "'", "list", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "2", "'_", ":_", "set_", "(_", "[_", "'", "read", "'_", ",_", "'", "write", "'_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "del", "\\u", "user_", "=_", "'", "tod", "ele", "te", "@", "example", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "g_", "._", "\\u", "Get", "Group", "Mem", "bers", "And", "Permissions_", "._", "return", "\\u", "value_", "=_", "group", "\\u", "users_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "key", "\\u", "to", "\\u", "del_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "key", "\\u", "u1_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "[_", "mock", "\\u", "key", "\\u", "to", "\\u", "del_", ",_", "mock", "\\u", "key", "\\u", "u1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "key", "\\u", "to", "\\u", "del_", "._", "name_", "._", "return", "\\u", "value_", "=_", "to", "\\u", "del", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "key", "\\u", "u1_", "._", "name_", "._", "return", "\\u", "value_", "=_", "'", "u1", "@", "example", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from", "\\u", "path", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "'", "tod", "el", "user", "key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "add_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "calls_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "u_", ",_", "p_", "in_", "group", "\\u", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calls_", "._", "append_", "(_", "(_", "u_", ",_", "p_", ",_", "'", "toadd", "-%", "s", "'_", "%_", "u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "add_", "._", "append_", "(_", "'", "toadd", "-%", "s", "'_", "%_", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Match", "Call", "Side", "Effect_", "(_", "a1_", ",_", "a2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "u_", ",_", "p_", ",_", "r_", "in_", "calls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "u_", "!=_", "a1_", "or_", "p_", "!=_", "a2_", ":_", "\\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_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "g_", "._", "\\u", "Make", "User", "Entity_", "._", "side", "\\u", "effect_", "=_", "Match", "Call", "Side", "Effect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "g_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from", "\\u", "path", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "sync_", "._", "models_", "._", "User_", "._", "\\u\\u", "name\\u\\u_", ",_", "to", "\\u", "del", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "g_", "._", "\\u", "Bat", "ch", "Datas", "tore", "Op_", "._", "assert", "\\u", "has", "\\u", "calls_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "(_", "group", "\\u", "sync_", "._", "db_", "._", "delete_", ",_", "[_", "'", "tod", "el", "user", "key", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "(_", "group", "\\u", "sync_", "._", "db_", "._", "put_", ",_", "to", "\\u", "add_", ")_", "]_", ")_", "\\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, 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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 ]
Unused local variable
ImageEngine/gaffer/python/GafferSceneTest/CustomOptionsTest.py
[ { "content": "\tdef testSerialisation( self ) :\n\n\t\ts = Gaffer.ScriptNode()\n\t\ts[\"optionsNode\"] = GafferScene.CustomOptions()\n\t\ts[\"optionsNode\"][\"options\"].addMember( \"test\", IECore.IntData( 10 ) )\n\t\ts[\"optionsNode\"][\"options\"].addMember( \"test2\", IECore.StringData( \"10\" ) )\n\n\t\tss = s.serialise()\n\n\t\ts2 = Gaffer.ScriptNode()\n\t\ts2.execute( ss )\n\n\t\tg = s2[\"optionsNode\"][\"out\"][\"globals\"].getValue()\n\t\tself.assertEqual( len( g ), 2 )\n\t\tself.assertEqual( g[\"option:test\"], IECore.IntData( 10 ) )\n\t\tself.assertEqual( g[\"option:test2\"], IECore.StringData( \"10\" ) )\n\t\tself.assertTrue( \"options1\" not in s2[\"optionsNode\"] )", "metadata": "root.CustomOptionsTest.testSerialisation", "header": "['class', 'CustomOptionsTest', '(', 'GafferSceneTest', '.', 'SceneTestCase', ')', ':', '___EOS___']", "index": 76 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Custom", "Optio", "ns", "Test_", "(_", "Ga", "ffer", "Scen", "e", "Test_", "._", "Scen", "e", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Seriali", "sation", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "s_", "=_", "Ga", "ffer", "_", "._", "Script", "Node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "[_", "\"", "options", "Node", "\"_", "]_", "=_", "Ga", "ffer", "Scene_", "._", "Custom", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "[_", "\"", "options", "Node", "\"_", "]_", "[_", "\"", "options", "\"_", "]_", "._", "add", "Member_", "(_", "\"", "test", "\"_", ",_", "IE", "Core_", "._", "Int", "Data_", "(_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "[_", "\"", "options", "Node", "\"_", "]_", "[_", "\"", "options", "\"_", "]_", "._", "add", "Member_", "(_", "\"", "test", "2", "\"_", ",_", "IE", "Core_", "._", "String", "Data_", "(_", "\"", "10", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ss_", "=_", "s_", "._", "serial", "ise_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s2_", "=_", "Ga", "ffer", "_", "._", "Script", "Node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s2_", "._", "execute_", "(_", "ss_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "s2_", "[_", "\"", "options", "Node", "\"_", "]_", "[_", "\"", "out", "\"_", "]_", "[_", "\"", "globals", "\"_", "]_", "._", "get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "g_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "g_", "[_", "\"", "option", ":", "test", "\"_", "]_", ",_", "IE", "Core_", "._", "Int", "Data_", "(_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "g_", "[_", "\"", "option", ":", "test", "2", "\"_", "]_", ",_", "IE", "Core_", "._", "String", "Data_", "(_", "\"", "10", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "options", "1", "\"_", "not_", "in_", "s2_", "[_", "\"", "options", "Node", "\"_", "]_", ")_", "\\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 ]
Module is imported more than once
tornadoweb/tornado/tornado/escape.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2009 Facebook\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"Escaping/unescaping methods for HTML, JSON, URLs, and others.\n\nAlso includes a few other miscellaneous string manipulation functions that\nhave crept in over time.\n\"\"\"\n\nfrom __future__ import absolute_import, division, print_function, with_statement\n\nimport json\nimport re\n\nfrom tornado.util import PY3, unicode_type, basestring_type\n\nif PY3:\n from urllib.parse import parse_qs as _parse_qs\n import html.entities as htmlentitydefs\n import urllib.parse as urllib_parse\n unichr = chr\nelse:\n from urlparse import parse_qs as _parse_qs\n import htmlentitydefs\n import urllib as urllib_parse\n\ntry:\n import typing # noqa\nexcept ImportError:\n pass\n\n\n_XHTML_ESCAPE_RE = re.compile('[&<>\"\\']')\n_XHTML_ESCAPE_DICT = {'&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;',\n '\\'': '&#39;'}\n\n\n\n\n\n\n# The fact that json_encode wraps json.dumps is an implementation detail.\n# Please see https://github.com/tornadoweb/tornado/pull/706\n# before sending a pull request that adds **kwargs to this function.\n\n\n\n\n\n\n\n\n# python 3 changed things around enough that we need two separate\n# implementations of url_unescape. We also need our own implementation\n# of parse_qs since python 3's version insists on decoding everything.\nif not PY3:\n\n parse_qs_bytes = _parse_qs\nelse:\n\n\n\n_UTF8_TYPES = (bytes, type(None))\n\n\n\n_TO_UNICODE_TYPES = (unicode_type, type(None))\n\n\n\n# to_unicode was previously named _unicode not because it was private,\n# but to avoid conflicts with the built-in unicode() function/type\n_unicode = to_unicode\n\n# When dealing with the standard library across python 2 and 3 it is\n# sometimes useful to have a direct conversion to the native string type\nif str is unicode_type:\n native_str = to_unicode\nelse:\n native_str = utf8\n\n_BASESTRING_TYPES = (basestring_type, type(None))\n\n\n\n\n\n# I originally used the regex from\n# http://daringfireball.net/2010/07/improved_regex_for_matching_urls\n# but it gets all exponential on certain patterns (such as too many trailing\n# dots), causing the regex matcher to never return.\n# This regex should avoid those problems.\n# Use to_unicode instead of tornado.util.u - we don't want backslashes getting\n# processed as escapes.\n_URL_RE = re.compile(to_unicode(r\"\"\"\\b((?:([\\w-]+):(/{1,3})|www[.])(?:(?:(?:[^\\s&()]|&amp;|&quot;)*(?:[^!\"#$%&'()*+,.:;<=>?@\\[\\]^`{|}~\\s]))|(?:\\((?:[^\\s&()]|&amp;|&quot;)*\\)))+)\"\"\"))\n\n\n\n\n\n\n\n_HTML_UNICODE_MAP = _build_unicode_map()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "200", "9", " ", "Face", "book_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Esc", "api", "ng", "/", "une", "scap", "ing", " ", "method", "s", " ", "for", " ", "HTM", "L", ",", " ", "JSO", "N", ",", " ", "URL", "s", ",", " ", "and", " ", "other", "s", ".", "\\", "10", ";", "\\", "10", ";", "Al", "so", " ", "include", "s", " ", "a", " ", "few", " ", "other", " ", "misc", "ella", "neous", " ", "string", " ", "manipulati", "on", " ", "function", "s", " ", "tha", "t", "\\", "10", ";", "have", " ", "cre", "pt", " ", "in", " ", "over", " ", "time", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", ",_", "with", "\\u", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tornado_", "._", "util_", "import_", "PY", "3_", ",_", "unicode", "\\u", "type_", ",_", "basest", "ring", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "._", "parse_", "import_", "parse", "\\u", "qs_", "as_", "\\u", "parse", "\\u", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "html_", "._", "entities_", "as_", "html", "entity", "defs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "._", "parse_", "as_", "url", "lib", "\\u", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unichr_", "=_", "chr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urlparse_", "import_", "parse", "\\u", "qs_", "as_", "\\u", "parse", "\\u", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "html", "entity", "defs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "as_", "url", "lib", "\\u", "parse_", "\\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 ", " _", "import_", "typing_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "XH", "TML", "\\u", "ESCAPE", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "'[", "&", "<>", "\"\\\\'", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "XH", "TML", "\\u", "ESCAPE", "\\u", "DICT_", "=_", "{_", "'&'_", ":_", "'&", "amp", ";'_", ",_", "'<'_", ":_", "'&", "lt", ";'_", ",_", "'>'_", ":_", "'&", "gt", ";'_", ",_", "'\"'_", ":_", "'&", "quot", ";'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\''_", ":_", "'&", "#", "3", "9", ";'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "fact", " ", "tha", "t", " ", "json", "\\u", "encode", " ", "wrap", "s", " ", "json", ".", "dump", "s", " ", "is", " ", "an", " ", "implementation", " ", "deta", "il", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ple", "ase", " ", "see", " ", "https", "://", "git", "hub", ".", "com", "/", "torn", "ado", "web", "/", "torn", "ado", "/", "pull", "/", "706", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bef", "ore", " ", "sendin", "g", " ", "a", " ", "pull", " ", "request", " ", "tha", "t", " ", "adds", " ", "**", "kwarg", "s", " ", "to", " ", "this", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "3", " ", "change", "d", " ", "thing", "s", " ", "aro", "und", " ", "eno", "ugh", " ", "tha", "t", " ", "we", " ", "need", " ", "two", " ", "separate", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "implementation", "s", " ", "of", " ", "url", "\\u", "unescape", ".", " ", " ", "We", " ", "als", "o", " ", "need", " ", "our", " ", "own", " ", "implementation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "parse", "\\u", "qs", " ", "sinc", "e", " ", "python", " ", "3", "'", "s", " ", "version", " ", "insi", "sts", " ", "on", " ", "deco", "ding", " ", "every", "thing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parse", "\\u", "qs", "\\u", "bytes_", "=_", "\\u", "parse", "\\u", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "UT", "F8", "\\u", "TYPES_", "=_", "(_", "bytes_", ",_", "type_", "(_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "TO", "\\u", "UNICODE", "\\u", "TYPES_", "=_", "(_", "unicode", "\\u", "type_", ",_", "type_", "(_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", "\\u", "unicode", " ", "was", " ", "previ", "ously", " ", "named", " ", "\\u", "unicode", " ", "not", " ", "bec", "aus", "e", " ", "it", " ", "was", " ", "private", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "to", " ", "avoid", " ", "confl", "icts", " ", "with", " ", "the", " ", "bui", "lt", "-", "in", " ", "unicode", "()", " ", "function", "/", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "unicode_", "=_", "to", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "deal", "ing", " ", "with", " ", "the", " ", "standard", " ", "librar", "y", " ", "acro", "ss", " ", "python", " ", "2", " ", "and", " ", "3", " ", "it", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "somet", "imes", " ", "usef", "ul", " ", "to", " ", "have", " ", "a", " ", "direct", " ", "conve", "rsi", "on", " ", "to", " ", "the", " ", "nativ", "e", " ", "string", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "str_", "is_", "unicode", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nativ", "e\\u", "str_", "=_", "to", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nativ", "e\\u", "str_", "=_", "utf8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "BASE", "STRING", "\\u", "TYPES_", "=_", "(_", "basest", "ring", "\\u", "type_", ",_", "type_", "(_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", " ", "original", "ly", " ", "used", " ", "the", " ", "regex", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "dar", "ing", "fireba", "ll", ".", "net", "/", "2010", "/", "0", "7", "/", "improve", "d\\u", "regex", "\\u", "for", "\\u", "matchi", "ng", "\\u", "urls_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "it", " ", "gets", " ", "all", " ", "exponential", " ", "on", " ", "cert", "ain", " ", "pattern", "s", " ", "(", "suc", "h", " ", "as", " ", "too", " ", "many", " ", "trail", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dot", "s", "),", " ", "caus", "ing", " ", "the", " ", "regex", " ", "matche", "r", " ", "to", " ", "neve", "r", " ", "return", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "regex", " ", "shou", "ld", " ", "avoid", " ", "tho", "se", " ", "problem", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "to", "\\u", "unicode", " ", "inst", "ead", " ", "of", " ", "torn", "ado", ".", "util", ".", "u", " ", "-", " ", "we", " ", "don", "'", "t", " ", "want", " ", "backslash", "es", " ", "getti", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "process", "ed", " ", "as", " ", "escape", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "URL", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "to", "\\u", "unicode_", "(_", "r", "\"\"\"", "\\\\", "b", "((", "?:", "([\\\\", "w", "-]+)", ":(", "/{", "1", ",", "3", "})", "|", "www", "[.", "])(", "?:", "(?:", "(?:[", "^", "\\\\", "s", "&(", ")]", "|", "&", "amp", ";", "|", "&", "quot", ";)", "*(", "?:[", "^", "!\"", "#$", "%&", "'(", ")*", "+,", ".:", ";<", "=>", "?", "@", "\\\\[", "\\\\]", "^", "`", "{", "|", "}", "~", "\\\\", "s", "]))", "|(?", ":\\\\", "((", "?:[", "^", "\\\\", "s", "&(", ")]", "|", "&", "amp", ";", "|", "&", "quot", ";)", "*\\\\", ")))", "+)", "\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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", "HTM", "L", "\\u", "UNICODE", "\\u", "MAP_", "=_", "\\u", "build", "\\u", "unicode", "\\u", "map_", "(_", ")_" ]
[ 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,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
reviewboard/reviewboard/reviewboard/webapi/tests/test_review_screenshot_comment.py
[ { "content": " def setup_basic_put_test(self, user, with_local_site, local_site_name,\n put_valid_data):\n review_request = self.create_review_request(\n with_local_site=with_local_site,\n submitter=user,\n publish=True)\n screenshot = self.create_screenshot(review_request)\n review = self.create_review(review_request, user=user)\n comment = self.create_screenshot_comment(review, screenshot)\n\n return (get_review_screenshot_comment_item_url(review, comment.pk,\n local_site_name),\n screenshot_comment_item_mimetype,\n {'text': 'Test comment'},\n comment,\n [])", "metadata": "root.ResourceItemTests.setup_basic_put_test", "header": "['class', 'ResourceItemTests', '(', 'CommentItemMixin', ',', 'ReviewRequestChildItemMixin', ',', '___NL___', 'BaseTestCase', ')', ':', '___EOS___']", "index": 239 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Reso", "urc", "e", "Item", "Tests_", "(_", "Comme", "nt", "Item", "Mixin_", ",_", "Review", "Request", "Chil", "d", "Item", "Mixin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "basic", "\\u", "put", "\\u", "test_", "(_", "self_", ",_", "user_", ",_", "with", "\\u", "local", "\\u", "site_", ",_", "local", "\\u", "site", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "put", "\\u", "valid", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "review", "\\u", "request_", "=_", "self_", "._", "create", "\\u", "review", "\\u", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "with", "\\u", "local", "\\u", "site_", "=_", "with", "\\u", "local", "\\u", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "submitter", "_", "=_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "publish_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screenshot_", "=_", "self_", "._", "create", "\\u", "screenshot_", "(_", "review", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "review_", "=_", "self_", "._", "create", "\\u", "review_", "(_", "review", "\\u", "request_", ",_", "user_", "=_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "self_", "._", "create", "\\u", "screenshot", "\\u", "comment_", "(_", "review_", ",_", "screenshot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "get", "\\u", "review", "\\u", "screenshot", "\\u", "comment", "\\u", "item", "\\u", "url_", "(_", "review_", ",_", "comment_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "site", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "screenshot", "\\u", "comment", "\\u", "item", "\\u", "mimetype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "text", "'_", ":_", "'", "Test", " ", "comment", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
zorna/zorna/zorna/account/forms.py
[ { "content": "import os\nfrom django.conf import settings\nfrom django import forms\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.contrib.auth.models import User\nfrom django.forms import ModelForm\nfrom django.contrib.sites.models import Site\nfrom django.template.loader import render_to_string\nfrom django.core.urlresolvers import reverse\nfrom django.db.models import Q\nfrom mptt.forms import TreeNodeChoiceField\n\nfrom zorna.account.models import UserProfile, UserAvatar\nfrom zorna.account.models import UserGroup\nfrom zorna.site.models import SiteRegistration, REGISTRATION_NO_VALIDATION, \\\n REGISTRATION_EMAIL_VALIDATION, REGISTRATION_ADMIN_VALIDATION\nfrom zorna.site.email import ZornaEmail\n\n\n\n\n\n\n\n\n\n\n\nSEPARATOR_CHOICES = (\n (\";\", _(\"Semicolon\")),\n (\",\", _(\"Comma\")),\n (\"tab\", _(\"Tabulation\")))\n\nENCODING_CHOICES = (\n (\"UTF-8\", _(\"UTF-8\")),\n (\"ISO-8859-1\", _(\"ISO-8859-1\")),)\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AccountEditPasswordForm(forms.Form):\n password1 = forms.CharField(widget=forms.PasswordInput(render_value=False),\n label=_(u'Password'))\n password2 = forms.CharField(widget=forms.PasswordInput(render_value=False),\n label=_(u'Password (again)'))\n", "metadata": "root.AccountEditPasswordForm", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def clean(self):\n \"\"\"\n Verify that the 2 passwords fields are equal\n \"\"\"\n if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:\n if self.cleaned_data['password1'] != self.cleaned_data['password2'] or self.cleaned_data['password2'] == '':\n raise forms.ValidationError(_(\n u'You must type the same password each time'))\n else:\n raise forms.ValidationError(_(u'You must type password'))\n return self.cleaned_data", "metadata": "root.AccountEditPasswordForm.clean", "header": "['class', 'AccountEditPasswordForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 25 }, { "content": "class AccountEditProfileForm(forms.Form):\n username = forms.RegexField(regex=r'^\\w+$',\n max_length=30,\n widget=forms.TextInput(attrs={'size': 80}), label=_(u'Username'))\n email = forms.EmailField(widget=forms.TextInput(\n attrs={'size': 80}), label=_(u'Email address'))\n firstname = forms.CharField(widget=forms.TextInput(\n attrs={'size': 80}), label=_(u'Firstname'))\n lastname = forms.CharField(widget=forms.TextInput(\n attrs={'size': 80}), label=_(u'Lastname'))\n is_active = forms.BooleanField(label=_('is active'), required=False, help_text=_(\n \"Designates whether this user should be treated as active. Unselect this instead of deleting accounts.\"))\n\n", "metadata": "root.AccountEditProfileForm", "header": "['module', '___EOS___']", "index": 38 }, { "content": " def __init__(self, user, *args, **kwargs):\n super(AccountEditProfileForm, self).__init__(*args, **kwargs)\n self.user = user\n self.initial['email'] = user.email\n self.initial['firstname'] = user.first_name\n self.initial['lastname'] = user.last_name\n self.initial['username'] = user.username\n self.initial['is_active'] = user.is_active", "metadata": "root.AccountEditProfileForm.__init__", "header": "['class', 'AccountEditProfileForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 51 }, { "content": " def clean_username(self):\n \"\"\"\n Validate that the username is alphanumeric and is not already\n in use.\n\n \"\"\"\n username = self.cleaned_data.get(\"username\")\n if not set(username).issubset(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\"):\n raise forms.ValidationError(_(\n \"That username has invalid characters. The valid values are letters, numbers and underscore.\"))\n try:\n user = User.objects.get(\n username__iexact=self.cleaned_data['username'])\n except User.DoesNotExist:\n return self.cleaned_data['username']\n if self.user and self.user.pk == user.pk:\n return self.cleaned_data['username']\n raise forms.ValidationError(_(\n u'This username is already taken. Please choose another.'))", "metadata": "root.AccountEditProfileForm.clean_username", "header": "['class', 'AccountEditProfileForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 60 }, { "content": "class AccountRegistrationForm(forms.Form):\n\n username = forms.RegexField(regex=r'^\\w+$',\n max_length=30,\n widget=forms.TextInput(attrs={'size': 80}), label=_(u'Login ID'))\n password1 = forms.CharField(widget=forms.PasswordInput(render_value=False),\n label=_(u'Password'))\n password2 = forms.CharField(widget=forms.PasswordInput(render_value=False),\n label=_(u'Password (again)'))\n firstname = forms.CharField(widget=forms.TextInput(\n attrs={'size': 80}), label=_(u'Firstname'))\n lastname = forms.CharField(widget=forms.TextInput(\n attrs={'size': 80}), label=_(u'Lastname'))\n email = forms.EmailField(widget=forms.TextInput(\n attrs={'size': 80}), label=_(u'Email address'))\n\n\n", "metadata": "root.AccountRegistrationForm", "header": "['module', '___EOS___']", "index": 81 }, { "content": " def clean_username(self):\n \"\"\"\n Validate that the username is alphanumeric and is not already\n in use.\n\n \"\"\"\n username = self.cleaned_data.get(\"username\")\n if not set(username).issubset(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\"):\n raise forms.ValidationError(_(\n \"That username has invalid characters. The valid values are letters, numbers and underscore.\"))\n try:\n User.objects.get(username__iexact=self.cleaned_data['username'])\n except User.DoesNotExist:\n return self.cleaned_data['username']\n raise forms.ValidationError(_(\n u'This username is already taken. Please choose another.'))", "metadata": "root.AccountRegistrationForm.clean_username", "header": "['class', 'AccountRegistrationForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 97 }, { "content": " def clean(self):\n \"\"\"\n Verify that the 2 passwords fields are equal\n \"\"\"\n if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:\n if self.cleaned_data['password1'] != self.cleaned_data['password2']:\n raise forms.ValidationError(_(\n u'You must type the same password each time'))\n return self.cleaned_data", "metadata": "root.AccountRegistrationForm.clean", "header": "['class', 'AccountRegistrationForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 114 }, { "content": " def save(self, request, admin_origin, is_active, *args, **kwargs):\n \"\"\"\n Create the new ``User`` and his profile\n \"\"\"\n current_site = Site.objects.get_current()\n try:\n reg = SiteRegistration.objects.get(site=current_site)\n except SiteRegistration.DoesNotExist:\n reg = None\n\n if reg and reg.validation_type == REGISTRATION_NO_VALIDATION:\n is_active = True\n\n new_user = User.objects.create_user(self.cleaned_data[\n 'username'], self.cleaned_data['email'], self.cleaned_data['password1'])\n new_user.is_active = is_active\n new_user.first_name = self.cleaned_data['firstname']\n new_user.last_name = self.cleaned_data['lastname']\n new_user.save()\n up = new_user.get_profile()\n if admin_origin or (reg and reg.validation_type == REGISTRATION_NO_VALIDATION):\n up.activation_key = UserProfile.ACTIVATED\n up.save()\n if reg:\n groups = reg.groups.all()\n if groups:\n args = [obj for obj in groups]\n up.groups.clear()\n up.groups.add(*args)\n\n if admin_origin is False and reg:\n ec = {'activation_key': up.activation_key,\n 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,\n 'site': current_site,\n 'user': new_user, 'mime_type': 'text',\n 'url': request.build_absolute_uri(reverse('account_activate', args=[up.activation_key]))\n }\n if reg.validation_type == REGISTRATION_EMAIL_VALIDATION:\n subject = _(\"Account activation on\") + ' ' + current_site.name\n body_text = render_to_string(\n 'account/activation_email.html', ec)\n ec['mime_type'] = 'html'\n body_html = render_to_string(\n 'account/activation_email.html', ec)\n email = ZornaEmail()\n email.append(subject, body_text, body_html, settings.DEFAULT_FROM_EMAIL, [\n new_user.email])\n email.send()\n elif reg.validation_type == REGISTRATION_ADMIN_VALIDATION:\n from zorna.site.models import SiteOptions\n email_lists = SiteOptions.objects.get_authorized_user(\n 'zorna_validate_registration')\n if email_lists:\n subject = _(\"Your site has recorded a new registration\")\n body_text = render_to_string(\n 'account/registration_email.html', ec)\n ec['mime_type'] = 'html'\n body_html = render_to_string(\n 'account/registration_email.html', ec)\n email = ZornaEmail()\n email.append(subject, body_text, body_html, settings.DEFAULT_FROM_EMAIL, [\n u.email for u in email_lists])\n email.send()\n return new_user", "metadata": "root.AccountRegistrationForm.save", "header": "['class', 'AccountRegistrationForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 124 }, { "content": "class UserGroupForm(ModelForm):\n parent = TreeNodeChoiceField(queryset=UserGroup.objects.filter(\n id__gte=3).order_by('lft'), required=True) # @UndefinedVariable\n name = forms.CharField(max_length=80,\n widget=forms.TextInput({'size': 100})\n )\n\n class Meta:\n model = UserGroup", "metadata": "root.UserGroupForm", "header": "['module', '___EOS___']", "index": 190 }, { "content": "class UserAvatarForm(forms.ModelForm):\n\n class Meta:\n exclude = ('user',)\n model = UserAvatar\n", "metadata": "root.UserAvatarForm", "header": "['module', '___EOS___']", "index": 201 }, { "content": " def clean_avatar(self):\n data = self.cleaned_data['avatar']\n if data:\n (root, ext) = os.path.splitext(data.name.lower())\n allowed_extensions = ['.jpg', '.jpeg', '.png', '.gif']\n if ext not in allowed_extensions:\n raise forms.ValidationError(\n _(u\"%(ext)s is an invalid file extension. Authorized extensions are : %(valid_exts_list)s\") %\n {'ext': ext, 'valid_exts_list': \", \".join(allowed_extensions)})\n else:\n raise forms.ValidationError(_(\n u\"Please, choose a valid image file\"))\n return data", "metadata": "root.UserAvatarForm.clean_avatar", "header": "['class', 'UserAvatarForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 207 }, { "content": "class UsersFormImportCsv(forms.Form):\n csv_file = forms.CharField(label=_(\n u'File'), widget=forms.FileInput(attrs={'size': '80'}))\n separator = forms.ChoiceField(label=_(\n \"Separator\"), choices=SEPARATOR_CHOICES, required=True)\n other = forms.CharField(widget=forms.TextInput(attrs={\n 'size': 1}), label=_(u'Other'), max_length=1, required=False)\n encoding = forms.ChoiceField(label=_(\n \"Encoding\"), choices=ENCODING_CHOICES, required=True)", "metadata": "root.UsersFormImportCsv", "header": "['module', '___EOS___']", "index": 231 }, { "content": "class RequestNewPasswordForm(forms.Form):\n username = forms.CharField(widget=forms.TextInput(attrs={\n 'size': '80'}), label=_(u'Username'), help_text=_(u'Username or email address'))\n", "metadata": "root.RequestNewPasswordForm", "header": "['module', '___EOS___']", "index": 242 }, { "content": " def clean(self):\n \"\"\"\n Verify that user with email or username field exist\n \"\"\"\n try:\n User.objects.get(Q(username=self.cleaned_data[\n 'username']) | Q(email=self.cleaned_data['username']))\n except User.DoesNotExist:\n raise forms.ValidationError(_(u'Unkown username or email'))\n except:\n raise forms.ValidationError(_(u'Invlaid username or email'))\n return self.cleaned_data", "metadata": "root.RequestNewPasswordForm.clean", "header": "['class', 'RequestNewPasswordForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 246 }, { "content": "class ResetPasswordForm(forms.Form):\n password1 = forms.CharField(widget=forms.PasswordInput(render_value=False),\n label=_(u'Password'))\n password2 = forms.CharField(widget=forms.PasswordInput(render_value=False),\n label=_(u'Password (again)'))\n", "metadata": "root.ResetPasswordForm", "header": "['module', '___EOS___']", "index": 260 }, { "content": " def clean(self):\n \"\"\"\n Verify that the 2 passwords fields are equal\n \"\"\"\n if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:\n if self.cleaned_data['password1'] != self.cleaned_data['password2']:\n raise forms.ValidationError(_(\n u'You must type the same password each time'))\n return self.cleaned_data", "metadata": "root.ResetPasswordForm.clean", "header": "['class', 'ResetPasswordForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 266 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "import_", "Model", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "sites_", "._", "models_", "import_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "loader_", "import_", "render", "\\u", "to", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mpt", "t_", "._", "forms_", "import_", "Tree", "Node", "Choi", "ce", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zor", "na_", "._", "account_", "._", "models_", "import_", "User", "Profile_", ",_", "User", "Avatar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zor", "na_", "._", "account_", "._", "models_", "import_", "User", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zor", "na_", "._", "site_", "._", "models_", "import_", "Site", "Registration", "_", ",_", "REGI", "STRAT", "ION", "\\u", "NO", "\\u", "VALIDATION", "_", ",_", "REGI", "STRAT", "ION", "\\u", "EMA", "IL", "\\u", "VALIDATION", "_", ",_", "REGI", "STRAT", "ION", "\\u", "ADM", "IN", "\\u", "VALIDATION", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zor", "na_", "._", "site_", "._", "email_", "import_", "Zo", "rna", "Email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "SEPA", "RAT", "OR", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\";\"_", ",_", "\\u_", "(_", "\"", "Semi", "colon", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\",\"_", ",_", "\\u_", "(_", "\"", "Comm", "a", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "tab", "\"_", ",_", "\\u_", "(_", "\"", "Tab", "ulation", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ENCODING", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "UT", "F", "-", "8", "\"_", ",_", "\\u_", "(_", "\"", "UT", "F", "-", "8", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ISO", "-", "8859", "-1", "\"_", ",_", "\\u_", "(_", "\"", "ISO", "-", "8859", "-1", "\"_", ")_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Account", "Edit", "Passw", "ord", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password", "1_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", "(_", "render", "\\u", "value_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "u", "'", "Passw", "ord", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "2_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", "(_", "render", "\\u", "value_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "u", "'", "Passw", "ord", " ", "(", "again", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Account", "Edit", "Passw", "ord", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Verify", " ", "tha", "t", " ", "the", " ", "2", " ", "passwords", " ", "fields", " ", "are", " ", "equal", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "password", "1", "'_", "in_", "self_", "._", "clean", "ed", "\\u", "data_", "and_", "'", "password", "2", "'_", "in_", "self_", "._", "clean", "ed", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "1", "'_", "]_", "!=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "2", "'_", "]_", "or_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "2", "'_", "]_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "You", " ", "must", " ", "type", " ", "the", " ", "same", " ", "password", " ", "each", " ", "time", "'_", ")_", ")_", "\\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_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "u", "'", "You", " ", "must", " ", "type", " ", "password", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "clean", "ed", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Account", "Edit", "Profil", "e", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "forms_", "._", "Rege", "x", "Field_", "(_", "regex_", "=_", "r", "'", "^", "\\\\", "w", "+$", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "length_", "=_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "attrs_", "=_", "{_", "'", "size", "'_", ":_", "80_", "}_", ")_", ",_", "label_", "=_", "\\u_", "(_", "u", "'", "User", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "forms_", "._", "Ema", "il", "Field_", "(_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "size", "'_", ":_", "80_", "}_", ")_", ",_", "label_", "=_", "\\u_", "(_", "u", "'", "Ema", "il", " ", "address", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "firstname_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "size", "'_", ":_", "80_", "}_", ")_", ",_", "label_", "=_", "\\u_", "(_", "u", "'", "Fi", "rst", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lastname_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "size", "'_", ":_", "80_", "}_", ")_", ",_", "label_", "=_", "\\u_", "(_", "u", "'", "Las", "tname", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "active_", "=_", "forms_", "._", "Boo", "lean", "Field_", "(_", "label_", "=_", "\\u_", "(_", "'", "is", " ", "active", "'_", ")_", ",_", "required_", "=_", "False_", ",_", "help", "\\u", "text_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Designat", "es", " ", "whe", "ther", " ", "this", " ", "user", " ", "shou", "ld", " ", "be", " ", "treat", "ed", " ", "as", " ", "active", ".", " ", "Unse", "lect", " ", "this", " ", "inst", "ead", " ", "of", " ", "delet", "ing", " ", "account", "s", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Account", "Edit", "Profil", "e", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Account", "Edit", "Profil", "e", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "initial_", "[_", "'", "email", "'_", "]_", "=_", "user_", "._", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "initial_", "[_", "'", "first", "name", "'_", "]_", "=_", "user_", "._", "first", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "initial_", "[_", "'", "last", "name", "'_", "]_", "=_", "user_", "._", "last", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "initial_", "[_", "'", "user", "name", "'_", "]_", "=_", "user_", "._", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "initial_", "[_", "'", "is", "\\u", "active", "'_", "]_", "=_", "user_", "._", "is", "\\u", "active_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Account", "Edit", "Profil", "e", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "username_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", " ", "tha", "t", " ", "the", " ", "user", "name", " ", "is", " ", "alphanumeric", " ", "and", " ", "is", " ", "not", " ", "alr", "ead", "y", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "use", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "user", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "set_", "(_", "username_", ")_", "._", "issubset_", "(_", "\"", "abcdefg", "hij", "kl", "mn", "op", "qr", "stu", "vw", "xyz", "ABCDE", "FG", "HI", "JK", "LM", "NOP", "QR", "STU", "VW", "XY", "Z", "0123456", "789", "\\u\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Tha", "t", " ", "user", "name", " ", "has", " ", "invalid", " ", "character", "s", ".", " ", "The", " ", "valid", " ", "values", " ", "are", " ", "letter", "s", ",", " ", "numbers", " ", "and", " ", "underscore", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "User_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user", "name", "\\u\\u", "iex", "act_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "user", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "User_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "user_", "and_", "self_", "._", "user_", "._", "pk_", "==_", "user_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Thi", "s", " ", "user", "name", " ", "is", " ", "alr", "ead", "y", " ", "take", "n", ".", " ", "Ple", "ase", " ", "choose", " ", "anot", "her", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Account", "Registration", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "forms_", "._", "Rege", "x", "Field_", "(_", "regex_", "=_", "r", "'", "^", "\\\\", "w", "+$", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "length_", "=_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "attrs_", "=_", "{_", "'", "size", "'_", ":_", "80_", "}_", ")_", ",_", "label_", "=_", "\\u_", "(_", "u", "'", "Logi", "n", " ", "ID", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "1_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", "(_", "render", "\\u", "value_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "u", "'", "Passw", "ord", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "2_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", "(_", "render", "\\u", "value_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "u", "'", "Passw", "ord", " ", "(", "again", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "firstname_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "size", "'_", ":_", "80_", "}_", ")_", ",_", "label_", "=_", "\\u_", "(_", "u", "'", "Fi", "rst", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lastname_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "size", "'_", ":_", "80_", "}_", ")_", ",_", "label_", "=_", "\\u_", "(_", "u", "'", "Las", "tname", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "forms_", "._", "Ema", "il", "Field_", "(_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "size", "'_", ":_", "80_", "}_", ")_", ",_", "label_", "=_", "\\u_", "(_", "u", "'", "Ema", "il", " ", "address", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Account", "Registration", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clean", "\\u", "username_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", " ", "tha", "t", " ", "the", " ", "user", "name", " ", "is", " ", "alphanumeric", " ", "and", " ", "is", " ", "not", " ", "alr", "ead", "y", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "use", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "user", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "set_", "(_", "username_", ")_", "._", "issubset_", "(_", "\"", "abcdefg", "hij", "kl", "mn", "op", "qr", "stu", "vw", "xyz", "ABCDE", "FG", "HI", "JK", "LM", "NOP", "QR", "STU", "VW", "XY", "Z", "0123456", "789", "\\u\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Tha", "t", " ", "user", "name", " ", "has", " ", "invalid", " ", "character", "s", ".", " ", "The", " ", "valid", " ", "values", " ", "are", " ", "letter", "s", ",", " ", "numbers", " ", "and", " ", "underscore", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "User_", "._", "objects_", "._", "get_", "(_", "user", "name", "\\u\\u", "iex", "act_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "user", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "User_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Thi", "s", " ", "user", "name", " ", "is", " ", "alr", "ead", "y", " ", "take", "n", ".", " ", "Ple", "ase", " ", "choose", " ", "anot", "her", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Account", "Registration", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Verify", " ", "tha", "t", " ", "the", " ", "2", " ", "passwords", " ", "fields", " ", "are", " ", "equal", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "password", "1", "'_", "in_", "self_", "._", "clean", "ed", "\\u", "data_", "and_", "'", "password", "2", "'_", "in_", "self_", "._", "clean", "ed", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "1", "'_", "]_", "!=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "2", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "You", " ", "must", " ", "type", " ", "the", " ", "same", " ", "password", " ", "each", " ", "time", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "clean", "ed", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Account", "Registration", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "request_", ",_", "admin", "\\u", "origin_", ",_", "is", "\\u", "active_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "the", " ", "new", " ", "``", "User", "``", " ", "and", " ", "his", " ", "profile", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "site_", "=_", "Site_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "=_", "Site", "Registration", "_", "._", "objects_", "._", "get_", "(_", "site_", "=_", "current", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Registration", "_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "reg_", "and_", "reg_", "._", "validation", "\\u", "type_", "==_", "REGI", "STRAT", "ION", "\\u", "NO", "\\u", "VALIDATION", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "active_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "user_", "=_", "User_", "._", "objects_", "._", "create", "\\u", "user_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", "]_", ",_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "email", "'_", "]_", ",_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "user_", "._", "is", "\\u", "active_", "=_", "is", "\\u", "active_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "user_", "._", "first", "\\u", "name_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "first", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "user_", "._", "last", "\\u", "name_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "last", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "up_", "=_", "new", "\\u", "user_", "._", "get", "\\u", "profile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "admin", "\\u", "origin_", "or_", "(_", "reg_", "and_", "reg_", "._", "validation", "\\u", "type_", "==_", "REGI", "STRAT", "ION", "\\u", "NO", "\\u", "VALIDATION", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "up_", "._", "activation", "\\u", "key_", "=_", "User", "Profile_", "._", "ACTIVAT", "ED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "up_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "groups_", "=_", "reg_", "._", "groups_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "obj_", "for_", "obj_", "in_", "groups_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "up_", "._", "groups_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "up_", "._", "groups_", "._", "add_", "(_", "*_", "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_", "if_", "admin", "\\u", "origin_", "is_", "False_", "and_", "reg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ec_", "=_", "{_", "'", "activation", "\\u", "key", "'_", ":_", "up_", "._", "activation", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expir", "ation", "\\u", "day", "s", "'_", ":_", "settings_", "._", "ACCOUNT", "\\u", "ACTIVAT", "ION", "\\u", "DAYS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "site", "'_", ":_", "current", "\\u", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "new", "\\u", "user_", ",_", "'", "mime", "\\u", "type", "'_", ":_", "'", "text", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "request_", "._", "build", "\\u", "abs", "olute", "\\u", "uri_", "(_", "reverse_", "(_", "'", "account", "\\u", "activat", "e", "'_", ",_", "args_", "=_", "[_", "up_", "._", "activation", "\\u", "key_", "]_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reg_", "._", "validation", "\\u", "type_", "==_", "REGI", "STRAT", "ION", "\\u", "EMA", "IL", "\\u", "VALIDATION", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject_", "=_", "\\u_", "(_", "\"", "Account", " ", "activation", " ", "on", "\"_", ")_", "+_", "'", " ", "'_", "+_", "current", "\\u", "site_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "text_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "account", "/", "activation", "\\u", "email", ".", "html", "'_", ",_", "ec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ec_", "[_", "'", "mime", "\\u", "type", "'_", "]_", "=_", "'", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "html_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "account", "/", "activation", "\\u", "email", ".", "html", "'_", ",_", "ec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "Zo", "rna", "Email_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "._", "append_", "(_", "subject_", ",_", "body", "\\u", "text_", ",_", "body", "\\u", "html_", ",_", "settings_", "._", "DEF", "AUL", "T", "\\u", "FROM", "\\u", "EMAIL_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "user_", "._", "email_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "._", "send_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reg_", "._", "validation", "\\u", "type_", "==_", "REGI", "STRAT", "ION", "\\u", "ADM", "IN", "\\u", "VALIDATION", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "zor", "na_", "._", "site_", "._", "models_", "import_", "Site", "Options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email", "\\u", "lists_", "=_", "Site", "Options_", "._", "objects_", "._", "get", "\\u", "authoriz", "ed", "\\u", "user_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zor", "na", "\\u", "validat", "e\\u", "registration", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "email", "\\u", "lists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "subject_", "=_", "\\u_", "(_", "\"", "You", "r", " ", "site", " ", "has", " ", "recorde", "d", " ", "a", " ", "new", " ", "registration", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "text_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "account", "/", "registration", "\\u", "email", ".", "html", "'_", ",_", "ec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ec_", "[_", "'", "mime", "\\u", "type", "'_", "]_", "=_", "'", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "html_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "account", "/", "registration", "\\u", "email", ".", "html", "'_", ",_", "ec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "Zo", "rna", "Email_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "._", "append_", "(_", "subject_", ",_", "body", "\\u", "text_", ",_", "body", "\\u", "html_", ",_", "settings_", "._", "DEF", "AUL", "T", "\\u", "FROM", "\\u", "EMAIL_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "u_", "._", "email_", "for_", "u_", "in_", "email", "\\u", "lists_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "._", "send_", "(_", ")_", "\\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_", "new", "\\u", "user_", "\\u\\u\\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", "Group", "Form_", "(_", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "Tree", "Node", "Choi", "ce", "Field_", "(_", "queryset_", "=_", "User", "Group_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u\\u", "gte_", "=_", "3_", ")_", "._", "order", "\\u", "by_", "(_", "'", "lft", "'_", ")_", ",_", "required_", "=_", "True_", ")_", "#", " ", "@", "Unde", "fined", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "80_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "{_", "'", "size", "'_", ":_", "100_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "User", "Group_", "\\u\\u\\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", "Ava", "tar", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exclude_", "=_", "(_", "'", "user", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "User", "Avatar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "User", "Ava", "tar", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "avatar_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "avat", "ar", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "root_", ",_", "ext_", ")_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "data_", "._", "name_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "extensions_", "=_", "[_", "'.", "jp", "g", "'_", ",_", "'.", "jpeg", "'_", ",_", "'.", "png", "'_", ",_", "'.", "gif", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ext_", "not_", "in_", "allow", "ed", "\\u", "extensions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "u", "\"%", "(", "ext", ")", "s", " ", "is", " ", "an", " ", "invalid", " ", "file", " ", "extensi", "on", ".", " ", "Authorized", " ", "extensi", "ons", " ", "are", " ", ":", " ", "%", "(", "valid", "\\u", "ext", "s", "\\u", "list", ")", "s", "\"_", ")_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "ext", "'_", ":_", "ext_", ",_", "'", "valid", "\\u", "ext", "s", "\\u", "list", "'_", ":_", "\",", " ", "\"_", "._", "join_", "(_", "allow", "ed", "\\u", "extensions_", ")_", "}_", ")_", "\\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_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Ple", "ase", ",", " ", "choose", " ", "a", " ", "valid", " ", "image", " ", "file", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "User", "s", "Form", "Import", "Cs", "v_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csv", "\\u", "file_", "=_", "forms_", "._", "Char", "Field_", "(_", "label_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "File", "'_", ")_", ",_", "widget_", "=_", "forms_", "._", "File", "Input_", "(_", "attrs_", "=_", "{_", "'", "size", "'_", ":_", "'", "80", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "separator_", "=_", "forms_", "._", "Choi", "ce", "Field_", "(_", "label_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sepa", "rator", "\"_", ")_", ",_", "choices_", "=_", "SEPA", "RAT", "OR", "\\u", "CHOICES_", ",_", "required_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "attrs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "1_", "}_", ")_", ",_", "label_", "=_", "\\u_", "(_", "u", "'", "Ot", "her", "'_", ")_", ",_", "max", "\\u", "length_", "=_", "1_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoding_", "=_", "forms_", "._", "Choi", "ce", "Field_", "(_", "label_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Enco", "ding", "\"_", ")_", ",_", "choices_", "=_", "ENCODING", "\\u", "CHOICES_", ",_", "required_", "=_", "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_", "class_", "Request", "New", "Passw", "ord", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "attrs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "'", "80", "'_", "}_", ")_", ",_", "label_", "=_", "\\u_", "(_", "u", "'", "User", "name", "'_", ")_", ",_", "help", "\\u", "text_", "=_", "\\u_", "(_", "u", "'", "User", "name", " ", "or", " ", "email", " ", "address", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Request", "New", "Passw", "ord", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Verify", " ", "tha", "t", " ", "user", " ", "with", " ", "email", " ", "or", " ", "user", "name", " ", "field", " ", "exist", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "User_", "._", "objects_", "._", "get_", "(_", "Q_", "(_", "username_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", "]_", ")_", "|_", "Q_", "(_", "email_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "user", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "User_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "u", "'", "Un", "kow", "n", " ", "user", "name", " ", "or", " ", "email", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "u", "'", "Inv", "lai", "d", " ", "user", "name", " ", "or", " ", "email", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "clean", "ed", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reset", "Passw", "ord", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password", "1_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", "(_", "render", "\\u", "value_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "u", "'", "Passw", "ord", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "2_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", "(_", "render", "\\u", "value_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "u", "'", "Passw", "ord", " ", "(", "again", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reset", "Passw", "ord", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Verify", " ", "tha", "t", " ", "the", " ", "2", " ", "passwords", " ", "fields", " ", "are", " ", "equal", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "password", "1", "'_", "in_", "self_", "._", "clean", "ed", "\\u", "data_", "and_", "'", "password", "2", "'_", "in_", "self_", "._", "clean", "ed", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "1", "'_", "]_", "!=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "2", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
Lawouach/WebSocket-for-Python/ws4py/framing.py
[ { "content": " def build(self):\n \"\"\"\n Builds a frame from the instance's attributes and returns\n its bytes representation.\n \"\"\"\n header = b''\n\n if self.fin > 0x1:\n raise ValueError('FIN bit parameter must be 0 or 1')\n\n if 0x3 <= self.opcode <= 0x7 or 0xB <= self.opcode:\n raise ValueError('Opcode cannot be a reserved opcode')\n\n ## +-+-+-+-+-------+\n ## |F|R|R|R| opcode|\n ## |I|S|S|S| (4) |\n ## |N|V|V|V| |\n ## | |1|2|3| |\n ## +-+-+-+-+-------+\n header = pack('!B', ((self.fin << 7)\n | (self.rsv1 << 6)\n | (self.rsv2 << 5)\n | (self.rsv3 << 4)\n | self.opcode))\n\n ## +-+-------------+-------------------------------+\n ## |M| Payload len | Extended payload length |\n ## |A| (7) | (16/63) |\n ## |S| | (if payload len==126/127) |\n ## |K| | |\n ## +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +\n ## | Extended payload length continued, if payload len == 127 |\n ## + - - - - - - - - - - - - - - - +-------------------------------+\n if self.masking_key: mask_bit = 1 << 7\n else: mask_bit = 0\n\n length = self.payload_length\n if length < 126:\n header += pack('!B', (mask_bit | length))\n elif length < (1 << 16):\n header += pack('!B', (mask_bit | 126)) + pack('!H', length)\n elif length < (1 << 63):\n header += pack('!B', (mask_bit | 127)) + pack('!Q', length)\n else:\n raise FrameTooLargeException()\n \n ## + - - - - - - - - - - - - - - - +-------------------------------+\n ## | |Masking-key, if MASK set to 1 |\n ## +-------------------------------+-------------------------------+\n ## | Masking-key (continued) | Payload Data |\n ## +-------------------------------- - - - - - - - - - - - - - - - +\n ## : Payload Data continued ... :\n ## + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +\n ## | Payload Data continued ... |\n ## +---------------------------------------------------------------+\n body = self.body\n if not self.masking_key:\n return bytes(header + body)\n\n return bytes(header + self.masking_key + self.mask(body))", "metadata": "root.Frame.build", "header": "['class', 'Frame', '(', 'object', ')', ':', '___EOS___']", "index": 64 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Frame_", "(_", "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 ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Build", "s", " ", "a", " ", "frame", " ", "from", " ", "the", " ", "instance", "'", "s", " ", "attribute", "s", " ", "and", " ", "return", "s", "\\", "10", ";", " ", " ", " ", " ", "its", " ", "bytes", " ", "represent", "ation", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "fin_", ">_", "0x1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "FIN", " ", "bit", " ", "parameter", " ", "must", " ", "be", " ", "0", " ", "or", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "0x3", "_", "<=_", "self_", "._", "opcode_", "<=_", "0x7", "_", "or_", "0xB", "_", "<=_", "self_", "._", "opcode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Opcode", " ", "cann", "ot", " ", "be", " ", "a", " ", "reserve", "d", " ", "opcode", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "+-+", "-+-", "+-+", "-------", "+_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "|", "F", "|", "R", "|", "R", "|", "R", "|", " ", "opcode", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "|", "I", "|", "S", "|", "S", "|", "S", "|", " ", " ", "(", "4", ")", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "|", "N", "|", "V", "|", "V", "|", "V", "|", " ", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "|", " ", "|", "1", "|", "2", "|", "3", "|", " ", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "+-+", "-+-", "+-+", "-------", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header_", "=_", "pack_", "(_", "'!", "B", "'_", ",_", "(_", "(_", "self_", "._", "fin_", "<<_", "7_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "(_", "self_", "._", "rsv", "1_", "<<_", "6_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "(_", "self_", "._", "rsv", "2_", "<<_", "5_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "(_", "self_", "._", "rsv", "3_", "<<_", "4_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "self_", "._", "opcode_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "+-+", "-------------", "+----------", "--------------", "-------", "+_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "|", "M", "|", " ", "Pay", "load", " ", "len", " ", "|", " ", " ", " ", " ", "Extend", "ed", " ", "payload", " ", "length", " ", " ", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "|", "A", "|", " ", "(", "7", ")", " ", "|", " ", " ", " ", " ", " ", "(", "16", "/", "6", "3", ")", " ", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "|", "S", "|", " ", " ", " ", " ", " ", "|", " ", " ", " ", "(", "if", " ", "payload", " ", "len", "==", "126", "/", "127", ")", " ", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "|", "K", "|", " ", " ", " ", " ", " ", "|", " ", " ", " ", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "+-+", "-+-", "+-+", "-------", "+-+", "-------------", "+", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "+_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "|", " ", "Extend", "ed", " ", "payload", " ", "length", " ", "continue", "d", ",", " ", "if", " ", "payload", " ", "len", " ", "==", " ", "127", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "+", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "+----------", "--------------", "-------", "+_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "masking", "\\u", "key_", ":_", "mask", "\\u", "bit_", "=_", "1_", "<<_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "mask", "\\u", "bit_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "length_", "=_", "self_", "._", "payload", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "length_", "<_", "126_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "+=_", "pack_", "(_", "'!", "B", "'_", ",_", "(_", "mask", "\\u", "bit_", "|_", "length_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "length_", "<_", "(_", "1_", "<<_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "+=_", "pack_", "(_", "'!", "B", "'_", ",_", "(_", "mask", "\\u", "bit_", "|_", "126_", ")_", ")_", "+_", "pack_", "(_", "'!", "H", "'_", ",_", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "length_", "<_", "(_", "1_", "<<_", "63_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "+=_", "pack_", "(_", "'!", "B", "'_", ",_", "(_", "mask", "\\u", "bit_", "|_", "127_", ")_", ")_", "+_", "pack_", "(_", "'!", "Q", "'_", ",_", "length_", ")_", "\\u\\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_", "Frame", "Too", "Large", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "+", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "+----------", "--------------", "-------", "+_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "|", " ", " ", " ", " ", " ", "|", "Mask", "ing", "-", "key", ",", " ", "if", " ", "MASK", " ", "set", " ", "to", " ", "1", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "+----------", "--------------", "-------", "+----------", "--------------", "-------", "+_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "|", " ", "Mask", "ing", "-", "key", " ", "(", "continue", "d", ")", " ", " ", " ", "|", " ", " ", "Pay", "load", " ", "Data", " ", " ", " ", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "+----------", "--------------", "--------", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "+_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", ":", " ", " ", " ", "Pay", "load", " ", "Data", " ", "continue", "d", " ", "...", " ", " ", " ", " ", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "+", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "+_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "|", " ", " ", " ", "Pay", "load", " ", "Data", " ", "continue", "d", " ", "...", " ", " ", " ", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "+----------", "--------------", "--------------", "--------------", "-----------", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body_", "=_", "self_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "masking", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bytes_", "(_", "header_", "+_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bytes_", "(_", "header_", "+_", "self_", "._", "masking", "\\u", "key_", "+_", "self_", "._", "mask_", "(_", "body_", ")_", ")_", "\\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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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 ]
Missing call to `__init__` during object initialization
allegro/ralph/src/ralph/attachments/admin.py
[ { "content": "class AttachmentsMixin(object):\n \"\"\"\n Mixin add new URL to admin for download file.\n \"\"\"", "metadata": "root.AttachmentsMixin", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def __init__(self, *args, **kwargs):\n # create unique AttachmentsView subclass for each descendant admin site\n # this prevents conflicts between urls etc.\n # See ralph.admin.extra.RalphExtraViewMixin.post_register for details\n if self.change_views is None:\n self.change_views = []\n self.change_views.append(type(\n '{}AttachmentsView'.format(self.__class__.__name__),\n (AttachmentsView,),\n {}\n ))\n super().__init__(*args, **kwargs)", "metadata": "root.AttachmentsMixin.__init__", "header": "['class', 'AttachmentsMixin', '(', 'object', ')', ':', '___EOS___']", "index": 8 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Attach", "ment", "s", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Mix", "in", " ", "add", " ", "new", " ", "URL", " ", "to", " ", "admin", " ", "for", " ", "download", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attach", "ment", "s", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "unique", " ", "Attach", "ment", "s", "View", " ", "subclass", " ", "for", " ", "each", " ", "descendant", " ", "admin", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "prevent", "s", " ", "confl", "icts", " ", "bet", "ween", " ", "urls", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "ral", "ph", ".", "admin", ".", "extra", ".", "Ra", "lph", "Extra", "View", "Mix", "in", ".", "post", "\\u", "register", " ", "for", " ", "details_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "change", "\\u", "views_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "change", "\\u", "views_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "change", "\\u", "views_", "._", "append_", "(_", "type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'{}", "Attach", "ment", "s", "View", "'_", "._", "format_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Attach", "ment", "s", "View_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
First argument to super() is not enclosing class
jhmaddox/django-precompressed/precompressed/storage/base.py
[ { "content": " def post_process(self, paths, dry_run=False, **options):\n\n \"\"\"\n Post process the given list of files (called from collectstatic).\n\n Processing finds paths that match the configuration,\n gzips them and copies them to the target storage with\n the name generated by utils.get_gzipped_name.\n\n \"\"\"\n\n # allow other processors to run, yielding their values\n # and adding new files to the list of ones to be gzipped\n if hasattr(super(SaveGzippedCopyMixin, self), 'post_process'):\n processor = super(SaveGzippedCopyMixin, self).post_process(\n paths=paths.copy(), dry_run=dry_run, options=options,\n )\n for original_path, processed_path, processed in processor:\n if processed and original_path != processed_path:\n paths[processed_path] = (self, processed_path)\n yield original_path, processed_path, processed\n\n # don't even dare to process the files if we're in dry run mode\n if dry_run:\n return\n\n path_level = lambda name: len(name.split(os.sep))\n\n # make a list of files that are to be gzipped\n adjustable_paths = [\n path for path in\n sorted(paths.keys(), key=path_level, reverse=True)\n if utils.should_save_gzipped_copy(path)\n ]\n\n for name in adjustable_paths:\n storage, path = paths[name]\n gzipped_name = utils.get_gzipped_name(name)\n if not self.should_skip_processing(storage, path, gzipped_name):\n with storage.open(path) as original_file:\n if hasattr(original_file, 'seek'):\n original_file.seek(0)\n pregzipped_file = ContentFile(original_file.read())\n pregzipped_file = self.pre_save_gzipped(\n name, gzipped_name, pregzipped_file,\n )\n if self.exists(gzipped_name):\n self.delete(gzipped_name)\n gzipped_file = self.gzipped_file(\n name, gzipped_name, pregzipped_file,\n )\n saved_name = self._save(gzipped_name, gzipped_file)\n gzipped_name = force_text(saved_name.replace('\\\\', '/'))\n self.post_save_gzipped(\n name, gzipped_name, gzipped_file,\n )\n yield name, gzipped_name, True", "metadata": "root.SaveGzippedCopyMixin.post_process", "header": "['class', 'SaveGzippedCopyMixin', '(', 'object', ')', ':', '___EOS___']", "index": 108 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Save", "Gz", "ipp", "ed", "Copy", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "process_", "(_", "self_", ",_", "paths_", ",_", "dry", "\\u", "run_", "=_", "False_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Post", " ", "process", " ", "the", " ", "give", "n", " ", "list", " ", "of", " ", "files", " ", "(", "call", "ed", " ", "from", " ", "collect", "static", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Process", "ing", " ", "find", "s", " ", "path", "s", " ", "tha", "t", " ", "match", " ", "the", " ", "configura", "tion", ",", "\\", "10", ";", " ", " ", " ", " ", "gzip", "s", " ", "them", " ", "and", " ", "copie", "s", " ", "them", " ", "to", " ", "the", " ", "target", " ", "storage", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "name", " ", "generat", "ed", " ", "by", " ", "util", "s", ".", "get", "\\u", "gzip", "ped", "\\u", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "allow", " ", "other", " ", "process", "ors", " ", "to", " ", "run", ",", " ", "yield", "ing", " ", "thei", "r", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "addin", "g", " ", "new", " ", "files", " ", "to", " ", "the", " ", "list", " ", "of", " ", "ones", " ", "to", " ", "be", " ", "gzip", "ped_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "super_", "(_", "Save", "Gz", "ipp", "ed", "Copy", "Mixin_", ",_", "self_", ")_", ",_", "'", "post", "\\u", "process", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "processor_", "=_", "super_", "(_", "Save", "Gz", "ipp", "ed", "Copy", "Mixin_", ",_", "self_", ")_", "._", "post", "\\u", "process_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "paths_", "=_", "paths_", "._", "copy_", "(_", ")_", ",_", "dry", "\\u", "run_", "=_", "dry", "\\u", "run_", ",_", "options_", "=_", "options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "original", "\\u", "path_", ",_", "process", "ed", "\\u", "path_", ",_", "processed_", "in_", "processor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "processed_", "and_", "original", "\\u", "path_", "!=_", "process", "ed", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "paths_", "[_", "process", "ed", "\\u", "path_", "]_", "=_", "(_", "self_", ",_", "process", "ed", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "original", "\\u", "path_", ",_", "process", "ed", "\\u", "path_", ",_", "processed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "even", " ", "dar", "e", " ", "to", " ", "process", " ", "the", " ", "files", " ", "if", " ", "we", "'", "re", " ", "in", " ", "dry", " ", "run", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dry", "\\u", "run_", ":_", "\\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_", "path", "\\u", "level_", "=_", "lambda_", "name_", ":_", "len_", "(_", "name_", "._", "split_", "(_", "os_", "._", "sep_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "list", " ", "of", " ", "files", " ", "tha", "t", " ", "are", " ", "to", " ", "be", " ", "gzip", "ped_", "\\u\\u\\uNL\\u\\u\\u_", "adjust", "able", "\\u", "paths_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "for_", "path_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "sorted_", "(_", "paths_", "._", "keys_", "(_", ")_", ",_", "key_", "=_", "path", "\\u", "level_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "utils_", "._", "shou", "ld", "\\u", "save", "\\u", "gzip", "ped", "\\u", "copy_", "(_", "path_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "adjust", "able", "\\u", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "storage_", ",_", "path_", "=_", "paths_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gzip", "ped", "\\u", "name_", "=_", "utils_", "._", "get", "\\u", "gzip", "ped", "\\u", "name_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "shou", "ld", "\\u", "skip", "\\u", "processing_", "(_", "storage_", ",_", "path_", ",_", "gzip", "ped", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "storage_", "._", "open_", "(_", "path_", ")_", "as_", "original", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "hasattr_", "(_", "original", "\\u", "file_", ",_", "'", "seek", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "original", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "preg", "zipped", "\\u", "file_", "=_", "Conten", "t", "File_", "(_", "original", "\\u", "file_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "preg", "zipped", "\\u", "file_", "=_", "self_", "._", "pre", "\\u", "save", "\\u", "gzip", "ped_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "gzip", "ped", "\\u", "name_", ",_", "preg", "zipped", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "exists_", "(_", "gzip", "ped", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "delete_", "(_", "gzip", "ped", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gzip", "ped", "\\u", "file_", "=_", "self_", "._", "gzip", "ped", "\\u", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "gzip", "ped", "\\u", "name_", ",_", "preg", "zipped", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "saved", "\\u", "name_", "=_", "self_", "._", "\\u", "save_", "(_", "gzip", "ped", "\\u", "name_", ",_", "gzip", "ped", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gzip", "ped", "\\u", "name_", "=_", "force", "\\u", "text_", "(_", "saved", "\\u", "name_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'/'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "\\u", "save", "\\u", "gzip", "ped_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "gzip", "ped", "\\u", "name_", ",_", "gzip", "ped", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "name_", ",_", "gzip", "ped", "\\u", "name_", ",_", "True_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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['M', 'I', 'D', 'N', 'S', 'H', 'P', '=', 'X']\nbam_cigar_op = {\n 'M': 0,\n 'I': 1,\n 'D': 2,\n 'N': 3,\n 'S': 4,\n 'H': 5,\n 'P': 6,\n '=': 7,\n 'X': 8,\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__region_cache = {}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n import doctest\n doctest.testmod()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def bam_open(fname, mode='r', *args, **kwargs):\n if fname.lower()[-4:] == '.bam':\n return pysam.Samfile(fname, '%sb' % mode, *args, **kwargs)\n return pysam.Samfile(fname, '%s' % mode, *args, **kwargs)", "metadata": "root.bam_open", "header": "['module', '___EOS___']", "index": 8 }, { "content": "def bam_pileup_iter(bam, mask=1796, quiet=False, callback=None):\n if not quiet and bam.filename:\n eta = ETA(os.stat(bam.filename).st_size)\n else:\n eta = None\n\n for pileup in bam.pileup(mask=mask):\n pos = bam.tell()\n bgz_offset = pos >> 16\n\n if not quiet:\n if callback:\n eta.print_status(bgz_offset, extra=callback(pileup))\n else:\n eta.print_status(bgz_offset, extra='%s:%s' % (bam.getrname(pileup.tid), pileup.pos))\n\n yield pileup\n\n if eta:\n eta.done()", "metadata": "root.bam_pileup_iter", "header": "['module', '___EOS___']", "index": 14 }, { "content": "def bam_iter(bam, quiet=False, show_ref_pos=False, ref=None, start=None, end=None, callback=None):\n '''\n >>> [x.qname for x in bam_iter(bam_open(os.path.join(os.path.dirname(__file__), 't', 'test.bam')), quiet=True)]\n ['A', 'B', 'E', 'C', 'D', 'F', 'Z']\n '''\n\n if os.path.exists('%s.bai' % bam.filename):\n # This is an indexed file, so it is ref sorted...\n # Meaning that we should show chrom:pos, instead of read names\n show_ref_pos = True\n\n eta = None\n\n if not ref:\n if not quiet and bam.filename:\n eta = ETA(os.stat(bam.filename).st_size)\n\n for read in bam:\n pos = bam.tell()\n bgz_offset = pos >> 16\n\n if not quiet and eta:\n if callback:\n eta.print_status(bgz_offset, extra=callback(read))\n elif (show_ref_pos):\n if read.tid > -1:\n eta.print_status(bgz_offset, extra='%s:%s %s' % (bam.getrname(read.tid), read.pos, read.qname))\n else:\n eta.print_status(bgz_offset, extra='unmapped %s' % (read.qname))\n else:\n eta.print_status(bgz_offset, extra='%s' % read.qname)\n\n yield read\n\n else:\n working_chrom = None\n if ref in bam.references:\n working_chrom = ref\n elif ref[0:3] == 'chr':\n # compensate for Ensembl vs UCSC ref naming\n if ref[3:] in bam.references:\n working_chrom = ref[3:]\n\n if not working_chrom:\n raise ValueError('Missing reference: %s' % ref)\n\n tid = bam.gettid(working_chrom)\n\n if not start:\n start = 0\n if not end:\n end = bam.lengths[tid]\n\n if not quiet and bam.filename:\n eta = ETA(end - start)\n\n for read in bam.fetch(working_chrom, start, end):\n if not quiet and eta:\n if callback:\n eta.print_status(read.pos - start, extra=callback(read))\n else:\n eta.print_status(read.pos - start, extra='%s:%s %s' % (bam.getrname(read.tid), read.pos, read.qname))\n\n yield read\n\n if eta:\n eta.done()", "metadata": "root.bam_iter", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def bam_batch_reads(bam, quiet=False):\n '''\n Batch mapping for the same reads (qname) together, this way\n they can all be compared/converted together.\n '''\n reads = []\n last = None\n for read in bam_iter(bam, quiet=quiet):\n if last and read.qname != last:\n yield reads\n reads = []\n last = read.qname\n reads.append(read)\n\n if reads:\n yield reads", "metadata": "root.bam_batch_reads", "header": "['module', '___EOS___']", "index": 105 }, { "content": "def cigar_fromstr(s):\n '''\n >>> cigar_fromstr('10M5I20M')\n [(0, 10), (1, 5), (0, 20)]\n >>> cigar_fromstr('1M1I1D1N1S1H1P')\n [(0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (5, 1), (6, 1)]\n '''\n ret = []\n spl = re.split('([0-9]+)', s)[1:]\n for op, size in zip(spl[1::2], spl[::2]):\n ret.append((bam_cigar_op[op], int(size)))\n return ret", "metadata": "root.cigar_fromstr", "header": "['module', '___EOS___']", "index": 137 }, { "content": "def cigar_tostr(cigar):\n '''\n >>> cigar_tostr(((0, 10), (1, 5), (0, 20)))\n '10M5I20M'\n >>> cigar_tostr(((0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (5, 1), (6, 1)))\n '1M1I1D1N1S1H1P'\n '''\n \n s = ''\n\n for op, size in cigar:\n s += '%s%s' % (size, bam_cigar[op])\n\n return s", "metadata": "root.cigar_tostr", "header": "['module', '___EOS___']", "index": 151 }, { "content": "def cigar_read_len(cigar):\n '''\n >>> cigar_read_len(cigar_fromstr('8M'))\n 8\n >>> cigar_read_len(cigar_fromstr('8M100N8M'))\n 16\n >>> cigar_read_len(cigar_fromstr('8M10I8M'))\n 26\n >>> cigar_read_len(cigar_fromstr('8M10D8M'))\n 16\n '''\n\n read_pos = 0\n\n for op, length in cigar:\n if op == 0: # M\n read_pos += length\n elif op == 1: # I\n read_pos += length\n elif op == 2: # D\n pass\n elif op == 3: # N\n pass\n elif op == 4: # S\n read_pos += length\n elif op == 5: # H\n pass\n elif op == 7: # =\n read_pos += length\n elif op == 8: # X\n read_pos += length\n else:\n raise ValueError(\"Unsupported CIGAR operation: %s\" % op)\n\n return read_pos", "metadata": "root.cigar_read_len", "header": "['module', '___EOS___']", "index": 167 }, { "content": "def read_calc_mismatches(read):\n inserts = 0\n deletions = 0\n indels = 0\n edits = int(read.opt('NM'))\n #\n # NM counts the length of indels\n # We really just care about *if* there is an indel, not the size\n #\n\n for op, length in read.cigar:\n if op == 1:\n inserts += length\n indels += 1\n elif op == 2:\n deletions += length\n indels += 1\n\n return edits - inserts - deletions + indels", "metadata": "root.read_calc_mismatches", "header": "['module', '___EOS___']", "index": 204 }, { "content": "def _extract_md_matches(md, maxlength):\n md_pos = 0\n\n while md and md_pos < maxlength:\n tmp = '0' # preload a zero so that immediate mismatches will be caught\n # the zero will have no affect otherwise...\n\n # look for matches\n while md and md[0] in '0123456789':\n tmp += md[0]\n md = md[1:]\n\n pos = int(tmp)\n if pos > maxlength:\n return (maxlength, '%s%s' % (pos - maxlength, md))\n return (pos, md)", "metadata": "root._extract_md_matches", "header": "['module', '___EOS___']", "index": 225 }, { "content": "def read_calc_variations(read):\n 'see _read_calc_variations'\n for tup in _read_calc_variations(read.pos, read.cigar, read.opt('MD'), read.seq):\n yield tup", "metadata": "root.read_calc_variations", "header": "['module', '___EOS___']", "index": 243 }, { "content": "def _read_calc_variations(start_pos, cigar, md, seq):\n '''\n For each variation, outputs a tuple: (op, pos, seq)\n\n op - operation (0 = mismatch, 1 = insert, 2 = deletion) (like CIGAR)\n pos - 0-based position of the variation (relative to reference)\n seq - the base (or bases) involved in the variation\n for mismatch or insert, this is the sequence inserted\n for deletions, this is the reference sequence that was removed\n\n MD is the mismatch string. Not all aligners include the tag. If your aligner\n doesn't include this, then you'll need to add it, or use a different function\n (see: read_calc_mismatches_gen).\n\n Special care must be used to handle RNAseq reads that cross\n an exon-exon junction.\n\n Also: MD is a *really* dumb format that can't be read correctly with\n a regex. It must be processed in concert with the CIGAR alignment\n in order to catch all edge cases. Some implementations insert 0's\n at the end of inserts / deltions / variations to make parsing easier\n but not everyone follows this. Look at the complex examples: the\n CIGAR alignment may show an insert, but the MD just shows all matches.\n\n Examples: See: http://davetang.org/muse/2011/01/28/perl-and-sam/\n Also from CCBB actual mappings and manual altered (shortened,\n made more complex)\n (doctests included)\n\n Match/mismatch\n CIGAR: 36M\n MD:Z: 1A0C0C0C1T0C0T27\n MD:Z: 1ACCC1TCT27 (alternative)\n 1 2\n 123456789012345678901234567890123456\n ref: CGATACGGGGACATCCGGCCTGCTCCTTCTCACATG\n XXXX XXX\n read: CACCCCTCTGACATCCGGCCTGCTCCTTCTCACATG\n MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n -ACCC-TCT---------------------------\n >>> list(_read_calc_variations(1, [(0,36)], '1A0C0C0C1T0C0T27', 'CACCCCTCTGACATCCGGCCTGCTCCTTCTCACATG'))\n [(0, 2, 'A'), (0, 3, 'C'), (0, 4, 'C'), (0, 5, 'C'), (0, 7, 'T'), (0, 8, 'C'), (0, 9, 'T')]\n\n Insert\n CIGAR: 6M1I29M\n MD:Z: 0C1C0C1C0T0C27\n C1CC1CTC27 (alt)\n 1 2\n 123456^789012345678901234567890123456\n ref: CACCCC^TCTGACATCCGGCCTGCTCCTTCTCACAT\n X XX X|XX\n read: GAGACGGGGTGACATCCGGCCTGCTCCTTCTCACAT\n MMMMMMIMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n G-GA-GGGG---------------------------\n >>> list(_read_calc_variations(1, [(0,6), (1,1), (0, 29)], '0C1C0C1C0T0C27', 'GAGACGGGGTGACATCCGGCCTGCTCCTTCTCACAT'))\n [(0, 1, 'G'), (0, 3, 'G'), (0, 4, 'A'), (0, 6, 'G'), (1, 7, 'G'), (0, 7, 'G'), (0, 8, 'G')]\n >>> list(_read_calc_variations(1, [(0,6), (1,1), (0, 29)], 'C1CC1CTC27', 'GAGACGGGGTGACATCCGGCCTGCTCCTTCTCACAT'))\n [(0, 1, 'G'), (0, 3, 'G'), (0, 4, 'A'), (0, 6, 'G'), (1, 7, 'G'), (0, 7, 'G'), (0, 8, 'G')]\n\n\n Deletion\n CIGAR: 9M9D27M\n MD:Z: 2G0A5^ATGATGTCA27\n 2GA5^ATGATGTCA27 (alt)\n ref: AGGAATGGGATGATGTCAGGGGTTCCAGGTGGAGACGAGGACTCC\n XX ^^^^^^^^^\n read: AGTGATGGG^^^^^^^^^GGGGTTCCAGGTGGAGACGAGGACTCC\n MMMMMMMMMDDDDDDDDDMMMMMMMMMMMMMMMMMMMMMMMMMMM\n --TG-----ATGATGTCA---------------------------\n >>> list(_read_calc_variations(1, [(0,9), (2,9), (0, 27)], '2G0A5^ATGATGTCA27', 'AGTGATGGGGGGGTTCCAGGTGGAGACGAGGACTCC'))\n [(0, 3, 'T'), (0, 4, 'G'), (2, 10, 'ATGATGTCA')]\n\n\n Complex\n CIGAR: 9M9D11M1I15M\n MD:Z: 2G0A5^ATGATGTCAA26\n MD:Z: 2G0A5^ATGATGTCA0G26 (alt)\n 1 2 3 4\n pos: 123456789012345678901234567890123456789012345\n ref: AGGAATGGGATGATGTCAGGGGTTCCAGG^GGAGACGAGGACTCC\n XX ^^^^^^^^^X |\n read: AGTGATGGG^^^^^^^^^AGGGTTCCAGGTGGAGACGAGGACTCC\n MMMMMMMMMDDDDDDDDDMMMMMMMMMMMMMMMMMMMMMMMMMMM\n --TG-----ATGATGTCAG----------T---------------\n >>> list(_read_calc_variations(1, [(0,9), (2,9), (0,11), (1,1), (0,15)], '2G0A5^ATGATGTCAA26', 'AGTGATGGGGGGGTTCCAGGTGGAGACGAGGACTCC'))\n [(0, 3, 'T'), (0, 4, 'G'), (2, 10, 'ATGATGTCA'), (0, 19, 'G'), (1, 30, 'T')]\n\n\n Complex example - inserts aren't separately handled by MD, only visible in CIGAR\n CIGAR: 14M2D16M3I42M\n MD:Z: 14^TC58\n 1 2 3 4 5 6 7\n pos: 12345678901234567890123456789012^^^345678901234567890123456789012345678901234567\n ref: caagtatcaccatgtcaggcatttttttcatt^^^tttgtagagagagaagacttgctatgttgcccaagctggcct\n ^^ |||\n read: CAAGTATCACCATG^^AGGCATTTTTTTCATTTGGTTTGTAGAGAGAGAAGACTTGCTATGTTGCCCAAGCTGGCCT\n MMMMMMMMMMMMMMDDMMMMMMMMMMMMMMMMIIIMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n --------------tc----------------TGG------------------------------------------\n >>> list(_read_calc_variations(1, [(0,14), (2,2), (0,16), (1,3), (0,42)], '14^TC58', 'CAAGTATCACCATGAGGCATTTTTTTCATTTGGTTTGTAGAGAGAGAAGACTTGCTATGTTGCCCAAGCTGGCCT'))\n [(2, 15, 'TC'), (1, 33, 'TGG')]\n\n\n Complex example 2:\n CIGAR: 41M3I10M1I5M1I2M2I10M\n MD:Z: 44C2C6T6T6\n 1 2 3 4 5 6\n pos: 12345678901234567890123456789012345678901^^^2345678901^23456^78^^9012345678\n ref: AGGGTGGCGAGATCGATGACGGCATTGGCGATGGTGATCTT^^^GAGCCACATG^CGGTC^GC^^GGATCTCCAG\n ||| X X | X | || X\n read: AGGGTGGCGAGATCGATGACGGCATTGGCGATGGTGATCTTTTAGAGACATATGCCGGACGGCGTGGAGCTCCAG\n MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMIIIMMMMMMMMMMIMMMMMIMMIIMMMMMMMMMM\n -----------------------------------------tta---A--T---c---A----gt---G------\n\n\n 13M 28M 3I 10M 1I 5M 1I 2M 2I 10M\n >>> list(_read_calc_variations(1, [(0, 41), (1, 3), (0, 10), (1, 1), (0, 5), (1, 1), (0, 2), (1, 2), (0, 10)], '44C2C6T6T6', 'AGGGTGGCGAGATCGATGACGGCATTGGCGATGGTGATCTTTTAGAGACATATGCCGGACGGCGTGGAGCTCCAG'))\n [(1, 42, 'TTA'), (0, 45, 'A'), (0, 48, 'T'), (1, 52, 'C'), (0, 55, 'A'), (1, 57, 'G'), (1, 59, 'GT'), (0, 62, 'G')]\n\n\n Splice junction example:\n CIGAR: 62M100N13M\n MD:Z: 2T27C44\n 1 1\n 1 2 3 4 5 6 6 7\n pos: 12345678901234567890123456789012345678901234567890123456789012| [100] |3456789012345\n ref: CCTCATGACCAGCTTGTTGAAGAGATCCGACATCAAGTGCCCACCTTGGCTCGTGGCTCTCA|-------|CTTGCTCCTGCTC\n X X\n read: CCGCATGACCAGCTTGTTGAAGAGATCCGATATCAAGTGCCCACCTTGGCTCGTGGCTCTCA|-------|CTTGCTCCTGCTC\n --G---------------------------T-----------------------------------------------------\n\n >>> list(_read_calc_variations(1, [(0,62), (4,100), (0,13)], '2T27C44', 'CCGCATGACCAGCTTGTTGAAGAGATCCGATATCAAGTGCCCACCTTGGCTCGTGGCTCTCACTTGCTCCTGCTC'))\n [(0, 3, 'G'), (0, 31, 'T')]\n\n\n Splice junction example 2:\n CIGAR: 13M100N28M3I10M1I5M1I2M2I10M\n MD:Z: 44C2C6T6T6\n 1 1 1 1 1\n 1 2 3 4 5 6\n pos: 1234567890123| [100] |4567890123456789012345678901^^^2345678901^23456^78^^9012345678\n ref: AGGGTGGCGAGAT|-------|CGATGACGGCATTGGCGATGGTGATCTT^^^GAGCCACATG^CGGTC^GC^^GGATCTCCAG\n ||| X X | X | || X\n read: AGGGTGGCGAGAT|-------|CGATGACGGCATTGGCGATGGTGATCTTTTAGAGACATATGCCGGACGGCGTGGAGCTCCAG\n MMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMMMMIIIMMMMMMMMMMIMMMMMIMMIIMMMMMMMMMM\n ------------- ----------------------------tta---A--T---c---A----gt---G------\n\n 13M 100N 28M 3I 10M 1I 5M 1I 2M 2I 10M\n >>> list(_read_calc_variations(1, [(0, 13), (3, 100), (0, 28), (1, 3), (0, 10), (1, 1), (0, 5), (1, 1), (0, 2), (1, 2), (0, 10)], '44C2C6T6T6', 'AGGGTGGCGAGATCGATGACGGCATTGGCGATGGTGATCTTTTAGAGACATATGCCGGACGGCGTGGAGCTCCAG'))\n [(1, 142, 'TTA'), (0, 145, 'A'), (0, 148, 'T'), (1, 152, 'C'), (0, 155, 'A'), (1, 157, 'G'), (1, 159, 'GT'), (0, 162, 'G')]\n\n\n Splice junction example 2A:\n CIGAR: 13M100N7M2D19M3I10M1I5M1I2M2I10M\n MD:Z: 9A10^GG22C2C6T6T6\n 1 1 1 1 1\n 1 2 3 4 5 6\n pos: 1234567890123| [100] |4567890123456789012345678901^^^2345678901^23456^78^^9012345678\n ref: AGGGTGGCGAGAT|-------|CGATGACGGCATTGGCGATGGTGATCTT^^^GAGCCACATG^CGGTC^GC^^GGATCTCCAG\n ^^ ||| X X | X | || X\n read: AGGGTGGCGCGAT|-------|CGATGAC^^CATTGGCGATGGTGATCTTTTAGAGACATATGCCGGACGGCGTGGAGCTCCAG\n MMMMMMMMMMMMM MMMMMMMDDMMMMMMMMMMMMMMMMMMMIIIMMMMMMMMMMIMMMMMIMMIIMMMMMMMMMM\n ---------C--- ----------------------------tta---A--T---c---A----gt---G------\n .........A... .......GG................... ...C..C... ...T. .. ...T......\n 9 A 10 ^GG 22 C 2C 6 T 6 T 6\n\n >>> list(_read_calc_variations(1, [(0, 13), (3, 100), (0, 7), (2, 2), (0, 19), (1, 3), (0, 10), (1, 1), (0, 5), (1, 1), (0, 2), (1, 2), (0, 10)], '9A10^GG22C2C6T6T6', 'AGGGTGGCGCGATCGATGACCATTGGCGATGGTGATCTTTTAGAGACATATGCCGGACGGCGTGGAGCTCCAG'))\n [(0, 10, 'C'), (2, 121, 'GG'), (1, 142, 'TTA'), (0, 145, 'A'), (0, 148, 'T'), (1, 152, 'C'), (0, 155, 'A'), (1, 157, 'G'), (1, 159, 'GT'), (0, 162, 'G')]\n\n Real Example\n 242_1071_1799_B1\n CIGAR: 42M10I3M1D9M1D11M\n MD:Z: 27G16A0^T6C2^T1C9\n 1 2 3 4 5 6 7\n pos: 123456789012345678901234567890123456789012 345678901234567890123456789012345\n ref: ACTGAGAAACCCAACCCTCTGAGACCAGCACACCCCTTTCAA^^^^^^^^^^GCATGTTCCTCCCTCCCCTTCTTTG\n X X^ X ^ X\n read: ACTGAGAAACCCAACCCTCTGAGACCAACACACCCCTTTCAACACATTTTTGGCC^GTTCCTGCC^CGCCTTCTTTG\n MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMIIIIIIIIIIMMMDMMMMMMMMMDMMMMMMMMMMM\n ---------------------------A--------------^^^^^^^^^^--CT------G--T-G---------\n\n >>> list(_read_calc_variations(1, [(0,42), (1,10), (0, 3), (2, 1), (0, 9), (2, 1), (0, 11)], '27G16A0^T6C2^T1C9', 'ACTGAGAAACCCAACCCTCTGAGACCAACACACCCCTTTCAACACATTTTTGGCCGTTCCTGCCCGCCTTCTTTG', ))\n [(0, 28, 'A'), (1, 43, 'CACATTTTTG'), (0, 45, 'C'), (2, 46, 'T'), (0, 53, 'G'), (2, 56, 'T'), (0, 58, 'G')]\n\n\n Real example 2\n 577_1692_891_A1\n CIGAR: 34M100N39M2I\n MD:Z: 3T69\n 1 1 1 1\n 1 2 3 4 5 6 7\n pos: 1234567890123456789012345678901234| [100] |567890123456789012345678901234567890123\n ref: GGATTCTTCCCACTGGGTCGATGTTGTTTGTGAT|-------|CTGAGAGAGAGTTGCATCTGCACATGCTTTCCTGGCGTC^^\n\n read: GGAATCTTCCCACTGGGTCGATGTTGTTTGTGAT|-------|CTGAGAGAGAGTTGCATCTGCACATGCTTTCCTGGCGTCTC\n MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM NNNNN MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMII\n ---A------------------------------ ---------------------------------------TC\n\n >>> list(_read_calc_variations(1, [(0,34), (3,100), (0, 39), (1, 2)], '3T69', 'GGAATCTTCCCACTGGGTCGATGTTGTTTGTGATCTGAGAGAGAGTTGCATCTGCACATGCTTTCCTGGCGTCTC', ))\n [(0, 4, 'A'), (1, 174, 'TC')]\n\n '''\n\n ref_pos = start_pos\n read_pos = 0\n\n for op, length in cigar:\n if md and md[0] == '0':\n md = md[1:]\n # sys.stderr.write('%s, %s, %s\\n' %(op, length, md))\n if op == 0: # M\n # how far in the chunk are we? (do *not* update ref_pos until end)\n md_pos = 0\n last = None\n while md and md_pos < length:\n if last == (op, length, md):\n sys.stderr.write('\\nInfinite loop in variant finding!\\nPos: %s\\nCIGAR: (%s, %s)\\n' % (ref_pos, op, length))\n sys.exit(1)\n last = (op, length, md)\n # sys.stderr.write('%s, %s, %s\\n' %(op, length, md))\n chunk_size, md = _extract_md_matches(md, length - md_pos)\n # sys.stderr.write(' -> %s, %s\\n' %(chunk_size, md))\n md_pos += chunk_size\n\n # look for mismatches\n while md_pos < length and md and md[0] not in '0123456789^':\n yield (op, ref_pos + md_pos, seq[read_pos + md_pos])\n md = md[1:]\n\n md_pos += 1\n\n ref_pos += length\n read_pos += length\n\n elif op == 1: # I\n # nothing in MD about inserts...\n yield (op, ref_pos, seq[read_pos:read_pos + length])\n read_pos += length\n\n elif op == 2: # D\n # prefixed with '^' and includes all of the removed bases\n if md[0] == '^':\n md = md[1:]\n yield (op, ref_pos, md[:length])\n md = md[length:]\n ref_pos += length\n\n elif op == 3: # N\n ref_pos += length", "metadata": "root._read_calc_variations", "header": "['module', '___EOS___']", "index": 249 }, { "content": "def read_calc_mismatches_gen(ref, read, chrom):\n start = read.pos\n ref_pos = 0\n read_pos = 0\n\n for op, length in read.cigar:\n if op == 1:\n yield ref_pos, op, None\n read_pos += length\n elif op == 2:\n yield ref_pos, op, None\n ref_pos += length\n elif op == 3:\n ref_pos += length\n elif op == 0:\n refseq = ref.fetch(chrom, start + ref_pos, start + ref_pos + length)\n if not refseq:\n raise ValueError(\"Reference '%s' not found in FASTA file: %s\" % (chrom, ref.filename))\n cur_pos = start + ref_pos\n for refbase, readbase in zip(refseq.upper(), read.seq[read_pos:read_pos + length].upper()):\n if refbase != readbase:\n yield op, cur_pos, readbase\n cur_pos += 1\n ref_pos += length\n read_pos += length\n else:\n raise ValueError(\"Unsupported CIGAR operation: %s\" % op)", "metadata": "root.read_calc_mismatches_gen", "header": "['module', '___EOS___']", "index": 499 }, { "content": "def read_calc_mismatches_ref(ref, read, chrom):\n edits = 0\n\n for op, pos, base in read_calc_mismatches_gen(ref, read, chrom):\n edits += 1\n\n return edits", "metadata": "root.read_calc_mismatches_ref", "header": "['module', '___EOS___']", "index": 528 }, { "content": "def region_pos_to_genomic_pos(name, start, cigar):\n '''\n converts a junction position to a genomic location given a junction\n ref name, the junction position, and the cigar alignment.\n\n returns: (genomic ref, genomic pos, genomic cigar)\n\n >>> region_pos_to_genomic_pos('chr1:1000-1050,2000-2050,3000-4000', 25, [(0, 100)])\n ('chr1', 1025, [(0, 25), (3, 950), (0, 50), (3, 950), (0, 25)])\n\n >>> region_pos_to_genomic_pos('chr1:1000-1050,1050-1200', 25, [(0, 100)])\n ('chr1', 1025, [(0, 25), (3, 0), (0, 75)])\n\n >>> region_pos_to_genomic_pos('chr3R:17630851-17630897,17634338-17634384', 17, [(0, 39)])\n ('chr3R', 17630868, [(0, 29), (3, 3441), (0, 10)])\n\n >>> region_pos_to_genomic_pos('chr1:1000-1050,2000-2050', 25, [(4, 25), (0, 50), (4, 25)])\n ('chr1', 1025, [(4, 25), (0, 25), (3, 950), (0, 25), (4, 25)])\n\n >>> region_pos_to_genomic_pos('chr1:1000-1050,2000-2050', 25, [(5, 25), (0, 75)])\n ('chr1', 1025, [(5, 25), (0, 25), (3, 950), (0, 50)])\n\n >>> region_pos_to_genomic_pos('chr1:1000-1050,2000-2050', 25, [(5, 25), (0, 75)])\n ('chr1', 1025, [(5, 25), (0, 25), (3, 950), (0, 50)])\n\n >>> region_pos_to_genomic_pos('chr7:16829153-16829246,16829246-16829339', 62, cigar_fromstr('83M18S'))\n ('chr7', 16829215, [(0, 31), (3, 0), (0, 52), (4, 18)])\n\n\n '''\n\n if name in __region_cache:\n chrom, fragments = __region_cache[name]\n else:\n c1 = name.split(':')\n chrom = c1[0]\n\n fragments = []\n for fragment in c1[1].split(','):\n s, e = fragment.split('-')\n fragments.append((int(s), int(e)))\n\n __region_cache[name] = (chrom, fragments)\n\n chr_cigar = []\n chr_start = fragments[0][0]\n\n read_start = int(start)\n\n frag_idx = 0\n frag_start = 0\n frag_end = 0\n\n for i, (s, e) in enumerate(fragments):\n if chr_start + read_start < e:\n chr_start += read_start\n frag_idx = i\n frag_start = s\n frag_end = e\n break\n\n else:\n chr_start += (e - s)\n read_start -= (e - s)\n\n cur_pos = chr_start\n\n for op, length in cigar:\n if op in [1, 4, 5]:\n chr_cigar.append((op, length))\n\n elif op in [0, 2]:\n if cur_pos + length <= frag_end:\n cur_pos += length\n chr_cigar.append((op, length))\n\n else:\n while cur_pos + length > frag_end:\n if frag_end - cur_pos > 0:\n chr_cigar.append((op, frag_end - cur_pos))\n length -= (frag_end - cur_pos)\n cur_pos = frag_end\n frag_idx += 1\n if len(fragments) <= frag_idx:\n print 'ERROR converting: ', name, fragments \n return (chrom, 0, chr_cigar)\n frag_start, frag_end = fragments[frag_idx]\n chr_cigar.append((3, frag_start - cur_pos))\n cur_pos = frag_start\n\n cur_pos = cur_pos + length\n chr_cigar.append((op, length))\n else:\n print \"Unsupported CIGAR operation (%s)\" % bam_cigar[op]\n sys.exit(1)\n\n return (chrom, chr_start, chr_cigar)", "metadata": "root.region_pos_to_genomic_pos", "header": "['module', '___EOS___']", "index": 540 }, { "content": "def is_junction_valid(cigar, min_overlap=4):\n '''\n Does the genomic cigar alignment represent a 'good' alignment.\n Used for checking junction->genome alignments\n\n 1) the alignment must not start at a splice junction\n 2) the alignment must not start or end with an overhang\n 3) the alignment must overhang the splice junction by min_overlap (4)\n\n | Exon1 | Intron | Exon2 |\n |-----------------|oooooooooooooooo|------------------|\n XXXXXXXXXXXXXXXXXXXXXXXX (bad 1)\n XXXXXXXXXXXXX (bad 2) XXXXXXXXXXXXXXXX (bad 2)\n XX-----------------XXXXXXXXXXXXXXXXX (bad 3)\n\n >>> is_junction_valid(cigar_fromstr('1000N40M'))\n (False, 'Starts at gap (1000N40M)')\n\n >>> is_junction_valid(cigar_fromstr('100M'))\n (False, \"Doesn't cover junction\")\n\n >>> is_junction_valid(cigar_fromstr('100M1000N3M'), 4)\n (False, \"Too short overlap at 3' (100M1000N3M)\")\n\n >>> is_junction_valid(cigar_fromstr('2M1000N100M'), 4)\n (False, \"Too short overlap at 5' (2M1000N100M)\")\n\n >>> is_junction_valid(cigar_fromstr('4M1000N100M'), 4)\n (True, '')\n\n >>> is_junction_valid(cigar_fromstr('100M1000N4M'), 4)\n (True, '')\n\n >>> is_junction_valid(cigar_fromstr('4M0N100M'), 4)\n (True, '')\n\n '''\n first = True\n pre_gap = True\n\n pre_gap_count = 0\n post_gap_count = 0\n\n has_gap = False\n\n for op, length in cigar:\n # mapping can't start at a gap\n if first and op == 3:\n return (False, 'Starts at gap (%s)' % cigar_tostr(cigar))\n first = False\n\n if op == 3:\n pre_gap = False\n post_gap_count = 0\n has_gap = True\n\n elif pre_gap:\n pre_gap_count += length\n else:\n post_gap_count += length\n\n # mapping must start with more than min_overlap base match\n\n if not has_gap:\n return (False, \"Doesn't cover junction\")\n elif pre_gap_count < min_overlap:\n return (False, \"Too short overlap at 5' (%s)\" % cigar_tostr(cigar))\n elif post_gap_count < min_overlap:\n return (False, \"Too short overlap at 3' (%s)\" % cigar_tostr(cigar))\n\n return True, ''", "metadata": "root.is_junction_valid", "header": "['module', '___EOS___']", "index": 639 }, { "content": "def read_alignment_fragments_gen(read):\n '''\n Takes a read and returns the start and end positions for each match/mismatch region.\n This will let us know where each read alignment \"touches\" the genome.\n '''\n\n for start, end in _read_alignment_fragments_gen(read.pos, read.cigar):\n yield (start, end)", "metadata": "root.read_alignment_fragments_gen", "header": "['module', '___EOS___']", "index": 712 }, { "content": "def _read_alignment_fragments_gen(pos, cigar):\n ''' Test-able version of read_alignment_fragments_gen\n >>> list(_read_alignment_fragments_gen(1, cigar_fromstr('50M')))\n [(1, 51)]\n\n >>> list(_read_alignment_fragments_gen(1, cigar_fromstr('25M100N25M')))\n [(1, 26), (126, 151)]\n\n >>> list(_read_alignment_fragments_gen(1, cigar_fromstr('20M1D4M100N10M5I10M')))\n [(1, 21), (22, 26), (126, 136), (136, 146)]\n '''\n ref_pos = pos\n\n for op, length in cigar:\n if op == 0:\n yield (ref_pos, ref_pos + length)\n ref_pos += length\n elif op == 1:\n pass\n elif op == 2:\n ref_pos += length\n elif op == 3:\n ref_pos += length\n else:\n raise ValueError(\"Unsupported CIGAR operation: %s\" % op)", "metadata": "root._read_alignment_fragments_gen", "header": "['module', '___EOS___']", "index": 722 }, { "content": "def read_cigar_at_pos(cigar, qpos, is_del):\n '''\n Returns the CIGAR operation for a given read position\n\n qpos is the 0-based index of the base in the read\n '''\n pos = 0\n returnnext = False\n for op, length in cigar:\n if returnnext:\n return op\n if op == 0:\n pos += length\n elif op == 1:\n pos += length\n elif op == 2:\n pass\n elif op == 3:\n pass\n elif op == 4:\n pos += length\n elif op == 5:\n pass\n else:\n raise ValueError(\"Unsupported CIGAR operation: %s\" % op)\n\n if pos > qpos:\n return op\n if is_del and pos == qpos:\n returnnext = True\n\n return None", "metadata": "root.read_cigar_at_pos", "header": "['module', '___EOS___']", "index": 749 }, { "content": "def cleancigar(cigar):\n '''\n Cleans a CIGAR alignment to remove zero length operations\n\n >>> cigar_tostr(cleancigar(cigar_fromstr('31M0N52M18S')))\n '83M18S'\n\n '''\n newcigar = []\n\n changed = False\n zero = False\n\n for op, size in cigar:\n if size > 0:\n if zero and newcigar:\n if newcigar[-1][0] == op:\n newsize = newcigar[-1][1] + size\n newcigar[-1] = (op, newsize)\n zero = 0\n else:\n newcigar.append((op, size))\n else:\n changed = True\n zero = True\n\n if changed:\n return newcigar\n\n return None", "metadata": "root.cleancigar", "header": "['module', '___EOS___']", "index": 783 }, { "content": "def read_cleancigar(read):\n '''\n Replaces the CIGAR string for a read to remove any operations that are zero length.\n\n This happens to the read in-place\n '''\n if read.is_unmapped:\n return False\n\n newcigar = []\n\n newcigar = cleancigar(read.cigar)\n\n if newcigar:\n read.cigar = newcigar\n return True\n\n return False", "metadata": "root.read_cleancigar", "header": "['module', '___EOS___']", "index": 815 }, { "content": "def read_to_unmapped(read, ref=None):\n '''\n Converts a read from mapped to unmapped.\n\n Sets the 'ZR' tag to indicate the original ref/pos/cigar (if ref is passed)\n '''\n\n newread = pysam.AlignedRead()\n\n if ref:\n tags = [('ZR', '%s:%s:%s' % (ref, read.pos, cigar_tostr(read.cigar)))]\n\n newread.is_unmapped = True\n newread.mapq = 0\n newread.tlen = 0\n newread.pos = -1\n newread.pnext = -1\n newread.rnext = -1\n newread.tid = -1\n\n newread.qname = read.qname\n\n if read.is_paired:\n newread.is_paired = True\n\n if not read.is_unmapped and read.is_reverse:\n newread.seq = ngsutils.support.revcomp(read.seq)\n newread.qual = read.qual[::-1]\n else: \n newread.seq = read.seq\n newread.qual = read.qual\n\n newread.tags = tags\n\n return newread", "metadata": "root.read_to_unmapped", "header": "['module', '___EOS___']", "index": 835 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pysam", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eta_", "import_", "ETA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ngs", "utils_", "._", "support_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "bam", "\\u", "cigar", "_", "=_", "[_", "'", "M", "'_", ",_", "'", "I", "'_", ",_", "'", "D", "'_", ",_", "'", "N", "'_", ",_", "'", "S", "'_", ",_", "'", "H", "'_", ",_", "'", "P", "'_", ",_", "'='_", ",_", "'", "X", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bam", "\\u", "cigar", "\\u", "op_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "M", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "I", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "D", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "N", "'_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "S", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "H", "'_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "P", "'_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'='_", ":_", "7_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "'_", ":_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "region", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doctest_", "._", "testmod_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "bam", "\\u", "open_", "(_", "fname_", ",_", "mode_", "=_", "'", "r", "'_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fname_", "._", "lower_", "(_", ")_", "[_", "-_", "4_", ":_", "]_", "==_", "'.", "bam", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pysam", "_", "._", "Sam", "file_", "(_", "fname_", ",_", "'%", "sb", "'_", "%_", "mode_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pysam", "_", "._", "Sam", "file_", "(_", "fname_", ",_", "'%", "s", "'_", "%_", "mode_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bam", "\\u", "pile", "up", "\\u", "iter_", "(_", "bam_", ",_", "mask_", "=_", "179", "6_", ",_", "quiet_", "=_", "False_", ",_", "callback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "quiet_", "and_", "bam_", "._", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta_", "=_", "ETA", "_", "(_", "os_", "._", "stat_", "(_", "bam_", "._", "filename_", ")_", "._", "st", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "pile", "up_", "in_", "bam_", "._", "pile", "up_", "(_", "mask_", "=_", "mask_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "=_", "bam_", "._", "tell_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "z", "\\u", "offset_", "=_", "pos_", ">>_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "quiet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta_", "._", "print", "\\u", "status_", "(_", "bg", "z", "\\u", "offset_", ",_", "extra_", "=_", "callback_", "(_", "pile", "up_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta_", "._", "print", "\\u", "status_", "(_", "bg", "z", "\\u", "offset_", ",_", "extra_", "=_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "bam_", "._", "getr", "name_", "(_", "pile", "up_", "._", "tid_", ")_", ",_", "pile", "up_", "._", "pos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "pile", "up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "eta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta_", "._", "done_", "(_", ")_", "\\u\\u\\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_", "bam", "\\u", "iter_", "(_", "bam_", ",_", "quiet_", "=_", "False_", ",_", "show", "\\u", "ref", "\\u", "pos_", "=_", "False_", ",_", "ref_", "=_", "None_", ",_", "start_", "=_", "None_", ",_", "end_", "=_", "None_", ",_", "callback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "[", "x", ".", "qna", "me", " ", "for", " ", "x", " ", "in", " ", "bam", "\\u", "iter", "(", "bam", "\\u", "open", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dir", "name", "(\\u", "\\u", "file", "\\u\\u)", ",", " ", "'", "t", "',", " ", "'", "test", ".", "bam", "'))", ",", " ", "quie", "t", "=", "Tru", "e", ")]", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "',", " ", "'", "B", "',", " ", "'", "E", "',", " ", "'", "C", "',", " ", "'", "D", "',", " ", "'", "F", "',", " ", "'", "Z", "']", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "'%", "s", ".", "bai", "'_", "%_", "bam_", "._", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "an", " ", "indexe", "d", " ", "file", ",", " ", "so", " ", "it", " ", "is", " ", "ref", " ", "sorte", "d", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mea", "ning", " ", "tha", "t", " ", "we", " ", "shou", "ld", " ", "show", " ", "chrom", ":", "pos", ",", " ", "inst", "ead", " ", "of", " ", "read", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "ref", "\\u", "pos_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eta_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ref_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "quiet_", "and_", "bam_", "._", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta_", "=_", "ETA", "_", "(_", "os_", "._", "stat_", "(_", "bam_", "._", "filename_", ")_", "._", "st", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "read_", "in_", "bam_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "=_", "bam_", "._", "tell_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "z", "\\u", "offset_", "=_", "pos_", ">>_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "quiet_", "and_", "eta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "eta_", "._", "print", "\\u", "status_", "(_", "bg", "z", "\\u", "offset_", ",_", "extra_", "=_", "callback_", "(_", "read_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "show", "\\u", "ref", "\\u", "pos_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "read_", "._", "tid_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "eta_", "._", "print", "\\u", "status_", "(_", "bg", "z", "\\u", "offset_", ",_", "extra_", "=_", "'%", "s", ":", "%", "s", " ", "%", "s", "'_", "%_", "(_", "bam_", "._", "getr", "name_", "(_", "read_", "._", "tid_", ")_", ",_", "read_", "._", "pos_", ",_", "read_", "._", "qname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "eta_", "._", "print", "\\u", "status_", "(_", "bg", "z", "\\u", "offset_", ",_", "extra_", "=_", "'", "unmapped", " ", "%", "s", "'_", "%_", "(_", "read_", "._", "qname_", ")_", ")_", "\\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 ", " ", "_", "eta_", "._", "print", "\\u", "status_", "(_", "bg", "z", "\\u", "offset_", ",_", "extra_", "=_", "'%", "s", "'_", "%_", "read_", "._", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "read_", "\\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 ", " _", "working", "\\u", "chrom_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ref_", "in_", "bam_", "._", "references_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "working", "\\u", "chrom_", "=_", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ref_", "[_", "0_", ":_", "3_", "]_", "==_", "'", "chr", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "compen", "sat", "e", " ", "for", " ", "Ens", "embl", " ", "vs", " ", "UCS", "C", " ", "ref", " ", "naming_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ref_", "[_", "3_", ":_", "]_", "in_", "bam_", "._", "references_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "working", "\\u", "chrom_", "=_", "ref_", "[_", "3_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "working", "\\u", "chrom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Missing", " ", "reference", ":", " ", "%", "s", "'_", "%_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tid_", "=_", "bam_", "._", "getti", "d_", "(_", "working", "\\u", "chrom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "end_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end_", "=_", "bam_", "._", "lengths_", "[_", "tid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "quiet_", "and_", "bam_", "._", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta_", "=_", "ETA", "_", "(_", "end_", "-_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "read_", "in_", "bam_", "._", "fetch_", "(_", "working", "\\u", "chrom_", ",_", "start_", ",_", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "quiet_", "and_", "eta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "eta_", "._", "print", "\\u", "status_", "(_", "read_", "._", "pos_", "-_", "start_", ",_", "extra_", "=_", "callback_", "(_", "read_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "eta_", "._", "print", "\\u", "status_", "(_", "read_", "._", "pos_", "-_", "start_", ",_", "extra_", "=_", "'%", "s", ":", "%", "s", " ", "%", "s", "'_", "%_", "(_", "bam_", "._", "getr", "name_", "(_", "read_", "._", "tid_", ")_", ",_", "read_", "._", "pos_", ",_", "read_", "._", "qname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "read_", "\\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_", "eta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta_", "._", "done_", "(_", ")_", "\\u\\u\\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_", "bam", "\\u", "batch", "\\u", "reads_", "(_", "bam_", ",_", "quiet_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Bat", "ch", " ", "mapping", " ", "for", " ", "the", " ", "same", " ", "reads", " ", "(", "qna", "me", ")", " ", "tog", "ether", ",", " ", "this", " ", "way", "\\", "10", ";", " ", " ", " ", " ", "the", "y", " ", "can", " ", "all", " ", "be", " ", "compare", "d", "/", "convert", "ed", " ", "tog", "ether", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reads_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "read_", "in_", "bam", "\\u", "iter_", "(_", "bam_", ",_", "quiet_", "=_", "quiet_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "last_", "and_", "read_", "._", "qname_", "!=_", "last_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "reads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reads_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last_", "=_", "read_", "._", "qname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reads_", "._", "append_", "(_", "read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "reads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "reads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cigar", "\\u", "froms", "tr_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cigar", "\\u", "froms", "tr", "('", "10", "M", "5", "I2", "0", "M", "')", "\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "10", "),", " ", "(", "1", ",", " ", "5", "),", " ", "(", "0", ",", " ", "20", ")]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cigar", "\\u", "froms", "tr", "('", "1", "M1", "I1", "D1", "N1", "S1", "H1", "P", "')", "\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "1", "),", " ", "(", "1", ",", " ", "1", "),", " ", "(", "2", ",", " ", "1", "),", " ", "(", "3", ",", " ", "1", "),", " ", "(", "4", ",", " ", "1", "),", " ", "(", "5", ",", " ", "1", "),", " ", "(", "6", ",", " ", "1", ")]", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spl_", "=_", "re_", "._", "split_", "(_", "'(", "[", "0", "-", "9", "]+)'_", ",_", "s_", ")_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "op_", ",_", "size_", "in_", "zip_", "(_", "spl_", "[_", "1_", ":_", ":_", "2_", "]_", ",_", "spl_", "[_", ":_", ":_", "2_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "._", "append_", "(_", "(_", "bam", "\\u", "cigar", "\\u", "op_", "[_", "op_", "]_", ",_", "int_", "(_", "size_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cigar", "\\u", "tost", "r_", "(_", "cigar", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cigar", "\\u", "tost", "r", "(((", "0", ",", " ", "10", "),", " ", "(", "1", ",", " ", "5", "),", " ", "(", "0", ",", " ", "20", ")))", "\\", "10", ";", " ", " ", " ", " ", "'", "10", "M", "5", "I2", "0", "M", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cigar", "\\u", "tost", "r", "(((", "0", ",", " ", "1", "),", " ", "(", "1", ",", " ", "1", "),", " ", "(", "2", ",", " ", "1", "),", " ", "(", "3", ",", " ", "1", "),", " ", "(", "4", ",", " ", "1", "),", " ", "(", "5", ",", " ", "1", "),", " ", "(", "6", ",", " ", "1", ")))", "\\", "10", ";", " ", " ", " ", " ", "'", "1", "M1", "I1", "D1", "N1", "S1", "H1", "P", "'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", ",_", "size_", "in_", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'%", "s", "%", "s", "'_", "%_", "(_", "size_", ",_", "bam", "\\u", "cigar", "_", "[_", "op_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cigar", "\\u", "read", "\\u", "len_", "(_", "cigar", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cigar", "\\u", "read", "\\u", "len", "(", "cigar", "\\u", "froms", "tr", "('", "8", "M", "'))", "\\", "10", ";", " ", " ", " ", " ", "8", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cigar", "\\u", "read", "\\u", "len", "(", "cigar", "\\u", "froms", "tr", "('", "8", "M1", "00", "N", "8", "M", "'))", "\\", "10", ";", " ", " ", " ", " ", "16", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cigar", "\\u", "read", "\\u", "len", "(", "cigar", "\\u", "froms", "tr", "('", "8", "M1", "0", "I", "8", "M", "'))", "\\", "10", ";", " ", " ", " ", " ", "2", "6", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cigar", "\\u", "read", "\\u", "len", "(", "cigar", "\\u", "froms", "tr", "('", "8", "M1", "0", "D8", "M", "'))", "\\", "10", ";", " ", " ", " ", " ", "16", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", ",_", "length_", "in_", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op_", "==_", "0_", ":_", "#", " ", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "1_", ":_", "#", " ", "I_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "2_", ":_", "#", " ", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "3_", ":_", "#", " ", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "4_", ":_", "#", " ", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "5_", ":_", "#", " ", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "7_", ":_", "#", " ", "=_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "8_", ":_", "#", " ", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "pos_", "+=_", "length_", "\\u\\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_", "(_", "\"", "Unsu", "ppo", "rted", " ", "CI", "GAR", " ", "operati", "on", ":", " ", "%", "s", "\"_", "%_", "op_", ")_", "\\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_", "read", "\\u", "pos_", "\\u\\u\\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", "calc", "\\u", "mismatche", "s_", "(_", "read_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inserts", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deletion", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indel", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edits", "_", "=_", "int_", "(_", "read_", "._", "opt_", "(_", "'", "NM", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NM", " ", "count", "s", " ", "the", " ", "length", " ", "of", " ", "indel", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "reall", "y", " ", "just", " ", "care", " ", "abo", "ut", " ", "*", "if", "*", " ", "there", " ", "is", " ", "an", " ", "indel", ",", " ", "not", " ", "the", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", ",_", "length_", "in_", "read_", "._", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inserts", "_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indel", "s_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deletion", "s_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indel", "s_", "+=_", "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_", "edits", "_", "-_", "inserts", "_", "-_", "deletion", "s_", "+_", "indel", "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_", "\\u", "extract", "\\u", "md", "\\u", "matches_", "(_", "md_", ",_", "maxlength", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "md", "\\u", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "md_", "and_", "md", "\\u", "pos_", "<_", "maxlength", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "'", "0", "'_", "#", " ", "prelo", "ad", " ", "a", " ", "zero", " ", "so", " ", "tha", "t", " ", "immediate", " ", "mismatche", "s", " ", "will", " ", "be", " ", "cau", "ght_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "zero", " ", "will", " ", "have", " ", "no", " ", "affect", " ", "other", "wis", "e", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "look", " ", "for", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "md_", "and_", "md_", "[_", "0_", "]_", "in_", "'", "0123456", "789", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "+=_", "md_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "md_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pos_", "=_", "int_", "(_", "tmp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", ">_", "maxlength", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "maxlength", "_", ",_", "'%", "s", "%", "s", "'_", "%_", "(_", "pos_", "-_", "maxlength", "_", ",_", "md_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "pos_", ",_", "md_", ")_", "\\u\\u\\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", "calc", "\\u", "variations", "_", "(_", "read_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'", "see", " ", "\\u", "read", "\\u", "calc", "\\u", "variations", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tup_", "in_", "\\u", "read", "\\u", "calc", "\\u", "variations", "_", "(_", "read_", "._", "pos_", ",_", "read_", "._", "cigar", "_", ",_", "read_", "._", "opt_", "(_", "'", "MD", "'_", ")_", ",_", "read_", "._", "seq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "tup_", "\\u\\u\\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", "read", "\\u", "calc", "\\u", "variations", "_", "(_", "start", "\\u", "pos_", ",_", "cigar", "_", ",_", "md_", ",_", "seq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "each", " ", "variatio", "n", ",", " ", "output", "s", " ", "a", " ", "tuple", ":", " ", "(", "op", ",", " ", "pos", ",", " ", "seq", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "op", " ", " ", "-", " ", "operati", "on", " ", "(", "0", " ", "=", " ", "mism", "atch", ",", " ", "1", " ", "=", " ", "insert", ",", " ", "2", " ", "=", " ", "deletion", ")", " ", "(", "like", " ", "CI", "GAR", ")", "\\", "10", ";", " ", " ", " ", " ", "pos", " ", "-", " ", "0", "-", "based", " ", "position", " ", "of", " ", "the", " ", "variatio", "n", " ", "(", "relative", " ", "to", " ", "reference", ")", "\\", "10", ";", " ", " ", " ", " ", "seq", " ", "-", " ", "the", " ", "base", " ", "(", "or", " ", "base", "s", ")", " ", "involved", " ", "in", " ", "the", " ", "variatio", "n", "\\", "10", ";", " ", " ", "for", " ", "mism", "atch", " ", "or", " ", "insert", ",", " ", "this", " ", "is", " ", "the", " ", "sequence", " ", "inserted", "\\", "10", ";", " ", " ", "for", " ", "deletion", "s", ",", " ", "this", " ", "is", " ", "the", " ", "reference", " ", "sequence", " ", "tha", "t", " ", "was", " ", "remove", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "MD", " ", "is", " ", "the", " ", "mism", "atch", " ", "string", ".", " ", "Not", " ", "all", " ", "aligner", "s", " ", "include", " ", "the", " ", "tag", ".", " ", "If", " ", "your", " ", "aligner", "\\", "10", ";", " ", " ", " ", " ", "doe", "sn", "'", "t", " ", "include", " ", "this", ",", " ", "then", " ", "you", "'", "ll", " ", "need", " ", "to", " ", "add", " ", "it", ",", " ", "or", " ", "use", " ", "a", " ", "different", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "(", "see", ":", " ", "read", "\\u", "calc", "\\u", "mismatche", "s", "\\u", "gen", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Special", " ", "care", " ", "must", " ", "be", " ", "used", " ", "to", " ", "handle", " ", "RNA", "seq", " ", "reads", " ", "tha", "t", " ", "cross", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "exon", "-", "exon", " ", "junction", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Al", "so", ":", " ", "MD", " ", "is", " ", "a", " ", "*", "reall", "y", "*", " ", "dumb", " ", "format", " ", "tha", "t", " ", "can", "'", "t", " ", "be", " ", "read", " ", "correct", "ly", " ", "with", "\\", "10", ";", " ", " ", "a", " ", "regex", ".", " ", "It", " ", "must", " ", "be", " ", "process", "ed", " ", "in", " ", "conce", "rt", " ", "with", " ", "the", " ", "CI", "GAR", " ", "alignme", "nt", "\\", "10", ";", " ", " ", "in", " ", "order", " ", "to", " ", "catch", " ", "all", " ", "edge", " ", "case", "s", ".", " ", "Some", " ", "implementation", "s", " ", "insert", " ", "0", "'", "s", "\\", "10", ";", " ", " ", "at", " ", "the", " ", "end", " ", "of", " ", "inserts", " ", "/", " ", "del", "tion", "s", " ", "/", " ", "variations", " ", "to", " ", "make", " ", "pars", "ing", " ", "easi", "er", "\\", "10", ";", " ", " ", "but", " ", "not", " ", "everyone", " ", "follow", "s", " ", "this", ".", " ", "Look", " ", "at", " ", "the", " ", "complex", " ", "example", "s", ":", " ", "the", "\\", "10", ";", " ", " ", "CI", "GAR", " ", "alignme", "nt", " ", "may", " ", "show", " ", "an", " ", "insert", ",", " ", "but", " ", "the", " ", "MD", " ", "just", " ", "show", "s", " ", "all", " ", "matche", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", ":", " ", "See", ":", " ", "http", "://", "dav", "eta", "ng", ".", "org", "/", "mus", "e", "/", "2011", "/", "01", "/", "2", "8", "/", "perl", "-", "and", "-", "sam", "/", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Al", "so", " ", "from", " ", "CC", "BB", " ", "actual", " ", "mapping", "s", " ", "and", " ", "manu", "al", " ", "alter", "ed", " ", "(", "shorten", "ed", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "made", " ", "more", " ", "complex", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "(", "docte", "sts", " ", "include", "d", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Match", "/", "mism", "atch", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "3", "6", "M", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", " ", "1", "A0", "C0", "C0", "C1", "T", "0", "C0", "T2", "7", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", " ", "1", "ACC", "C1", "TCT", "2", "7", " ", "(", "alternative", ")", "\\", "10", ";", " ", "1", " ", " ", " ", " ", " ", "2", "\\", "10", ";", " ", " ", "123456789012", "3456", "7890", "123456789012", "3456", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "CGA", "TAC", "GGGG", "ACA", "TCC", "GGC", "CTG", "CTC", "CTT", "CTC", "ACA", "TG", "\\", "10", ";", " ", " ", " ", "XXXX", " ", "XX", "X", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "CAC", "CCC", "TCT", "GAC", "ATC", "CGG", "CCT", "GCT", "CCT", "TCT", "CAC", "ATG", "\\", "10", ";", " ", " ", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "\\", "10", ";", " ", " ", "-", "ACC", "C", "-", "TCT", "--------------", "-------------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", "3", "6", ")]", ",", " ", "'", "1", "A0", "C0", "C0", "C1", "T", "0", "C0", "T2", "7", "',", " ", "'", "CAC", "CCC", "TCT", "GAC", "ATC", "CGG", "CCT", "GCT", "CCT", "TCT", "CAC", "ATG", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "2", ",", " ", "'", "A", "')", ",", " ", "(", "0", ",", " ", "3", ",", " ", "'", "C", "')", ",", " ", "(", "0", ",", " ", "4", ",", " ", "'", "C", "')", ",", " ", "(", "0", ",", " ", "5", ",", " ", "'", "C", "')", ",", " ", "(", "0", ",", " ", "7", ",", " ", "'", "T", "')", ",", " ", "(", "0", ",", " ", "8", ",", " ", "'", "C", "')", ",", " ", "(", "0", ",", " ", "9", ",", " ", "'", "T", "')]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Insert", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "6", "M1", "I2", "9", "M", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", "0", "C1", "C0", "C1", "C0", "T", "0", "C2", "7", "\\", "10", ";", " ", " ", "C1", "CC", "1", "CTC", "2", "7", " ", "(", "alt", ")", "\\", "10", ";", " ", " ", "1", " ", " ", " ", " ", " ", "2", "\\", "10", ";", " ", " ", "12345", "6", "^", "7890", "123456789012", "3456", "7890", "12345", "6", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "CAC", "CCC", "^", "TCT", "GAC", "ATC", "CGG", "CCT", "GCT", "CCT", "TCT", "CAC", "AT", "\\", "10", ";", " ", " ", "X", " ", "XX", " ", "X", "|", "XX", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "GAG", "ACG", "GGG", "TGA", "CAT", "CCG", "GCC", "TGC", "TCC", "TTC", "TCA", "CAT", "\\", "10", ";", " ", " ", "MMM", "MMM", "IMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "\\", "10", ";", " ", " ", "G", "-", "GA", "-", "GGGG", "--------------", "-------------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", "6", "),", " ", "(", "1", ",", "1", "),", " ", "(", "0", ",", " ", "2", "9", ")]", ",", " ", "'", "0", "C1", "C0", "C1", "C0", "T", "0", "C2", "7", "',", " ", "'", "GAG", "ACG", "GGG", "TGA", "CAT", "CCG", "GCC", "TGC", "TCC", "TTC", "TCA", "CAT", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "1", ",", " ", "'", "G", "')", ",", " ", "(", "0", ",", " ", "3", ",", " ", "'", "G", "')", ",", " ", "(", "0", ",", " ", "4", ",", " ", "'", "A", "')", ",", " ", "(", "0", ",", " ", "6", ",", " ", "'", "G", "')", ",", " ", "(", "1", ",", " ", "7", ",", " ", "'", "G", "')", ",", " ", "(", "0", ",", " ", "7", ",", " ", "'", "G", "')", ",", " ", "(", "0", ",", " ", "8", ",", " ", "'", "G", "')]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", "6", "),", " ", "(", "1", ",", "1", "),", " ", "(", "0", ",", " ", "2", "9", ")]", ",", " ", "'", "C1", "CC", "1", "CTC", "2", "7", "',", " ", "'", "GAG", "ACG", "GGG", "TGA", "CAT", "CCG", "GCC", "TGC", "TCC", "TTC", "TCA", "CAT", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "1", ",", " ", "'", "G", "')", ",", " ", "(", "0", ",", " ", "3", ",", " ", "'", "G", "')", ",", " ", "(", "0", ",", " ", "4", ",", " ", "'", "A", "')", ",", " ", "(", "0", ",", " ", "6", ",", " ", "'", "G", "')", ",", " ", "(", "1", ",", " ", "7", ",", " ", "'", "G", "')", ",", " ", "(", "0", ",", " ", "7", ",", " ", "'", "G", "')", ",", " ", "(", "0", ",", " ", "8", ",", " ", "'", "G", "')]", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Deletion", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "9", "M", "9", "D2", "7", "M", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", "2", "G", "0", "A5", "^", "ATG", "ATG", "TCA", "2", "7", "\\", "10", ";", " ", " ", "2", "GA", "5", "^", "ATG", "ATG", "TCA", "2", "7", " ", "(", "alt", ")", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "AGG", "AAT", "GGG", "ATG", "ATG", "TCA", "GGGG", "TTC", "CAG", "GTG", "GAG", "ACG", "AGG", "ACT", "CC", "\\", "10", ";", " ", " ", " ", " ", "XX", " ", "^", "^", "^", "^", "^", "^", "^", "^", "^", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "AGT", "GAT", "GGG", "^", "^", "^", "^", "^", "^", "^", "^", "^", "GGGG", "TTC", "CAG", "GTG", "GAG", "ACG", "AGG", "ACT", "CC", "\\", "10", ";", " ", " ", "MMM", "MMM", "MMM", "DDD", "DDD", "DDD", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "\\", "10", ";", " ", " ", "--", "TG", "-----", "ATG", "ATG", "TCA", "--------------", "-------------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", "9", "),", " ", "(", "2", ",", "9", "),", " ", "(", "0", ",", " ", "2", "7", ")]", ",", " ", "'", "2", "G", "0", "A5", "^", "ATG", "ATG", "TCA", "2", "7", "',", " ", "'", "AGT", "GAT", "GGGG", "GGG", "TTC", "CAG", "GTG", "GAG", "ACG", "AGG", "ACT", "CC", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "3", ",", " ", "'", "T", "')", ",", " ", "(", "0", ",", " ", "4", ",", " ", "'", "G", "')", ",", " ", "(", "2", ",", " ", "10", ",", " ", "'", "ATG", "ATG", "TCA", "')]", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Comple", "x", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "9", "M", "9", "D1", "1", "M1", "I1", "5", "M", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", "2", "G", "0", "A5", "^", "ATG", "ATG", "TCA", "A2", "6", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", "2", "G", "0", "A5", "^", "ATG", "ATG", "TCA", "0", "G2", "6", " ", "(", "alt", ")", "\\", "10", ";", " ", "1", " ", " ", " ", " ", " ", "2", " ", " ", " ", " ", " ", "3", " ", " ", " ", " ", " ", "4", "\\", "10", ";", " ", " ", " ", " ", "pos", ":", " ", " ", "123456789012", "3456", "7890", "123456789012", "3456", "7890", "12345", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "AGG", "AAT", "GGG", "ATG", "ATG", "TCA", "GGGG", "TTC", "CAG", "G", "^", "GGA", "GAC", "GAG", "GAC", "TCC", "\\", "10", ";", " ", " ", " ", " ", "XX", " ", "^", "^", "^", "^", "^", "^", "^", "^", "^", "X", " ", " ", "|", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "AGT", "GAT", "GGG", "^", "^", "^", "^", "^", "^", "^", "^", "^", "AGG", "GTT", "CCA", "GGT", "GGA", "GAC", "GAG", "GAC", "TCC", "\\", "10", ";", " ", " ", "MMM", "MMM", "MMM", "DDD", "DDD", "DDD", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "\\", "10", ";", " ", " ", "--", "TG", "-----", "ATG", "ATG", "TCA", "G", "----------", "T", "--------------", "-", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", "9", "),", " ", "(", "2", ",", "9", "),", " ", "(", "0", ",", "11", "),", " ", "(", "1", ",", "1", "),", " ", "(", "0", ",", "15", ")]", ",", " ", "'", "2", "G", "0", "A5", "^", "ATG", "ATG", "TCA", "A2", "6", "',", " ", "'", "AGT", "GAT", "GGGG", "GGG", "TTC", "CAG", "GTG", "GAG", "ACG", "AGG", "ACT", "CC", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "3", ",", " ", "'", "T", "')", ",", " ", "(", "0", ",", " ", "4", ",", " ", "'", "G", "')", ",", " ", "(", "2", ",", " ", "10", ",", " ", "'", "ATG", "ATG", "TCA", "')", ",", " ", "(", "0", ",", " ", "1", "9", ",", " ", "'", "G", "')", ",", " ", "(", "1", ",", " ", "30", ",", " ", "'", "T", "')]", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Comple", "x", " ", "example", " ", "-", " ", "inserts", " ", "are", "n", "'", "t", " ", "separately", " ", "handle", "d", " ", "by", " ", "MD", ",", " ", "only", " ", "visi", "ble", " ", "in", " ", "CI", "GAR", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "14", "M2", "D1", "6", "M3", "I", "4", "2", "M", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", " ", "14", "^", "TC", "5", "8", "\\", "10", ";", " ", "1", " ", " ", " ", " ", " ", "2", " ", " ", " ", " ", " ", "3", " ", " ", " ", " ", "4", " ", " ", " ", " ", " ", "5", " ", " ", " ", " ", " ", "6", " ", " ", " ", " ", " ", "7", "\\", "10", ";", " ", " ", " ", " ", "pos", ":", " ", " ", "123456789012", "3456", "7890", "123456789012", "^", "^", "^", "3456", "7890", "123456789012", "3456", "7890", "123456789012", "3456", "7", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "caa", "gta", "tca", "cca", "tgt", "cag", "gca", "ttt", "ttt", "tca", "tt", "^", "^", "^", "ttt", "gta", "gag", "aga", "ga", "aga", "ct", "tg", "cta", "tgt", "tg", "ccc", "aa", "gc", "tg", "gcc", "t", "\\", "10", ";", " ", " ", "^", "^", " ", " ", " ", " ", "|||", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "CAA", "GTA", "TCA", "CCA", "TG", "^", "^", "AGG", "CAT", "TTTT", "TTC", "ATT", "TGG", "TTT", "GTA", "GAG", "AGA", "GAA", "GAC", "TTG", "CTA", "TGT", "TGC", "CCA", "AGC", "TGG", "CCT", "\\", "10", ";", " ", " ", "MMM", "MMM", "MMM", "MMM", "MM", "DD", "MMM", "MMM", "MMM", "MMM", "MMM", "MI", "II", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "\\", "10", ";", " ", " ", "--------------", "tc", "--------------", "--", "TGG", "--------------", "--------------", "--------------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", "14", "),", " ", "(", "2", ",", "2", "),", " ", "(", "0", ",", "16", "),", " ", "(", "1", ",", "3", "),", " ", "(", "0", ",", "4", "2", ")]", ",", " ", "'", "14", "^", "TC", "5", "8", "',", " ", "'", "CAA", "GTA", "TCA", "CCA", "TGA", "GGC", "ATT", "TTTT", "TCA", "TTT", "GGT", "TTG", "TAG", "AGA", "GAG", "AAG", "ACT", "TGC", "TAT", "GTT", "GCC", "CAA", "GCT", "GGC", "CT", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "2", ",", " ", "15", ",", " ", "'", "TC", "')", ",", " ", "(", "1", ",", " ", "3", "3", ",", " ", "'", "TGG", "')]", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Comple", "x", " ", "example", " ", "2", ":", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "4", "1", "M3", "I1", "0", "M1", "I", "5", "M1", "I2", "M2", "I1", "0", "M", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", " ", "4", "4", "C2", "C6", "T6", "T6", "\\", "10", ";", " ", "1", " ", " ", " ", " ", " ", "2", " ", " ", " ", " ", " ", "3", " ", " ", " ", " ", " ", "4", " ", " ", " ", " ", "5", " ", " ", " ", " ", " ", "6", "\\", "10", ";", " ", " ", " ", " ", "pos", ":", " ", " ", "123456789012", "3456", "7890", "123456789012", "3456", "7890", "1", "^", "^", "^", "23456", "7890", "1", "^", "23456", "^", "7", "8", "^", "^", "901", "23456", "7", "8", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "AGG", "GTG", "GCG", "AGA", "TCG", "ATG", "ACG", "GCA", "TTG", "GCG", "ATG", "GTG", "ATC", "TT", "^", "^", "^", "GAG", "CCA", "CAT", "G", "^", "CGG", "TC", "^", "GC", "^", "^", "GGA", "TCT", "CCA", "G", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "|||", " ", " ", " ", "X", " ", " ", "X", " ", " ", " ", "|", " ", " ", " ", "X", " ", "|", " ", " ", "||", " ", " ", " ", "X", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "AGG", "GTG", "GCG", "AGA", "TCG", "ATG", "ACG", "GCA", "TTG", "GCG", "ATG", "GTG", "ATC", "TTTT", "AGA", "GAC", "ATA", "TGC", "CGG", "ACG", "GCG", "TGG", "AGC", "TCC", "AG", "\\", "10", ";", " ", " ", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MM", "III", "MMM", "MMM", "MMM", "MI", "MMM", "MM", "IMM", "II", "MMM", "MMM", "MMM", "M", "\\", "10", ";", " ", " ", "--------------", "--------------", "-------------", "tta", "---", "A", "--", "T", "---", "c", "---", "A", "----", "gt", "---", "G", "------", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "13", "M", " ", "2", "8", "M", " ", "3", "I", " ", "10", "M", " ", "1", "I", " ", "5", "M", " ", "1", "I", " ", "2", "M", " ", "2", "I", " ", "10", "M", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", " ", "4", "1", "),", " ", "(", "1", ",", " ", "3", "),", " ", "(", "0", ",", " ", "10", "),", " ", "(", "1", ",", " ", "1", "),", " ", "(", "0", ",", " ", "5", "),", " ", "(", "1", ",", " ", "1", "),", " ", "(", "0", ",", " ", "2", "),", " ", "(", "1", ",", " ", "2", "),", " ", "(", "0", ",", " ", "10", ")]", ",", " ", "'", "4", "4", "C2", "C6", "T6", "T6", "',", " ", "'", "AGG", "GTG", "GCG", "AGA", "TCG", "ATG", "ACG", "GCA", "TTG", "GCG", "ATG", "GTG", "ATC", "TTTT", "AGA", "GAC", "ATA", "TGC", "CGG", "ACG", "GCG", "TGG", "AGC", "TCC", "AG", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "1", ",", " ", "4", "2", ",", " ", "'", "TTA", "')", ",", " ", "(", "0", ",", " ", "4", "5", ",", " ", "'", "A", "')", ",", " ", "(", "0", ",", " ", "4", "8", ",", " ", "'", "T", "')", ",", " ", "(", "1", ",", " ", "5", "2", ",", " ", "'", "C", "')", ",", " ", "(", "0", ",", " ", "5", "5", ",", " ", "'", "A", "')", ",", " ", "(", "1", ",", " ", "5", "7", ",", " ", "'", "G", "')", ",", " ", "(", "1", ",", " ", "5", "9", ",", " ", "'", "GT", "')", ",", " ", "(", "0", ",", " ", "6", "2", ",", " ", "'", "G", "')]", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Spl", "ice", " ", "junction", " ", "example", ":", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "6", "2", "M1", "00", "N1", "3", "M", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", " ", "2", "T2", "7", "C4", "4", "\\", "10", ";", " ", " ", " ", " ", " ", "1", " ", " ", "1", "\\", "10", ";", " ", "1", " ", " ", " ", " ", " ", "2", " ", " ", " ", " ", " ", "3", " ", " ", " ", " ", " ", "4", " ", " ", " ", " ", " ", "5", " ", " ", " ", " ", " ", "6", " ", " ", " ", "6", " ", " ", "7", "\\", "10", ";", " ", " ", " ", " ", "pos", ":", " ", " ", "123456789012", "3456", "7890", "123456789012", "3456", "7890", "123456789012", "3456", "7890", "1", "2", "|", " ", "[", "100", "]", " ", "|", "3456", "7890", "12345", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "CCT", "CAT", "GAC", "CAG", "CTT", "GTT", "GAA", "GAG", "ATC", "CGA", "CAT", "CAA", "GTG", "CCC", "ACC", "TTG", "GCT", "CGT", "GGC", "TCT", "CA", "|---", "----", "|", "CTT", "GCT", "CCT", "GCT", "C", "\\", "10", ";", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "CCG", "CAT", "GAC", "CAG", "CTT", "GTT", "GAA", "GAG", "ATC", "CGA", "TAT", "CAA", "GTG", "CCC", "ACC", "TTG", "GCT", "CGT", "GGC", "TCT", "CA", "|---", "----", "|", "CTT", "GCT", "CCT", "GCT", "C", "\\", "10", ";", " ", " ", "--", "G", "--------------", "-------------", "T", "--------------", "--------------", "--------------", "-----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", "6", "2", "),", " ", "(", "4", ",", "100", "),", " ", "(", "0", ",", "13", ")]", ",", " ", "'", "2", "T2", "7", "C4", "4", "',", " ", "'", "CCG", "CAT", "GAC", "CAG", "CTT", "GTT", "GAA", "GAG", "ATC", "CGA", "TAT", "CAA", "GTG", "CCC", "ACC", "TTG", "GCT", "CGT", "GGC", "TCT", "CAC", "TTG", "CTC", "CTG", "CTC", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "3", ",", " ", "'", "G", "')", ",", " ", "(", "0", ",", " ", "3", "1", ",", " ", "'", "T", "')]", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Spl", "ice", " ", "junction", " ", "example", " ", "2", ":", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "13", "M1", "00", "N", "2", "8", "M3", "I1", "0", "M1", "I", "5", "M1", "I2", "M2", "I1", "0", "M", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", " ", "4", "4", "C2", "C6", "T6", "T6", "\\", "10", ";", " ", " ", "1", " ", " ", " ", " ", " ", "1", " ", " ", " ", " ", " ", "1", " ", " ", " ", " ", "1", " ", " ", " ", " ", " ", "1", "\\", "10", ";", " ", "1", " ", " ", " ", " ", " ", " ", "2", " ", " ", " ", " ", " ", "3", " ", " ", " ", " ", " ", "4", " ", " ", " ", " ", "5", " ", " ", " ", " ", " ", "6", "\\", "10", ";", " ", " ", " ", " ", "pos", ":", " ", " ", "123456789012", "3", "|", " ", "[", "100", "]", " ", "|", "4567", "890", "123456789012", "3456", "7890", "1", "^", "^", "^", "23456", "7890", "1", "^", "23456", "^", "7", "8", "^", "^", "901", "23456", "7", "8", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "AGG", "GTG", "GCG", "AGA", "T", "|---", "----", "|", "CGA", "TGA", "CGG", "CAT", "TGG", "CGA", "TGG", "TGA", "TCT", "T", "^", "^", "^", "GAG", "CCA", "CAT", "G", "^", "CGG", "TC", "^", "GC", "^", "^", "GGA", "TCT", "CCA", "G", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "|||", " ", " ", " ", "X", " ", " ", "X", " ", " ", " ", "|", " ", " ", " ", "X", " ", "|", " ", " ", "||", " ", " ", " ", "X", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "AGG", "GTG", "GCG", "AGA", "T", "|---", "----", "|", "CGA", "TGA", "CGG", "CAT", "TGG", "CGA", "TGG", "TGA", "TCT", "TTT", "AGA", "GAC", "ATA", "TGC", "CGG", "ACG", "GCG", "TGG", "AGC", "TCC", "AG", "\\", "10", ";", " ", " ", "MMM", "MMM", "MMM", "MMM", "M", " ", " ", " ", " ", " ", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MI", "II", "MMM", "MMM", "MMM", "MI", "MMM", "MM", "IMM", "II", "MMM", "MMM", "MMM", "M", "\\", "10", ";", " ", " ", "-------------", " ", " ", " ", " ", " ", "--------------", "--------------", "tta", "---", "A", "--", "T", "---", "c", "---", "A", "----", "gt", "---", "G", "------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "13", "M", " ", "100", "N", " ", "2", "8", "M", " ", "3", "I", " ", "10", "M", " ", "1", "I", " ", "5", "M", " ", "1", "I", " ", "2", "M", " ", "2", "I", " ", "10", "M", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", " ", "13", "),", " ", "(", "3", ",", " ", "100", "),", " ", "(", "0", ",", " ", "2", "8", "),", " ", "(", "1", ",", " ", "3", "),", " ", "(", "0", ",", " ", "10", "),", " ", "(", "1", ",", " ", "1", "),", " ", "(", "0", ",", " ", "5", "),", " ", "(", "1", ",", " ", "1", "),", " ", "(", "0", ",", " ", "2", "),", " ", "(", "1", ",", " ", "2", "),", " ", "(", "0", ",", " ", "10", ")]", ",", " ", "'", "4", "4", "C2", "C6", "T6", "T6", "',", " ", "'", "AGG", "GTG", "GCG", "AGA", "TCG", "ATG", "ACG", "GCA", "TTG", "GCG", "ATG", "GTG", "ATC", "TTTT", "AGA", "GAC", "ATA", "TGC", "CGG", "ACG", "GCG", "TGG", "AGC", "TCC", "AG", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "1", ",", " ", "142", ",", " ", "'", "TTA", "')", ",", " ", "(", "0", ",", " ", "145", ",", " ", "'", "A", "')", ",", " ", "(", "0", ",", " ", "148", ",", " ", "'", "T", "')", ",", " ", "(", "1", ",", " ", "152", ",", " ", "'", "C", "')", ",", " ", "(", "0", ",", " ", "155", ",", " ", "'", "A", "')", ",", " ", "(", "1", ",", " ", "157", ",", " ", "'", "G", "')", ",", " ", "(", "1", ",", " ", "159", ",", " ", "'", "GT", "')", ",", " ", "(", "0", ",", " ", "162", ",", " ", "'", "G", "')]", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Spl", "ice", " ", "junction", " ", "example", " ", "2", "A", ":", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "13", "M1", "00", "N", "7", "M2", "D1", "9", "M3", "I1", "0", "M1", "I", "5", "M1", "I2", "M2", "I1", "0", "M", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", " ", "9", "A1", "0", "^", "GG", "2", "2", "C2", "C6", "T6", "T6", "\\", "10", ";", " ", " ", "1", " ", " ", " ", " ", " ", "1", " ", " ", " ", " ", " ", "1", " ", " ", " ", " ", "1", " ", " ", " ", " ", " ", "1", "\\", "10", ";", " ", "1", " ", " ", " ", " ", " ", " ", "2", " ", " ", " ", " ", " ", "3", " ", " ", " ", " ", " ", "4", " ", " ", " ", " ", "5", " ", " ", " ", " ", " ", "6", "\\", "10", ";", " ", " ", " ", " ", "pos", ":", " ", " ", "123456789012", "3", "|", " ", "[", "100", "]", " ", "|", "4567", "890", "123456789012", "3456", "7890", "1", "^", "^", "^", "23456", "7890", "1", "^", "23456", "^", "7", "8", "^", "^", "901", "23456", "7", "8", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "AGG", "GTG", "GCG", "AGA", "T", "|---", "----", "|", "CGA", "TGA", "CGG", "CAT", "TGG", "CGA", "TGG", "TGA", "TCT", "T", "^", "^", "^", "GAG", "CCA", "CAT", "G", "^", "CGG", "TC", "^", "GC", "^", "^", "GGA", "TCT", "CCA", "G", "\\", "10", ";", " ", " ", " ", "^", "^", " ", "|||", " ", " ", " ", "X", " ", " ", "X", " ", " ", " ", "|", " ", " ", " ", "X", " ", "|", " ", " ", "||", " ", " ", " ", "X", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "AGG", "GTG", "GCG", "CGA", "T", "|---", "----", "|", "CGA", "TGA", "C", "^", "^", "CAT", "TGG", "CGA", "TGG", "TGA", "TCT", "TTT", "AGA", "GAC", "ATA", "TGC", "CGG", "ACG", "GCG", "TGG", "AGC", "TCC", "AG", "\\", "10", ";", " ", " ", "MMM", "MMM", "MMM", "MMM", "M", " ", " ", " ", " ", " ", "MMM", "MMM", "MD", "DM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "III", "MMM", "MMM", "MMM", "MI", "MMM", "MM", "IMM", "II", "MMM", "MMM", "MMM", "M", "\\", "10", ";", " ", " ", "---------", "C", "---", " ", " ", " ", " ", " ", "--------------", "--------------", "tta", "---", "A", "--", "T", "---", "c", "---", "A", "----", "gt", "---", "G", "------", "\\", "10", ";", " ", " ", "........", ".", "A", "...", " ", " ", " ", " ", " ", "......", ".", "GG", "...........", "........", " ", " ", " ", "...", "C", "..", "C", "...", " ", "...", "T", ".", " ", "..", " ", " ", "...", "T", "......", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "9", " ", " ", " ", " ", "A", " ", " ", " ", " ", "10", " ", " ", " ", " ", "^", "GG", " ", " ", " ", " ", " ", "2", "2", " ", " ", "C", " ", "2", "C", " ", " ", " ", "6", " ", " ", " ", "T", " ", "6", " ", " ", " ", "T", " ", " ", " ", "6", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", " ", "13", "),", " ", "(", "3", ",", " ", "100", "),", " ", "(", "0", ",", " ", "7", "),", " ", "(", "2", ",", " ", "2", "),", " ", "(", "0", ",", " ", "1", "9", "),", " ", "(", "1", ",", " ", "3", "),", " ", "(", "0", ",", " ", "10", "),", " ", "(", "1", ",", " ", "1", "),", " ", "(", "0", ",", " ", "5", "),", " ", "(", "1", ",", " ", "1", "),", " ", "(", "0", ",", " ", "2", "),", " ", "(", "1", ",", " ", "2", "),", " ", "(", "0", ",", " ", "10", ")]", ",", " ", "'", "9", "A1", "0", "^", "GG", "2", "2", "C2", "C6", "T6", "T6", "',", " ", "'", "AGG", "GTG", "GCG", "CGA", "TCG", "ATG", "ACC", "ATT", "GGCG", "ATG", "GTG", "ATC", "TTTT", "AGA", "GAC", "ATA", "TGC", "CGG", "ACG", "GCG", "TGG", "AGC", "TCC", "AG", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "10", ",", " ", "'", "C", "')", ",", " ", "(", "2", ",", " ", "121", ",", " ", "'", "GG", "')", ",", " ", "(", "1", ",", " ", "142", ",", " ", "'", "TTA", "')", ",", " ", "(", "0", ",", " ", "145", ",", " ", "'", "A", "')", ",", " ", "(", "0", ",", " ", "148", ",", " ", "'", "T", "')", ",", " ", "(", "1", ",", " ", "152", ",", " ", "'", "C", "')", ",", " ", "(", "0", ",", " ", "155", ",", " ", "'", "A", "')", ",", " ", "(", "1", ",", " ", "157", ",", " ", "'", "G", "')", ",", " ", "(", "1", ",", " ", "159", ",", " ", "'", "GT", "')", ",", " ", "(", "0", ",", " ", "162", ",", " ", "'", "G", "')]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Real", " ", "Exam", "ple", "\\", "10", ";", " ", " ", " ", " ", "242", "\\u", "107", "1", "\\u", "179", "9", "\\u", "B1", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "4", "2", "M1", "0", "I", "3", "M1", "D", "9", "M1", "D1", "1", "M", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", " ", "2", "7", "G1", "6", "A0", "^", "T6", "C2", "^", "T1", "C", "9", "\\", "10", ";", " ", "1", " ", " ", " ", " ", " ", "2", " ", " ", " ", " ", " ", "3", " ", " ", " ", " ", " ", "4", " ", "5", " ", " ", " ", " ", " ", "6", " ", " ", " ", " ", " ", "7", "\\", "10", ";", " ", " ", " ", " ", "pos", ":", " ", " ", "123456789012", "3456", "7890", "123456789012", "3456", "7890", "1", "2", " ", " ", "3456", "7890", "123456789012", "3456", "7890", "12345", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "ACT", "GAG", "AAAC", "CCA", "ACC", "CTC", "TGA", "GAC", "CAG", "CAC", "ACC", "CCT", "TTC", "AA", "^", "^", "^", "^", "^", "^", "^", "^", "^", "^", "GCA", "TGT", "TCC", "TCC", "CTC", "CCC", "TTC", "TTT", "G", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", "X", "^", " ", " ", "X", " ", " ", "^", " ", "X", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "ACT", "GAG", "AAAC", "CCA", "ACC", "CTC", "TGA", "GAC", "CAA", "CAC", "ACC", "CCT", "TTC", "AAC", "ACA", "TTTT", "TGG", "CC", "^", "GTT", "CCT", "GCC", "^", "CGC", "CTT", "CTT", "TG", "\\", "10", ";", " ", " ", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "III", "III", "III", "IMM", "MD", "MMM", "MMM", "MMM", "DM", "MMM", "MMM", "MMM", "M", "\\", "10", ";", " ", " ", "--------------", "-------------", "A", "--------------", "^", "^", "^", "^", "^", "^", "^", "^", "^", "^", "--", "CT", "------", "G", "--", "T", "-", "G", "---------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", "4", "2", "),", " ", "(", "1", ",", "10", "),", " ", "(", "0", ",", " ", "3", "),", " ", "(", "2", ",", " ", "1", "),", " ", "(", "0", ",", " ", "9", "),", " ", "(", "2", ",", " ", "1", "),", " ", "(", "0", ",", " ", "11", ")]", ",", " ", "'", "2", "7", "G1", "6", "A0", "^", "T6", "C2", "^", "T1", "C", "9", "',", " ", "'", "ACT", "GAG", "AAAC", "CCA", "ACC", "CTC", "TGA", "GAC", "CAA", "CAC", "ACC", "CCT", "TTC", "AAC", "ACA", "TTTT", "TGG", "CCG", "TTC", "CTG", "CCC", "GCC", "TTC", "TTT", "G", "',", " ", " ", "))\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "2", "8", ",", " ", "'", "A", "')", ",", " ", "(", "1", ",", " ", "4", "3", ",", " ", "'", "CAC", "ATT", "TTT", "G", "')", ",", " ", "(", "0", ",", " ", "4", "5", ",", " ", "'", "C", "')", ",", " ", "(", "2", ",", " ", "4", "6", ",", " ", "'", "T", "')", ",", " ", "(", "0", ",", " ", "5", "3", ",", " ", "'", "G", "')", ",", " ", "(", "2", ",", " ", "56", ",", " ", "'", "T", "')", ",", " ", "(", "0", ",", " ", "5", "8", ",", " ", "'", "G", "')]", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Real", " ", "example", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "577", "\\u", "169", "2", "\\u", "891", "\\u", "A1", "\\", "10", ";", " ", " ", " ", " ", "CI", "GAR", ":", " ", "3", "4", "M1", "00", "N3", "9", "M2", "I", "\\", "10", ";", " ", " ", " ", " ", "MD", ":", "Z", ":", " ", " ", "3", "T6", "9", "\\", "10", ";", " ", " ", " ", " ", "1", " ", " ", " ", " ", " ", "1", " ", " ", " ", " ", " ", "1", " ", " ", " ", " ", " ", "1", "\\", "10", ";", " ", "1", " ", " ", " ", " ", " ", "2", " ", " ", " ", " ", " ", "3", " ", " ", " ", " ", " ", " ", "4", " ", " ", " ", " ", " ", "5", " ", " ", " ", " ", " ", "6", " ", " ", " ", " ", " ", "7", "\\", "10", ";", " ", " ", " ", " ", "pos", ":", " ", " ", "123456789012", "3456", "7890", "123456789012", "3", "4", "|", " ", "[", "100", "]", " ", "|", "5678", "901", "23456", "7890", "123456789012", "3456", "7890", "123", "\\", "10", ";", " ", " ", " ", " ", "ref", ":", " ", " ", "GGA", "TTC", "TTC", "CCA", "CTG", "GGT", "CGA", "TGT", "TGT", "TTG", "TGA", "T", "|---", "----", "|", "CTG", "AGA", "GAG", "AGT", "TGC", "ATC", "TGC", "ACA", "TGC", "TTT", "CCT", "GGCG", "TC", "^", "^", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "read", ":", " ", "GGA", "ATC", "TTC", "CCA", "CTG", "GGT", "CGA", "TGT", "TGT", "TTG", "TGA", "T", "|---", "----", "|", "CTG", "AGA", "GAG", "AGT", "TGC", "ATC", "TGC", "ACA", "TGC", "TTT", "CCT", "GGCG", "TCT", "C", "\\", "10", ";", " ", " ", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "M", " ", " ", "NN", "NN", "N", " ", " ", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "MMM", "II", "\\", "10", ";", " ", " ", "---", "A", "--------------", "--------------", "--", " ", " ", " ", " ", " ", "--------------", "--------------", "-----------", "TC", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "calc", "\\u", "variations", "(", "1", ",", " ", "[(", "0", ",", "3", "4", "),", " ", "(", "3", ",", "100", "),", " ", "(", "0", ",", " ", "3", "9", "),", " ", "(", "1", ",", " ", "2", ")]", ",", " ", "'", "3", "T6", "9", "',", " ", "'", "GGA", "ATC", "TTC", "CCA", "CTG", "GGT", "CGA", "TGT", "TGT", "TTG", "TGA", "TCT", "GAG", "AGA", "GAG", "TTG", "CAT", "CTG", "CAC", "ATG", "CTT", "TCC", "TGG", "CGT", "CTC", "',", " ", " ", "))\\", "10", ";", " ", " ", " ", " ", "[(", "0", ",", " ", "4", ",", " ", "'", "A", "')", ",", " ", "(", "1", ",", " ", "174", ",", " ", "'", "TC", "')]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "\\u", "pos_", "=_", "start", "\\u", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", ",_", "length_", "in_", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "md_", "and_", "md_", "[_", "0_", "]_", "==_", "'", "0", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "md_", "=_", "md_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sys", ".", "std", "err", ".", "write", "('", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", "\\\\", "n", "'", " ", "%", "(", "op", ",", " ", "length", ",", " ", "md", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "op_", "==_", "0_", ":_", "#", " ", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "how", " ", "far", " ", "in", " ", "the", " ", "chunk", " ", "are", " ", "we", "?", " ", "(", "do", " ", "*", "not", "*", " ", "update", " ", "ref", "\\u", "pos", " ", "unti", "l", " ", "end", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "md", "\\u", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "md_", "and_", "md", "\\u", "pos_", "<_", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "last_", "==_", "(_", "op_", ",_", "length_", ",_", "md_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sys_", "._", "stderr_", "._", "write_", "(_", "'\\\\", "n", "Infinit", "e", " ", "loop", " ", "in", " ", "variant", " ", "finding", "!\\\\", "n", "Pos", ":", " ", "%", "s", "\\\\", "n", "CI", "GAR", ":", " ", "(%", "s", ",", " ", "%", "s", ")\\\\", "n", "'_", "%_", "(_", "ref", "\\u", "pos_", ",_", "op_", ",_", "length_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last_", "=_", "(_", "op_", ",_", "length_", ",_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sys", ".", "std", "err", ".", "write", "('", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", "\\\\", "n", "'", " ", "%", "(", "op", ",", " ", "length", ",", " ", "md", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "chunk", "\\u", "size_", ",_", "md_", "=_", "\\u", "extract", "\\u", "md", "\\u", "matches_", "(_", "md_", ",_", "length_", "-_", "md", "\\u", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sys", ".", "std", "err", ".", "write", "('", " ", " ", " ", "->", " ", "%", "s", ",", " ", "%", "s", "\\\\", "n", "'", " ", "%", "(", "chunk", "\\u", "size", ",", " ", "md", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "md", "\\u", "pos_", "+=_", "chunk", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "look", " ", "for", " ", "mismatche", "s_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "md", "\\u", "pos_", "<_", "length_", "and_", "md_", "and_", "md_", "[_", "0_", "]_", "not_", "in_", "'", "0123456", "789", "^", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "(_", "op_", ",_", "ref", "\\u", "pos_", "+_", "md", "\\u", "pos_", ",_", "seq_", "[_", "read", "\\u", "pos_", "+_", "md", "\\u", "pos_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "md_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "md", "\\u", "pos_", "+=_", "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_", "ref", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "1_", ":_", "#", " ", "I_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", "hing", " ", "in", " ", "MD", " ", "abo", "ut", " ", "inserts", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "op_", ",_", "ref", "\\u", "pos_", ",_", "seq_", "[_", "read", "\\u", "pos_", ":_", "read", "\\u", "pos_", "+_", "length_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "2_", ":_", "#", " ", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prefixed", " ", "with", " ", "'", "^", "'", " ", "and", " ", "include", "s", " ", "all", " ", "of", " ", "the", " ", "remove", "d", " ", "bases_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "md_", "[_", "0_", "]_", "==_", "'", "^", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "md_", "=_", "md_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "(_", "op_", ",_", "ref", "\\u", "pos_", ",_", "md_", "[_", ":_", "length_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "md_", "[_", "length_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "3_", ":_", "#", " ", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "\\u", "pos_", "+=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "calc", "\\u", "mismatche", "s", "\\u", "gen_", "(_", "ref_", ",_", "read_", ",_", "chrom_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "read_", "._", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", ",_", "length_", "in_", "read_", "._", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "ref", "\\u", "pos_", ",_", "op_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "ref", "\\u", "pos_", ",_", "op_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "refse", "q_", "=_", "ref_", "._", "fetch_", "(_", "chrom_", ",_", "start_", "+_", "ref", "\\u", "pos_", ",_", "start_", "+_", "ref", "\\u", "pos_", "+_", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "refse", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Reference", " ", "'%", "s", "'", " ", "not", " ", "found", " ", "in", " ", "FAST", "A", " ", "file", ":", " ", "%", "s", "\"_", "%_", "(_", "chrom_", ",_", "ref_", "._", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cur", "\\u", "pos_", "=_", "start_", "+_", "ref", "\\u", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ref", "base_", ",_", "read", "base_", "in_", "zip_", "(_", "refse", "q_", "._", "upper_", "(_", ")_", ",_", "read_", "._", "seq_", "[_", "read", "\\u", "pos_", ":_", "read", "\\u", "pos_", "+_", "length_", "]_", "._", "upper_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ref", "base_", "!=_", "read", "base_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "op_", ",_", "cur", "\\u", "pos_", ",_", "read", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cur", "\\u", "pos_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ref", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "pos_", "+=_", "length_", "\\u\\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_", "(_", "\"", "Unsu", "ppo", "rted", " ", "CI", "GAR", " ", "operati", "on", ":", " ", "%", "s", "\"_", "%_", "op_", ")_", "\\u\\u\\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_", "read", "\\u", "calc", "\\u", "mismatche", "s", "\\u", "ref_", "(_", "ref_", ",_", "read_", ",_", "chrom_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edits", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", ",_", "pos_", ",_", "base_", "in_", "read", "\\u", "calc", "\\u", "mismatche", "s", "\\u", "gen_", "(_", "ref_", ",_", "read_", ",_", "chrom_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edits", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "edits", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "region", "\\u", "pos", "\\u", "to", "\\u", "genomic", "\\u", "pos_", "(_", "name_", ",_", "start_", ",_", "cigar", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "convert", "s", " ", "a", " ", "junction", " ", "position", " ", "to", " ", "a", " ", "genomic", " ", "location", " ", "give", "n", " ", "a", " ", "junction", "\\", "10", ";", " ", " ", " ", " ", "ref", " ", "name", ",", " ", "the", " ", "junction", " ", "position", ",", " ", "and", " ", "the", " ", "cigar", " ", "alignme", "nt", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", "s", ":", " ", "(", "genomic", " ", "ref", ",", " ", "genomic", " ", "pos", ",", " ", "genomic", " ", "cigar", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "region", "\\u", "pos", "\\u", "to", "\\u", "genomic", "\\u", "pos", "('", "chr", "1", ":", "1000", "-1", "050", ",", "2000", "-", "2050", ",", "3000", "-", "4000", "',", " ", "25", ",", " ", "[(", "0", ",", " ", "100", ")])", "\\", "10", ";", " ", " ", " ", " ", "('", "chr", "1", "',", " ", "1025", ",", " ", "[(", "0", ",", " ", "25", "),", " ", "(", "3", ",", " ", "950", "),", " ", "(", "0", ",", " ", "50", "),", " ", "(", "3", ",", " ", "950", "),", " ", "(", "0", ",", " ", "25", ")])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "region", "\\u", "pos", "\\u", "to", "\\u", "genomic", "\\u", "pos", "('", "chr", "1", ":", "1000", "-1", "050", ",", "1050", "-1", "200", "',", " ", "25", ",", " ", "[(", "0", ",", " ", "100", ")])", "\\", "10", ";", " ", " ", " ", " ", "('", "chr", "1", "',", " ", "1025", ",", " ", "[(", "0", ",", " ", "25", "),", " ", "(", "3", ",", " ", "0", "),", " ", "(", "0", ",", " ", "7", "5", ")])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "region", "\\u", "pos", "\\u", "to", "\\u", "genomic", "\\u", "pos", "('", "chr", "3", "R", ":", "176", "308", "5", "1", "-1", "763", "089", "7", ",", "176", "343", "3", "8", "-1", "763", "438", "4", "',", " ", "1", "7", ",", " ", "[(", "0", ",", " ", "3", "9", ")])", "\\", "10", ";", " ", " ", " ", " ", "('", "chr", "3", "R", "',", " ", "176", "308", "6", "8", ",", " ", "[(", "0", ",", " ", "2", "9", "),", " ", "(", "3", ",", " ", "344", "1", "),", " ", "(", "0", ",", " ", "10", ")])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "region", "\\u", "pos", "\\u", "to", "\\u", "genomic", "\\u", "pos", "('", "chr", "1", ":", "1000", "-1", "050", ",", "2000", "-", "2050", "',", " ", "25", ",", " ", "[(", "4", ",", " ", "25", "),", " ", "(", "0", ",", " ", "50", "),", " ", "(", "4", ",", " ", "25", ")])", "\\", "10", ";", " ", " ", " ", " ", "('", "chr", "1", "',", " ", "1025", ",", " ", "[(", "4", ",", " ", "25", "),", " ", "(", "0", ",", " ", "25", "),", " ", "(", "3", ",", " ", "950", "),", " ", "(", "0", ",", " ", "25", "),", " ", "(", "4", ",", " ", "25", ")])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "region", "\\u", "pos", "\\u", "to", "\\u", "genomic", "\\u", "pos", "('", "chr", "1", ":", "1000", "-1", "050", ",", "2000", "-", "2050", "',", " ", "25", ",", " ", "[(", "5", ",", " ", "25", "),", " ", "(", "0", ",", " ", "7", "5", ")])", "\\", "10", ";", " ", " ", " ", " ", "('", "chr", "1", "',", " ", "1025", ",", " ", "[(", "5", ",", " ", "25", "),", " ", "(", "0", ",", " ", "25", "),", " ", "(", "3", ",", " ", "950", "),", " ", "(", "0", ",", " ", "50", ")])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "region", "\\u", "pos", "\\u", "to", "\\u", "genomic", "\\u", "pos", "('", "chr", "1", ":", "1000", "-1", "050", ",", "2000", "-", "2050", "',", " ", "25", ",", " ", "[(", "5", ",", " ", "25", "),", " ", "(", "0", ",", " ", "7", "5", ")])", "\\", "10", ";", " ", " ", " ", " ", "('", "chr", "1", "',", " ", "1025", ",", " ", "[(", "5", ",", " ", "25", "),", " ", "(", "0", ",", " ", "25", "),", " ", "(", "3", ",", " ", "950", "),", " ", "(", "0", ",", " ", "50", ")])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "region", "\\u", "pos", "\\u", "to", "\\u", "genomic", "\\u", "pos", "('", "chr", "7", ":", "168", "291", "5", "3", "-1", "682", "924", "6", ",", "168", "292", "4", "6", "-1", "682", "933", "9", "',", " ", "6", "2", ",", " ", "cigar", "\\u", "froms", "tr", "('", "8", "3", "M1", "8", "S", "'))", "\\", "10", ";", " ", " ", " ", " ", "('", "chr", "7", "',", " ", "168", "292", "15", ",", " ", "[(", "0", ",", " ", "3", "1", "),", " ", "(", "3", ",", " ", "0", "),", " ", "(", "0", ",", " ", "5", "2", "),", " ", "(", "4", ",", " ", "1", "8", ")])", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name_", "in_", "\\u\\u", "region", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chrom_", ",_", "fragments_", "=_", "\\u\\u", "region", "\\u", "cache_", "[_", "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 ", " _", "c1_", "=_", "name_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chrom_", "=_", "c1_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fragments_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fragment_", "in_", "c1_", "[_", "1_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", ",_", "e_", "=_", "fragment_", "._", "split_", "(_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fragments_", "._", "append_", "(_", "(_", "int_", "(_", "s_", ")_", ",_", "int_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "region", "\\u", "cache_", "[_", "name_", "]_", "=_", "(_", "chrom_", ",_", "fragments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "chr", "\\u", "cigar", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chr", "\\u", "start_", "=_", "fragments_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "start_", "=_", "int_", "(_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frag", "\\u", "idx_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "end_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "(_", "s_", ",_", "e_", ")_", "in_", "enumerate_", "(_", "fragments_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "chr", "\\u", "start_", "+_", "read", "\\u", "start_", "<_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chr", "\\u", "start_", "+=_", "read", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "idx_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "start_", "=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "end_", "=_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chr", "\\u", "start_", "+=_", "(_", "e_", "-_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "start_", "-=_", "(_", "e_", "-_", "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_", "cur", "\\u", "pos_", "=_", "chr", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", ",_", "length_", "in_", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op_", "in_", "[_", "1_", ",_", "4_", ",_", "5_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chr", "\\u", "cigar", "_", "._", "append_", "(_", "(_", "op_", ",_", "length_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "in_", "[_", "0_", ",_", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cur", "\\u", "pos_", "+_", "length_", "<=_", "frag", "\\u", "end_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chr", "\\u", "cigar", "_", "._", "append_", "(_", "(_", "op_", ",_", "length_", ")_", ")_", "\\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 ", " _", "while_", "cur", "\\u", "pos_", "+_", "length_", ">_", "frag", "\\u", "end_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "frag", "\\u", "end_", "-_", "cur", "\\u", "pos_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "chr", "\\u", "cigar", "_", "._", "append_", "(_", "(_", "op_", ",_", "frag", "\\u", "end_", "-_", "cur", "\\u", "pos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "-=_", "(_", "frag", "\\u", "end_", "-_", "cur", "\\u", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cur", "\\u", "pos_", "=_", "frag", "\\u", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag", "\\u", "idx_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "fragments_", ")_", "<=_", "frag", "\\u", "idx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "ERROR", " ", "convert", "ing", ":", " ", "'_", ",_", "name_", ",_", "fragments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "chrom_", ",_", "0_", ",_", "chr", "\\u", "cigar", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frag", "\\u", "start_", ",_", "frag", "\\u", "end_", "=_", "fragments_", "[_", "frag", "\\u", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chr", "\\u", "cigar", "_", "._", "append_", "(_", "(_", "3_", ",_", "frag", "\\u", "start_", "-_", "cur", "\\u", "pos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "pos_", "=_", "frag", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cur", "\\u", "pos_", "=_", "cur", "\\u", "pos_", "+_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chr", "\\u", "cigar", "_", "._", "append_", "(_", "(_", "op_", ",_", "length_", ")_", ")_", "\\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_", "\"", "Unsu", "ppo", "rted", " ", "CI", "GAR", " ", "operati", "on", " ", "(%", "s", ")\"_", "%_", "bam", "\\u", "cigar", "_", "[_", "op_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "chrom_", ",_", "chr", "\\u", "start_", ",_", "chr", "\\u", "cigar", "_", ")_", "\\u\\u\\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_", "is", "\\u", "junction", "\\u", "valid_", "(_", "cigar", "_", ",_", "min", "\\u", "overlap_", "=_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Do", "es", " ", "the", " ", "genomic", " ", "cigar", " ", "alignme", "nt", " ", "represent", " ", "a", " ", "'", "good", "'", " ", "alignme", "nt", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "for", " ", "checking", " ", "junction", "->", "geno", "me", " ", "alignme", "nts", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ")", " ", "the", " ", "alignme", "nt", " ", "must", " ", "not", " ", "start", " ", "at", " ", "a", " ", "splice", " ", "junction", "\\", "10", ";", " ", " ", " ", " ", "2", ")", " ", "the", " ", "alignme", "nt", " ", "must", " ", "not", " ", "start", " ", "or", " ", "end", " ", "with", " ", "an", " ", "over", "hang", "\\", "10", ";", " ", " ", " ", " ", "3", ")", " ", "the", " ", "alignme", "nt", " ", "must", " ", "over", "hang", " ", "the", " ", "splice", " ", "junction", " ", "by", " ", "min", "\\u", "overl", "ap", " ", "(", "4", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "Exo", "n1", " ", " ", " ", "|", " ", "Intro", "n", " ", "|", " ", " ", "Exo", "n2", " ", " ", " ", "|", "\\", "10", ";", " ", " ", " ", " ", "|---", "--------------", "|", "oooo", "oooo", "oooo", "oooo", "|---", "--------------", "-|", "\\", "10", ";", " ", " ", " ", " ", "XXXXXXXXXX", "XXXXXXXXXX", "XXXX", " ", "(", "bad", " ", "1", ")", "\\", "10", ";", " ", " ", "XXXXXXXXXX", "XX", "X", " ", "(", "bad", " ", "2", ")", " ", " ", " ", " ", " ", "XXXXXXXXXX", "XXXXXX", " ", "(", "bad", " ", "2", ")", "\\", "10", ";", " ", " ", "XX", "--------------", "---", "XXXXXXXXXX", "XXXXXX", "X", " ", "(", "bad", " ", "3", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "is", "\\u", "junction", "\\u", "valid", "(", "cigar", "\\u", "froms", "tr", "('", "1000", "N", "40", "M", "'))", "\\", "10", ";", " ", " ", " ", " ", "(", "Fal", "se", ",", " ", "'", "Start", "s", " ", "at", " ", "gap", " ", "(", "1000", "N", "40", "M", ")'", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "is", "\\u", "junction", "\\u", "valid", "(", "cigar", "\\u", "froms", "tr", "('", "100", "M", "'))", "\\", "10", ";", " ", " ", " ", " ", "(", "Fal", "se", ",", " ", "\"", "Do", "esn", "'", "t", " ", "cover", " ", "junction", "\")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "is", "\\u", "junction", "\\u", "valid", "(", "cigar", "\\u", "froms", "tr", "('", "100", "M1", "000", "N3", "M", "')", ",", " ", "4", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "Fal", "se", ",", " ", "\"", "Too", " ", "short", " ", "overl", "ap", " ", "at", " ", "3", "'", " ", "(", "100", "M1", "000", "N3", "M", ")\"", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "is", "\\u", "junction", "\\u", "valid", "(", "cigar", "\\u", "froms", "tr", "('", "2", "M1", "000", "N1", "00", "M", "')", ",", " ", "4", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "Fal", "se", ",", " ", "\"", "Too", " ", "short", " ", "overl", "ap", " ", "at", " ", "5", "'", " ", "(", "2", "M1", "000", "N1", "00", "M", ")\"", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "is", "\\u", "junction", "\\u", "valid", "(", "cigar", "\\u", "froms", "tr", "('", "4", "M1", "000", "N1", "00", "M", "')", ",", " ", "4", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "Tru", "e", ",", " ", "''", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "is", "\\u", "junction", "\\u", "valid", "(", "cigar", "\\u", "froms", "tr", "('", "100", "M1", "000", "N", "4", "M", "')", ",", " ", "4", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "Tru", "e", ",", " ", "''", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "is", "\\u", "junction", "\\u", "valid", "(", "cigar", "\\u", "froms", "tr", "('", "4", "M", "0", "N1", "00", "M", "')", ",", " ", "4", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "Tru", "e", ",", " ", "''", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pre", "\\u", "gap_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "\\u", "gap", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "gap", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "gap_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", ",_", "length_", "in_", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mapping", " ", "can", "'", "t", " ", "start", " ", "at", " ", "a", " ", "gap_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "first_", "and_", "op_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "False_", ",_", "'", "Start", "s", " ", "at", " ", "gap", " ", "(%", "s", ")'_", "%_", "cigar", "\\u", "tost", "r_", "(_", "cigar", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "first_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "op_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pre", "\\u", "gap_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "gap", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "gap_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "pre", "\\u", "gap_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pre", "\\u", "gap", "\\u", "count_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "gap", "\\u", "count_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mapping", " ", "must", " ", "start", " ", "with", " ", "more", " ", "than", " ", "min", "\\u", "overl", "ap", " ", "base", " ", "match_", "\\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_", "not_", "has", "\\u", "gap_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "False_", ",_", "\"", "Do", "esn", "'", "t", " ", "cover", " ", "junction", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "pre", "\\u", "gap", "\\u", "count_", "<_", "min", "\\u", "overlap_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "False_", ",_", "\"", "Too", " ", "short", " ", "overl", "ap", " ", "at", " ", "5", "'", " ", "(%", "s", ")\"_", "%_", "cigar", "\\u", "tost", "r_", "(_", "cigar", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "post", "\\u", "gap", "\\u", "count_", "<_", "min", "\\u", "overlap_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "False_", ",_", "\"", "Too", " ", "short", " ", "overl", "ap", " ", "at", " ", "3", "'", " ", "(%", "s", ")\"_", "%_", "cigar", "\\u", "tost", "r_", "(_", "cigar", "_", ")_", ")_", "\\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", "\\u", "alignme", "nt", "\\u", "fragment", "s", "\\u", "gen_", "(_", "read_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Tak", "es", " ", "a", " ", "read", " ", "and", " ", "return", "s", " ", "the", " ", "start", " ", "and", " ", "end", " ", "position", "s", " ", "for", " ", "each", " ", "match", "/", "mism", "atch", " ", "region", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "let", " ", "us", " ", "know", " ", "where", " ", "each", " ", "read", " ", "alignme", "nt", " ", "\"", "touche", "s", "\"", " ", "the", " ", "geno", "me", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "start_", ",_", "end_", "in_", "\\u", "read", "\\u", "alignme", "nt", "\\u", "fragment", "s", "\\u", "gen_", "(_", "read_", "._", "pos_", ",_", "read_", "._", "cigar", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "start_", ",_", "end_", ")_", "\\u\\u\\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", "read", "\\u", "alignme", "nt", "\\u", "fragment", "s", "\\u", "gen_", "(_", "pos_", ",_", "cigar", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Test", "-", "able", " ", "version", " ", "of", " ", "read", "\\u", "alignme", "nt", "\\u", "fragment", "s", "\\u", "gen", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "alignme", "nt", "\\u", "fragment", "s", "\\u", "gen", "(", "1", ",", " ", "cigar", "\\u", "froms", "tr", "('", "50", "M", "'))", ")", "\\", "10", ";", " ", " ", " ", " ", "[(", "1", ",", " ", "5", "1", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "alignme", "nt", "\\u", "fragment", "s", "\\u", "gen", "(", "1", ",", " ", "cigar", "\\u", "froms", "tr", "('", "25", "M1", "00", "N", "25", "M", "'))", ")", "\\", "10", ";", " ", " ", " ", " ", "[(", "1", ",", " ", "2", "6", "),", " ", "(", "126", ",", " ", "151", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "list", "(\\u", "read", "\\u", "alignme", "nt", "\\u", "fragment", "s", "\\u", "gen", "(", "1", ",", " ", "cigar", "\\u", "froms", "tr", "('", "20", "M1", "D4", "M1", "00", "N1", "0", "M", "5", "I1", "0", "M", "'))", ")", "\\", "10", ";", " ", " ", " ", " ", "[(", "1", ",", " ", "21", "),", " ", "(", "2", "2", ",", " ", "2", "6", "),", " ", "(", "126", ",", " ", "136", "),", " ", "(", "136", ",", " ", "146", ")]", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "pos_", "=_", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", ",_", "length_", "in_", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "ref", "\\u", "pos_", ",_", "ref", "\\u", "pos_", "+_", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "\\u", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "\\u", "pos_", "+=_", "length_", "\\u\\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_", "(_", "\"", "Unsu", "ppo", "rted", " ", "CI", "GAR", " ", "operati", "on", ":", " ", "%", "s", "\"_", "%_", "op_", ")_", "\\u\\u\\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_", "read", "\\u", "cigar", "\\u", "at", "\\u", "pos_", "(_", "cigar", "_", ",_", "qp", "os_", ",_", "is", "\\u", "del_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "CI", "GAR", " ", "operati", "on", " ", "for", " ", "a", " ", "give", "n", " ", "read", " ", "position", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "qp", "os", " ", "is", " ", "the", " ", "0", "-", "based", " ", "index", " ", "of", " ", "the", " ", "base", " ", "in", " ", "the", " ", "read", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "next_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "op_", ",_", "length_", "in_", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "return", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "op_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Unsu", "ppo", "rted", " ", "CI", "GAR", " ", "operati", "on", ":", " ", "%", "s", "\"_", "%_", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pos_", ">_", "qp", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "del_", "and_", "pos_", "==_", "qp", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return", "next_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "cigar", "_", "(_", "cigar", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Clean", "s", " ", "a", " ", "CI", "GAR", " ", "alignme", "nt", " ", "to", " ", "remove", " ", "zero", " ", "length", " ", "operati", "ons", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cigar", "\\u", "tost", "r", "(", "clean", "cigar", "(", "cigar", "\\u", "froms", "tr", "('", "3", "1", "M", "0", "N", "5", "2", "M1", "8", "S", "'))", ")", "\\", "10", ";", " ", " ", " ", " ", "'", "8", "3", "M1", "8", "S", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newc", "iga", "r_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "changed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zero_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "op_", ",_", "size_", "in_", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "size_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "zero_", "and_", "newc", "iga", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "newc", "iga", "r_", "[_", "-_", "1_", "]_", "[_", "0_", "]_", "==_", "op_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "news", "ize_", "=_", "newc", "iga", "r_", "[_", "-_", "1_", "]_", "[_", "1_", "]_", "+_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newc", "iga", "r_", "[_", "-_", "1_", "]_", "=_", "(_", "op_", ",_", "news", "ize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zero_", "=_", "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 ", " _", "newc", "iga", "r_", "._", "append_", "(_", "(_", "op_", ",_", "size_", ")_", ")_", "\\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 ", " _", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zero_", "=_", "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_", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "newc", "iga", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "clean", "cigar", "_", "(_", "read_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Replace", "s", " ", "the", " ", "CI", "GAR", " ", "string", " ", "for", " ", "a", " ", "read", " ", "to", " ", "remove", " ", "any", " ", "operati", "ons", " ", "tha", "t", " ", "are", " ", "zero", " ", "length", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "happ", "ens", " ", "to", " ", "the", " ", "read", " ", "in", "-", "place", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "read_", "._", "is", "\\u", "unmapped", "_", ":_", "\\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_", "newc", "iga", "r_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "newc", "iga", "r_", "=_", "clean", "cigar", "_", "(_", "read_", "._", "cigar", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "newc", "iga", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read_", "._", "cigar", "_", "=_", "newc", "iga", "r_", "\\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_", "read", "\\u", "to", "\\u", "unmapped", "_", "(_", "read_", ",_", "ref_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "read", " ", "from", " ", "mapp", "ed", " ", "to", " ", "unmapped", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "the", " ", "'", "ZR", "'", " ", "tag", " ", "to", " ", "indicat", "e", " ", "the", " ", "original", " ", "ref", "/", "pos", "/", "cigar", " ", "(", "if", " ", "ref", " ", "is", " ", "pass", "ed", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "newre", "ad_", "=_", "pysam", "_", "._", "Aligned", "Read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ref_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tags_", "=_", "[_", "(_", "'", "ZR", "'_", ",_", "'%", "s", ":", "%", "s", ":", "%", "s", "'_", "%_", "(_", "ref_", ",_", "read_", "._", "pos_", ",_", "cigar", "\\u", "tost", "r_", "(_", "read_", "._", "cigar", "_", ")_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newre", "ad_", "._", "is", "\\u", "unmapped", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newre", "ad_", "._", "map", "q_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newre", "ad_", "._", "tle", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newre", "ad_", "._", "pos_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newre", "ad_", "._", "pne", "xt_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newre", "ad_", "._", "rne", "xt_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newre", "ad_", "._", "tid_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "newre", "ad_", "._", "qname_", "=_", "read_", "._", "qname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "read_", "._", "is", "\\u", "paired", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newre", "ad_", "._", "is", "\\u", "paired", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "read_", "._", "is", "\\u", "unmapped", "_", "and_", "read_", "._", "is", "\\u", "reverse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newre", "ad_", "._", "seq_", "=_", "ngs", "utils_", "._", "support_", "._", "rev", "comp_", "(_", "read_", "._", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newre", "ad_", "._", "qual_", "=_", "read_", "._", "qual_", "[_", ":_", ":_", "-_", "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 ", " _", "newre", "ad_", "._", "seq_", "=_", "read_", "._", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newre", "ad_", "._", "qual_", "=_", "read_", "._", "qual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newre", "ad_", "._", "tags_", "=_", "tags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "newre", "ad_", "\\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,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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 ]
Unused import
olivierverdier/dispatch/dispatch/dispatcher.py
[ { "content": "import weakref\n\nfrom dispatch import saferef\n\nWEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _make_id(target):\n if hasattr(target, 'im_func'):\n return (id(target.im_self), id(target.im_func))\n return id(target)", "metadata": "root._make_id", "header": "['module', '___EOS___']", "index": 6 }, { "content": "class Signal(object):\n \"\"\"\n Base class for all signals\n\n Internal attributes:\n\n receivers\n { receriverkey (id) : weakref(receiver) }\n \"\"\"\n\n _debugging = False\n\n\n\n\n\n\n", "metadata": "root.Signal", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self, providing_args=None):\n \"\"\"\n Create a new signal.\n\n providing_args\n A list of the arguments this signal can pass along in a send() call.\n \"\"\"\n self.receivers = []\n if providing_args is None:\n providing_args = []\n self.providing_args = set(providing_args)", "metadata": "root.Signal.__init__", "header": "['class', 'Signal', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": " def connect(self, receiver, sender=None, weak=True, dispatch_uid=None):\n \"\"\"\n Connect receiver to sender for signal.\n\n Arguments:\n\n receiver\n A function or an instance method which is to receive signals.\n Receivers must be hashable objects.\n\n if weak is True, then receiver must be weak-referencable (more\n precisely saferef.safeRef() must be able to create a reference\n to the receiver).\n\n Receivers must be able to accept keyword arguments.\n\n If receivers have a dispatch_uid attribute, the receiver will\n not be added if another receiver already exists with that\n dispatch_uid.\n\n sender\n The sender to which the receiver should respond Must either be\n of type Signal, or None to receive events from any sender.\n\n weak\n Whether to use weak references to the receiver By default, the\n module will attempt to use weak references to the receiver\n objects. If this parameter is false, then strong references will\n be used.\n\n dispatch_uid\n An identifier used to uniquely identify a particular instance of\n a receiver. This will usually be a string, though it may be\n anything hashable.\n \"\"\"\n # If debugging is on, check that we got a good receiver\n if self._debugging:\n import inspect\n assert callable(receiver), \"Signal receivers must be callable.\"\n\n # Check for **kwargs\n # Not all callables are inspectable with getargspec, so we'll\n # try a couple different ways but in the end fall back on assuming\n # it is -- we don't want to prevent registration of valid but weird\n # callables.\n try:\n argspec = inspect.getargspec(receiver)\n except TypeError:\n try:\n argspec = inspect.getargspec(receiver.__call__)\n except (TypeError, AttributeError):\n argspec = None\n if argspec:\n assert argspec[2] is not None, \\\n \"Signal receivers must accept keyword arguments (**kwargs).\"\n\n if dispatch_uid:\n lookup_key = (dispatch_uid, _make_id(sender))\n else:\n lookup_key = (_make_id(receiver), _make_id(sender))\n\n if weak:\n receiver = saferef.safeRef(receiver, onDelete=self._remove_receiver)\n\n for r_key, _ in self.receivers:\n if r_key == lookup_key:\n break\n else:\n self.receivers.append((lookup_key, receiver))", "metadata": "root.Signal.connect", "header": "['class', 'Signal', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " def disconnect(self, receiver=None, sender=None, weak=True, dispatch_uid=None):\n \"\"\"\n Disconnect receiver from sender for signal.\n\n If weak references are used, disconnect need not be called. The receiver\n will be remove from dispatch automatically.\n\n Arguments:\n\n receiver\n The registered receiver to disconnect. May be none if\n dispatch_uid is specified.\n\n sender\n The registered sender to disconnect\n\n weak\n The weakref state to disconnect\n\n dispatch_uid\n the unique identifier of the receiver to disconnect\n \"\"\"\n if dispatch_uid:\n lookup_key = (dispatch_uid, _make_id(sender))\n else:\n lookup_key = (_make_id(receiver), _make_id(sender))\n\n for index in range(len(self.receivers)):\n (r_key, _) = self.receivers[index]\n if r_key == lookup_key:\n del self.receivers[index]\n break", "metadata": "root.Signal.disconnect", "header": "['class', 'Signal', '(', 'object', ')', ':', '___EOS___']", "index": 105 }, { "content": " def send(self, sender, **named):\n \"\"\"\n Send signal from sender to all connected receivers.\n\n If any receiver raises an error, the error propagates back through send,\n terminating the dispatch loop, so it is quite possible to not have all\n receivers called if a raises an error.\n\n Arguments:\n\n sender\n The sender of the signal Either a specific object or None.\n\n named\n Named arguments which will be passed to receivers.\n\n Returns a list of tuple pairs [(receiver, response), ... ].\n \"\"\"\n responses = []\n if not self.receivers:\n return responses\n\n for receiver in self._live_receivers(_make_id(sender)):\n response = receiver(signal=self, sender=sender, **named)\n responses.append((receiver, response))\n return responses", "metadata": "root.Signal.send", "header": "['class', 'Signal', '(', 'object', ')', ':', '___EOS___']", "index": 138 }, { "content": " def send_robust(self, sender, **named):\n \"\"\"\n Send signal from sender to all connected receivers catching errors.\n\n Arguments:\n\n sender\n The sender of the signal Can be any python object (normally one\n registered with a connect if you actually want something to\n occur).\n\n named\n Named arguments which will be passed to receivers. These\n arguments must be a subset of the argument names defined in\n providing_args.\n\n Return a list of tuple pairs [(receiver, response), ... ]. May raise\n DispatcherKeyError.\n\n if any receiver raises an error (specifically any subclass of\n Exception), the error instance is returned as the result for that\n receiver.\n \"\"\"\n responses = []\n if not self.receivers:\n return responses\n\n # Call each receiver with whatever arguments it can accept.\n # Return a list of tuple pairs [(receiver, response), ... ].\n for receiver in self._live_receivers(_make_id(sender)):\n try:\n response = receiver(signal=self, sender=sender, **named)\n except Exception as err:\n responses.append((receiver, err))\n else:\n responses.append((receiver, response))\n return responses", "metadata": "root.Signal.send_robust", "header": "['class', 'Signal', '(', 'object', ')', ':', '___EOS___']", "index": 165 }, { "content": " def _live_receivers(self, senderkey):\n \"\"\"\n Filter sequence of receivers to get resolved, live receivers.\n\n This checks for weak references and resolves them, then returning only\n live receivers.\n \"\"\"\n none_senderkey = _make_id(None)\n receivers = []\n\n for (receiverkey, r_senderkey), receiver in self.receivers:\n if r_senderkey == none_senderkey or r_senderkey == senderkey:\n if isinstance(receiver, WEAKREF_TYPES):\n # Dereference the weak reference.\n receiver = receiver()\n if receiver is not None:\n receivers.append(receiver)\n else:\n receivers.append(receiver)\n return receivers", "metadata": "root.Signal._live_receivers", "header": "['class', 'Signal', '(', 'object', ')', ':', '___EOS___']", "index": 203 }, { "content": " def _remove_receiver(self, receiver):\n \"\"\"\n Remove dead receivers from connections.\n \"\"\"\n\n to_remove = []\n for key, connected_receiver in self.receivers:\n if connected_receiver == receiver:\n to_remove.append(key)\n for key in to_remove:\n for idx, (r_key, _) in enumerate(self.receivers):\n if r_key == key:\n del self.receivers[idx]", "metadata": "root.Signal._remove_receiver", "header": "['class', 'Signal', '(', 'object', ')', ':', '___EOS___']", "index": 224 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "weakref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dispatch_", "import_", "safe", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "WEA", "KR", "EF", "\\u", "TYPES_", "=_", "(_", "weakref_", "._", "Reference", "Type_", ",_", "safe", "ref_", "._", "Bound", "Meth", "od", "Wea", "kre", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "make", "\\u", "id_", "(_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "target_", ",_", "'", "im", "\\u", "func", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "id_", "(_", "target_", "._", "im", "\\u", "self_", ")_", ",_", "id_", "(_", "target_", "._", "im", "\\u", "func_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "id_", "(_", "target_", ")_", "\\u\\u\\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_", "Signal_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "class", " ", "for", " ", "all", " ", "signal", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Intern", "al", " ", "attribute", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "receive", "rs", "\\", "10", ";", " ", " ", " ", " ", "{", " ", "rece", "river", "key", " ", "(", "id", ")", " ", ":", " ", "weak", "ref", "(", "receive", "r", ")", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "debugg", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Signal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "provi", "ding", "\\u", "args_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "new", " ", "signal", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "provi", "ding", "\\u", "args", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "list", " ", "of", " ", "the", " ", "argu", "ment", "s", " ", "this", " ", "signal", " ", "can", " ", "pass", " ", "along", " ", "in", " ", "a", " ", "send", "()", " ", "call", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "receivers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "provi", "ding", "\\u", "args_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "provi", "ding", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "provi", "ding", "\\u", "args_", "=_", "set_", "(_", "provi", "ding", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Signal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect_", "(_", "self_", ",_", "receiver_", ",_", "sender_", "=_", "None_", ",_", "weak", "_", "=_", "True_", ",_", "dispatch", "\\u", "uid_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Connect", " ", "receive", "r", " ", "to", " ", "sender", " ", "for", " ", "signal", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "receive", "r", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "function", " ", "or", " ", "an", " ", "instance", " ", "method", " ", "whi", "ch", " ", "is", " ", "to", " ", "receive", " ", "signal", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Receive", "rs", " ", "must", " ", "be", " ", "hashable", " ", "object", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "weak", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "receive", "r", " ", "must", " ", "be", " ", "weak", "-", "referen", "cable", " ", "(", "more", "\\", "10", ";", " ", " ", " ", " ", "precise", "ly", " ", "safe", "ref", ".", "safe", "Ref", "()", " ", "must", " ", "be", " ", "able", " ", "to", " ", "create", " ", "a", " ", "reference", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "receive", "r", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Receive", "rs", " ", "must", " ", "be", " ", "able", " ", "to", " ", "accept", " ", "keyw", "ord", " ", "argu", "ment", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "receive", "rs", " ", "have", " ", "a", " ", "dispatch", "\\u", "uid", " ", "attribute", ",", " ", "the", " ", "receive", "r", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "be", " ", "adde", "d", " ", "if", " ", "anot", "her", " ", "receive", "r", " ", "alr", "ead", "y", " ", "exist", "s", " ", "with", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "dispatch", "\\u", "uid", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sender", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "sender", " ", "to", " ", "whi", "ch", " ", "the", " ", "receive", "r", " ", "shou", "ld", " ", "respond", " ", "Mus", "t", " ", "eit", "her", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "type", " ", "Signal", ",", " ", "or", " ", "Non", "e", " ", "to", " ", "receive", " ", "events", " ", "from", " ", "any", " ", "sender", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "weak", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "use", " ", "weak", " ", "reference", "s", " ", "to", " ", "the", " ", "receive", "r", " ", "By", " ", "default", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "module", " ", "will", " ", "atte", "mpt", " ", "to", " ", "use", " ", "weak", " ", "reference", "s", " ", "to", " ", "the", " ", "receive", "r", "\\", "10", ";", " ", " ", " ", " ", "object", "s", ".", " ", "If", " ", "this", " ", "parameter", " ", "is", " ", "fal", "se", ",", " ", "then", " ", "strong", " ", "reference", "s", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "used", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dispatch", "\\u", "uid", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "identifi", "er", " ", "used", " ", "to", " ", "unique", "ly", " ", "identify", " ", "a", " ", "partic", "ular", " ", "instance", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "receive", "r", ".", " ", "Thi", "s", " ", "will", " ", "usual", "ly", " ", "be", " ", "a", " ", "string", ",", " ", "tho", "ugh", " ", "it", " ", "may", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "anyt", "hing", " ", "hashable", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "debugg", "ing", " ", "is", " ", "on", ",", " ", "check", " ", "tha", "t", " ", "we", " ", "got", " ", "a", " ", "good", " ", "receiver_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "debugg", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "callable_", "(_", "receiver_", ")_", ",_", "\"", "Signal", " ", "receive", "rs", " ", "must", " ", "be", " ", "calla", "ble", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "**", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "all", " ", "calla", "bles", " ", "are", " ", "inspect", "able", " ", "with", " ", "getargs", "pec", ",", " ", "so", " ", "we", "'", "ll_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "a", " ", "couple", " ", "different", " ", "way", "s", " ", "but", " ", "in", " ", "the", " ", "end", " ", "fall", " ", "back", " ", "on", " ", "ass", "umi", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "is", " ", "--", " ", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "prevent", " ", "registration", " ", "of", " ", "valid", " ", "but", " ", "weird", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calla", "bles", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argspec_", "=_", "inspect_", "._", "getargs", "pec_", "(_", "receiver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "argspec_", "=_", "inspect_", "._", "getargs", "pec_", "(_", "receiver_", "._", "\\u\\u", "call\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Attribute", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "argspec_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "argspec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "argspec_", "[_", "2_", "]_", "is_", "not_", "None_", ",_", "\"", "Signal", " ", "receive", "rs", " ", "must", " ", "accept", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "(*", "*", "kwarg", "s", ").\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dispatch", "\\u", "uid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "look", "up", "\\u", "key_", "=_", "(_", "dispatch", "\\u", "uid_", ",_", "\\u", "make", "\\u", "id_", "(_", "sender_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "look", "up", "\\u", "key_", "=_", "(_", "\\u", "make", "\\u", "id_", "(_", "receiver_", ")_", ",_", "\\u", "make", "\\u", "id_", "(_", "sender_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "weak", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receiver_", "=_", "safe", "ref_", "._", "safe", "Ref_", "(_", "receiver_", ",_", "on", "Delete_", "=_", "self_", "._", "\\u", "remove", "\\u", "receiver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "r", "\\u", "key_", ",_", "\\u_", "in_", "self_", "._", "receivers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "r", "\\u", "key_", "==_", "look", "up", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "receivers_", "._", "append_", "(_", "(_", "look", "up", "\\u", "key_", ",_", "receiver_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Signal_", "(_", "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_", "disconnect_", "(_", "self_", ",_", "receiver_", "=_", "None_", ",_", "sender_", "=_", "None_", ",_", "weak", "_", "=_", "True_", ",_", "dispatch", "\\u", "uid_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Disconnect", " ", "receive", "r", " ", "from", " ", "sender", " ", "for", " ", "signal", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "weak", " ", "reference", "s", " ", "are", " ", "used", ",", " ", "discon", "nect", " ", "need", " ", "not", " ", "be", " ", "call", "ed", ".", " ", "The", " ", "receive", "r", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "remove", " ", "from", " ", "dispatch", " ", "automati", "call", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "receive", "r", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "register", "ed", " ", "receive", "r", " ", "to", " ", "discon", "nect", ".", " ", "Ma", "y", " ", "be", " ", "none", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "dispatch", "\\u", "uid", " ", "is", " ", "specified", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sender", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "register", "ed", " ", "sender", " ", "to", " ", "discon", "nect", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "weak", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "weak", "ref", " ", "state", " ", "to", " ", "discon", "nect", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dispatch", "\\u", "uid", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "unique", " ", "identifi", "er", " ", "of", " ", "the", " ", "receive", "r", " ", "to", " ", "discon", "nect", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dispatch", "\\u", "uid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "look", "up", "\\u", "key_", "=_", "(_", "dispatch", "\\u", "uid_", ",_", "\\u", "make", "\\u", "id_", "(_", "sender_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "look", "up", "\\u", "key_", "=_", "(_", "\\u", "make", "\\u", "id_", "(_", "receiver_", ")_", ",_", "\\u", "make", "\\u", "id_", "(_", "sender_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "index_", "in_", "range_", "(_", "len_", "(_", "self_", "._", "receivers_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "r", "\\u", "key_", ",_", "\\u_", ")_", "=_", "self_", "._", "receivers_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r", "\\u", "key_", "==_", "look", "up", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "receivers_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Signal_", "(_", "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_", "send_", "(_", "self_", ",_", "sender_", ",_", "**_", "named_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "signal", " ", "from", " ", "sender", " ", "to", " ", "all", " ", "connect", "ed", " ", "receive", "rs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "any", " ", "receive", "r", " ", "raise", "s", " ", "an", " ", "error", ",", " ", "the", " ", "error", " ", "propagate", "s", " ", "back", " ", "through", " ", "send", ",", "\\", "10", ";", " ", " ", " ", " ", "termina", "ting", " ", "the", " ", "dispatch", " ", "loop", ",", " ", "so", " ", "it", " ", "is", " ", "quite", " ", "possib", "le", " ", "to", " ", "not", " ", "have", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "receive", "rs", " ", "call", "ed", " ", "if", " ", "a", " ", "raise", "s", " ", "an", " ", "error", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sender", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "sender", " ", "of", " ", "the", " ", "signal", " ", "Ei", "ther", " ", "a", " ", "specific", " ", "object", " ", "or", " ", "Non", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "named", "\\", "10", ";", " ", " ", " ", " ", "Name", "d", " ", "argu", "ment", "s", " ", "whi", "ch", " ", "will", " ", "be", " ", "pass", "ed", " ", "to", " ", "receive", "rs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "tuple", " ", "pair", "s", " ", "[(", "receive", "r", ",", " ", "response", "),", " ", "...", " ", "].", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "responses_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "receivers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "responses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "receiver_", "in_", "self_", "._", "\\u", "live", "\\u", "receivers_", "(_", "\\u", "make", "\\u", "id_", "(_", "sender_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "receiver_", "(_", "signal_", "=_", "self_", ",_", "sender_", "=_", "sender_", ",_", "**_", "named_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "responses_", "._", "append_", "(_", "(_", "receiver_", ",_", "response_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "responses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Signal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "robust", "_", "(_", "self_", ",_", "sender_", ",_", "**_", "named_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "signal", " ", "from", " ", "sender", " ", "to", " ", "all", " ", "connect", "ed", " ", "receive", "rs", " ", "catch", "ing", " ", "error", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sender", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "sender", " ", "of", " ", "the", " ", "signal", " ", "Can", " ", "be", " ", "any", " ", "python", " ", "object", " ", "(", "normal", "ly", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "register", "ed", " ", "with", " ", "a", " ", "connect", " ", "if", " ", "you", " ", "actual", "ly", " ", "want", " ", "somet", "hing", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "occur", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "named", "\\", "10", ";", " ", " ", " ", " ", "Name", "d", " ", "argu", "ment", "s", " ", "whi", "ch", " ", "will", " ", "be", " ", "pass", "ed", " ", "to", " ", "receive", "rs", ".", " ", "The", "se", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", "s", " ", "must", " ", "be", " ", "a", " ", "subse", "t", " ", "of", " ", "the", " ", "argu", "ment", " ", "names", " ", "defin", "ed", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "provi", "ding", "\\u", "args", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "tuple", " ", "pair", "s", " ", "[(", "receive", "r", ",", " ", "response", "),", " ", "...", " ", "].", " ", "Ma", "y", " ", "raise", "\\", "10", ";", " ", " ", " ", " ", "Dispatcher", "Key", "Error", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "any", " ", "receive", "r", " ", "raise", "s", " ", "an", " ", "error", " ", "(", "specifica", "ll", "y", " ", "any", " ", "subclass", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "Except", "ion", "),", " ", "the", " ", "error", " ", "instance", " ", "is", " ", "return", "ed", " ", "as", " ", "the", " ", "result", " ", "for", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "receive", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "responses_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "receivers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "responses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "each", " ", "receive", "r", " ", "with", " ", "what", "ever", " ", "argu", "ment", "s", " ", "it", " ", "can", " ", "accept", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "tuple", " ", "pair", "s", " ", "[(", "receive", "r", ",", " ", "response", "),", " ", "...", " ", "].", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "receiver_", "in_", "self_", "._", "\\u", "live", "\\u", "receivers_", "(_", "\\u", "make", "\\u", "id_", "(_", "sender_", ")_", ")_", ":_", "\\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 ", " _", "response_", "=_", "receiver_", "(_", "signal_", "=_", "self_", ",_", "sender_", "=_", "sender_", ",_", "**_", "named_", ")_", "\\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 ", " _", "responses_", "._", "append_", "(_", "(_", "receiver_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "responses_", "._", "append_", "(_", "(_", "receiver_", ",_", "response_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "responses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Signal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "live", "\\u", "receivers_", "(_", "self_", ",_", "sender", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Filter", " ", "sequence", " ", "of", " ", "receive", "rs", " ", "to", " ", "get", " ", "resolve", "d", ",", " ", "live", " ", "receive", "rs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "checks", " ", "for", " ", "weak", " ", "reference", "s", " ", "and", " ", "resolve", "s", " ", "them", ",", " ", "then", " ", "return", "ing", " ", "only", "\\", "10", ";", " ", " ", " ", " ", "live", " ", "receive", "rs", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "none", "\\u", "sender", "key_", "=_", "\\u", "make", "\\u", "id_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receivers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "receive", "rke", "y_", ",_", "r", "\\u", "sender", "key_", ")_", ",_", "receiver_", "in_", "self_", "._", "receivers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "r", "\\u", "sender", "key_", "==_", "none", "\\u", "sender", "key_", "or_", "r", "\\u", "sender", "key_", "==_", "sender", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "receiver_", ",_", "WEA", "KR", "EF", "\\u", "TYPES_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Der", "efer", "ence", " ", "the", " ", "weak", " ", "reference", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "receiver_", "=_", "receiver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "receiver_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "receivers_", "._", "append_", "(_", "receiver_", ")_", "\\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 ", " ", "_", "receivers_", "._", "append_", "(_", "receiver_", ")_", "\\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_", "receivers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Signal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "remove", "\\u", "receiver_", "(_", "self_", ",_", "receiver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "dead", " ", "receive", "rs", " ", "from", " ", "connections", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "remove_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "connect", "ed", "\\u", "receiver_", "in_", "self_", "._", "receivers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "connect", "ed", "\\u", "receiver_", "==_", "receiver_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "remove_", "._", "append_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "to", "\\u", "remove_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "idx_", ",_", "(_", "r", "\\u", "key_", ",_", "\\u_", ")_", "in_", "enumerate_", "(_", "self_", "._", "receivers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "r", "\\u", "key_", "==_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "self_", "._", "receivers_", "[_", "idx_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/functional/api_sample_tests/test_floating_ip_dns.py
[ { "content": " def test_floating_ip_dns_entry_delete(self):\n self._create_or_update_entry()\n response = self._do_delete('os-floating-ip-dns/%s/entries/%s'\n % (self.domain, self.name))\n self.assertEqual(202, response.status_code)", "metadata": "root.FloatingIpDNSTest.test_floating_ip_dns_entry_delete", "header": "['class', 'FloatingIpDNSTest', '(', 'api_sample_base', '.', 'ApiSampleTestBaseV21', ')', ':', '___EOS___']", "index": 90 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Float", "ing", "Ip", "DNS", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "float", "ing", "\\u", "ip", "\\u", "dns", "\\u", "entry", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "create", "\\u", "or", "\\u", "update", "\\u", "entry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "do", "\\u", "delete_", "(_", "'", "os", "-", "float", "ing", "-", "ip", "-", "dns", "/", "%", "s", "/", "entri", "es", "/", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "self_", "._", "domain_", ",_", "self_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "202_", ",_", "response_", "._", "status", "\\u", "code_", ")_", "\\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 ]
First parameter of a method is not named 'self'
sakura-internet/saklient.python/saklient/cloud/resources/router.py
[ { "content": " def set_name(self, v):\n Util.validate_type(v, \"str\")\n self.m_name = v\n self.n_name = True\n return self.m_name", "metadata": "root.Router.set_name", "header": "['class', 'Router', '(', 'Resource', ')', ':', '___NEWLINE___', '## ルータの実体1つに対応し、属性の取得や操作を行うためのクラス。', '___NL___', '___NL___', '# (instance field) m_id', '___NL___', '___NL___', '# (instance field) m_name', '___NL___', '___NL___', '# (instance field) m_description', '___NL___', '___NL___', '# (instance field) m_network_mask_len', '___NL___', '___NL___', '# (instance field) m_band_width_mbps', '___NL___', '___NL___', '# (instance field) m_swytch_id', '___NL___', '___NL___', '## @private', '___NL___', '# @return {str}', '___NL___', '___EOS___']", "index": 222 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Router_", "(_", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "3", ";", "\\", "125", "40", ";", "\\", "124", "7", "9", ";", "\\", "123", "98", ";", "\\", "2345", "5", ";", "\\", "2030", "7", ";", "1", "\\", "123", "88", ";", "\\", "123", "9", "5", ";", "\\", "235", "50", ";", "\\", "245", "40", ";", "\\", "123", "7", "5", ";", "\\", "122", "89", ";", "\\", "236", "4", "6", ";", "\\", "246", "15", ";", "\\", "123", "98", ";", "\\", "214", "6", "2", ";", "\\", "244", "7", "1", ";", "\\", "124", "20", ";", "\\", "258", "05", ";", "\\", "203", "16", ";", "\\", "124", "3", "4", ";", "\\", "348", "9", "2", ";", "\\", "123", "5", "8", ";", "\\", "123", "8", "3", ";", "\\", "124", "1", "7", ";", "\\", "123", "98", ";", "\\", "124", "6", "3", ";", "\\", "1252", "1", ";", "\\", "124", "7", "3", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "m", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "m", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "m", "\\u", "description_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "m", "\\u", "network", "\\u", "mask", "\\u", "len_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "m", "\\u", "band", "\\u", "widt", "h", "\\u", "mb", "ps_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "m", "\\u", "sw", "yt", "ch", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "private_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "{", "str", "}_", "\\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_", "set\\u", "name_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Util_", "._", "validat", "e\\u", "type_", "(_", "v_", ",_", "\"", "str", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "m", "\\u", "name_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "n", "\\u", "name_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "m", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Wrong number of arguments in a call
Axelrod-Python/Axelrod/axelrod/tests/unit/test_mock_player.py
[ { "content": " def test_various2(self):\n p1 = axelrod.Cooperator()\n p2 = axelrod.Defector()\n self.assertEqual(simulate_play(p1, p2), (C, D))\n self.assertEqual(p1.cooperations, 1)\n self.assertEqual(p2.cooperations, 0)\n self.assertEqual(p1.defections, 0)\n self.assertEqual(p2.defections, 1)\n\n self.assertEqual(simulate_play(p1, p2), (C, D))\n self.assertEqual(p1.cooperations, 2)\n self.assertEqual(p2.cooperations, 0)\n self.assertEqual(p1.defections, 0)\n self.assertEqual(p2.defections, 2)\n\n self.assertEqual(p1.history, [C] * 2)\n self.assertEqual(p2.history, [D] * 2)", "metadata": "root.TestSimulatePlay.test_various2", "header": "['class', 'TestSimulatePlay', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 78 } ]
[]
[]
0
false
[ "[CLS]_", "Wro", "ng_", "number_", "of_", "arguments_", "in_", "a_", "call_", "[SEP]_", "class_", "Test", "Simulate", "Play_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "vari", "ous", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p1_", "=_", "axe", "lro", "d_", "._", "Coo", "perat", "or_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "axe", "lro", "d_", "._", "Defe", "ctor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "simulat", "e\\u", "play_", "(_", "p1_", ",_", "p2_", ")_", ",_", "(_", "C_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p1_", "._", "coop", "eratio", "ns_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p2_", "._", "coop", "eratio", "ns_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p1_", "._", "defect", "ions_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p2_", "._", "defect", "ions_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "simulat", "e\\u", "play_", "(_", "p1_", ",_", "p2_", ")_", ",_", "(_", "C_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p1_", "._", "coop", "eratio", "ns_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p2_", "._", "coop", "eratio", "ns_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p1_", "._", "defect", "ions_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p2_", "._", "defect", "ions_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p1_", "._", "history_", ",_", "[_", "C_", "]_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "p2_", "._", "history_", ",_", "[_", "D_", "]_", "*_", "2_", ")_" ]
[ 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 ]
Unused import
enthought/pikos/pikos/monitors/line_memory_monitor.py
[ { "content": "# -*- coding: utf-8 -*-\n#------------------------------------------------------------------------------\n# Package: Pikos toolkit\n# File: monitors/line_memory_monitor.py\n# License: LICENSE.TXT\n#\n# Copyright (c) 2012, Enthought, Inc.\n# All rights reserved.\n#------------------------------------------------------------------------------\nfrom __future__ import absolute_import\nimport inspect\nimport os\n\nimport psutil\n\nfrom pikos.monitors.line_monitor import LineMonitor\nfrom pikos.monitors.records import LineMemoryRecord\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LineMemoryMonitor(LineMonitor):\n \"\"\" Record process memory on python line events.\n\n The class hooks on the settrace function to receive trace events and\n record the current process memory when a line of code is about to be\n executed.\n\n \"\"\"\n\n\n\n", "metadata": "root.LineMemoryMonitor", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def __init__(self, recorder, record_type=None):\n \"\"\" Initialize the monitoring class.\n\n Parameters\n ----------\n recorder : object\n A subclass of :class:`~pikos.recorders.AbstractRecorder` or a\n class that implements the same interface to handle the values\n to be recorded.\n\n record_type: class object\n A class object to be used for records. Default is\n :class:`~pikos.monitors.records.LineMemoryMonitor`\n\n \"\"\"\n if record_type is None:\n record_type = LineMemoryRecord\n super(LineMemoryMonitor, self).__init__(recorder, record_type)\n self._process = None", "metadata": "root.LineMemoryMonitor.__init__", "header": "['class', 'LineMemoryMonitor', '(', 'LineMonitor', ')', ':', '___EOS___']", "index": 28 }, { "content": " def enable(self):\n \"\"\" Enable the monitor.\n\n The first time the method is called (the context is entered) it will\n initialize the Process class, set the settrace hooks and initialize\n the recorder.\n\n \"\"\"\n if self._call_tracker('ping'):\n self._process = psutil.Process(os.getpid())\n self._recorder.prepare(self._record_type)\n self._tracer.replace(self.on_line_event)", "metadata": "root.LineMemoryMonitor.enable", "header": "['class', 'LineMemoryMonitor', '(', 'LineMonitor', ')', ':', '___EOS___']", "index": 48 }, { "content": " def disable(self):\n \"\"\" Disable the monitor.\n\n The last time the method is called (the context is exited) it will\n unset the settrace hooks and finalize the recorder and set\n :attr:`_process` to None.\n\n \"\"\"\n if self._call_tracker('pong'):\n self._tracer.recover()\n self._recorder.finalize()\n self._process = None", "metadata": "root.LineMemoryMonitor.disable", "header": "['class', 'LineMemoryMonitor', '(', 'LineMonitor', ')', ':', '___EOS___']", "index": 61 }, { "content": " def gather_info(self, frame):\n \"\"\" Gather memory information for the line.\n \"\"\"\n rss, vms = self._process.memory_info()\n filename, lineno, function, line, _ = \\\n inspect.getframeinfo(frame, context=1)\n if line is None:\n line = ['<compiled string>']\n return (\n self._index, function, lineno, rss, vms, line[0].rstrip(),\n filename)", "metadata": "root.LineMemoryMonitor.gather_info", "header": "['class', 'LineMemoryMonitor', '(', 'LineMonitor', ')', ':', '___EOS___']", "index": 74 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Packa", "ge", ":", " ", "Pi", "ko", "s", " ", "toolkit_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "File", ":", " ", "monit", "ors", "/", "line", "\\u", "memory", "\\u", "monit", "or", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "License", ":", " ", "LICENSE", ".", "TXT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", ",", " ", "Ent", "hou", "ght", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "psutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pi", "ko", "s_", "._", "monitors_", "._", "line", "\\u", "monitor_", "import_", "Line", "Monitor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pi", "ko", "s_", "._", "monitors_", "._", "records_", "import_", "Line", "Memo", "ry", "Record_", "\\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_", "Line", "Memo", "ry", "Monitor_", "(_", "Line", "Monitor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Record", " ", "process", " ", "memory", " ", "on", " ", "python", " ", "line", " ", "events", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "class", " ", "hook", "s", " ", "on", " ", "the", " ", "sett", "race", " ", "function", " ", "to", " ", "receive", " ", "trace", " ", "events", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "record", " ", "the", " ", "current", " ", "process", " ", "memory", " ", "whe", "n", " ", "a", " ", "line", " ", "of", " ", "code", " ", "is", " ", "abo", "ut", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "executed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Line", "Memo", "ry", "Monitor_", "(_", "Line", "Monitor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "recorder_", ",_", "record", "\\u", "type_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Initializ", "e", " ", "the", " ", "monitorin", "g", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "recorde", "r", " ", ":", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "subclass", " ", "of", " ", ":", "class", ":`", "~", "pi", "ko", "s", ".", "recorde", "rs", ".", "Abstract", "Recorder", "`", " ", "or", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "tha", "t", " ", "implement", "s", " ", "the", " ", "same", " ", "interface", " ", "to", " ", "handle", " ", "the", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "be", " ", "recorde", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "record", "\\u", "type", ":", " ", "class", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "class", " ", "object", " ", "to", " ", "be", " ", "used", " ", "for", " ", "record", "s", ".", " ", "Default", " ", "is", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", "~", "pi", "ko", "s", ".", "monit", "ors", ".", "record", "s", ".", "Line", "Memo", "ry", "Monitor", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "record", "\\u", "type_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "type_", "=_", "Line", "Memo", "ry", "Record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Line", "Memo", "ry", "Monitor_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "recorder_", ",_", "record", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "process_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Memo", "ry", "Monitor_", "(_", "Line", "Monitor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "enable_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Enable", " ", "the", " ", "monit", "or", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "first", " ", "time", " ", "the", " ", "method", " ", "is", " ", "call", "ed", " ", "(", "the", " ", "context", " ", "is", " ", "enter", "ed", ")", " ", "it", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "initialize", " ", "the", " ", "Process", " ", "class", ",", " ", "set", " ", "the", " ", "sett", "race", " ", "hook", "s", " ", "and", " ", "initialize", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "recorde", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "call", "\\u", "tracker_", "(_", "'", "ping", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "process_", "=_", "psutil_", "._", "Process_", "(_", "os_", "._", "getpid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recorder_", "._", "prepare_", "(_", "self_", "._", "\\u", "record", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "tracer_", "._", "replace_", "(_", "self_", "._", "on", "\\u", "line", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Memo", "ry", "Monitor_", "(_", "Line", "Monitor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "disable_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Disa", "ble", " ", "the", " ", "monit", "or", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "last", " ", "time", " ", "the", " ", "method", " ", "is", " ", "call", "ed", " ", "(", "the", " ", "context", " ", "is", " ", "exit", "ed", ")", " ", "it", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "unse", "t", " ", "the", " ", "sett", "race", " ", "hook", "s", " ", "and", " ", "finalize", " ", "the", " ", "recorde", "r", " ", "and", " ", "set", "\\", "10", ";", " ", " ", " ", " ", ":", "attr", ":`", "\\u", "process", "`", " ", "to", " ", "Non", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "call", "\\u", "tracker_", "(_", "'", "pong", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "tracer_", "._", "recover_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recorder_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "process_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Memo", "ry", "Monitor_", "(_", "Line", "Monitor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gather", "\\u", "info_", "(_", "self_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Gather", " ", "memory", " ", "informati", "on", " ", "for", " ", "the", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rss_", ",_", "vms_", "=_", "self_", "._", "\\u", "process_", "._", "memory", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", ",_", "lineno_", ",_", "function_", ",_", "line_", ",_", "\\u_", "=_", "inspect_", "._", "getf", "rame", "info_", "(_", "frame_", ",_", "context_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "[_", "'<", "compile", "d", " ", "string", ">'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "index_", ",_", "function_", ",_", "lineno_", ",_", "rss_", ",_", "vms_", ",_", "line_", "[_", "0_", "]_", "._", "rstrip_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
yourlabs/django-autocomplete-light/test_project/select2_tagging/test_functional.py
[ { "content": "class TaggitSelect2AdminTest(TagSelect2AdminTestMixin,\n case.AutocompleteTestCase):\n\n field_name = 'test'\n inline_related_name = 'inline_test_models'\n model = TestModel\n tag_model = Tag", "metadata": "root.TaggitSelect2AdminTest", "header": "['module', '___EOS___']", "index": 33 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Tagg", "it", "Select", "2", "Admi", "n", "Test_", "(_", "Ta", "g", "Select", "2", "Admi", "n", "Test", "Mixin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case_", "._", "Autoco", "mplet", "e", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "name_", "=_", "'", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inline", "\\u", "relate", "d\\u", "name_", "=_", "'", "inline", "\\u", "test\\u", "model", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Test", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "model_", "=_", "Tag_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
spinnaker/spinnaker/dev/create_google_dev_vm.py
[ { "content": "#!/usr/bin/python\n#\n# Copyright 2015 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport os\nimport re\nimport sys\nimport tempfile\nimport time\n\nfrom spinnaker.fetch import fetch\nfrom spinnaker.fetch import GOOGLE_INSTANCE_METADATA_URL\nfrom spinnaker.run import run_quick\nfrom spinnaker.run import check_run_quick\nfrom spinnaker.yaml_util import YamlBindings\n\n\n__NEXT_STEP_INSTRUCTIONS = \"\"\"\nTo finish the installation, follow these steps:\n\n(1) Log into your new instance (with or without tunneling ssh-flags):\n\n gcloud compute ssh --project {project} --zone {zone} {instance}\\\n --ssh-flag=\"-L 9000:localhost:9000\"\\\n --ssh-flag=\"-L 8084:localhost:8084\"\\\n --ssh-flag=\"-L 8087:localhost:8087\"\n\n\n(2) Wait for the installation to complete:\n\n tail -f /var/log/startupscript.log\n\n When the instance startup script finishes installing the developer tools\n you will be ready to continue. ^C to terminate the tail process.\n\n\n(3) Set up the build environment:\n\n source /opt/spinnaker/install/bootstrap_dev.sh\n\n\nFor more information about Spinnaker, see http://spinnaker.io\n\n\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n check_gcloud()\n\n parser = argparse.ArgumentParser()\n init_argument_parser(parser)\n options = parser.parse_args()\n\n if options.copy_private_files:\n sys.stderr.write('--copy_private_files is deprecated.\\n'\n 'Use --copy_git_credentials --copy_ssh_credentials.')\n sys.exit(-1)\n\n check_args(options)\n create_instance(options)\n\n \n make_remote_directories(options)\n if options.copy_personal_files:\n copy_personal_files(options)\n\n maybe_copy_ssh_credentials(options)\n maybe_copy_git_credentials(options)\n maybe_copy_aws_credentials(options)\n maybe_copy_gcloud_config(options)\n maybe_copy_master_yml(options)\n\n print __NEXT_STEP_INSTRUCTIONS.format(\n project=get_project(options),\n zone=get_zone(options),\n instance=options.instance)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_project(options):\n \"\"\"Determine the default project name.\n\n The default project name is the gcloud configured default project.\n \"\"\"\n if not options.project:\n result = check_run_quick('gcloud config list', echo=False)\n options.project = re.search('project = (.*)\\n', result.stdout).group(1)\n return options.project", "metadata": "root.get_project", "header": "['module', '___EOS___']", "index": 59 }, { "content": "def get_zone(options):\n \"\"\"Determine the default availability zone.\n\n The default zone is the current zone if on GCE or an arbitrary zone.\n \"\"\"\n if not options.zone:\n result = fetch(os.path.join(GOOGLE_INSTANCE_METADATA_URL, 'zone'),\n google=True)\n if result.ok():\n options.zone = os.path.basename(result.content)\n else:\n options.zone = 'us-central1-f'\n\n return options.zone", "metadata": "root.get_zone", "header": "['module', '___EOS___']", "index": 70 }, { "content": "def init_argument_parser(parser):\n parser.add_argument(\n '--instance',\n default='{user}-spinnaker-dev'.format(user=os.environ['USER']),\n help='The name of the GCE instance to create.')\n parser.add_argument(\n '--project', default=None,\n help='The Google Project ID to create the new instance in.'\n ' If left empty, use the default project gcloud was configured with.')\n\n parser.add_argument(\n '--zone', default=None,\n help='The Google Cloud Platform zone to create the new instance in.')\n\n parser.add_argument(\n '--disk_type', default='pd-standard',\n help='The Google Cloud Platform disk type to use for the new instance.'\n ' The default is pd-standard. For a list of other available options,'\n ' see \"gcloud compute disk-types list\".')\n parser.add_argument('--disk_size', default='200GB',\n help='Warnings appear if disk size < 200GB')\n parser.add_argument('--machine_type', default='n1-highmem-8')\n\n parser.add_argument(\n '--copy_personal_files', default=True, action='store_true',\n help='Copy personal configuration files (.gitconfig, etc.)')\n parser.add_argument(\n '--no_personal_files', dest='copy_personal_files',\n action='store_false', help='Do not copy personal files.')\n parser.add_argument(\n '--nopersonal', dest='copy_personal_files', action='store_false',\n help='DEPRECATED')\n\n parser.add_argument(\n '--copy_private_files', default=False, action='store_true',\n help='DEPRECATED')\n\n parser.add_argument(\n '--copy_git_credentials', default=False, action='store_true',\n help='Copy git credentials (.git-credentials)')\n parser.add_argument(\n '--no_git_credentials', dest='copy_git_credentials',\n action='store_false', help='Do not copy git credentials')\n parser.add_argument(\n '--copy_ssh_credentials', default=False, action='store_true',\n help='Copy ssh credentials (.ssh/id_rsa, .ssh/google_compute_engine)')\n parser.add_argument(\n '--no_ssh_credentials', dest='copy_ssh_credentials',\n action='store_false', help='Do not copy ssh credentials')\n\n parser.add_argument(\n '--copy_gcloud_config', default=False, action='store_true',\n help='Copy private gcloud configuration files.')\n parser.add_argument(\n '--no_gcloud_config', dest='copy_gcloud_config',\n action='store_false',\n help='Do not copy private gcloud configuration files.')\n\n parser.add_argument(\n '--aws_credentials', default=None,\n help='If specified, the path to the aws credentials file.')\n parser.add_argument(\n '--master_yml', default=None,\n help='If specified, the path to the master spinnaker-local.yml file.')\n\n parser.add_argument(\n '--address', default=None,\n help='The IP address to assign to the new instance. The address may'\n ' be an IP address or the name or URI of an address resource.')\n parser.add_argument(\n '--scopes', default='compute-rw,storage-rw,monitoring-write,logging-write',\n help='Create the instance with these scopes.'\n 'The default are the minimal scopes needed to run the development'\n ' scripts. This is currently \"compute-rw,storage-rw,monitoring-write,logging-write\".')", "metadata": "root.init_argument_parser", "header": "['module', '___EOS___']", "index": 86 }, { "content": "def try_until_ready(command):\n while True:\n result = run_quick(command, echo=False)\n if not result.returncode:\n break\n msg = result.stderr or result.stdout\n if msg.find('refused') > 0:\n print 'New instance does not seem ready yet...retry in 5s.'\n else:\n print msg.strip()\n print 'Retrying in 5s.'\n time.sleep(5)", "metadata": "root.try_until_ready", "header": "['module', '___EOS___']", "index": 162 }, { "content": "def make_remote_directories(options):\n all = []\n if options.copy_personal_files:\n all.append('.gradle')\n if options.aws_credentials:\n all.append('.aws')\n if options.master_yml:\n all.append('.spinnaker')\n if options.copy_gcloud_config:\n all.append('.config/gcloud')\n\n if all:\n command = ' '.join([\n 'gcloud compute ssh',\n options.instance,\n '--project', get_project(options),\n '--zone', get_zone(options),\n '--command=\\'bash -c \"for i in {0}; do mkdir -p \\\\$i; done\"\\''.format(' '.join(all))])\n\n try_until_ready(command)", "metadata": "root.make_remote_directories", "header": "['module', '___EOS___']", "index": 176 }, { "content": "def copy_custom_file(options, source, target):\n command = ' '.join([\n 'gcloud compute copy-files',\n '--project', get_project(options),\n '--zone', get_zone(options),\n source,\n '{instance}:{target}'.format(instance=options.instance,\n target=target)])\n try_until_ready(command)", "metadata": "root.copy_custom_file", "header": "['module', '___EOS___']", "index": 199 }, { "content": "def copy_home_file_list(options, type, base_dir, sources):\n have = []\n for file in sources:\n full_path = os.path.abspath(\n os.path.join(os.environ['HOME'], base_dir, file))\n if os.path.exists(full_path):\n have.append('\"{0}\"'.format(full_path))\n\n if have:\n print 'Copying {type}...'.format(type=type)\n source_list = ' '.join(have)\n # gcloud will copy permissions as well, however it won't create\n # directories. Assume make_remote_directories was called already.\n copy_custom_file(options, source_list, base_dir)\n else:\n print 'Skipping {type} because there are no files.'.format(type=type)", "metadata": "root.copy_home_file_list", "header": "['module', '___EOS___']", "index": 210 }, { "content": "def maybe_inform(type, test_path, option_to_enable):\n if os.path.exists(os.path.join(os.environ['HOME'], test_path)):\n print 'Skipping {type} because missing {option}.'.format(\n type=type, option=option_to_enable)", "metadata": "root.maybe_inform", "header": "['module', '___EOS___']", "index": 228 }, { "content": "def maybe_copy_aws_credentials(options):\n if options.aws_credentials:\n print 'Copying aws credentials...'\n copy_custom_file(options, options.aws_credentials, '.aws/credentials')\n else:\n maybe_inform('aws credentials', '.aws/credentials', '--aws_credentials')", "metadata": "root.maybe_copy_aws_credentials", "header": "['module', '___EOS___']", "index": 234 }, { "content": "def maybe_copy_gcloud_config(options):\n if options.copy_gcloud_config:\n copy_home_file_list(options,\n 'gcloud credentials',\n '.config/gcloud',\n ['application_default_credentials.json',\n 'credentials',\n 'properties'])\n else:\n maybe_inform('gcloud credentials',\n '.config/gcloud/credentials', '--copy_gcloud_config')", "metadata": "root.maybe_copy_gcloud_config", "header": "['module', '___EOS___']", "index": 242 }, { "content": "def maybe_copy_git_credentials(options):\n if options.copy_git_credentials:\n copy_home_file_list(options, 'git credentials',\n '.', ['.git-credentials'])\n else:\n maybe_inform('git credentials',\n '.git-credentials', '--copy_git_credentials')", "metadata": "root.maybe_copy_git_credentials", "header": "['module', '___EOS___']", "index": 255 }, { "content": "def maybe_copy_ssh_credentials(options):\n if options.copy_ssh_credentials:\n copy_home_file_list(options, 'ssh credentials',\n '.ssh', ['id_rsa', 'google_compute_engine'])\n else:\n maybe_inform('ssh credentials',\n '.ssh/.id_rsa', '--copy_ssh_credentials')", "metadata": "root.maybe_copy_ssh_credentials", "header": "['module', '___EOS___']", "index": 264 }, { "content": "def copy_personal_files(options):\n copy_home_file_list(options, 'personal configuration files',\n '.',\n ['.gitconfig', '.emacs', '.bashrc', '.screenrc'])\n # Ideally this is part of the above, but it goes into a different directory.\n copy_home_file_list(options, 'gradle configuration',\n '.gradle', ['gradle.properties'])", "metadata": "root.copy_personal_files", "header": "['module', '___EOS___']", "index": 273 }, { "content": "def create_instance(options):\n \"\"\"Creates new GCE VM instance for development.\"\"\"\n project = get_project(options)\n print 'Creating instance {project}/{zone}/{instance}'.format(\n project=project, zone=get_zone(options), instance=options.instance)\n print (' with --machine_type={type} and --disk_size={disk_size}...'\n .format(type=options.machine_type, disk_size=options.disk_size))\n\n google_dev_dir = os.path.join(os.path.dirname(__file__), '../google/dev')\n dev_dir = os.path.dirname(__file__)\n project_dir = os.path.join(dev_dir, '..')\n\n install_dir = '{dir}/../install'.format(dir=dev_dir)\n\n startup_command = ['/opt/spinnaker/install/install_spinnaker.sh'\n ' --dependencies_only',\n '/opt/spinnaker/install/install_development.sh']\n fd, temp_startup = tempfile.mkstemp()\n os.write(fd, ';'.join(startup_command))\n os.close(fd)\n\n metadata_files = [\n 'startup-script={google_dev_dir}/google_install_loader.py'\n ',sh_bootstrap_dev={dev_dir}/bootstrap_dev.sh'\n ',sh_install_spinnaker={project_dir}/InstallSpinnaker.sh'\n ',sh_install_development={dev_dir}/install_development.sh'\n ',startup_command={temp_startup}'\n .format(google_dev_dir=google_dev_dir,\n dev_dir=dev_dir,\n project_dir=project_dir,\n temp_startup=temp_startup)]\n\n metadata = ','.join([\n 'startup_loader_files='\n 'sh_install_spinnaker'\n '+sh_install_development'\n '+sh_bootstrap_dev'])\n\n command = ['gcloud', 'compute', 'instances', 'create',\n options.instance,\n '--project', get_project(options),\n '--zone', get_zone(options),\n '--machine-type', options.machine_type,\n '--image', 'ubuntu-14-04',\n '--scopes', 'compute-rw,storage-rw',\n '--boot-disk-size={size}'.format(size=options.disk_size),\n '--boot-disk-type={type}'.format(type=options.disk_type),\n '--metadata', metadata,\n '--metadata-from-file={files}'.format(\n files=','.join(metadata_files))]\n if options.address:\n command.extend(['--address', options.address])\n\n check_run_quick(' '.join(command), echo=False)", "metadata": "root.create_instance", "header": "['module', '___EOS___']", "index": 282 }, { "content": "def maybe_copy_master_yml(options):\n \"\"\"Copy the specified master spinnaker-local.yml, and credentials.\n\n This will look for paths to credentials within the spinnaker-local.yml, and\n copy those as well. The paths to the credentials (and the reference\n in the config file) will be changed to reflect the filesystem on the\n new instance, which may be different than on this instance.\n\n Args:\n options [Namespace]: The parser namespace options contain information\n about the instance we're going to copy to, as well as the source\n of the master spinnaker-local.yml file.\n \"\"\"\n if not options.master_yml:\n maybe_inform('custom spinnaker-local.yml',\n '.spinnaker/spinnaker-local.yml', '--copy_master_yml')\n return\n\n bindings = YamlBindings()\n bindings.import_path(options.master_yml)\n\n try:\n json_credential_path = bindings.get(\n 'providers.google.primaryCredentials.jsonPath')\n except KeyError:\n json_credential_path = None\n\n gcp_home = os.path.join('/home', os.environ['LOGNAME'], '.spinnaker')\n\n # If there are credentials, write them to this path\n gcp_credential_path = os.path.join(gcp_home, 'google-credentials.json')\n\n with open(options.master_yml, 'r') as f:\n content = f.read()\n\n # Replace all the occurrences of the original credentials path with the\n # path that we are going to place the file in on the new instance.\n if json_credential_path:\n if not os.path.exists(json_credential_path):\n raise ValueError('{0} specifies google credentials in {1},'\n ' which does not exist.'\n .format(options.master_yml,\n json_credential_path))\n\n content = content.replace(json_credential_path, gcp_credential_path)\n\n fd, temp_path = tempfile.mkstemp()\n os.fchmod(fd, os.stat(options.master_yml).st_mode) # Copy original mode\n os.write(fd, content)\n os.close(fd)\n actual_path = temp_path\n\n # Copy the credentials here. The cfg file will be copied after.\n copy_custom_file(options, actual_path, '.spinnaker/spinnaker-local.yml')\n\n if json_credential_path:\n copy_custom_file(options, json_credential_path,\n '.spinnaker/google-credentials.json')\n\n if temp_path:\n os.remove(temp_path)", "metadata": "root.maybe_copy_master_yml", "header": "['module', '___EOS___']", "index": 338 }, { "content": "def check_gcloud():\n result = run_quick('gcloud --version', echo=False)\n if not result.returncode:\n return\n\n sys.stderr.write('ERROR: This program requires gcloud. To obtain gcloud:\\n'\n ' curl https://sdk.cloud.google.com | bash\\n')\n sys.exit(-1)", "metadata": "root.check_gcloud", "header": "['module', '___EOS___']", "index": 401 }, { "content": "def check_args(options):\n \"\"\"Fail fast if paths we explicitly want to copy do not exist.\"\"\"\n for path in [options.aws_credentials, options.master_yml]:\n if path and not os.path.exists(path):\n sys.stderr.write('ERROR: {path} not found.\\n'.format(path=path))\n sys.exit(-1)", "metadata": "root.check_args", "header": "['module', '___EOS___']", "index": 411 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "spinn", "ake", "r_", "._", "fetch_", "import_", "fetch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spinn", "ake", "r_", "._", "fetch_", "import_", "GO", "OG", "LE", "\\u", "INSTANCE", "\\u", "METAD", "ATA", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spinn", "ake", "r_", "._", "run_", "import_", "run", "\\u", "quick", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spinn", "ake", "r_", "._", "run_", "import_", "check", "\\u", "run", "\\u", "quick", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spinn", "ake", "r_", "._", "yaml", "\\u", "util_", "import_", "Ya", "ml", "Bindings", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "NEXT", "\\u", "STEP", "\\u", "INSTRU", "CTION", "S_", "=_", "\"\"\"", "\\", "10", ";", "To", " ", "finish", " ", "the", " ", "installation", ",", " ", "follow", " ", "these", " ", "step", "s", ":", "\\", "10", ";", "\\", "10", ";", "(", "1", ")", " ", "Log", " ", "int", "o", " ", "your", " ", "new", " ", "instance", " ", "(", "with", " ", "or", " ", "with", "out", " ", "tunnel", "ing", " ", "ssh", "-", "flags", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", "gcloud", " ", "compute", " ", "ssh", " ", "--", "project", " ", "{", "project", "}", " ", "--", "zone", " ", "{", "zone", "}", " ", "{", "instance", "}\\\\", "\\", "10", ";", " ", "--", "ssh", "-", "flag", "=\"", "-", "L", " ", "9000", ":", "local", "host", ":", "9000", "\"\\\\", "\\", "10", ";", " ", "--", "ssh", "-", "flag", "=\"", "-", "L", " ", "808", "4", ":", "local", "host", ":", "808", "4", "\"\\\\", "\\", "10", ";", " ", "--", "ssh", "-", "flag", "=\"", "-", "L", " ", "808", "7", ":", "local", "host", ":", "808", "7", "\"", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "(", "2", ")", " ", "Wait", " ", "for", " ", "the", " ", "installation", " ", "to", " ", "complete", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "tail", " ", "-", "f", " ", "/", "var", "/", "log", "/", "start", "ups", "cript", ".", "log", "\\", "10", ";", "\\", "10", ";", " ", " ", "Whe", "n", " ", "the", " ", "instance", " ", "start", "up", " ", "script", " ", "finish", "es", " ", "install", "ing", " ", "the", " ", "developer", " ", "tool", "s", "\\", "10", ";", " ", " ", "you", " ", "will", " ", "be", " ", "read", "y", " ", "to", " ", "continue", ".", " ", "^", "C", " ", "to", " ", "terminate", " ", "the", " ", "tail", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "(", "3", ")", " ", "Set", " ", "up", " ", "the", " ", "build", " ", "environ", "ment", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "source", " ", "/", "opt", "/", "spinn", "ake", "r", "/", "install", "/", "boots", "trap", "\\u", "dev", ".", "sh", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "For", " ", "more", " ", "informati", "on", " ", "abo", "ut", " ", "Spin", "nak", "er", ",", " ", "see", " ", "http", "://", "spinn", "ake", "r", ".", "io", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u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\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "gcloud", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "\\u", "argu", "ment", "\\u", "parser_", "(_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "copy", "\\u", "private", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "'--", "copy", "\\u", "private", "\\u", "files", " ", "is", " ", "depre", "cated", ".\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Us", "e", " ", "--", "copy", "\\u", "git", "\\u", "cred", "ential", "s", " ", "--", "copy", "\\u", "ssh", "\\u", "cred", "ential", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "\\u", "args_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "instance_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "remote", "\\u", "directories_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "copy", "\\u", "persona", "l\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "\\u", "persona", "l\\u", "files_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "may", "be", "\\u", "copy", "\\u", "ssh", "\\u", "credentials_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "may", "be", "\\u", "copy", "\\u", "git", "\\u", "credentials_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "may", "be", "\\u", "copy", "\\u", "aws", "\\u", "credentials_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "may", "be", "\\u", "copy", "\\u", "gcloud", "\\u", "config_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "may", "be", "\\u", "copy", "\\u", "master", "\\u", "yml", "_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\\u\\u", "NEXT", "\\u", "STEP", "\\u", "INSTRU", "CTION", "S_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "get", "\\u", "project_", "(_", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zone_", "=_", "get", "\\u", "zone_", "(_", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", "=_", "options_", "._", "instance_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "project_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Det", "erm", "ine", " ", "the", " ", "default", " ", "project", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "project", " ", "name", " ", "is", " ", "the", " ", "gcloud", " ", "configur", "ed", " ", "default", " ", "project", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "options_", "._", "project_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "check", "\\u", "run", "\\u", "quick", "_", "(_", "'", "gcloud", " ", "config", " ", "list", "'_", ",_", "echo_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "project_", "=_", "re_", "._", "search_", "(_", "'", "project", " ", "=", " ", "(.*)", "\\\\", "n", "'_", ",_", "result_", "._", "stdout_", ")_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "options_", "._", "project_", "\\u\\u\\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", "zone_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Det", "erm", "ine", " ", "the", " ", "default", " ", "avail", "abilit", "y", " ", "zone", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "zone", " ", "is", " ", "the", " ", "current", " ", "zone", " ", "if", " ", "on", " ", "GC", "E", " ", "or", " ", "an", " ", "arbitra", "ry", " ", "zone", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "options_", "._", "zone_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "fetch_", "(_", "os_", "._", "path_", "._", "join_", "(_", "GO", "OG", "LE", "\\u", "INSTANCE", "\\u", "METAD", "ATA", "\\u", "URL_", ",_", "'", "zone", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "google_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "._", "ok_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "zone_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "result_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "zone_", "=_", "'", "us", "-", "central", "1", "-", "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_", "options_", "._", "zone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "argu", "ment", "\\u", "parser_", "(_", "parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "instance", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'{", "user", "}-", "spinn", "ake", "r", "-", "dev", "'_", "._", "format_", "(_", "user_", "=_", "os_", "._", "environ_", "[_", "'", "USER", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "The", " ", "name", " ", "of", " ", "the", " ", "GC", "E", " ", "instance", " ", "to", " ", "create", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "project", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "The", " ", "Goo", "gle", " ", "Project", " ", "ID", " ", "to", " ", "create", " ", "the", " ", "new", " ", "instance", " ", "in", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "If", " ", "left", " ", "empty", ",", " ", "use", " ", "the", " ", "default", " ", "project", " ", "gcloud", " ", "was", " ", "configur", "ed", " ", "with", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "zone", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "The", " ", "Goo", "gle", " ", "Cloud", " ", "Plat", "form", " ", "zone", " ", "to", " ", "create", " ", "the", " ", "new", " ", "instance", " ", "in", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "disk", "\\u", "type", "'_", ",_", "default_", "=_", "'", "pd", "-", "standard", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "The", " ", "Goo", "gle", " ", "Cloud", " ", "Plat", "form", " ", "disk", " ", "type", " ", "to", " ", "use", " ", "for", " ", "the", " ", "new", " ", "instance", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "The", " ", "default", " ", "is", " ", "pd", "-", "standard", ".", " ", "For", " ", "a", " ", "list", " ", "of", " ", "other", " ", "avail", "able", " ", "options", ",'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "see", " ", "\"", "gcloud", " ", "compute", " ", "disk", "-", "types", " ", "list", "\".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "disk", "\\u", "size", "'_", ",_", "default_", "=_", "'", "200", "GB", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Warnings", " ", "appear", " ", "if", " ", "disk", " ", "size", " ", "<", " ", "200", "GB", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "machine", "\\u", "type", "'_", ",_", "default_", "=_", "'", "n1", "-", "high", "mem", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "copy", "\\u", "persona", "l\\u", "files", "'_", ",_", "default_", "=_", "True_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Copy", " ", "persona", "l", " ", "configura", "tion", " ", "files", " ", "(.", "git", "config", ",", " ", "etc", ".)", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "\\u", "persona", "l\\u", "files", "'_", ",_", "dest_", "=_", "'", "copy", "\\u", "persona", "l\\u", "files", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "fal", "se", "'_", ",_", "help_", "=_", "'", "Do", " ", "not", " ", "copy", " ", "persona", "l", " ", "files", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "nop", "ers", "onal", "'_", ",_", "dest_", "=_", "'", "copy", "\\u", "persona", "l\\u", "files", "'_", ",_", "action_", "=_", "'", "store", "\\u", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "DEP", "RECA", "TED", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "copy", "\\u", "private", "\\u", "files", "'_", ",_", "default_", "=_", "False_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "DEP", "RECA", "TED", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "copy", "\\u", "git", "\\u", "cred", "ential", "s", "'_", ",_", "default_", "=_", "False_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Copy", " ", "git", " ", "cred", "ential", "s", " ", "(.", "git", "-", "cred", "ential", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "\\u", "git", "\\u", "cred", "ential", "s", "'_", ",_", "dest_", "=_", "'", "copy", "\\u", "git", "\\u", "cred", "ential", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "fal", "se", "'_", ",_", "help_", "=_", "'", "Do", " ", "not", " ", "copy", " ", "git", " ", "cred", "ential", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "copy", "\\u", "ssh", "\\u", "cred", "ential", "s", "'_", ",_", "default_", "=_", "False_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Copy", " ", "ssh", " ", "cred", "ential", "s", " ", "(.", "ssh", "/", "id", "\\u", "rsa", ",", " ", ".", "ssh", "/", "google", "\\u", "compute", "\\u", "eng", "ine", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "\\u", "ssh", "\\u", "cred", "ential", "s", "'_", ",_", "dest_", "=_", "'", "copy", "\\u", "ssh", "\\u", "cred", "ential", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "fal", "se", "'_", ",_", "help_", "=_", "'", "Do", " ", "not", " ", "copy", " ", "ssh", " ", "cred", "ential", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "copy", "\\u", "gcloud", "\\u", "config", "'_", ",_", "default_", "=_", "False_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Copy", " ", "private", " ", "gcloud", " ", "configura", "tion", " ", "files", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "\\u", "gcloud", "\\u", "config", "'_", ",_", "dest_", "=_", "'", "copy", "\\u", "gcloud", "\\u", "config", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Do", " ", "not", " ", "copy", " ", "private", " ", "gcloud", " ", "configura", "tion", " ", "files", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "aws", "\\u", "cred", "ential", "s", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "If", " ", "specified", ",", " ", "the", " ", "path", " ", "to", " ", "the", " ", "aws", " ", "cred", "ential", "s", " ", "file", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "master", "\\u", "yml", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "If", " ", "specified", ",", " ", "the", " ", "path", " ", "to", " ", "the", " ", "master", " ", "spinn", "ake", "r", "-", "local", ".", "yml", " ", "file", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "address", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "The", " ", "IP", " ", "address", " ", "to", " ", "assign", " ", "to", " ", "the", " ", "new", " ", "instance", ".", " ", "The", " ", "address", " ", "may", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "be", " ", "an", " ", "IP", " ", "address", " ", "or", " ", "the", " ", "name", " ", "or", " ", "URI", " ", "of", " ", "an", " ", "address", " ", "resource", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "scope", "s", "'_", ",_", "default_", "=_", "'", "compute", "-", "rw", ",", "storage", "-", "rw", ",", "monitorin", "g", "-", "write", ",", "logg", "ing", "-", "write", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Creat", "e", " ", "the", " ", "instance", " ", "with", " ", "these", " ", "scope", "s", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "default", " ", "are", " ", "the", " ", "minima", "l", " ", "scope", "s", " ", "need", "ed", " ", "to", " ", "run", " ", "the", " ", "develop", "ment", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "scripts", ".", " ", "Thi", "s", " ", "is", " ", "currentl", "y", " ", "\"", "compute", "-", "rw", ",", "storage", "-", "rw", ",", "monitorin", "g", "-", "write", ",", "logg", "ing", "-", "write", "\".'_", ")_", "\\u\\u\\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_", "try", "\\u", "unti", "l\\u", "ready_", "(_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "run", "\\u", "quick", "_", "(_", "command_", ",_", "echo_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "result_", "._", "returncode_", ":_", "\\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_", "msg_", "=_", "result_", "._", "stderr_", "or_", "result_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", "._", "find_", "(_", "'", "refuse", "d", "'_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "New", " ", "instance", " ", "doe", "s", " ", "not", " ", "see", "m", " ", "read", "y", " ", "ye", "t", "...", "retr", "y", " ", "in", " ", "5", "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_", "msg_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Retr", "ying", " ", "in", " ", "5", "s", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "remote", "\\u", "directories_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "copy", "\\u", "persona", "l\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all_", "._", "append_", "(_", "'.", "grad", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "aws", "\\u", "credentials_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all_", "._", "append_", "(_", "'.", "aws", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "master", "\\u", "yml", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all_", "._", "append_", "(_", "'.", "spinn", "ake", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "copy", "\\u", "gcloud", "\\u", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all_", "._", "append_", "(_", "'.", "config", "/", "gcloud", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gcloud", " ", "compute", " ", "ssh", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "project", "'_", ",_", "get", "\\u", "project_", "(_", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "zone", "'_", ",_", "get", "\\u", "zone_", "(_", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "command", "=\\\\", "'", "bash", " ", "-", "c", " ", "\"", "for", " ", "i", " ", "in", " ", "{", "0", "};", " ", "do", " ", "mkd", "ir", " ", "-", "p", " ", "\\\\\\\\", "$", "i", ";", " ", "don", "e", "\"\\\\'", "'_", "._", "format_", "(_", "'", " ", "'_", "._", "join_", "(_", "all_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try", "\\u", "unti", "l\\u", "ready_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "\\u", "custom", "\\u", "file_", "(_", "options_", ",_", "source_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gcloud", " ", "compute", " ", "copy", "-", "files", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "project", "'_", ",_", "get", "\\u", "project_", "(_", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "zone", "'_", ",_", "get", "\\u", "zone_", "(_", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "instance", "}:", "{", "target", "}'_", "._", "format_", "(_", "instance_", "=_", "options_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "target_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try", "\\u", "unti", "l\\u", "ready_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "\\u", "home", "\\u", "file", "\\u", "list_", "(_", "options_", ",_", "type_", ",_", "base", "\\u", "dir_", ",_", "sources_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "have_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file_", "in_", "sources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", ",_", "base", "\\u", "dir_", ",_", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "full", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "have_", "._", "append_", "(_", "'\"{", "0", "}\"'_", "._", "format_", "(_", "full", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "have_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Copy", "ing", " ", "{", "type", "}.", "..'_", "._", "format_", "(_", "type_", "=_", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "list_", "=_", "'", " ", "'_", "._", "join_", "(_", "have_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gcloud", " ", "will", " ", "copy", " ", "permissi", "ons", " ", "as", " ", "well", ",", " ", "how", "ever", " ", "it", " ", "won", "'", "t", " ", "create_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", ".", " ", "Assume", " ", "make", "\\u", "remote", "\\u", "director", "ies", " ", "was", " ", "call", "ed", " ", "alr", "ead", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "copy", "\\u", "custom", "\\u", "file_", "(_", "options_", ",_", "source", "\\u", "list_", ",_", "base", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Ski", "ppi", "ng", " ", "{", "type", "}", " ", "bec", "aus", "e", " ", "there", " ", "are", " ", "no", " ", "files", ".'_", "._", "format_", "(_", "type_", "=_", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "may", "be", "\\u", "inform", "_", "(_", "type_", ",_", "test\\u", "path_", ",_", "option", "\\u", "to", "\\u", "enable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", ",_", "test\\u", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Ski", "ppi", "ng", " ", "{", "type", "}", " ", "bec", "aus", "e", " ", "missi", "ng", " ", "{", "option", "}.'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "type_", ",_", "option_", "=_", "option", "\\u", "to", "\\u", "enable_", ")_", "\\u\\u\\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_", "may", "be", "\\u", "copy", "\\u", "aws", "\\u", "credentials_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "aws", "\\u", "credentials_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Copy", "ing", " ", "aws", " ", "cred", "ential", "s", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "\\u", "custom", "\\u", "file_", "(_", "options_", ",_", "options_", "._", "aws", "\\u", "credentials_", ",_", "'.", "aws", "/", "cred", "ential", "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 ", " _", "may", "be", "\\u", "inform", "_", "(_", "'", "aws", " ", "cred", "ential", "s", "'_", ",_", "'.", "aws", "/", "cred", "ential", "s", "'_", ",_", "'--", "aws", "\\u", "cred", "ential", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "may", "be", "\\u", "copy", "\\u", "gcloud", "\\u", "config_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "copy", "\\u", "gcloud", "\\u", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "\\u", "home", "\\u", "file", "\\u", "list_", "(_", "options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gcloud", " ", "cred", "ential", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "config", "/", "gcloud", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "applica", "tion", "\\u", "default", "\\u", "cred", "ential", "s", ".", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cred", "ential", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proper", "ties", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "may", "be", "\\u", "inform", "_", "(_", "'", "gcloud", " ", "cred", "ential", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "config", "/", "gcloud", "/", "cred", "ential", "s", "'_", ",_", "'--", "copy", "\\u", "gcloud", "\\u", "config", "'_", ")_", "\\u\\u\\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_", "may", "be", "\\u", "copy", "\\u", "git", "\\u", "credentials_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "copy", "\\u", "git", "\\u", "credentials_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "\\u", "home", "\\u", "file", "\\u", "list_", "(_", "options_", ",_", "'", "git", " ", "cred", "ential", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.'_", ",_", "[_", "'.", "git", "-", "cred", "ential", "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 ", " _", "may", "be", "\\u", "inform", "_", "(_", "'", "git", " ", "cred", "ential", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "git", "-", "cred", "ential", "s", "'_", ",_", "'--", "copy", "\\u", "git", "\\u", "cred", "ential", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "may", "be", "\\u", "copy", "\\u", "ssh", "\\u", "credentials_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "copy", "\\u", "ssh", "\\u", "credentials_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "\\u", "home", "\\u", "file", "\\u", "list_", "(_", "options_", ",_", "'", "ssh", " ", "cred", "ential", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ssh", "'_", ",_", "[_", "'", "id", "\\u", "rsa", "'_", ",_", "'", "google", "\\u", "compute", "\\u", "eng", "ine", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "may", "be", "\\u", "inform", "_", "(_", "'", "ssh", " ", "cred", "ential", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "ssh", "/.", "id", "\\u", "rsa", "'_", ",_", "'--", "copy", "\\u", "ssh", "\\u", "cred", "ential", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "\\u", "persona", "l\\u", "files_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "\\u", "home", "\\u", "file", "\\u", "list_", "(_", "options_", ",_", "'", "persona", "l", " ", "configura", "tion", " ", "files", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'.", "git", "config", "'_", ",_", "'.", "ema", "cs", "'_", ",_", "'.", "bash", "rc", "'_", ",_", "'.", "screen", "rc", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ideal", "ly", " ", "this", " ", "is", " ", "part", " ", "of", " ", "the", " ", "above", ",", " ", "but", " ", "it", " ", "go", "es", " ", "int", "o", " ", "a", " ", "different", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "copy", "\\u", "home", "\\u", "file", "\\u", "list_", "(_", "options_", ",_", "'", "grad", "le", " ", "configura", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "grad", "le", "'_", ",_", "[_", "'", "grad", "le", ".", "proper", "ties", "'_", "]_", ")_", "\\u\\u\\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", "instance_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "new", " ", "GC", "E", " ", "VM", " ", "instance", " ", "for", " ", "develop", "ment", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "get", "\\u", "project_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Creat", "ing", " ", "instance", " ", "{", "project", "}/", "{", "zone", "}/", "{", "instance", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "project_", ",_", "zone_", "=_", "get", "\\u", "zone_", "(_", "options_", ")_", ",_", "instance_", "=_", "options_", "._", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "with", " ", "--", "machine", "\\u", "type", "={", "type", "}", " ", "and", " ", "--", "disk", "\\u", "size", "={", "disk", "\\u", "size", "}.", "..'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "type_", "=_", "options_", "._", "machine", "\\u", "type_", ",_", "disk", "\\u", "size_", "=_", "options_", "._", "disk", "\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "google", "\\u", "dev", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'../", "google", "/", "dev", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dev", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dev", "\\u", "dir_", ",_", "'..'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "dir_", "=_", "'{", "dir", "}/", "..", "/", "install", "'_", "._", "format_", "(_", "dir_", "=_", "dev", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "up", "\\u", "command_", "=_", "[_", "'/", "opt", "/", "spinn", "ake", "r", "/", "install", "/", "install", "\\u", "spinn", "ake", "r", ".", "sh", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "--", "dependen", "cies", "\\u", "only", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "opt", "/", "spinn", "ake", "r", "/", "install", "/", "install", "\\u", "develop", "ment", ".", "sh", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", ",_", "temp", "\\u", "startup_", "=_", "tempfile_", "._", "mkstemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "write_", "(_", "fd_", ",_", "';'_", "._", "join_", "(_", "start", "up", "\\u", "command_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "close_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata", "\\u", "files_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "up", "-", "script", "={", "google", "\\u", "dev", "\\u", "dir", "}/", "google", "\\u", "install", "\\u", "load", "er", ".", "py", "'_", "\\u\\u\\uNL\\u\\u\\u_", "',", "sh", "\\u", "boots", "trap", "\\u", "dev", "={", "dev", "\\u", "dir", "}/", "boots", "trap", "\\u", "dev", ".", "sh", "'_", "\\u\\u\\uNL\\u\\u\\u_", "',", "sh", "\\u", "install", "\\u", "spinn", "ake", "r", "={", "project", "\\u", "dir", "}/", "Install", "Spin", "nak", "er", ".", "sh", "'_", "\\u\\u\\uNL\\u\\u\\u_", "',", "sh", "\\u", "install", "\\u", "develop", "ment", "={", "dev", "\\u", "dir", "}/", "install", "\\u", "develop", "ment", ".", "sh", "'_", "\\u\\u\\uNL\\u\\u\\u_", "',", "start", "up", "\\u", "command", "={", "temp", "\\u", "start", "up", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "google", "\\u", "dev", "\\u", "dir_", "=_", "google", "\\u", "dev", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dev", "\\u", "dir_", "=_", "dev", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "dir_", "=_", "project", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "\\u", "startup_", "=_", "temp", "\\u", "startup_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "','_", "._", "join_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "up", "\\u", "load", "er", "\\u", "files", "='_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sh", "\\u", "install", "\\u", "spinn", "ake", "r", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'+", "sh", "\\u", "install", "\\u", "develop", "ment", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'+", "sh", "\\u", "boots", "trap", "\\u", "dev", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "[_", "'", "gcloud", "'_", ",_", "'", "compute", "'_", ",_", "'", "instance", "s", "'_", ",_", "'", "create", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "project", "'_", ",_", "get", "\\u", "project_", "(_", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "zone", "'_", ",_", "get", "\\u", "zone_", "(_", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "machine", "-", "type", "'_", ",_", "options_", "._", "machine", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "image", "'_", ",_", "'", "ubu", "ntu", "-1", "4", "-0", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "scope", "s", "'_", ",_", "'", "compute", "-", "rw", ",", "storage", "-", "rw", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "boot", "-", "disk", "-", "size", "={", "size", "}'_", "._", "format_", "(_", "size_", "=_", "options_", "._", "disk", "\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "boot", "-", "disk", "-", "type", "={", "type", "}'_", "._", "format_", "(_", "type_", "=_", "options_", "._", "disk", "\\u", "type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "metadata", "'_", ",_", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "metadata", "-", "from", "-", "file", "={", "files", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "','_", "._", "join_", "(_", "metadata", "\\u", "files_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "address_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "._", "extend_", "(_", "[_", "'--", "address", "'_", ",_", "options_", "._", "address_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "\\u", "run", "\\u", "quick", "_", "(_", "'", " ", "'_", "._", "join_", "(_", "command_", ")_", ",_", "echo_", "=_", "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_", "may", "be", "\\u", "copy", "\\u", "master", "\\u", "yml", "_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Copy", " ", "the", " ", "specified", " ", "master", " ", "spinn", "ake", "r", "-", "local", ".", "yml", ",", " ", "and", " ", "cred", "ential", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "look", " ", "for", " ", "path", "s", " ", "to", " ", "cred", "ential", "s", " ", "within", " ", "the", " ", "spinn", "ake", "r", "-", "local", ".", "yml", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "copy", " ", "tho", "se", " ", "as", " ", "well", ".", " ", "The", " ", "path", "s", " ", "to", " ", "the", " ", "cred", "ential", "s", " ", "(", "and", " ", "the", " ", "reference", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "config", " ", "file", ")", " ", "will", " ", "be", " ", "change", "d", " ", "to", " ", "reflect", " ", "the", " ", "filesystem", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "new", " ", "instance", ",", " ", "whi", "ch", " ", "may", " ", "be", " ", "different", " ", "than", " ", "on", " ", "this", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "options", " ", "[", "Names", "pace", "]:", " ", "The", " ", "parser", " ", "namespace", " ", "options", " ", "contain", " ", "informati", "on", "\\", "10", ";", " ", " ", " ", " ", "abo", "ut", " ", "the", " ", "instance", " ", "we", "'", "re", " ", "goi", "ng", " ", "to", " ", "copy", " ", "to", ",", " ", "as", " ", "well", " ", "as", " ", "the", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "master", " ", "spinn", "ake", "r", "-", "local", ".", "yml", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "options_", "._", "master", "\\u", "yml", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "may", "be", "\\u", "inform", "_", "(_", "'", "custom", " ", "spinn", "ake", "r", "-", "local", ".", "yml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "spinn", "ake", "r", "/", "spinn", "ake", "r", "-", "local", ".", "yml", "'_", ",_", "'--", "copy", "\\u", "master", "\\u", "yml", "'_", ")_", "\\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_", "bindings_", "=_", "Ya", "ml", "Bindings", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bindings_", "._", "import", "\\u", "path_", "(_", "options_", "._", "master", "\\u", "yml", "_", ")_", "\\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 ", " _", "json", "\\u", "cred", "ential", "\\u", "path_", "=_", "bindings_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "provide", "rs", ".", "google", ".", "primary", "Cred", "ential", "s", ".", "json", "Path", "'_", ")_", "\\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 ", " _", "json", "\\u", "cred", "ential", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gcp", "\\u", "home_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'/", "home", "'_", ",_", "os_", "._", "environ_", "[_", "'", "LOG", "NAME", "'_", "]_", ",_", "'.", "spinn", "ake", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "cred", "ential", "s", ",", " ", "write", " ", "them", " ", "to", " ", "this", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "gcp", "\\u", "cred", "ential", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "gcp", "\\u", "home_", ",_", "'", "google", "-", "cred", "ential", "s", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "options_", "._", "master", "\\u", "yml", "_", ",_", "'", "r", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "all", " ", "the", " ", "occurrences", " ", "of", " ", "the", " ", "original", " ", "cred", "ential", "s", " ", "path", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "path", " ", "tha", "t", " ", "we", " ", "are", " ", "goi", "ng", " ", "to", " ", "place", " ", "the", " ", "file", " ", "in", " ", "on", " ", "the", " ", "new", " ", "instance", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "json", "\\u", "cred", "ential", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "json", "\\u", "cred", "ential", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'{", "0", "}", " ", "speci", "fie", "s", " ", "google", " ", "cred", "ential", "s", " ", "in", " ", "{", "1", "},", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "whi", "ch", " ", "doe", "s", " ", "not", " ", "exist", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "options_", "._", "master", "\\u", "yml", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "json", "\\u", "cred", "ential", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "content_", "=_", "content_", "._", "replace_", "(_", "json", "\\u", "cred", "ential", "\\u", "path_", ",_", "gcp", "\\u", "cred", "ential", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", ",_", "temp", "\\u", "path_", "=_", "tempfile_", "._", "mkstemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "fch", "mod_", "(_", "fd_", ",_", "os_", "._", "stat_", "(_", "options_", "._", "master", "\\u", "yml", "_", ")_", "._", "st", "\\u", "mode_", ")_", "#", " ", "Copy", " ", "original", " ", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "write_", "(_", "fd_", ",_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "close_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual", "\\u", "path_", "=_", "temp", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "the", " ", "cred", "ential", "s", " ", "here", ".", " ", "The", " ", "cfg", " ", "file", " ", "will", " ", "be", " ", "copie", "d", " ", "after", "._", "\\u\\u\\uNL\\u\\u\\u_", "copy", "\\u", "custom", "\\u", "file_", "(_", "options_", ",_", "actual", "\\u", "path_", ",_", "'.", "spinn", "ake", "r", "/", "spinn", "ake", "r", "-", "local", ".", "yml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "json", "\\u", "cred", "ential", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "\\u", "custom", "\\u", "file_", "(_", "options_", ",_", "json", "\\u", "cred", "ential", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "spinn", "ake", "r", "/", "google", "-", "cred", "ential", "s", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "temp", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "temp", "\\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_", "check", "\\u", "gcloud", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "run", "\\u", "quick", "_", "(_", "'", "gcloud", " ", "--", "version", "'_", ",_", "echo_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "result_", "._", "returncode_", ":_", "\\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_", "sys_", "._", "stderr_", "._", "write_", "(_", "'", "ERROR", ":", " ", "Thi", "s", " ", "program", " ", "require", "s", " ", "gcloud", ".", " ", "To", " ", "obtain", " ", "gcloud", ":\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", "curl", " ", "https", "://", "sd", "k", ".", "cloud", ".", "google", ".", "com", " ", "|", " ", "bash", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "args_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fail", " ", "fast", " ", "if", " ", "path", "s", " ", "we", " ", "explicit", "ly", " ", "want", " ", "to", " ", "copy", " ", "do", " ", "not", " ", "exist", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "path_", "in_", "[_", "options_", "._", "aws", "\\u", "credentials_", ",_", "options_", "._", "master", "\\u", "yml", "_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "path_", "and_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "'", "ERROR", ":", " ", "{", "path", "}", " ", "not", " ", "found", ".\\\\", "n", "'_", "._", "format_", "(_", "path_", "=_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
funkybob/django-sniplates/tests/test_nested.py
[ { "content": "\nfrom django.template import TemplateSyntaxError\nfrom django.template.loader import get_template\nfrom django.test import SimpleTestCase, override_settings\n\nfrom .forms import TestForm\nfrom .utils import TemplateTestMixin, template_path\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Templa", "te", "Syntax", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "loader_", "import_", "get", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Simple", "Test", "Case_", ",_", "override", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "forms_", "import_", "Test", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "Templa", "te", "Test", "Mixin_", ",_", "template", "\\u", "path_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
zorna/zorna/zorna/account/forms.py
[ { "content": "class UserGroupForm(ModelForm):\n parent = TreeNodeChoiceField(queryset=UserGroup.objects.filter(\n id__gte=3).order_by('lft'), required=True) # @UndefinedVariable\n name = forms.CharField(max_length=80,\n widget=forms.TextInput({'size': 100})\n )\n\n class Meta:\n model = UserGroup", "metadata": "root.UserGroupForm", "header": "['module', '___EOS___']", "index": 190 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User", "Group", "Form_", "(_", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "Tree", "Node", "Choi", "ce", "Field_", "(_", "queryset_", "=_", "User", "Group_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u\\u", "gte_", "=_", "3_", ")_", "._", "order", "\\u", "by_", "(_", "'", "lft", "'_", ")_", ",_", "required_", "=_", "True_", ")_", "#", " ", "@", "Unde", "fined", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "80_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Text", "Input_", "(_", "{_", "'", "size", "'_", ":_", "100_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "User", "Group_", "\\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 ]
Variable defined multiple times
erkyrath/tworld/lib/twest/test_propcache.py
[ { "content": " @tornado.testing.gen_test\n def test_simple_ops(self):\n yield self.resetTables()\n \n # Fresh propcache for each test (don't use app.propcache).\n cache = two.propcache.PropCache(self.app)\n deps = set()\n\n instq = lambda key: ('instanceprop', self.exiid, self.exlocid, key)\n\n # Get some values.\n\n res = yield cache.get(instq('x'), dependencies=deps)\n self.assertEqual(res.val, 1)\n self.assertTrue(res.found)\n self.assertFalse(res.dirty)\n self.assertFalse(res.haschanged())\n self.assertEqual(res.key, 'x')\n self.assertFalse(res.mutable)\n self.assertTrue(instq('x') in deps)\n self.assertTrue(cache.get_by_object(res.val) is None)\n \n res = yield cache.get(instq('qqq'), dependencies=deps)\n self.assertTrue(res is None)\n res = yield cache.get(instq('qqq'), dependencies=deps)\n self.assertTrue(res is None)\n self.assertTrue(instq('qqq') in deps)\n # Peek into cache internals for additional testing\n res = cache.propmap[instq('qqq')]\n self.assertFalse(res.found)\n self.assertFalse(res.dirty)\n self.assertFalse(res.haschanged())\n self.assertEqual(res.key, 'qqq')\n \n res = yield cache.get(instq('ls'), dependencies=deps)\n self.assertEqual(res.val, [1,2,3])\n self.assertTrue(res.found)\n self.assertFalse(res.dirty)\n self.assertFalse(res.haschanged())\n self.assertEqual(res.key, 'ls')\n self.assertTrue(res.mutable)\n self.assertTrue(instq('ls') in deps)\n self.assertTrue(cache.get_by_object(res.val) is res)\n\n res2 = yield cache.get(instq('ls'), dependencies=deps)\n self.assertTrue(res is res2)\n\n res = yield cache.get(instq('map'), dependencies=deps)\n self.assertEqual(res.val, {'one':1, 'two':2, 'three':3})\n self.assertTrue(res.found)\n self.assertFalse(res.dirty)\n self.assertFalse(res.haschanged())\n self.assertEqual(res.key, 'map')\n self.assertTrue(res.mutable)\n self.assertTrue(instq('map') in deps)\n self.assertTrue(cache.get_by_object(res.val) is res)\n\n self.assertEqual(cache.note_changed_entries(), [])\n self.assertEqual(cache.dirty_entries(), [])\n\n # Set some values.\n\n yield cache.set(instq('y'), 7)\n res = yield cache.get(instq('y'), dependencies=deps)\n self.assertEqual(res.val, 7)\n self.assertTrue(res.dirty)\n self.assertFalse(res.haschanged())\n \n res = yield self.get_db_prop(instq('y'))\n self.assertEqual(res, 2)\n\n yield cache.set(instq('z'), 3)\n res = yield cache.get(instq('z'), dependencies=deps)\n self.assertEqual(res.val, 3)\n self.assertTrue(res.dirty)\n self.assertFalse(res.haschanged())\n \n res = yield self.get_db_prop(instq('z'))\n self.assertEqual(res, NotFound)\n\n self.assertEqual(cache.note_changed_entries(), [])\n self.assertEqual(len(cache.dirty_entries()), 2)\n\n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n \n res = yield cache.get(instq('y'), dependencies=deps)\n self.assertEqual(res.val, 7)\n res = yield self.get_db_prop(instq('y'))\n self.assertEqual(res, 7)\n \n res = yield cache.get(instq('z'), dependencies=deps)\n self.assertEqual(res.val, 3)\n res = yield self.get_db_prop(instq('z'))\n self.assertEqual(res, 3)\n\n yield cache.set(instq('listtuple'), (1,2,3))\n res = yield cache.get(instq('listtuple'), dependencies=deps)\n self.assertEqual(res.val, (1,2,3))\n \n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n\n res = yield self.get_db_prop(instq('listtuple'))\n self.assertEqual(res, [1,2,3])\n \n # Delete some values.\n\n yield cache.delete(instq('x'))\n res = yield cache.get(instq('x'), dependencies=deps)\n self.assertTrue(res is None)\n\n res = yield self.get_db_prop(instq('x'))\n self.assertEqual(res, 1)\n \n yield cache.delete(instq('qqqq'))\n res = yield cache.get(instq('qqqq'), dependencies=deps)\n self.assertTrue(res is None)\n \n yield cache.delete(instq('map'))\n res = yield cache.get(instq('map'), dependencies=deps)\n self.assertTrue(res is None)\n\n res = yield self.get_db_prop(instq('map'))\n self.assertEqual(res, {'one':1, 'two':2, 'three':3})\n \n self.assertEqual(cache.note_changed_entries(), [])\n self.assertEqual(len(cache.dirty_entries()), 3)\n\n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n \n res = yield self.get_db_prop(instq('x'))\n self.assertEqual(res, NotFound)\n res = yield self.get_db_prop(instq('qqqq'))\n self.assertEqual(res, NotFound)\n res = yield self.get_db_prop(instq('map'))\n self.assertEqual(res, NotFound)\n \n yield cache.delete(instq('x'))\n res = yield cache.get(instq('x'), dependencies=deps)\n self.assertTrue(res is None)", "metadata": "root.TestPropcache.test_simple_ops", "header": "['class', 'TestPropcache', '(', 'twest', '.', 'mock', '.', 'MockAppTestCase', ')', ':', '___EOS___']", "index": 48 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Prop", "cache_", "(_", "twe", "st_", "._", "mock_", "._", "Moc", "k", "App", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tornado_", "._", "testing_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "simple", "\\u", "ops_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "reset", "Tables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fre", "sh", " ", "prop", "cache", " ", "for", " ", "each", " ", "test", " ", "(", "don", "'", "t", " ", "use", " ", "app", ".", "prop", "cache", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "two_", "._", "prop", "cache_", "._", "Prop", "Cache_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deps_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inst", "q_", "=_", "lambda_", "key_", ":_", "(_", "'", "instance", "prop", "'_", ",_", "self_", "._", "exi", "id_", ",_", "self_", "._", "ex", "loci", "d_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "some", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "key_", ",_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "mutable", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", "in_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cache_", "._", "get", "\\u", "by", "\\u", "object_", "(_", "res_", "._", "val_", ")_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "qq", "q", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "qq", "q", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst", "q_", "(_", "'", "qq", "q", "'_", ")_", "in_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pe", "ek", " ", "int", "o", " ", "cache", " ", "internals", " ", "for", " ", "addition", "al", " ", "testing_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "cache_", "._", "prop", "map_", "[_", "inst", "q_", "(_", "'", "qq", "q", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "key_", ",_", "'", "qq", "q", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "key_", ",_", "'", "ls", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "mutable", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", "in_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cache_", "._", "get", "\\u", "by", "\\u", "object_", "(_", "res_", "._", "val_", ")_", "is_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res2_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "res2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "{_", "'", "one", "'_", ":_", "1_", ",_", "'", "two", "'_", ":_", "2_", ",_", "'", "three", "'_", ":_", "3_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "key_", ",_", "'", "map", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "mutable", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", "in_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cache_", "._", "get", "\\u", "by", "\\u", "object_", "(_", "res_", "._", "val_", ")_", "is_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "some", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "y", "'_", ")_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "y", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "y", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "z", "'_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "z", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "Not", "Found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "y", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "y", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "z", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "list", "tuple", "'_", ")_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "list", "tuple", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "list", "tuple", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "some", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "qq", "qq", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "qq", "qq", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "{_", "'", "one", "'_", ":_", "1_", ",_", "'", "two", "'_", ":_", "2_", ",_", "'", "three", "'_", ":_", "3_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "Not", "Found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "qq", "qq", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "Not", "Found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "Not", "Found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary 'else' clause in loop
openstack/fuel-web/nailgun/nailgun/task/fake.py
[ { "content": " def run(self):\n super(FakeProvisionThread, self).run()\n # TEST: we can fail only in deployment stage here:\n error = self.params.get(\"error\")\n error_msg = self.params.get('error_msg')\n if error != \"provisioning\":\n error = None\n\n kwargs = {\n 'task_uuid': self.task_uuid,\n 'status': consts.TASK_STATUSES.running,\n 'progress': 0\n }\n\n smart_nodes = [\n FSMNodeFlow(n, consts.NODE_STATUSES.discover)\n for n in self.data['args']['provisioning_info']['nodes']\n ]\n\n for nodes in self.run_until_status(\n smart_nodes, consts.NODE_STATUSES.provisioned,\n random_error=error is not None\n ):\n kwargs['nodes'] = nodes\n for n in nodes:\n if n['status'] in (\n consts.NODE_STATUSES.provisioned,\n consts.NODE_STATUSES.error\n ):\n continue\n\n kwargs['progress'] = n['progress']\n kwargs['status'] = consts.TASK_STATUSES.running\n break\n else:\n kwargs['progress'] = 100\n if error is None:\n kwargs['status'] = consts.TASK_STATUSES.ready\n else:\n kwargs['status'] = consts.TASK_STATUSES.error\n if error_msg:\n kwargs['error_msg'] = error_msg\n\n self.notify(kwargs)\n self.sleep(self.tick_interval)", "metadata": "root.FakeProvisionThread.run", "header": "['class', 'FakeProvisionThread', '(', 'FakeThread', ')', ':', '___EOS___']", "index": 382 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "'", "else", "'_", "clause_", "in_", "loop_", "[SEP]_", "class_", "Fake", "Provision", "Thread_", "(_", "Fake", "Thread_", ")_", ":_", "\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Fake", "Provision", "Thread_", ",_", "self_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TEST", ":", " ", "we", " ", "can", " ", "fail", " ", "only", " ", "in", " ", "deploy", "ment", " ", "stage", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "error_", "=_", "self_", "._", "params_", "._", "get_", "(_", "\"", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "msg_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "error", "\\u", "msg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", "!=_", "\"", "provision", "ing", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "task", "\\u", "uuid", "'_", ":_", "self_", "._", "task", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "consts_", "._", "TASK", "\\u", "STATUS", "ES_", "._", "running_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "progress", "'_", ":_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "smart", "\\u", "nodes_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "FSM", "Node", "Flow_", "(_", "n_", ",_", "consts_", "._", "NODE", "\\u", "STATUS", "ES_", "._", "discover_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "self_", "._", "data_", "[_", "'", "args", "'_", "]_", "[_", "'", "provision", "ing", "\\u", "info", "'_", "]_", "[_", "'", "nodes", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "nodes_", "in_", "self_", "._", "run", "\\u", "unti", "l\\u", "status_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "smart", "\\u", "nodes_", ",_", "consts_", "._", "NODE", "\\u", "STATUS", "ES_", "._", "provisioned", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random", "\\u", "error_", "=_", "error_", "is_", "not_", "None_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "nodes", "'_", "]_", "=_", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "n_", "[_", "'", "status", "'_", "]_", "in_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "consts_", "._", "NODE", "\\u", "STATUS", "ES_", "._", "provisioned", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "consts_", "._", "NODE", "\\u", "STATUS", "ES_", "._", "error_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\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_", "kwargs_", "[_", "'", "progress", "'_", "]_", "=_", "n_", "[_", "'", "progress", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "status", "'_", "]_", "=_", "consts_", "._", "TASK", "\\u", "STATUS", "ES_", "._", "running_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "progress", "'_", "]_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "[_", "'", "status", "'_", "]_", "=_", "consts_", "._", "TASK", "\\u", "STATUS", "ES_", "._", "ready_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "[_", "'", "status", "'_", "]_", "=_", "consts_", "._", "TASK", "\\u", "STATUS", "ES_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error", "\\u", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "kwargs_", "[_", "'", "error", "\\u", "msg", "'_", "]_", "=_", "error", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "notify_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sleep_", "(_", "self_", "._", "tick", "\\u", "interval_", ")_", "\\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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ow/taskflow/tests/unit/persistence/base.py
[ { "content": "# -*- coding: utf-8 -*-\n\n# Copyright (C) 2013 Rackspace Hosting All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport contextlib\n\nfrom oslo_utils import uuidutils\n\nfrom taskflow import exceptions as exc\nfrom taskflow.persistence import models\nfrom taskflow import states\nfrom taskflow.types import failure\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PersistenceTestMixin(object):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.PersistenceTestMixin", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def _get_connection(self):\n raise NotImplementedError('_get_connection() implementation required')", "metadata": "root.PersistenceTestMixin._get_connection", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_task_detail_update_not_existing(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n td = models.TaskDetail(\"detail-1\", uuid=uuidutils.generate_uuid())\n fd.add(td)\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n\n td2 = models.TaskDetail(\"detail-1\", uuid=uuidutils.generate_uuid())\n fd.add(td2)\n with contextlib.closing(self._get_connection()) as conn:\n conn.update_flow_details(fd)\n\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb.uuid)\n fd2 = lb2.find(fd.uuid)\n self.assertIsNotNone(fd2.find(td.uuid))\n self.assertIsNotNone(fd2.find(td2.uuid))", "metadata": "root.PersistenceTestMixin.test_task_detail_update_not_existing", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 30 }, { "content": " def test_flow_detail_update_not_existing(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n\n fd2 = models.FlowDetail('test-2', uuid=uuidutils.generate_uuid())\n lb.add(fd2)\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb.uuid)\n self.assertIsNotNone(lb2.find(fd.uuid))\n self.assertIsNotNone(lb2.find(fd2.uuid))", "metadata": "root.PersistenceTestMixin.test_flow_detail_update_not_existing", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": " def test_logbook_save_retrieve_many(self):\n lb_ids = {}\n for i in range(0, 10):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s-%s' % (i, lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n lb_ids[lb_id] = True\n\n # Should not already exist\n with contextlib.closing(self._get_connection()) as conn:\n self.assertRaises(exc.NotFound, conn.get_logbook, lb_id)\n conn.save_logbook(lb)\n\n # Now fetch them all\n with contextlib.closing(self._get_connection()) as conn:\n lbs = conn.get_logbooks()\n for lb in lbs:\n self.assertIn(lb.uuid, lb_ids)\n lb_ids.pop(lb.uuid)\n self.assertEqual(0, len(lb_ids))", "metadata": "root.PersistenceTestMixin.test_logbook_save_retrieve_many", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 71 }, { "content": " def test_logbook_save_retrieve(self):\n lb_id = uuidutils.generate_uuid()\n lb_meta = {'1': 2}\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n lb.meta = lb_meta\n\n # Should not already exist\n with contextlib.closing(self._get_connection()) as conn:\n self.assertRaises(exc.NotFound, conn.get_logbook, lb_id)\n conn.save_logbook(lb)\n\n # Make sure we can reload it (and all of its attributes are what\n # we expect them to be).\n with contextlib.closing(self._get_connection()) as conn:\n lb = conn.get_logbook(lb_id)\n self.assertEqual(lb_name, lb.name)\n self.assertEqual(0, len(lb))\n self.assertEqual(lb_meta, lb.meta)\n self.assertIsNone(lb.updated_at)\n self.assertIsNotNone(lb.created_at)", "metadata": "root.PersistenceTestMixin.test_logbook_save_retrieve", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": " def test_flow_detail_save(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n\n # Ensure we can't save it since its owning logbook hasn't been\n # saved (flow details can not exist on their own without a connection\n # to a logbook).\n with contextlib.closing(self._get_connection()) as conn:\n self.assertRaises(exc.NotFound, conn.get_logbook, lb_id)\n self.assertRaises(exc.NotFound, conn.update_flow_details, fd)\n\n # Ok now we should be able to save both.\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n conn.update_flow_details(fd)", "metadata": "root.PersistenceTestMixin.test_flow_detail_save", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 114 }, { "content": " def test_flow_detail_meta_update(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n fd.meta = {'test': 42}\n lb.add(fd)\n\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n conn.update_flow_details(fd)\n\n fd.meta['test'] = 43\n with contextlib.closing(self._get_connection()) as conn:\n conn.update_flow_details(fd)\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id)\n fd2 = lb2.find(fd.uuid)\n self.assertEqual(43, fd2.meta.get('test'))", "metadata": "root.PersistenceTestMixin.test_flow_detail_meta_update", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 133 }, { "content": " def test_flow_detail_lazy_fetch(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n td = models.TaskDetail(\"detail-1\", uuid=uuidutils.generate_uuid())\n td.version = '4.2'\n fd.add(td)\n lb.add(fd)\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n with contextlib.closing(self._get_connection()) as conn:\n fd2 = conn.get_flow_details(fd.uuid, lazy=True)\n self.assertEqual(0, len(fd2))\n self.assertEqual(1, len(fd))", "metadata": "root.PersistenceTestMixin.test_flow_detail_lazy_fetch", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 153 }, { "content": " def test_task_detail_save(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n td = models.TaskDetail(\"detail-1\", uuid=uuidutils.generate_uuid())\n fd.add(td)\n\n # Ensure we can't save it since its owning logbook hasn't been\n # saved (flow details/task details can not exist on their own without\n # their parent existing).\n with contextlib.closing(self._get_connection()) as conn:\n self.assertRaises(exc.NotFound, conn.update_flow_details, fd)\n self.assertRaises(exc.NotFound, conn.update_atom_details, td)\n\n # Ok now we should be able to save them.\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n conn.update_flow_details(fd)\n conn.update_atom_details(td)", "metadata": "root.PersistenceTestMixin.test_task_detail_save", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 169 }, { "content": " def test_task_detail_meta_update(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n td = models.TaskDetail(\"detail-1\", uuid=uuidutils.generate_uuid())\n td.meta = {'test': 42}\n fd.add(td)\n\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n conn.update_flow_details(fd)\n conn.update_atom_details(td)\n\n td.meta['test'] = 43\n with contextlib.closing(self._get_connection()) as conn:\n conn.update_atom_details(td)\n\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id)\n fd2 = lb2.find(fd.uuid)\n td2 = fd2.find(td.uuid)\n self.assertEqual(43, td2.meta.get('test'))\n self.assertIsInstance(td2, models.TaskDetail)", "metadata": "root.PersistenceTestMixin.test_task_detail_meta_update", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 191 }, { "content": " def test_task_detail_with_failure(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n td = models.TaskDetail(\"detail-1\", uuid=uuidutils.generate_uuid())\n\n try:\n raise RuntimeError('Woot!')\n except Exception:\n td.failure = failure.Failure()\n\n fd.add(td)\n\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n conn.update_flow_details(fd)\n conn.update_atom_details(td)\n\n # Read failure back\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id)\n fd2 = lb2.find(fd.uuid)\n td2 = fd2.find(td.uuid)\n self.assertEqual('Woot!', td2.failure.exception_str)\n self.assertIs(td2.failure.check(RuntimeError), RuntimeError)\n self.assertEqual(td.failure.traceback_str, td2.failure.traceback_str)\n self.assertIsInstance(td2, models.TaskDetail)", "metadata": "root.PersistenceTestMixin.test_task_detail_with_failure", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 217 }, { "content": " def test_logbook_merge_flow_detail(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n lb2 = models.LogBook(name=lb_name, uuid=lb_id)\n fd2 = models.FlowDetail('test2', uuid=uuidutils.generate_uuid())\n lb2.add(fd2)\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb2)\n with contextlib.closing(self._get_connection()) as conn:\n lb3 = conn.get_logbook(lb_id)\n self.assertEqual(2, len(lb3))", "metadata": "root.PersistenceTestMixin.test_logbook_merge_flow_detail", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 247 }, { "content": " def test_logbook_add_flow_detail(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id)\n self.assertEqual(1, len(lb2))\n self.assertEqual(1, len(lb))\n self.assertEqual(fd.name, lb2.find(fd.uuid).name)", "metadata": "root.PersistenceTestMixin.test_logbook_add_flow_detail", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 264 }, { "content": " def test_logbook_lazy_fetch(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id, lazy=True)\n self.assertEqual(0, len(lb2))\n self.assertEqual(1, len(lb))", "metadata": "root.PersistenceTestMixin.test_logbook_lazy_fetch", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 278 }, { "content": " def test_logbook_add_task_detail(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n td = models.TaskDetail(\"detail-1\", uuid=uuidutils.generate_uuid())\n td.version = '4.2'\n fd.add(td)\n lb.add(fd)\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id)\n self.assertEqual(1, len(lb2))\n tasks = 0\n for fd in lb:\n tasks += len(fd)\n self.assertEqual(1, tasks)\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id)\n fd2 = lb2.find(fd.uuid)\n td2 = fd2.find(td.uuid)\n self.assertIsNot(td2, None)\n self.assertEqual('detail-1', td2.name)\n self.assertEqual('4.2', td2.version)\n self.assertEqual(states.EXECUTE, td2.intention)", "metadata": "root.PersistenceTestMixin.test_logbook_add_task_detail", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 291 }, { "content": " def test_logbook_delete(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n with contextlib.closing(self._get_connection()) as conn:\n self.assertRaises(exc.NotFound, conn.destroy_logbook, lb_id)\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id)\n self.assertIsNotNone(lb2)\n with contextlib.closing(self._get_connection()) as conn:\n conn.destroy_logbook(lb_id)\n self.assertRaises(exc.NotFound, conn.destroy_logbook, lb_id)", "metadata": "root.PersistenceTestMixin.test_logbook_delete", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 318 }, { "content": " def test_task_detail_retry_type_(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n rd = models.RetryDetail(\"detail-1\", uuid=uuidutils.generate_uuid())\n rd.intention = states.REVERT\n fd.add(rd)\n\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n conn.update_flow_details(fd)\n conn.update_atom_details(rd)\n\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id)\n fd2 = lb2.find(fd.uuid)\n rd2 = fd2.find(rd.uuid)\n self.assertEqual(states.REVERT, rd2.intention)\n self.assertIsInstance(rd2, models.RetryDetail)", "metadata": "root.PersistenceTestMixin.test_task_detail_retry_type_", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 333 }, { "content": " def test_retry_detail_save_with_task_failure(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n rd = models.RetryDetail(\"retry-1\", uuid=uuidutils.generate_uuid())\n fail = failure.Failure.from_exception(RuntimeError('fail'))\n rd.results.append((42, {'some-task': fail}))\n fd.add(rd)\n\n # save it\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n conn.update_flow_details(fd)\n conn.update_atom_details(rd)\n\n # now read it back\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id)\n fd2 = lb2.find(fd.uuid)\n rd2 = fd2.find(rd.uuid)\n self.assertIsInstance(rd2, models.RetryDetail)\n fail2 = rd2.results[0][1].get('some-task')\n self.assertIsInstance(fail2, failure.Failure)\n self.assertTrue(fail.matches(fail2))", "metadata": "root.PersistenceTestMixin.test_retry_detail_save_with_task_failure", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 355 }, { "content": " def test_retry_detail_save_intention(self):\n lb_id = uuidutils.generate_uuid()\n lb_name = 'lb-%s' % (lb_id)\n lb = models.LogBook(name=lb_name, uuid=lb_id)\n fd = models.FlowDetail('test', uuid=uuidutils.generate_uuid())\n lb.add(fd)\n rd = models.RetryDetail(\"retry-1\", uuid=uuidutils.generate_uuid())\n fd.add(rd)\n\n # save it\n with contextlib.closing(self._get_connection()) as conn:\n conn.save_logbook(lb)\n conn.update_flow_details(fd)\n conn.update_atom_details(rd)\n\n # change intention and save\n rd.intention = states.REVERT\n with contextlib.closing(self._get_connection()) as conn:\n conn.update_atom_details(rd)\n\n # now read it back\n with contextlib.closing(self._get_connection()) as conn:\n lb2 = conn.get_logbook(lb_id)\n fd2 = lb2.find(fd.uuid)\n rd2 = fd2.find(rd.uuid)\n self.assertEqual(states.REVERT, rd2.intention)\n self.assertIsInstance(rd2, models.RetryDetail)", "metadata": "root.PersistenceTestMixin.test_retry_detail_save_intention", "header": "['class', 'PersistenceTestMixin', '(', 'object', ')', ':', '___EOS___']", "index": 382 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "2013", " ", "Rack", "space", " ", "Host", "ing", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "contextlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "oslo", "\\u", "utils_", "import_", "uuidutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "task", "flow_", "import_", "exceptions_", "as_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "task", "flow_", "._", "persistence_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "task", "flow_", "import_", "states_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "task", "flow_", "._", "types_", "import_", "failure_", "\\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_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "get", "\\u", "connection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'\\u", "get", "\\u", "connecti", "on", "()", " ", "implementation", " ", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "task", "\\u", "deta", "il", "\\u", "update", "\\u", "not", "\\u", "existing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "=_", "models_", "._", "Task", "Detail_", "(_", "\"", "deta", "il", "-1", "\"_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "add_", "(_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "td", "2_", "=_", "models_", "._", "Task", "Detail_", "(_", "\"", "deta", "il", "-1", "\"_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "add_", "(_", "td", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd", "2_", "=_", "lb", "2_", "._", "find_", "(_", "fd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "fd", "2_", "._", "find_", "(_", "td_", "._", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "fd", "2_", "._", "find_", "(_", "td", "2_", "._", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "flow", "\\u", "deta", "il", "\\u", "update", "\\u", "not", "\\u", "existing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd", "2_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "-", "2", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "lb", "2_", "._", "find_", "(_", "fd_", "._", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "lb", "2_", "._", "find_", "(_", "fd", "2_", "._", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "logbo", "ok", "\\u", "save", "\\u", "retrieve", "\\u", "many_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "ids_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "-%", "s", "'_", "%_", "(_", "i_", ",_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "ids_", "[_", "lb", "\\u", "id_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sho", "ul", "d", " ", "not", " ", "alr", "ead", "y", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "exc_", "._", "Not", "Found_", ",_", "conn_", "._", "get", "\\u", "logbo", "ok_", ",_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "fetch", " ", "them", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "s_", "=_", "conn_", "._", "get", "\\u", "logbo", "oks", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lb_", "in_", "lb", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "In_", "(_", "lb_", "._", "uuid_", ",_", "lb", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "ids_", "._", "pop_", "(_", "lb_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "lb", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "logbo", "ok", "\\u", "save", "\\u", "retrieve_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "meta_", "=_", "{_", "'", "1", "'_", ":_", "2_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "meta_", "=_", "lb", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sho", "ul", "d", " ", "not", " ", "alr", "ead", "y", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "exc_", "._", "Not", "Found_", ",_", "conn_", "._", "get", "\\u", "logbo", "ok_", ",_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "can", " ", "relo", "ad", " ", "it", " ", "(", "and", " ", "all", " ", "of", " ", "its", " ", "attribute", "s", " ", "are", " ", "what_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "expect", " ", "them", " ", "to", " ", "be", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "lb", "\\u", "name_", ",_", "lb_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "lb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "lb", "\\u", "meta_", ",_", "lb_", "._", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "lb_", "._", "update", "d\\u", "at_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "lb_", "._", "created", "\\u", "at_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "flow", "\\u", "deta", "il", "\\u", "save_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "we", " ", "can", "'", "t", " ", "save", " ", "it", " ", "sinc", "e", " ", "its", " ", "own", "ing", " ", "logbo", "ok", " ", "hasn", "'", "t", " ", "bee", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "saved", " ", "(", "flow", " ", "deta", "il", "s", " ", "can", " ", "not", " ", "exist", " ", "on", " ", "thei", "r", " ", "own", " ", "with", "out", " ", "a", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "a", " ", "logbo", "ok", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "exc_", "._", "Not", "Found_", ",_", "conn_", "._", "get", "\\u", "logbo", "ok_", ",_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exc_", "._", "Not", "Found_", ",_", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", ",_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ok", " ", "now", " ", "we", " ", "shou", "ld", " ", "be", " ", "able", " ", "to", " ", "save", " ", "bot", "h", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "flow", "\\u", "deta", "il", "\\u", "meta", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "meta_", "=_", "{_", "'", "test", "'_", ":_", "42_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", "._", "meta_", "[_", "'", "test", "'_", "]_", "=_", "43_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd", "2_", "=_", "lb", "2_", "._", "find_", "(_", "fd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "43_", ",_", "fd", "2_", "._", "meta_", "._", "get_", "(_", "'", "test", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "flow", "\\u", "deta", "il", "\\u", "lazy", "\\u", "fetch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "=_", "models_", "._", "Task", "Detail_", "(_", "\"", "deta", "il", "-1", "\"_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "._", "version_", "=_", "'", "4.2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "add_", "(_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd", "2_", "=_", "conn_", "._", "get", "\\u", "flow", "\\u", "details_", "(_", "fd_", "._", "uuid_", ",_", "lazy_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "fd", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "fd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "task", "\\u", "deta", "il", "\\u", "save_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "=_", "models_", "._", "Task", "Detail_", "(_", "\"", "deta", "il", "-1", "\"_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "add_", "(_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "we", " ", "can", "'", "t", " ", "save", " ", "it", " ", "sinc", "e", " ", "its", " ", "own", "ing", " ", "logbo", "ok", " ", "hasn", "'", "t", " ", "bee", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "saved", " ", "(", "flow", " ", "deta", "il", "s", "/", "task", " ", "deta", "il", "s", " ", "can", " ", "not", " ", "exist", " ", "on", " ", "thei", "r", " ", "own", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thei", "r", " ", "parent", " ", "exist", "ing", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "exc_", "._", "Not", "Found_", ",_", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", ",_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exc_", "._", "Not", "Found_", ",_", "conn_", "._", "update", "\\u", "atom", "\\u", "details_", ",_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ok", " ", "now", " ", "we", " ", "shou", "ld", " ", "be", " ", "able", " ", "to", " ", "save", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "atom", "\\u", "details_", "(_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "task", "\\u", "deta", "il", "\\u", "meta", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "=_", "models_", "._", "Task", "Detail_", "(_", "\"", "deta", "il", "-1", "\"_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "._", "meta_", "=_", "{_", "'", "test", "'_", ":_", "42_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "add_", "(_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "atom", "\\u", "details_", "(_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "td_", "._", "meta_", "[_", "'", "test", "'_", "]_", "=_", "43_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "update", "\\u", "atom", "\\u", "details_", "(_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd", "2_", "=_", "lb", "2_", "._", "find_", "(_", "fd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td", "2_", "=_", "fd", "2_", "._", "find_", "(_", "td_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "43_", ",_", "td", "2_", "._", "meta_", "._", "get_", "(_", "'", "test", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "td", "2_", ",_", "models_", "._", "Task", "Detail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "task", "\\u", "deta", "il", "\\u", "with", "\\u", "failure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "=_", "models_", "._", "Task", "Detail_", "(_", "\"", "deta", "il", "-1", "\"_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\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 ", " _", "raise_", "Run", "time", "Error_", "(_", "'", "Wo", "ot", "!'_", ")_", "\\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 ", " _", "td_", "._", "failure_", "=_", "failure_", "._", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", "._", "add_", "(_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "atom", "\\u", "details_", "(_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "fail", "ure", " ", "back_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd", "2_", "=_", "lb", "2_", "._", "find_", "(_", "fd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td", "2_", "=_", "fd", "2_", "._", "find_", "(_", "td_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "Wo", "ot", "!'_", ",_", "td", "2_", "._", "failure_", "._", "exception", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "td", "2_", "._", "failure_", "._", "check_", "(_", "Run", "time", "Error_", ")_", ",_", "Run", "time", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "td_", "._", "failure_", "._", "traceback", "\\u", "str_", ",_", "td", "2_", "._", "failure_", "._", "traceback", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "td", "2_", ",_", "models_", "._", "Task", "Detail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "logbo", "ok", "\\u", "merge", "\\u", "flow", "\\u", "detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lb", "2_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd", "2_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "2", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "2_", "._", "add_", "(_", "fd", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "3_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "lb", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "logbo", "ok", "\\u", "add", "\\u", "flow", "\\u", "detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "lb", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "lb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fd_", "._", "name_", ",_", "lb", "2_", "._", "find_", "(_", "fd_", "._", "uuid_", ")_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "logbo", "ok", "\\u", "lazy", "\\u", "fetch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ",_", "lazy_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "lb", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "lb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "logbo", "ok", "\\u", "add", "\\u", "task", "\\u", "detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "=_", "models_", "._", "Task", "Detail_", "(_", "\"", "deta", "il", "-1", "\"_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "._", "version_", "=_", "'", "4.2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "add_", "(_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "lb", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tasks_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fd_", "in_", "lb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tasks_", "+=_", "len_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "tasks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd", "2_", "=_", "lb", "2_", "._", "find_", "(_", "fd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td", "2_", "=_", "fd", "2_", "._", "find_", "(_", "td_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "td", "2_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "deta", "il", "-1", "'_", ",_", "td", "2_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "4.2", "'_", ",_", "td", "2_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "states_", "._", "EXECUTE", "_", ",_", "td", "2_", "._", "intent", "ion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "logbo", "ok", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "exc_", "._", "Not", "Found_", ",_", "conn_", "._", "destroy", "\\u", "logbo", "ok_", ",_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "lb", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "destroy", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exc_", "._", "Not", "Found_", ",_", "conn_", "._", "destroy", "\\u", "logbo", "ok_", ",_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "task", "\\u", "deta", "il", "\\u", "retr", "y", "\\u", "type\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rd_", "=_", "models_", "._", "Retr", "y", "Detail_", "(_", "\"", "deta", "il", "-1", "\"_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rd_", "._", "intent", "ion_", "=_", "states_", "._", "REV", "ERT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "add_", "(_", "rd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "atom", "\\u", "details_", "(_", "rd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd", "2_", "=_", "lb", "2_", "._", "find_", "(_", "fd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rd", "2_", "=_", "fd", "2_", "._", "find_", "(_", "rd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "states_", "._", "REV", "ERT", "_", ",_", "rd", "2_", "._", "intent", "ion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "rd", "2_", ",_", "models_", "._", "Retr", "y", "Detail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "retr", "y", "\\u", "deta", "il", "\\u", "save", "\\u", "with", "\\u", "task", "\\u", "failure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rd_", "=_", "models_", "._", "Retr", "y", "Detail_", "(_", "\"", "retr", "y", "-1", "\"_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail_", "=_", "failure_", "._", "Failure_", "._", "from", "\\u", "exception_", "(_", "Run", "time", "Error_", "(_", "'", "fail", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rd_", "._", "results_", "._", "append_", "(_", "(_", "42_", ",_", "{_", "'", "some", "-", "task", "'_", ":_", "fail_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "add_", "(_", "rd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "atom", "\\u", "details_", "(_", "rd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "read", " ", "it", " ", "back_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd", "2_", "=_", "lb", "2_", "._", "find_", "(_", "fd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rd", "2_", "=_", "fd", "2_", "._", "find_", "(_", "rd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "rd", "2_", ",_", "models_", "._", "Retr", "y", "Detail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "2_", "=_", "rd", "2_", "._", "results_", "[_", "0_", "]_", "[_", "1_", "]_", "._", "get_", "(_", "'", "some", "-", "task", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "fail", "2_", ",_", "failure_", "._", "Failure_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "fail_", "._", "matches_", "(_", "fail", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Persisten", "ce", "Test", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "retr", "y", "\\u", "deta", "il", "\\u", "save", "\\u", "intent", "ion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "\\u", "id_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb", "\\u", "name_", "=_", "'", "lb", "-%", "s", "'_", "%_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "=_", "models_", "._", "Log", "Book_", "(_", "name_", "=_", "lb", "\\u", "name_", ",_", "uuid_", "=_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "models_", "._", "Flow", "Detail_", "(_", "'", "test", "'_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lb_", "._", "add_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rd_", "=_", "models_", "._", "Retr", "y", "Detail_", "(_", "\"", "retr", "y", "-1", "\"_", ",_", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "add_", "(_", "rd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "save", "\\u", "logbo", "ok_", "(_", "lb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "flow", "\\u", "details_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "update", "\\u", "atom", "\\u", "details_", "(_", "rd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", " ", "intent", "ion", " ", "and", " ", "save_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rd_", "._", "intent", "ion_", "=_", "states_", "._", "REV", "ERT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "update", "\\u", "atom", "\\u", "details_", "(_", "rd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "read", " ", "it", " ", "back_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "contextlib_", "._", "closing_", "(_", "self_", "._", "\\u", "get", "\\u", "connection_", "(_", ")_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb", "2_", "=_", "conn_", "._", "get", "\\u", "logbo", "ok_", "(_", "lb", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd", "2_", "=_", "lb", "2_", "._", "find_", "(_", "fd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rd", "2_", "=_", "fd", "2_", "._", "find_", "(_", "rd_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "states_", "._", "REV", "ERT", "_", ",_", "rd", "2_", "._", "intent", "ion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "rd", "2_", ",_", "models_", "._", "Retr", "y", "Detail_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
amrdraz/kodr/app/brython/www/src/Lib/time.py
[ { "content": "from browser import window\nimport javascript\n\n# use Javascript Date constructor\ndate = javascript.JSConstructor(window.Date)\n\n#daylight = 0 # fix me.. returns Non zero if DST timezone is defined\n\n##############################################\n# Added to pass some tests\n# Are there timezone always in the browser?\n# I'm assuming we don't have always this info\n_STRUCT_TM_ITEMS = 9\n##############################################\n\n\n##############################################\n## Helper functions\n\n \n \n \n \n \n \n## end of helper functions\n##############################################\n\n##############################################\n## Values depending the timezone of the browser.\ndaylight = _is_dst()\ntimezone = date().getTimezoneOffset() * 60\ntzname = _get_tzname()\naltzone = _set_altzone() if daylight else timezone\n##############################################\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n# All the clock_xx machinery shouldn't work in the browser so some\n# NotImplementedErrors or messages are shown\n_clock_msg = \"\"\"Browser cannot access CPU. See '%s'\"\"\"\nclock = lambda: _clock_xx(\"https://docs.python.org/3/library/time.html#time.clock\")\nclock_getres = lambda: _clock_xx(\"https://docs.python.org/3/library/time.html#time.clock_getres\")\nclock_gettime = lambda: _clock_xx(\"https://docs.python.org/3/library/time.html#time.clock_gettime\")\nclock_settime = lambda: _clock_xx(\"https://docs.python.org/3/library/time.html#time.clock_settime\")\nCLOCK_HIGHRES = _clock_msg % \"https://docs.python.org/3/library/time.html#time.CLOCK_HIGHRES\"\nCLOCK_MONOTONIC = _clock_msg % \"https://docs.python.org/3/library/time.html#time.CLOCK_MONOTONIC\"\nCLOCK_MONOTONIC_RAW = _clock_msg % \"https://docs.python.org/3/library/time.html#time.CLOCK_MONOTONIC_RAW\"\nCLOCK_PROCESS_CPUTIME_ID = _clock_msg % \"https://docs.python.org/3/library/time.html#time.CLOCK_PROCESS_CPUTIME_ID\"\nCLOCK_REALTIME = _clock_msg % \"https://docs.python.org/3/library/time.html#time.CLOCK_REALTIME\"\nCLOCK_THREAD_CPUTIME_ID = _clock_msg % \"https://docs.python.org/3/library/time.html#time.CLOCK_THREAD_CPUTIME_ID\"\nget_clock_info = lambda: _clock_xx(\"https://docs.python.org/3/library/time.html#time.get_clock_info\")\nprocess_time = lambda: _clock_xx(\"https://docs.python.org/3/library/time.html#time.process_time\")\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _get_day_of_year(arg):\n \"\"\"\n Get the day position in the year starting from 1\n \n Parameters\n ----------\n arg : tuple\n \n Returns\n -------\n int with the correct day of the year starting from 1\n \"\"\"\n ml = [31,28,31,30,31,30,31,31,30,31,30,31]\n if arg[0]%4==0:\n ml[1] += 1\n i=1\n yday=0\n while i<arg[1]:\n yday += ml[i-1]\n i += 1\n yday += arg[2]\n return yday", "metadata": "root._get_day_of_year", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def _get_week_of_year(arg):\n \"\"\"\n Get the week position in the year starting from 0. All days in a new \n year preceding the first Monday are considered to be in week 0.\n \n Parameters\n ----------\n arg : tuple\n \n Returns\n -------\n int with the correct iso week (weeks starting on Monday) of the year.\n \"\"\"\n d1 = date(arg[0], arg[1]-1, arg[2])\n d0 = date(arg[0], 0, 1)\n firstday = d0.getDay()\n if firstday == 0 : firstday = 7\n firstweek = 8 - firstday\n doy = arg[7]\n if firstday != 1:\n doy = doy - firstweek\n if doy % 7 == 0:\n week_number = doy // 7\n else:\n week_number = doy // 7 + 1\n return week_number", "metadata": "root._get_week_of_year", "header": "['module', '___EOS___']", "index": 41 }, { "content": "def _check_struct_time(t):\n mm = t[1]\n if mm == 0: mm = 1\n if -1 > mm > 13: raise ValueError(\"month out of range\")\n \n dd = t[2]\n if dd == 0: dd = 1\n if -1 > dd > 32: raise ValueError(\"day of month out of range\")\n \n hh = t[3]\n if -1 > hh > 24: raise ValueError(\"hour out of range\")\n \n minu = t[4]\n if -1 > minu > 60: raise ValueError(\"minute out of range\")\n \n ss = t[5]\n if -1 > ss > 62: raise ValueError(\"seconds out of range\")\n \n wd = t[6] % 7\n if wd < -2: raise ValueError(\"day of week out of range\")\n \n dy = t[7]\n if dy == 0: dy = 1\n if -1 > dy > 367: raise ValueError(\"day of year out of range\")\n \n return t[0], mm, dd, hh, minu, ss, wd, dy, t[-1]", "metadata": "root._check_struct_time", "header": "['module', '___EOS___']", "index": 68 }, { "content": "def _is_dst(secs = None):\n \"Check if data has daylight saving time\"\n d = date()\n if secs is not None:\n d = date(secs*1000)\n # calculate if we are in daylight savings time or not.\n # borrowed from http://stackoverflow.com/questions/11887934/check-if-daylight-saving-time-is-in-effect-and-if-it-is-for-how-many-hours\n jan = date(d.getFullYear(), 0, 1)\n jul = date(d.getFullYear(), 6, 1)\n dst = int(d.getTimezoneOffset() < max(abs(jan.getTimezoneOffset()), abs(jul.getTimezoneOffset())))\n return dst", "metadata": "root._is_dst", "header": "['module', '___EOS___']", "index": 96 }, { "content": "def _get_tzname():\n \"check if timezone is available, if not return a tuple of empty str\"\n d = date()\n d = d.toTimeString()\n try:\n d = d.split('(')[1].split(')')[0]\n return (d, 'NotAvailable')\n except:\n return ('', '')", "metadata": "root._get_tzname", "header": "['module', '___EOS___']", "index": 108 }, { "content": "def _set_altzone():\n d = date()\n jan = date(d.getFullYear(), 0, 1)\n jul = date(d.getFullYear(), 6, 1)\n result = timezone - (jan.getTimezoneOffset() - jul.getTimezoneOffset()) * 60\n return result", "metadata": "root._set_altzone", "header": "['module', '___EOS___']", "index": 118 }, { "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 }, { "content": "def asctime(t = None):\n weekdays = {0: \"Mon\", 1: \"Tue\", 2: \"Wed\", 3: \"Thu\", \n 4: \"Fri\", 5: \"Sat\", 6: \"Sun\"}\n months = {1:'Jan',2:'Feb',3:'Mar',4:'Apr',5:'May',6:'Jun',\n 7:'Jul',8:'Aug',9:'Sep',10:'Oct',11:'Nov',12:'Dec'}\n \n t = _check_input(t)\n t = _check_struct_time(t)\n \n result = \"%s %s %2d %02d:%02d:%02d %d\" % (\n weekdays[t[6]], months[t[1]], t[2], t[3], t[4], t[5], t[0])\n return result", "metadata": "root.asctime", "header": "['module', '___EOS___']", "index": 150 }, { "content": "def ctime(timestamp=None):\n if timestamp is None:\n timestamp = date().getTime() / 1000.\n d = date(0)\n d.setUTCSeconds(timestamp)\n jan = date(d.getFullYear(), 0, 1)\n jul = date(d.getFullYear(), 6, 1)\n dst = int(d.getTimezoneOffset() < max(jan.getTimezoneOffset(), jul.getTimezoneOffset()))\n d = date(0)\n d.setUTCSeconds(timestamp + (1 + dst) * 3600)\n weekdays = {1: \"Mon\", 2: \"Tue\", 3: \"Wed\", 4: \"Thu\", \n 5: \"Fri\", 6: \"Sat\", 0: \"Sun\"}\n months = {0:'Jan',1:'Feb',2:'Mar',3:'Apr',4:'May',5:'Jun',\n 6:'Jul',7:'Aug',8:'Sep',9:'Oct',10:'Nov',11:'Dec'}\n result = \"%s %s %2d %02d:%02d:%02d %d\" % (weekdays[d.getUTCDay()],\n months[d.getUTCMonth()], d.getUTCDate(),\n d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), \n d.getUTCFullYear())\n return result", "metadata": "root.ctime", "header": "['module', '___EOS___']", "index": 163 }, { "content": "def gmtime(secs = None):\n d = date()\n if secs is not None:\n d = date(secs*1000)\n wday = d.getUTCDay() - 1 if d.getUTCDay() - 1 >= 0 else 6\n tmp = struct_time([d.getUTCFullYear(), \n d.getUTCMonth()+1, d.getUTCDate(),\n d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(),\n wday, 0, 0])\n tmp.args[7] = _get_day_of_year(tmp.args)\n return tmp", "metadata": "root.gmtime", "header": "['module', '___EOS___']", "index": 183 }, { "content": "def localtime(secs = None):\n d = date()\n if secs is not None:\n d = date(secs * 1000)\n dst = _is_dst(secs)\n wday = d.getDay() - 1 if d.getDay() - 1 >= 0 else 6\n tmp = struct_time([d.getFullYear(), \n d.getMonth()+1, d.getDate(),\n d.getHours(), d.getMinutes(), d.getSeconds(),\n wday, 0, dst])\n tmp.args[7] = _get_day_of_year(tmp.args)\n return tmp", "metadata": "root.localtime", "header": "['module', '___EOS___']", "index": 195 }, { "content": "def mktime(t):\n if isinstance(t, struct_time):\n d1 = date(t.tm_year, t.tm_mon - 1, t.tm_mday, \n t.tm_hour, t.tm_min, t.tm_sec, 0).getTime()\n elif isinstance(t, tuple):\n d1 = date(t[0], t[1] - 1, t[2], t[3], t[4], t[5], 0).getTime()\n else:\n raise ValueError(\"Tuple or struct_time argument required\")\n d2 = date(0).getTime()\n return (d1 - d2) / 1000.", "metadata": "root.mktime", "header": "['module', '___EOS___']", "index": 208 }, { "content": "def monotonic():\n return javascript.JSObject(window.performance.now)()/1000.", "metadata": "root.monotonic", "header": "['module', '___EOS___']", "index": 219 }, { "content": "def perf_counter():\n return float(date().getTime()/1000.0)", "metadata": "root.perf_counter", "header": "['module', '___EOS___']", "index": 222 }, { "content": "def time():\n return float(date().getTime()/1000)", "metadata": "root.time", "header": "['module', '___EOS___']", "index": 225 }, { "content": "def sleep(secs):\n start = date().getTime()\n while date().getTime() - start < secs * 1000.:\n pass", "metadata": "root.sleep", "header": "['module', '___EOS___']", "index": 228 }, { "content": "def strftime(_format,t = None):\n \n def ns(t,nb):\n # left padding with 0\n res = str(t)\n while len(res)<nb:\n res = '0'+res\n return res\n\n t = _check_input(t) \n t = _check_struct_time(t)\n \n YY = ns(t[0],4)\n yy = ns(t[0],4)[2:]\n mm = ns(t[1],2)\n dd = ns(t[2],2)\n HH = t[3]\n HH24 = ns(HH,2)\n HH12 = ns(HH % 12,2)\n if HH12 == 0:HH12 = 12\n AMPM = 'AM' if 0 <= HH < 12 else 'PM'\n MM = ns(t[4],2)\n SS = ns(t[5],2)\n DoY = ns(t[7],3)\n w = t[6] + 1 if t[6] < 6 else 0\n W = ns(_get_week_of_year(t),2)\n \n abb_weekdays = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']\n full_weekdays = ['Sunday','Monday','Tuesday','Wednesday',\n 'Thursday','Friday','Saturday']\n abb_months = ['Jan','Feb','Mar','Apr','May','Jun',\n 'Jul','Aug','Sep','Oct','Nov','Dec']\n full_months = ['January','February','March','April','May','June',\n 'July','August','September','October','November','December']\n\n res = _format\n res = res.replace(\"%H\",HH24)\n res = res.replace(\"%I\",HH12)\n res = res.replace(\"%p\",AMPM)\n res = res.replace(\"%M\",MM)\n res = res.replace(\"%S\",SS)\n res = res.replace(\"%Y\",YY)\n res = res.replace(\"%y\",yy)\n res = res.replace(\"%m\",mm)\n res = res.replace(\"%d\",dd)\n res = res.replace(\"%a\",abb_weekdays[w])\n res = res.replace(\"%A\",full_weekdays[w])\n res = res.replace(\"%b\",abb_months[int(mm)-1])\n res = res.replace(\"%B\",full_months[int(mm)-1])\n res = res.replace(\"%j\", DoY)\n res = res.replace(\"%w\", str(w))\n res = res.replace(\"%W\", W)\n res = res.replace(\"%x\", mm+'/'+dd+'/'+yy)\n res = res.replace(\"%X\", HH24+':'+MM+':'+SS)\n res = res.replace(\"%c\", abb_weekdays[w]+' '+abb_months[int(mm)-1]+\n ' '+dd+' '+HH24+':'+MM+':'+SS+' '+YY)\n res = res.replace(\"%%\", '%')\n \n return res", "metadata": "root.strftime", "header": "['module', '___EOS___']", "index": 233 }, { "content": "class struct_time:\n\n \n\n \n \n \n \n\n\n\n\n\n\n", "metadata": "root.struct_time", "header": "['module', '___EOS___']", "index": 293 }, { "content": " def __init__(self, args):\n \n if len(args)!=9:\n raise TypeError(\"time.struct_time() takes a 9-sequence (%s-sequence given)\" %len(args))\n \n self.args = args", "metadata": "root.struct_time.__init__", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 295 }, { "content": " @property\n def tm_year(self):\n return self.args[0]", "metadata": "root.struct_time.tm_year", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 302 }, { "content": " @property\n def tm_mon(self):\n return self.args[1]", "metadata": "root.struct_time.tm_mon", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 306 }, { "content": " @property\n def tm_mday(self):\n return self.args[2]", "metadata": "root.struct_time.tm_mday", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 310 }, { "content": " @property\n def tm_hour(self):\n return self.args[3]", "metadata": "root.struct_time.tm_hour", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 314 }, { "content": " @property\n def tm_min(self):\n return self.args[4]", "metadata": "root.struct_time.tm_min", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 318 }, { "content": " @property\n def tm_sec(self):\n return self.args[5]", "metadata": "root.struct_time.tm_sec", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 322 }, { "content": " @property\n def tm_wday(self):\n return self.args[6]", "metadata": "root.struct_time.tm_wday", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 326 }, { "content": " @property\n def tm_yday(self):\n return self.args[7]", "metadata": "root.struct_time.tm_yday", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 330 }, { "content": " @property\n def tm_isdst(self):\n return self.args[8]", "metadata": "root.struct_time.tm_isdst", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 334 }, { "content": " def __getitem__(self, i):\n return self.args[i]", "metadata": "root.struct_time.__getitem__", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 338 }, { "content": " def __iter__(self):\n return iter(self.args)", "metadata": "root.struct_time.__iter__", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 341 }, { "content": " def __repr__(self):\n return (\"time.structime(tm_year={}, tm_mon={}, tm_day={}, \"+\\\n \"tm_hour={}, tm_min={}, tm_sec={}, tm_wday={}, \"+\\\n \"tm_yday={}, tm_isdst={})\").format(*self.args)", "metadata": "root.struct_time.__repr__", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 344 }, { "content": " def __str__(self):\n return self.__repr__()", "metadata": "root.struct_time.__str__", "header": "['class', 'struct_time', ':', '___EOS___']", "index": 349 }, { "content": "def to_struct_time(*arg):\n arg = list(arg)\n # The tuple received from module _strptime has 7 elements, we must add\n # the rank of day in the year in the range [1, 366]\n ml = [31,28,31,30,31,30,31,31,30,31,30,31]\n if arg[0]%4==0:\n ml[1] += 1\n\n i=1\n yday=0\n while i<arg[1]:\n yday += ml[i-1]\n i += 1\n yday += arg[2]\n arg.append(yday)\n arg.append(-1)\n return struct_time(tuple(arg))", "metadata": "root.to_struct_time", "header": "['module', '___EOS___']", "index": 352 }, { "content": "def strptime(string, _format):\n import _strptime\n return _strptime._strptime_datetime(to_struct_time, string, _format)", "metadata": "root.strptime", "header": "['module', '___EOS___']", "index": 370 }, { "content": "def _clock_xx(url):\n raise NotImplementedError(_clock_msg % url)", "metadata": "root._clock_xx", "header": "['module', '___EOS___']", "index": 377 }, { "content": "def tzset():\n raise NotImplementedError()", "metadata": "root.tzset", "header": "['module', '___EOS___']", "index": 392 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "browser_", "import_", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "javascript", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "Javascript", " ", "Date", " ", "constructor_", "\\u\\u\\uNL\\u\\u\\u_", "date_", "=_", "javascript", "_", "._", "JS", "Constructor", "_", "(_", "window_", "._", "Date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "day", "light", " ", "=", " ", "0", " ", "#", " ", "fix", " ", "me", "..", " ", "return", "s", " ", "Non", " ", "zero", " ", "if", " ", "DST", " ", "timezon", "e", " ", "is", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Added", " ", "to", " ", "pass", " ", "some", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Are", " ", "there", " ", "timezon", "e", " ", "alw", "ay", "s", " ", "in", " ", "the", " ", "browse", "r", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", "'", "m", " ", "ass", "umi", "ng", " ", "we", " ", "don", "'", "t", " ", "have", " ", "alw", "ay", "s", " ", "this", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STR", "UCT", "\\u", "TM", "\\u", "ITEMS_", "=_", "9_", "\\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_", "##", " ", "Help", "er", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "##", " ", "end", " ", "of", " ", "help", "er", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Value", "s", " ", "depend", "ing", " ", "the", " ", "timezon", "e", " ", "of", " ", "the", " ", "browse", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "day", "light_", "=_", "\\u", "is", "\\u", "dst_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timezone_", "=_", "date_", "(_", ")_", "._", "get", "Timezone", "Offset_", "(_", ")_", "*_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tz", "name_", "=_", "\\u", "get", "\\u", "tz", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alt", "zone_", "=_", "\\u", "set\\u", "alt", "zone_", "(_", ")_", "if_", "day", "light_", "else_", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "the", " ", "clock", "\\u", "xx", " ", "machine", "ry", " ", "shou", "ld", "n", "'", "t", " ", "work", " ", "in", " ", "the", " ", "browse", "r", " ", "so", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "Impl", "ement", "ed", "Error", "s", " ", "or", " ", "message", "s", " ", "are", " ", "shown", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "clock", "\\u", "msg_", "=_", "\"\"\"", "Brows", "er", " ", "cann", "ot", " ", "access", " ", "CPU", ".", " ", "See", " ", "'%", "s", "'\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clock_", "=_", "lambda_", ":_", "\\u", "clock", "\\u", "xx_", "(_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "clock", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clock", "\\u", "getre", "s_", "=_", "lambda_", ":_", "\\u", "clock", "\\u", "xx_", "(_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "clock", "\\u", "getre", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clock", "\\u", "getti", "me_", "=_", "lambda_", ":_", "\\u", "clock", "\\u", "xx_", "(_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "clock", "\\u", "getti", "me", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clock", "\\u", "setti", "me_", "=_", "lambda_", ":_", "\\u", "clock", "\\u", "xx_", "(_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "clock", "\\u", "setti", "me", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CLOCK", "\\u", "HIGH", "RES", "_", "=_", "\\u", "clock", "\\u", "msg_", "%_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "CLOCK", "\\u", "HIGH", "RES", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CLOCK", "\\u", "MON", "OT", "ONI", "C_", "=_", "\\u", "clock", "\\u", "msg_", "%_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "CLOCK", "\\u", "MON", "OT", "ONI", "C", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CLOCK", "\\u", "MON", "OT", "ONI", "C", "\\u", "RAW_", "=_", "\\u", "clock", "\\u", "msg_", "%_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "CLOCK", "\\u", "MON", "OT", "ONI", "C", "\\u", "RA", "W", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CLOCK", "\\u", "PROCESS", "\\u", "CPU", "TIME", "\\u", "ID_", "=_", "\\u", "clock", "\\u", "msg_", "%_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "CLOCK", "\\u", "PROCESS", "\\u", "CPU", "TIME", "\\u", "ID", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CLOCK", "\\u", "REAL", "TIME_", "=_", "\\u", "clock", "\\u", "msg_", "%_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "CLOCK", "\\u", "REAL", "TIME", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CLOCK", "\\u", "THREAD", "\\u", "CPU", "TIME", "\\u", "ID_", "=_", "\\u", "clock", "\\u", "msg_", "%_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "CLOCK", "\\u", "THREAD", "\\u", "CPU", "TIME", "\\u", "ID", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "clock", "\\u", "info_", "=_", "lambda_", ":_", "\\u", "clock", "\\u", "xx_", "(_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "get", "\\u", "clock", "\\u", "info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "time_", "=_", "lambda_", ":_", "\\u", "clock", "\\u", "xx_", "(_", "\"", "https", "://", "docs", ".", "python", ".", "org", "/", "3", "/", "librar", "y", "/", "time", ".", "html", "#", "time", ".", "process", "\\u", "time", "\"_", ")_", "\\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_", "\\u", "get", "\\u", "day", "\\u", "of", "\\u", "year_", "(_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "day", " ", "position", " ", "in", " ", "the", " ", "year", " ", "startin", "g", " ", "from", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "arg", " ", ":", " ", "tuple", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "int", " ", "with", " ", "the", " ", "correct", " ", "day", " ", "of", " ", "the", " ", "year", " ", "startin", "g", " ", "from", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ml_", "=_", "[_", "31_", ",_", "28_", ",_", "31_", ",_", "30_", ",_", "31_", ",_", "30_", ",_", "31_", ",_", "31_", ",_", "30_", ",_", "31_", ",_", "30_", ",_", "31_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arg_", "[_", "0_", "]_", "%_", "4_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ml_", "[_", "1_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yda", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "arg_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yda", "y_", "+=_", "ml_", "[_", "i_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yda", "y_", "+=_", "arg_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "yda", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "week", "\\u", "of", "\\u", "year_", "(_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "week", " ", "position", " ", "in", " ", "the", " ", "year", " ", "startin", "g", " ", "from", " ", "0.", " ", "All", " ", "day", "s", " ", "in", " ", "a", " ", "new", " ", "\\", "10", ";", " ", " ", " ", " ", "year", " ", "preceding", " ", "the", " ", "first", " ", "Mon", "day", " ", "are", " ", "consider", "ed", " ", "to", " ", "be", " ", "in", " ", "week", " ", "0.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "arg", " ", ":", " ", "tuple", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "int", " ", "with", " ", "the", " ", "correct", " ", "iso", " ", "week", " ", "(", "week", "s", " ", "startin", "g", " ", "on", " ", "Mon", "day", ")", " ", "of", " ", "the", " ", "year", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d1_", "=_", "date_", "(_", "arg_", "[_", "0_", "]_", ",_", "arg_", "[_", "1_", "]_", "-_", "1_", ",_", "arg_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d0_", "=_", "date_", "(_", "arg_", "[_", "0_", "]_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "day_", "=_", "d0_", "._", "get", "Day_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "first", "day_", "==_", "0_", ":_", "first", "day_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "week_", "=_", "8_", "-_", "first", "day_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "y_", "=_", "arg_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "first", "day_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "do", "y_", "=_", "do", "y_", "-_", "first", "week_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "do", "y_", "%_", "7_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "week", "\\u", "number_", "=_", "do", "y_", "//_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "week", "\\u", "number_", "=_", "do", "y_", "//_", "7_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "week", "\\u", "number_", "\\u\\u\\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", "check", "\\u", "struct", "\\u", "time_", "(_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mm_", "=_", "t_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mm_", "==_", "0_", ":_", "mm_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "-_", "1_", ">_", "mm_", ">_", "13_", ":_", "raise_", "Value", "Error_", "(_", "\"", "month", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dd_", "=_", "t_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dd_", "==_", "0_", ":_", "dd_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "-_", "1_", ">_", "dd_", ">_", "32_", ":_", "raise_", "Value", "Error_", "(_", "\"", "day", " ", "of", " ", "month", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hh_", "=_", "t_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "-_", "1_", ">_", "hh_", ">_", "24_", ":_", "raise_", "Value", "Error_", "(_", "\"", "hour", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "minu", "_", "=_", "t_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "-_", "1_", ">_", "minu", "_", ">_", "60_", ":_", "raise_", "Value", "Error_", "(_", "\"", "minute", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ss_", "=_", "t_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "-_", "1_", ">_", "ss_", ">_", "62_", ":_", "raise_", "Value", "Error_", "(_", "\"", "second", "s", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wd_", "=_", "t_", "[_", "6_", "]_", "%_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wd_", "<_", "-_", "2_", ":_", "raise_", "Value", "Error_", "(_", "\"", "day", " ", "of", " ", "week", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dy_", "=_", "t_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dy_", "==_", "0_", ":_", "dy_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "-_", "1_", ">_", "dy_", ">_", "367", "_", ":_", "raise_", "Value", "Error_", "(_", "\"", "day", " ", "of", " ", "year", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "t_", "[_", "0_", "]_", ",_", "mm_", ",_", "dd_", ",_", "hh_", ",_", "minu", "_", ",_", "ss_", ",_", "wd_", ",_", "dy_", ",_", "t_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "is", "\\u", "dst_", "(_", "secs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Check", " ", "if", " ", "data", " ", "has", " ", "day", "light", " ", "saving", " ", "time", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "secs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "date_", "(_", "secs_", "*_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "if", " ", "we", " ", "are", " ", "in", " ", "day", "light", " ", "saving", "s", " ", "time", " ", "or", " ", "not", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "borrow", "ed", " ", "from", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "1188", "793", "4", "/", "check", "-", "if", "-", "day", "light", "-", "saving", "-", "time", "-", "is", "-", "in", "-", "effect", "-", "and", "-", "if", "-", "it", "-", "is", "-", "for", "-", "how", "-", "many", "-", "hours_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "jan", "_", "=_", "date_", "(_", "d_", "._", "get", "Full", "Year_", "(_", ")_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "_", "=_", "date_", "(_", "d_", "._", "get", "Full", "Year_", "(_", ")_", ",_", "6_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst_", "=_", "int_", "(_", "d_", "._", "get", "Timezone", "Offset_", "(_", ")_", "<_", "max_", "(_", "abs_", "(_", "jan", "_", "._", "get", "Timezone", "Offset_", "(_", ")_", ")_", ",_", "abs_", "(_", "jul", "_", "._", "get", "Timezone", "Offset_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dst_", "\\u\\u\\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", "tz", "name_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "check", " ", "if", " ", "timezon", "e", " ", "is", " ", "avail", "able", ",", " ", "if", " ", "not", " ", "return", " ", "a", " ", "tuple", " ", "of", " ", "empty", " ", "str", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "d_", "._", "to", "Time", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "d_", "._", "split_", "(_", "'('_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "')'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "d_", ",_", "'", "Not", "Avail", "able", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "''_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "alt", "zone_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jan", "_", "=_", "date_", "(_", "d_", "._", "get", "Full", "Year_", "(_", ")_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "_", "=_", "date_", "(_", "d_", "._", "get", "Full", "Year_", "(_", ")_", ",_", "6_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "timezone_", "-_", "(_", "jan", "_", "._", "get", "Timezone", "Offset_", "(_", ")_", "-_", "jul", "_", "._", "get", "Timezone", "Offset_", "(_", ")_", ")_", "*_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "asc", "time_", "(_", "t_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "weekday", "s_", "=_", "{_", "0_", ":_", "\"", "Mon", "\"_", ",_", "1_", ":_", "\"", "Tu", "e", "\"_", ",_", "2_", ":_", "\"", "We", "d", "\"_", ",_", "3_", ":_", "\"", "Thu", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "\"", "Fri", "\"_", ",_", "5_", ":_", "\"", "Sat", "\"_", ",_", "6_", ":_", "\"", "Sun", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "months_", "=_", "{_", "1_", ":_", "'", "Jan", "'_", ",_", "2_", ":_", "'", "Fe", "b", "'_", ",_", "3_", ":_", "'", "Mar", "'_", ",_", "4_", ":_", "'", "Ap", "r", "'_", ",_", "5_", ":_", "'", "Ma", "y", "'_", ",_", "6_", ":_", "'", "Jun", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "7_", ":_", "'", "Ju", "l", "'_", ",_", "8_", ":_", "'", "Au", "g", "'_", ",_", "9_", ":_", "'", "Se", "p", "'_", ",_", "10_", ":_", "'", "Oct", "'_", ",_", "11_", ":_", "'", "Nov", "'_", ",_", "12_", ":_", "'", "De", "c", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "\\u", "check", "\\u", "input_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "\\u", "check", "\\u", "struct", "\\u", "time_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "\"%", "s", " ", "%", "s", " ", "%", "2d", " ", "%", "02", "d", ":", "%", "02", "d", ":", "%", "02", "d", " ", "%", "d", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "weekday", "s_", "[_", "t_", "[_", "6_", "]_", "]_", ",_", "months_", "[_", "t_", "[_", "1_", "]_", "]_", ",_", "t_", "[_", "2_", "]_", ",_", "t_", "[_", "3_", "]_", ",_", "t_", "[_", "4_", "]_", ",_", "t_", "[_", "5_", "]_", ",_", "t_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ctime_", "(_", "timestamp_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "timestamp_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp_", "=_", "date_", "(_", ")_", "._", "get", "Time_", "(_", ")_", "/_", "1000._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "date_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "set", "UT", "CS", "econd", "s_", "(_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jan", "_", "=_", "date_", "(_", "d_", "._", "get", "Full", "Year_", "(_", ")_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jul", "_", "=_", "date_", "(_", "d_", "._", "get", "Full", "Year_", "(_", ")_", ",_", "6_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst_", "=_", "int_", "(_", "d_", "._", "get", "Timezone", "Offset_", "(_", ")_", "<_", "max_", "(_", "jan", "_", "._", "get", "Timezone", "Offset_", "(_", ")_", ",_", "jul", "_", "._", "get", "Timezone", "Offset_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "date_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "set", "UT", "CS", "econd", "s_", "(_", "timestamp_", "+_", "(_", "1_", "+_", "dst_", ")_", "*_", "3600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weekday", "s_", "=_", "{_", "1_", ":_", "\"", "Mon", "\"_", ",_", "2_", ":_", "\"", "Tu", "e", "\"_", ",_", "3_", ":_", "\"", "We", "d", "\"_", ",_", "4_", ":_", "\"", "Thu", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "\"", "Fri", "\"_", ",_", "6_", ":_", "\"", "Sat", "\"_", ",_", "0_", ":_", "\"", "Sun", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "months_", "=_", "{_", "0_", ":_", "'", "Jan", "'_", ",_", "1_", ":_", "'", "Fe", "b", "'_", ",_", "2_", ":_", "'", "Mar", "'_", ",_", "3_", ":_", "'", "Ap", "r", "'_", ",_", "4_", ":_", "'", "Ma", "y", "'_", ",_", "5_", ":_", "'", "Jun", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "6_", ":_", "'", "Ju", "l", "'_", ",_", "7_", ":_", "'", "Au", "g", "'_", ",_", "8_", ":_", "'", "Se", "p", "'_", ",_", "9_", ":_", "'", "Oct", "'_", ",_", "10_", ":_", "'", "Nov", "'_", ",_", "11_", ":_", "'", "De", "c", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "\"%", "s", " ", "%", "s", " ", "%", "2d", " ", "%", "02", "d", ":", "%", "02", "d", ":", "%", "02", "d", " ", "%", "d", "\"_", "%_", "(_", "weekday", "s_", "[_", "d_", "._", "get", "UT", "CD", "ay_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "months_", "[_", "d_", "._", "get", "UT", "CM", "ont", "h_", "(_", ")_", "]_", ",_", "d_", "._", "get", "UT", "CD", "ate_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "get", "UT", "CH", "ours", "_", "(_", ")_", ",_", "d_", "._", "get", "UT", "CM", "inu", "tes_", "(_", ")_", ",_", "d_", "._", "get", "UT", "CS", "econd", "s_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "get", "UT", "CF", "ull", "Year_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gmtime_", "(_", "secs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "secs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "date_", "(_", "secs_", "*_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wda", "y_", "=_", "d_", "._", "get", "UT", "CD", "ay_", "(_", ")_", "-_", "1_", "if_", "d_", "._", "get", "UT", "CD", "ay_", "(_", ")_", "-_", "1_", ">=_", "0_", "else_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "struct", "\\u", "time_", "(_", "[_", "d_", "._", "get", "UT", "CF", "ull", "Year_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "get", "UT", "CM", "ont", "h_", "(_", ")_", "+_", "1_", ",_", "d_", "._", "get", "UT", "CD", "ate_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "get", "UT", "CH", "ours", "_", "(_", ")_", ",_", "d_", "._", "get", "UT", "CM", "inu", "tes_", "(_", ")_", ",_", "d_", "._", "get", "UT", "CS", "econd", "s_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wda", "y_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "._", "args_", "[_", "7_", "]_", "=_", "\\u", "get", "\\u", "day", "\\u", "of", "\\u", "year_", "(_", "tmp_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tmp_", "\\u\\u\\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_", "localtime_", "(_", "secs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "secs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "date_", "(_", "secs_", "*_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dst_", "=_", "\\u", "is", "\\u", "dst_", "(_", "secs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wda", "y_", "=_", "d_", "._", "get", "Day_", "(_", ")_", "-_", "1_", "if_", "d_", "._", "get", "Day_", "(_", ")_", "-_", "1_", ">=_", "0_", "else_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "struct", "\\u", "time_", "(_", "[_", "d_", "._", "get", "Full", "Year_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "get", "Month_", "(_", ")_", "+_", "1_", ",_", "d_", "._", "get", "Date_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "get", "Hour", "s_", "(_", ")_", ",_", "d_", "._", "get", "Minute", "s_", "(_", ")_", ",_", "d_", "._", "get", "Seconds_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wda", "y_", ",_", "0_", ",_", "dst_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "._", "args_", "[_", "7_", "]_", "=_", "\\u", "get", "\\u", "day", "\\u", "of", "\\u", "year_", "(_", "tmp_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tmp_", "\\u\\u\\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_", "mktime_", "(_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "t_", ",_", "struct", "\\u", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d1_", "=_", "date_", "(_", "t_", "._", "tm", "\\u", "year_", ",_", "t_", "._", "tm", "\\u", "mon_", "-_", "1_", ",_", "t_", "._", "tm", "\\u", "mda", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "._", "tm", "\\u", "hour_", ",_", "t_", "._", "tm", "\\u", "min_", ",_", "t_", "._", "tm", "\\u", "sec_", ",_", "0_", ")_", "._", "get", "Time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "t_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d1_", "=_", "date_", "(_", "t_", "[_", "0_", "]_", ",_", "t_", "[_", "1_", "]_", "-_", "1_", ",_", "t_", "[_", "2_", "]_", ",_", "t_", "[_", "3_", "]_", ",_", "t_", "[_", "4_", "]_", ",_", "t_", "[_", "5_", "]_", ",_", "0_", ")_", "._", "get", "Time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Tup", "le", " ", "or", " ", "struct", "\\u", "time", " ", "argu", "ment", " ", "require", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d2_", "=_", "date_", "(_", "0_", ")_", "._", "get", "Time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "d1_", "-_", "d2_", ")_", "/_", "1000._", "\\u\\u\\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_", "monotonic", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "javascript", "_", "._", "JSO", "bject_", "(_", "window_", "._", "performance_", "._", "now_", ")_", "(_", ")_", "/_", "1000._", "\\u\\u\\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_", "perf", "\\u", "counter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "date_", "(_", ")_", "._", "get", "Time_", "(_", ")_", "/_", "1000.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_", "time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "date_", "(_", ")_", "._", "get", "Time_", "(_", ")_", "/_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sleep_", "(_", "secs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "date_", "(_", ")_", "._", "get", "Time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "date_", "(_", ")_", "._", "get", "Time_", "(_", ")_", "-_", "start_", "<_", "secs_", "*_", "1000._", ":_", "\\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_", "strftime_", "(_", "\\u", "format_", ",_", "t_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "ns_", "(_", "t_", ",_", "nb_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "left", " ", "padd", "ing", " ", "with", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "str_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "res_", ")_", "<_", "nb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "'", "0", "'_", "+_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "\\u", "check", "\\u", "input_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "\\u", "check", "\\u", "struct", "\\u", "time_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "YY", "_", "=_", "ns_", "(_", "t_", "[_", "0_", "]_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yy_", "=_", "ns_", "(_", "t_", "[_", "0_", "]_", ",_", "4_", ")_", "[_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mm_", "=_", "ns_", "(_", "t_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dd_", "=_", "ns_", "(_", "t_", "[_", "2_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HH", "_", "=_", "t_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HH", "24_", "=_", "ns_", "(_", "HH", "_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HH", "12_", "=_", "ns_", "(_", "HH", "_", "%_", "12_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "HH", "12_", "==_", "0_", ":_", "HH", "12_", "=_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AMP", "M_", "=_", "'", "AM", "'_", "if_", "0_", "<=_", "HH", "_", "<_", "12_", "else_", "'", "PM", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MM_", "=_", "ns_", "(_", "t_", "[_", "4_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS_", "=_", "ns_", "(_", "t_", "[_", "5_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Do", "Y_", "=_", "ns_", "(_", "t_", "[_", "7_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "t_", "[_", "6_", "]_", "+_", "1_", "if_", "t_", "[_", "6_", "]_", "<_", "6_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "ns_", "(_", "\\u", "get", "\\u", "week", "\\u", "of", "\\u", "year_", "(_", "t_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "abb", "\\u", "weekday", "s_", "=_", "[_", "'", "Sun", "'_", ",_", "'", "Mon", "'_", ",_", "'", "Tu", "e", "'_", ",_", "'", "We", "d", "'_", ",_", "'", "Thu", "'_", ",_", "'", "Fri", "'_", ",_", "'", "Sat", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "weekday", "s_", "=_", "[_", "'", "Sun", "day", "'_", ",_", "'", "Mon", "day", "'_", ",_", "'", "Tu", "esd", "ay", "'_", ",_", "'", "We", "dnes", "day", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Thu", "rsd", "ay", "'_", ",_", "'", "Fri", "day", "'_", ",_", "'", "Satur", "day", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abb", "\\u", "months_", "=_", "[_", "'", "Jan", "'_", ",_", "'", "Fe", "b", "'_", ",_", "'", "Mar", "'_", ",_", "'", "Ap", "r", "'_", ",_", "'", "Ma", "y", "'_", ",_", "'", "Jun", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ju", "l", "'_", ",_", "'", "Au", "g", "'_", ",_", "'", "Se", "p", "'_", ",_", "'", "Oct", "'_", ",_", "'", "Nov", "'_", ",_", "'", "De", "c", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "months_", "=_", "[_", "'", "Januar", "y", "'_", ",_", "'", "Fe", "bru", "ary", "'_", ",_", "'", "March", "'_", ",_", "'", "Apri", "l", "'_", ",_", "'", "Ma", "y", "'_", ",_", "'", "Jun", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ju", "ly", "'_", ",_", "'", "August", "'_", ",_", "'", "Sept", "ember", "'_", ",_", "'", "Oct", "obe", "r", "'_", ",_", "'", "Nove", "mber", "'_", ",_", "'", "Dece", "mber", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "H", "\"_", ",_", "HH", "24_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "I", "\"_", ",_", "HH", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "p", "\"_", ",_", "AMP", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "M", "\"_", ",_", "MM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "S", "\"_", ",_", "SS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "Y", "\"_", ",_", "YY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "y", "\"_", ",_", "yy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "m", "\"_", ",_", "mm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "d", "\"_", ",_", "dd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "a", "\"_", ",_", "abb", "\\u", "weekday", "s_", "[_", "w_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "A", "\"_", ",_", "full", "\\u", "weekday", "s_", "[_", "w_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "b", "\"_", ",_", "abb", "\\u", "months_", "[_", "int_", "(_", "mm_", ")_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "B", "\"_", ",_", "full", "\\u", "months_", "[_", "int_", "(_", "mm_", ")_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "j", "\"_", ",_", "Do", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "w", "\"_", ",_", "str_", "(_", "w_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "W", "\"_", ",_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "x", "\"_", ",_", "mm_", "+_", "'/'_", "+_", "dd_", "+_", "'/'_", "+_", "yy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "X", "\"_", ",_", "HH", "24_", "+_", "':'_", "+_", "MM_", "+_", "':'_", "+_", "SS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%", "c", "\"_", ",_", "abb", "\\u", "weekday", "s_", "[_", "w_", "]_", "+_", "'", " ", "'_", "+_", "abb", "\\u", "months_", "[_", "int_", "(_", "mm_", ")_", "-_", "1_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "'_", "+_", "dd_", "+_", "'", " ", "'_", "+_", "HH", "24_", "+_", "':'_", "+_", "MM_", "+_", "':'_", "+_", "SS_", "+_", "'", " ", "'_", "+_", "YY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "res_", "._", "replace_", "(_", "\"%%", "\"_", ",_", "'%'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "struct", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "struct", "\\u", "time_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "!=_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "time", ".", "struct", "\\u", "time", "()", " ", "take", "s", " ", "a", " ", "9", "-", "sequence", " ", "(%", "s", "-", "sequence", " ", "give", "n", ")\"_", "%_", "len_", "(_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\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_", "tm", "\\u", "year_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\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_", "tm", "\\u", "mon_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "args_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\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_", "tm", "\\u", "mda", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "args_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\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_", "tm", "\\u", "hour_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "args_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\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_", "tm", "\\u", "min_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "args_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\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_", "tm", "\\u", "sec_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "args_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\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_", "tm", "\\u", "wda", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "args_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\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_", "tm", "\\u", "yda", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "args_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\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_", "tm", "\\u", "isd", "st_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "args_", "[_", "8_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\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_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "args_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "self_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\"", "time", ".", "struct", "ime", "(", "tm", "\\u", "year", "={}", ",", " ", "tm", "\\u", "mon", "={}", ",", " ", "tm", "\\u", "day", "={}", ",", " ", "\"_", "+_", "\"", "tm", "\\u", "hour", "={}", ",", " ", "tm", "\\u", "min", "={}", ",", " ", "tm", "\\u", "sec", "={}", ",", " ", "tm", "\\u", "wda", "y", "={}", ",", " ", "\"_", "+_", "\"", "tm", "\\u", "yda", "y", "={}", ",", " ", "tm", "\\u", "isd", "st", "={}", ")\"_", ")_", "._", "format_", "(_", "*_", "self_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "struct", "\\u", "time_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "repr\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "struct", "\\u", "time_", "(_", "*_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg_", "=_", "list_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "tuple", " ", "receive", "d", " ", "from", " ", "module", " ", "\\u", "strp", "time", " ", "has", " ", "7", " ", "element", "s", ",", " ", "we", " ", "must", " ", "add_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "rank", " ", "of", " ", "day", " ", "in", " ", "the", " ", "year", " ", "in", " ", "the", " ", "range", " ", "[", "1", ",", " ", "366", "]_", "\\u\\u\\uNL\\u\\u\\u_", "ml_", "=_", "[_", "31_", ",_", "28_", ",_", "31_", ",_", "30_", ",_", "31_", ",_", "30_", ",_", "31_", ",_", "31_", ",_", "30_", ",_", "31_", ",_", "30_", ",_", "31_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arg_", "[_", "0_", "]_", "%_", "4_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ml_", "[_", "1_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yda", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "arg_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yda", "y_", "+=_", "ml_", "[_", "i_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yda", "y_", "+=_", "arg_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg_", "._", "append_", "(_", "yda", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg_", "._", "append_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "struct", "\\u", "time_", "(_", "tuple_", "(_", "arg_", ")_", ")_", "\\u\\u\\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_", "strptime_", "(_", "string_", ",_", "\\u", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u", "strptime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "strptime_", "._", "\\u", "strp", "time", "\\u", "datetime_", "(_", "to", "\\u", "struct", "\\u", "time_", ",_", "string_", ",_", "\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "clock", "\\u", "xx_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\\u", "clock", "\\u", "msg_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "tz", "set_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
ringcentral/ringcentral-python/ringcentral/sdk.py
[ { "content": " def create_subscription(self):\n return Subscription(self._platform, self._pubnub_factory)", "metadata": "root.SDK.create_subscription", "header": "['class', 'SDK', ':', '___EOS___']", "index": 24 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "SD", "K_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "subscription_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Subscription_", "(_", "self_", "._", "\\u", "platform_", ",_", "self_", "._", "\\u", "pub", "nu", "b", "\\u", "factory_", ")_" ]
[ 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 ]
Unused local variable
getredash/redash/redash/query_runner/big_query.py
[ { "content": " def run_query(self, query):\n logger.debug(\"BigQuery got query: %s\", query)\n\n bigquery_service = self._get_bigquery_service()\n jobs = bigquery_service.jobs()\n\n try:\n if \"totalMBytesProcessedLimit\" in self.configuration:\n limitMB = self.configuration[\"totalMBytesProcessedLimit\"]\n processedMB = self._get_total_bytes_processed(jobs, query) / 1000.0 / 1000.0\n if limitMB < processedMB:\n return None, \"Larger than %d MBytes will be processed (%f MBytes)\" % (limitMB, processedMB)\n\n data = self._get_query_result(jobs, query)\n error = None\n\n json_data = json.dumps(data, cls=JSONEncoder)\n except apiclient.errors.HttpError, e:\n json_data = None\n if e.resp.status == 400:\n error = json.loads(e.content)['error']['message']\n else:\n error = e.content\n except KeyboardInterrupt:\n error = \"Query cancelled by user.\"\n json_data = None\n except Exception:\n raise sys.exc_info()[1], None, sys.exc_info()[2]\n\n return json_data, error", "metadata": "root.BigQuery.run_query", "header": "['class', 'BigQuery', '(', 'BaseQueryRunner', ')', ':', '___EOS___']", "index": 172 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Big", "Query_", "(_", "Base", "Query", "Runner_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "query_", "(_", "self_", ",_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"", "Big", "Query", " ", "got", " ", "query", ":", " ", "%", "s", "\"_", ",_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "big", "query", "\\u", "service_", "=_", "self_", "._", "\\u", "get", "\\u", "big", "query", "\\u", "service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jobs_", "=_", "big", "query", "\\u", "service_", "._", "jobs_", "(_", ")_", "\\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_", "\"", "total", "MB", "ytes", "Processe", "d", "Limit", "\"_", "in_", "self_", "._", "configuration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit", "MB_", "=_", "self_", "._", "configuration_", "[_", "\"", "total", "MB", "ytes", "Processe", "d", "Limit", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "MB_", "=_", "self_", "._", "\\u", "get", "\\u", "total", "\\u", "bytes", "\\u", "processed_", "(_", "jobs_", ",_", "query_", ")_", "/_", "1000.0_", "/_", "1000.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "limit", "MB_", "<_", "process", "ed", "MB_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "None_", ",_", "\"", "Large", "r", " ", "than", " ", "%", "d", " ", "MB", "ytes", " ", "will", " ", "be", " ", "process", "ed", " ", "(%", "f", " ", "MB", "ytes", ")\"_", "%_", "(_", "limit", "MB_", ",_", "process", "ed", "MB_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "\\u", "get", "\\u", "query", "\\u", "result_", "(_", "jobs_", ",_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json", "\\u", "data_", "=_", "json_", "._", "dumps_", "(_", "data_", ",_", "cls_", "=_", "JSO", "NE", "ncode", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "apiclient_", "._", "errors_", "._", "Http", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "e_", "._", "resp_", "._", "status_", "==_", "400_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "json_", "._", "loads_", "(_", "e_", "._", "content_", ")_", "[_", "'", "error", "'_", "]_", "[_", "'", "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 ", " _", "error_", "=_", "e_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"", "Query", " ", "cancel", "led", " ", "by", " ", "user", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ",_", "None_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "\\u", "data_", ",_", "error_", "\\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 ]
Unused import
pantsbuild/pex/pex/compatibility.py
[ { "content": "# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\n# This file contains several 2.x/3.x compatibility checkstyle violations for a reason\n# checkstyle: noqa\n\nimport os\nfrom abc import ABCMeta\nfrom numbers import Integral, Real\nfrom sys import version_info as sys_version_info\n\n# TODO(wickman) Since the io package is available in 2.6.x, use that instead of\n# cStringIO/StringIO\ntry:\n # CPython 2.x\n from cStringIO import StringIO\nexcept ImportError:\n try:\n # Python 2.x\n from StringIO import StringIO\n except:\n # Python 3.x\n from io import StringIO\n from io import BytesIO\n\ntry:\n # Python 2.x\n from ConfigParser import ConfigParser\nexcept ImportError:\n # Python 3.x\n from configparser import ConfigParser\n\nAbstractClass = ABCMeta('AbstractClass', (object,), {})\nPY2 = sys_version_info[0] == 2\nPY3 = sys_version_info[0] == 3\nStringIO = StringIO\nBytesIO = BytesIO if PY3 else StringIO\n\ninteger = (Integral,)\nreal = (Real,)\nnumeric = integer + real\nstring = (str,) if PY3 else (str, unicode)\nbytes = (bytes,)\n\nif PY2:\nelse:\n\n_PY3_EXEC_FUNCTION = \"\"\"\ndef exec_function(ast, globals_map):\n locals_map = globals_map\n exec ast in globals_map, locals_map\n return locals_map\n\"\"\"\n\nif PY3:\nelse:\n eval(compile(_PY3_EXEC_FUNCTION, \"<exec_function>\", \"exec\"))\n\nif PY3:\n from contextlib import contextmanager, ExitStack\n\n\nelse:\n from contextlib import nested\n\n\nif PY3:\n from urllib.request import pathname2url, url2pathname\nelse:\n from urllib import pathname2url, url2pathname\n\n\nWINDOWS = os.name == 'nt'\n\n\n__all__ = (\n 'AbstractClass',\n 'BytesIO',\n 'ConfigParser',\n 'PY2',\n 'PY3',\n 'StringIO',\n 'WINDOWS',\n 'bytes',\n 'exec_function',\n 'nested',\n 'pathname2url',\n 'string',\n 'to_bytes',\n 'url2pathname',\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def to_bytes(st, encoding='utf-8'):\n if isinstance(st, unicode):\n return st.encode(encoding)\n elif isinstance(st, bytes):\n return st\n else:\n raise ValueError('Cannot convert %s to bytes' % type(st))", "metadata": "root.to_bytes", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def to_bytes(st, encoding='utf-8'):\n if isinstance(st, str):\n return st.encode(encoding)\n elif isinstance(st, bytes):\n return st\n else:\n raise ValueError('Cannot convert %s to bytes.' % type(st))", "metadata": "root.to_bytes", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def exec_function(ast, globals_map):\n locals_map = globals_map\n exec(ast, globals_map, locals_map)\n return locals_map", "metadata": "root.exec_function", "header": "['module', '___EOS___']", "index": 69 }, { "content": " @contextmanager\n def nested(*context_managers):\n enters = []\n with ExitStack() as stack:\n for manager in context_managers:\n enters.append(stack.enter_context(manager))\n yield tuple(enters)", "metadata": "root.nested", "header": "['module', '___EOS___']", "index": 79 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Pant", "s", " ", "project", " ", "contributor", "s", " ", "(", "see", " ", "CONTRIB", "UTO", "RS", ".", "md", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "see", " ", "LICENSE", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "contain", "s", " ", "sever", "al", " ", "2", ".", "x", "/", "3", ".", "x", " ", "compatibility", " ", "checks", "tyl", "e", " ", "violations", " ", "for", " ", "a", " ", "reason_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "checks", "tyl", "e", ":", " ", "no", "qa_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "abc_", "import_", "ABC", "Meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numbers_", "import_", "Integral_", ",_", "Real_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sys_", "import_", "version", "\\u", "info_", "as_", "sys", "\\u", "version", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "wic", "kma", "n", ")", " ", " ", "Sin", "ce", " ", "the", " ", "io", " ", "package", " ", "is", " ", "avail", "able", " ", "in", " ", "2.6", ".", "x", ",", " ", "use", " ", "tha", "t", " ", "inst", "ead", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "c", "String", "IO", "/", "String", "IO_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "CP", "yth", "on", " ", "2", ".", "x_", "\\u\\u\\uNL\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2", ".", "x_", "\\u\\u\\uNL\\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_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3", ".", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "io_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2", ".", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Config", "Parser_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3", ".", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "configparser_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Abstract", "Class_", "=_", "ABC", "Meta_", "(_", "'", "Abstract", "Class", "'_", ",_", "(_", "object_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PY", "2_", "=_", "sys", "\\u", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PY", "3_", "=_", "sys", "\\u", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "String", "IO_", "=_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Byte", "s", "IO_", "=_", "Byte", "s", "IO_", "if_", "PY", "3_", "else_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "integer_", "=_", "(_", "Integral_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "real_", "=_", "(_", "Real_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "numeric_", "=_", "integer_", "+_", "real_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "string_", "=_", "(_", "str_", ",_", ")_", "if_", "PY", "3_", "else_", "(_", "str_", ",_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes_", "=_", "(_", "bytes_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "PY", "3", "\\u", "EXEC", "\\u", "FUNCTION_", "=_", "\"\"\"", "\\", "10", ";", "def", " ", "exec", "\\u", "function", "(", "ast", ",", " ", "globals", "\\u", "map", "):", "\\", "10", ";", " ", " ", "locals", "\\u", "map", " ", "=", " ", "globals", "\\u", "map", "\\", "10", ";", " ", " ", "exec", " ", "ast", " ", "in", " ", "globals", "\\u", "map", ",", " ", "locals", "\\u", "map", "\\", "10", ";", " ", " ", "return", " ", "locals", "\\u", "map", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eval_", "(_", "compile_", "(_", "\\u", "PY", "3", "\\u", "EXEC", "\\u", "FUNCTION_", ",_", "\"<", "exec", "\\u", "function", ">\"_", ",_", "\"", "exec", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "contextlib_", "import_", "contextmanager_", ",_", "Exi", "t", "Stack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "contextlib_", "import_", "nested_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "._", "request_", "import_", "path", "name2", "url_", ",_", "url2", "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 ", " _", "from_", "urllib_", "import_", "path", "name2", "url_", ",_", "url2", "pathname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "WINDOWS", "_", "=_", "os_", "._", "name_", "==_", "'", "nt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Abstract", "Class", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Byte", "s", "IO", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Config", "Parser", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PY", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PY", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "String", "IO", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "WINDOWS", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bytes", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exec", "\\u", "function", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nest", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "name2", "url", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "string", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", "\\u", "bytes", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url2", "path", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "to", "\\u", "bytes_", "(_", "st_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "st_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "st_", "._", "encode_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "st_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "st_", "\\u\\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_", "(_", "'", "Cann", "ot", " ", "convert", " ", "%", "s", " ", "to", " ", "bytes", "'_", "%_", "type_", "(_", "st_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "to", "\\u", "bytes_", "(_", "st_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "st_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "st_", "._", "encode_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "st_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "st_", "\\u\\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_", "(_", "'", "Cann", "ot", " ", "convert", " ", "%", "s", " ", "to", " ", "bytes", ".'_", "%_", "type_", "(_", "st_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "exec", "\\u", "function_", "(_", "ast_", ",_", "globals", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locals", "\\u", "map_", "=_", "globals", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "ast_", ",_", "globals", "\\u", "map_", ",_", "locals", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "locals", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "nested_", "(_", "*_", "context", "\\u", "managers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enter", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Exi", "t", "Stack_", "(_", ")_", "as_", "stack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "manager_", "in_", "context", "\\u", "managers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enter", "s_", "._", "append_", "(_", "stack_", "._", "enter", "\\u", "context_", "(_", "manager_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "tuple_", "(_", "enter", "s_", ")_", "\\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,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, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
healthchecks/healthchecks/hc/api/migrations/0002_auto_20150616_0732.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport datetime\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('api', '0001_initial'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='check',\n name='alert_after',\n field=models.DateTimeField(null=True, blank=True),\n ),\n migrations.AddField(\n model_name='check',\n name='enabled',\n field=models.BooleanField(default=True),\n ),\n migrations.AddField(\n model_name='check',\n name='status',\n field=models.CharField(max_length=6, choices=[('up', 'Up'), ('down', 'Down'), ('new', 'New')], default='new'),\n ),\n migrations.AddField(\n model_name='check',\n name='timeout',\n field=models.DurationField(choices=[(datetime.timedelta(0, 300), '5 minutes'), (datetime.timedelta(0, 600), '10 minutes'), (datetime.timedelta(0, 1800), '30 minutes'), (datetime.timedelta(0, 3600), '1 hour'), (datetime.timedelta(0, 7200), '2 hours'), (datetime.timedelta(0, 21600), '6 hours'), (datetime.timedelta(0, 43200), '12 hours'), (datetime.timedelta(1), '1 day'), (datetime.timedelta(2), '2 days'), (datetime.timedelta(7), '1 week'), (datetime.timedelta(14), '2 weeks')], default=datetime.timedelta(1)),\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "migrations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\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_", "Migration_", "(_", "migrations_", "._", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "api", "'_", ",_", "'", "0001", "\\u", "initial", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Add", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "check", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "alert", "\\u", "after", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Add", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "check", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "enable", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Add", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "check", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "status", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "6_", ",_", "choices_", "=_", "[_", "(_", "'", "up", "'_", ",_", "'", "Up", "'_", ")_", ",_", "(_", "'", "down", "'_", ",_", "'", "Down", "'_", ")_", ",_", "(_", "'", "new", "'_", ",_", "'", "New", "'_", ")_", "]_", ",_", "default_", "=_", "'", "new", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Add", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "check", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "timeo", "ut", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "models_", "._", "Dur", "ation", "Field_", "(_", "choices_", "=_", "[_", "(_", "datetime_", "._", "timedelta_", "(_", "0_", ",_", "300_", ")_", ",_", "'", "5", " ", "minute", "s", "'_", ")_", ",_", "(_", "datetime_", "._", "timedelta_", "(_", "0_", ",_", "600_", ")_", ",_", "'", "10", " ", "minute", "s", "'_", ")_", ",_", "(_", "datetime_", "._", "timedelta_", "(_", "0_", ",_", "1800_", ")_", ",_", "'", "30", " ", "minute", "s", "'_", ")_", ",_", "(_", "datetime_", "._", "timedelta_", "(_", "0_", ",_", "3600_", ")_", ",_", "'", "1", " ", "hour", "'_", ")_", ",_", "(_", "datetime_", "._", "timedelta_", "(_", "0_", ",_", "7200", "_", ")_", ",_", "'", "2", " ", "hour", "s", "'_", ")_", ",_", "(_", "datetime_", "._", "timedelta_", "(_", "0_", ",_", "2160", "0_", ")_", ",_", "'", "6", " ", "hour", "s", "'_", ")_", ",_", "(_", "datetime_", "._", "timedelta_", "(_", "0_", ",_", "432", "00_", ")_", ",_", "'", "1", "2", " ", "hour", "s", "'_", ")_", ",_", "(_", "datetime_", "._", "timedelta_", "(_", "1_", ")_", ",_", "'", "1", " ", "day", "'_", ")_", ",_", "(_", "datetime_", "._", "timedelta_", "(_", "2_", ")_", ",_", "'", "2", " ", "day", "s", "'_", ")_", ",_", "(_", "datetime_", "._", "timedelta_", "(_", "7_", ")_", ",_", "'", "1", " ", "week", "'_", ")_", ",_", "(_", "datetime_", "._", "timedelta_", "(_", "14_", ")_", ",_", "'", "2", " ", "week", "s", "'_", ")_", "]_", ",_", "default_", "=_", "datetime_", "._", "timedelta_", "(_", "1_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\u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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
FooBarWidget/mizuho/asciidoc/tests/testasciidoc.py
[ { "content": " def generate_expected(self, backend):\n \"\"\"\n Generate and return test data output for backend.\n \"\"\"\n asciidoc = asciidocapi.AsciiDocAPI()\n asciidoc.options.values = self.options\n asciidoc.attributes = self.attributes\n infile = self.source\n outfile = StringIO.StringIO()\n asciidoc.execute(infile, outfile, backend)\n return outfile.getvalue().splitlines()", "metadata": "root.AsciiDocTest.generate_expected", "header": "['class', 'AsciiDocTest', '(', 'object', ')', ':', '___EOS___']", "index": 174 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Asc", "ii", "Doc", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "expected_", "(_", "self_", ",_", "backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Generate", " ", "and", " ", "return", " ", "test", " ", "data", " ", "output", " ", "for", " ", "back", "end", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ascii", "doc_", "=_", "ascii", "doc", "api_", "._", "Asc", "ii", "Doc", "API_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ascii", "doc_", "._", "options_", "._", "values_", "=_", "self_", "._", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ascii", "doc_", "._", "attributes_", "=_", "self_", "._", "attributes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "infile_", "=_", "self_", "._", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ascii", "doc_", "._", "execute_", "(_", "infile_", ",_", "outfile_", ",_", "backend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "outfile_", "._", "getvalue_", "(_", ")_", "._", "splitlines_", "(_", ")_", "\\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 ]
Suspicious unused loop iteration variable
fredrik-johansson/mpmath/mpmath/ctx_mp.py
[ { "content": " def nstr(ctx, x, n=6, **kwargs):\n \"\"\"\n Convert an ``mpf`` or ``mpc`` to a decimal string literal with *n*\n significant digits. The small default value for *n* is chosen to\n make this function useful for printing collections of numbers\n (lists, matrices, etc).\n\n If *x* is a list or tuple, :func:`~mpmath.nstr` is applied recursively\n to each element. For unrecognized classes, :func:`~mpmath.nstr`\n simply returns ``str(x)``.\n\n The companion function :func:`~mpmath.nprint` prints the result\n instead of returning it.\n\n The keyword arguments *strip_zeros*, *min_fixed*, *max_fixed*\n and *show_zero_exponent* are forwarded to :func:`~mpmath.libmp.to_str`.\n\n The number will be printed in fixed-point format if the position\n of the leading digit is strictly between min_fixed\n (default = min(-dps/3,-5)) and max_fixed (default = dps).\n\n To force fixed-point format always, set min_fixed = -inf,\n max_fixed = +inf. To force floating-point format, set\n min_fixed >= max_fixed.\n\n >>> from mpmath import *\n >>> nstr([+pi, ldexp(1,-500)])\n '[3.14159, 3.05494e-151]'\n >>> nprint([+pi, ldexp(1,-500)])\n [3.14159, 3.05494e-151]\n >>> nstr(mpf(\"5e-10\"), 5)\n '5.0e-10'\n >>> nstr(mpf(\"5e-10\"), 5, strip_zeros=False)\n '5.0000e-10'\n >>> nstr(mpf(\"5e-10\"), 5, strip_zeros=False, min_fixed=-11)\n '0.00000000050000'\n >>> nstr(mpf(0), 5, show_zero_exponent=True)\n '0.0e+0'\n\n \"\"\"\n if isinstance(x, list):\n return \"[%s]\" % (\", \".join(ctx.nstr(c, n, **kwargs) for c in x))\n if isinstance(x, tuple):\n return \"(%s)\" % (\", \".join(ctx.nstr(c, n, **kwargs) for c in x))\n if hasattr(x, '_mpf_'):\n return to_str(x._mpf_, n, **kwargs)\n if hasattr(x, '_mpc_'):\n return \"(\" + mpc_to_str(x._mpc_, n, **kwargs) + \")\"\n if isinstance(x, basestring):\n return repr(x)\n if isinstance(x, ctx.matrix):\n return x.__nstr__(n, **kwargs)\n return str(x)", "metadata": "root.MPContext.nstr", "header": "['class', 'MPContext', '(', 'BaseMPContext', ',', 'StandardBaseContext', ')', ':', '___EOS___']", "index": 563 } ]
[]
[]
0
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "class_", "MP", "Context_", "(_", "Base", "MP", "Context_", ",_", "Standard", "Base", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "nstr", "_", "(_", "ctx_", ",_", "x_", ",_", "n_", "=_", "6_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "an", " ", "``", "mpf", "``", " ", "or", " ", "``", "mpc", "``", " ", "to", " ", "a", " ", "decima", "l", " ", "string", " ", "literal", " ", "with", " ", "*", "n", "*", "\\", "10", ";", " ", " ", " ", " ", "significant", " ", "digit", "s", ".", " ", "The", " ", "small", " ", "default", " ", "value", " ", "for", " ", "*", "n", "*", " ", "is", " ", "chosen", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "make", " ", "this", " ", "function", " ", "usef", "ul", " ", "for", " ", "printin", "g", " ", "collection", "s", " ", "of", " ", "numbers", "\\", "10", ";", " ", " ", " ", " ", "(", "lists", ",", " ", "matric", "es", ",", " ", "etc", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "*", "x", "*", " ", "is", " ", "a", " ", "list", " ", "or", " ", "tuple", ",", " ", ":", "func", ":`", "~", "mpm", "ath", ".", "nstr", "`", " ", "is", " ", "applied", " ", "recurs", "ively", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "each", " ", "element", ".", " ", "For", " ", "unre", "cogni", "zed", " ", "classe", "s", ",", " ", ":", "func", ":`", "~", "mpm", "ath", ".", "nstr", "`", "\\", "10", ";", " ", " ", " ", " ", "simp", "ly", " ", "return", "s", " ", "``", "str", "(", "x", ")``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "compan", "ion", " ", "function", " ", ":", "func", ":`", "~", "mpm", "ath", ".", "npr", "int", "`", " ", "print", "s", " ", "the", " ", "result", "\\", "10", ";", " ", " ", " ", " ", "inst", "ead", " ", "of", " ", "return", "ing", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "*", "strip", "\\u", "zero", "s", "*", ",", " ", "*", "min", "\\u", "fixed", "*", ",", " ", "*", "max", "\\u", "fixed", "*", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "*", "show", "\\u", "zero", "\\u", "expon", "ent", "*", " ", "are", " ", "forwarded", " ", "to", " ", ":", "func", ":`", "~", "mpm", "ath", ".", "libm", "p", ".", "to", "\\u", "str", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "number", " ", "will", " ", "be", " ", "printed", " ", "in", " ", "fixed", "-", "point", " ", "format", " ", "if", " ", "the", " ", "position", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "lead", "ing", " ", "digit", " ", "is", " ", "strict", "ly", " ", "bet", "ween", " ", "min", "\\u", "fixed", "\\", "10", ";", " ", " ", " ", " ", "(", "default", " ", "=", " ", "min", "(-", "dps", "/", "3", ",-", "5", "))", " ", "and", " ", "max", "\\u", "fixed", " ", "(", "default", " ", "=", " ", "dps", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "force", " ", "fixed", "-", "point", " ", "format", " ", "alw", "ay", "s", ",", " ", "set", " ", "min", "\\u", "fixed", " ", "=", " ", "-", "inf", ",", "\\", "10", ";", " ", " ", " ", " ", "max", "\\u", "fixed", " ", "=", " ", "+", "inf", ".", " ", "To", " ", "force", " ", "float", "ing", "-", "point", " ", "format", ",", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "min", "\\u", "fixed", " ", ">=", " ", "max", "\\u", "fixed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "mpm", "ath", " ", "import", " ", "*", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "nstr", "([", "+", "pi", ",", " ", "lde", "xp", "(", "1", ",-", "500", ")])", "\\", "10", ";", " ", " ", " ", " ", "'[", "3.14", "159", ",", " ", "3.0", "549", "4e", "-1", "5", "1", "]'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "npr", "int", "([", "+", "pi", ",", " ", "lde", "xp", "(", "1", ",-", "500", ")])", "\\", "10", ";", " ", " ", " ", " ", "[", "3.14", "159", ",", " ", "3.0", "549", "4e", "-1", "5", "1", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "nstr", "(", "mpf", "(\"", "5e-", "10", "\")", ",", " ", "5", ")", "\\", "10", ";", " ", " ", " ", " ", "'", "5.0", "e-1", "0", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "nstr", "(", "mpf", "(\"", "5e-", "10", "\")", ",", " ", "5", ",", " ", "strip", "\\u", "zero", "s", "=", "Fal", "se", ")", "\\", "10", ";", " ", " ", " ", " ", "'", "5.0", "000", "e-1", "0", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "nstr", "(", "mpf", "(\"", "5e-", "10", "\")", ",", " ", "5", ",", " ", "strip", "\\u", "zero", "s", "=", "Fal", "se", ",", " ", "min", "\\u", "fixed", "=-", "11", ")", "\\", "10", ";", " ", " ", " ", " ", "'", "0.000000000", "5000", "0", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "nstr", "(", "mpf", "(", "0", "),", " ", "5", ",", " ", "show", "\\u", "zero", "\\u", "expon", "ent", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "'", "0.", "0e", "+0", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "x_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"[", "%", "s", "]\"_", "%_", "(_", "\",", " ", "\"_", "._", "join_", "(_", "ctx_", "._", "nstr", "_", "(_", "c_", ",_", "n_", ",_", "**_", "kwargs_", ")_", "for_", "c_", "in_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "x_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"(", "%", "s", ")\"_", "%_", "(_", "\",", " ", "\"_", "._", "join_", "(_", "ctx_", "._", "nstr", "_", "(_", "c_", ",_", "n_", ",_", "**_", "kwargs_", ")_", "for_", "c_", "in_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "x_", ",_", "'\\u", "mpf", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "to", "\\u", "str_", "(_", "x_", "._", "\\u", "mpf", "\\u_", ",_", "n_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "x_", ",_", "'\\u", "mpc", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"(\"_", "+_", "mpc", "\\u", "to", "\\u", "str_", "(_", "x_", "._", "\\u", "mpc", "\\u_", ",_", "n_", ",_", "**_", "kwargs_", ")_", "+_", "\")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "x_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "repr_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "x_", ",_", "ctx_", "._", "matrix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "._", "\\u\\u", "nstr", "\\u\\u_", "(_", "n_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "(_", "x_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
First parameter of a method is not named 'self'
acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/atom/http_core.py
[ { "content": " def _get_connection(self, uri, headers=None):\n \"\"\"Opens a socket connection to the server to set up an HTTP request.\n\n Args:\n uri: The full URL for the request as a Uri object.\n headers: A dict of string pairs containing the HTTP headers for the\n request.\n \"\"\"\n connection = None\n if uri.scheme == 'https':\n if not uri.port:\n connection = httplib.HTTPSConnection(uri.host)\n else:\n connection = httplib.HTTPSConnection(uri.host, int(uri.port))\n else:\n if not uri.port:\n connection = httplib.HTTPConnection(uri.host)\n else:\n connection = httplib.HTTPConnection(uri.host, int(uri.port))\n return connection", "metadata": "root.HttpClient._get_connection", "header": "['class', 'HttpClient', '(', 'object', ')', ':', '___EOS___']", "index": 427 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Http", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "connection_", "(_", "self_", ",_", "uri_", ",_", "headers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Opens", " ", "a", " ", "socket", " ", "connecti", "on", " ", "to", " ", "the", " ", "server", " ", "to", " ", "set", " ", "up", " ", "an", " ", "HTTP", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "uri", ":", " ", "The", " ", "full", " ", "URL", " ", "for", " ", "the", " ", "request", " ", "as", " ", "a", " ", "Ur", "i", " ", "object", ".", "\\", "10", ";", " ", " ", "header", "s", ":", " ", "A", " ", "dict", " ", "of", " ", "string", " ", "pair", "s", " ", "contain", "ing", " ", "the", " ", "HTTP", " ", "header", "s", " ", "for", " ", "the", "\\", "10", ";", " ", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uri_", "._", "scheme_", "==_", "'", "https", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "uri_", "._", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "httplib_", "._", "HTTP", "SC", "onnect", "ion_", "(_", "uri_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "httplib_", "._", "HTTP", "SC", "onnect", "ion_", "(_", "uri_", "._", "host_", ",_", "int_", "(_", "uri_", "._", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "uri_", "._", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "httplib_", "._", "HTTP", "Connection_", "(_", "uri_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "httplib_", "._", "HTTP", "Connection_", "(_", "uri_", "._", "host_", ",_", "int_", "(_", "uri_", "._", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ncclient/ncclient/ncclient/operations/third_party/hpcomware/rpc.py
[ { "content": "from lxml import etree\nfrom ncclient.xml_ import *\nfrom ncclient.operations.rpc import RPC\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DisplayCommand(RPC):", "metadata": "root.DisplayCommand", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def request(self, cmds):\n \"\"\"\n Single Execution element is permitted.\n cmds can be a list or single command\n \"\"\"\n if isinstance(cmds, list):\n cmd = '\\n'.join(cmds)\n elif isinstance(cmds, str) or isinstance(cmds, unicode):\n cmd = cmds\n\n node = etree.Element(qualify('CLI', BASE_NS_1_0))\n\n etree.SubElement(node, qualify('Execution',\n BASE_NS_1_0)).text = cmd\n\n return self._request(node)", "metadata": "root.DisplayCommand.request", "header": "['class', 'DisplayCommand', '(', 'RPC', ')', ':', '___EOS___']", "index": 6 }, { "content": "class ConfigCommand(RPC):", "metadata": "root.ConfigCommand", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def request(self, cmds):\n \"\"\"\n Single Configuration element is permitted.\n cmds can be a list or single command\n commands are pushed to the switch in this method\n \"\"\"\n\n if isinstance(cmds, list):\n cmd = '\\n'.join(cmds)\n elif isinstance(cmds, str) or isinstance(cmds, unicode):\n cmd = cmds\n\n node = etree.Element(qualify('CLI', BASE_NS_1_0))\n\n etree.SubElement(node, qualify('Configuration',\n BASE_NS_1_0)).text = cmd\n\n return self._request(node)", "metadata": "root.ConfigCommand.request", "header": "['class', 'ConfigCommand', '(', 'RPC', ')', ':', '___EOS___']", "index": 25 }, { "content": "class Action(RPC):", "metadata": "root.Action", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def request(self, action=None):\n node = new_ele(\"action\")\n node.append(validated_element(action))\n return self._request(node)", "metadata": "root.Action.request", "header": "['class', 'Action', '(', 'RPC', ')', ':', '___EOS___']", "index": 46 }, { "content": "class Save(RPC):", "metadata": "root.Save", "header": "['module', '___EOS___']", "index": 52 }, { "content": " def request(self, filename=None):\n node = new_ele('save')\n sub_ele(node, 'file').text = filename\n return self._request(node)", "metadata": "root.Save.request", "header": "['class', 'Save', '(', 'RPC', ')', ':', '___EOS___']", "index": 53 }, { "content": "class Rollback(RPC):", "metadata": "root.Rollback", "header": "['module', '___EOS___']", "index": 59 }, { "content": " def request(self, filename=None):\n node = new_ele('rollback')\n sub_ele(node, 'file').text = filename\n return self._request(node)", "metadata": "root.Rollback.request", "header": "['class', 'Rollback', '(', 'RPC', ')', ':', '___EOS___']", "index": 60 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ncc", "lient_", "._", "xml", "\\u_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ncc", "lient_", "._", "operations_", "._", "rpc_", "import_", "RP", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Display", "Command_", "(_", "RP", "C_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Display", "Command_", "(_", "RP", "C_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "request_", "(_", "self_", ",_", "cmds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sing", "le", " ", "Execut", "ion", " ", "element", " ", "is", " ", "permit", "ted", ".", "\\", "10", ";", " ", " ", " ", " ", "cmds", " ", "can", " ", "be", " ", "a", " ", "list", " ", "or", " ", "single", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "cmds_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "cmds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "cmds_", ",_", "str_", ")_", "or_", "isinstance_", "(_", "cmds_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "cmds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "quali", "fy_", "(_", "'", "CLI", "'_", ",_", "BASE", "\\u", "NS", "\\u", "1", "\\u", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "quali", "fy_", "(_", "'", "Execut", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "BASE", "\\u", "NS", "\\u", "1", "\\u", "0_", ")_", ")_", "._", "text_", "=_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "request_", "(_", "node_", ")_", "\\u\\u\\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_", "Config", "Command_", "(_", "RP", "C_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Command_", "(_", "RP", "C_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "request_", "(_", "self_", ",_", "cmds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sing", "le", " ", "Configura", "tion", " ", "element", " ", "is", " ", "permit", "ted", ".", "\\", "10", ";", " ", " ", " ", " ", "cmds", " ", "can", " ", "be", " ", "a", " ", "list", " ", "or", " ", "single", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "command", "s", " ", "are", " ", "pushed", " ", "to", " ", "the", " ", "switch", " ", "in", " ", "this", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "cmds_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "cmds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "cmds_", ",_", "str_", ")_", "or_", "isinstance_", "(_", "cmds_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "cmds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "quali", "fy_", "(_", "'", "CLI", "'_", ",_", "BASE", "\\u", "NS", "\\u", "1", "\\u", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "quali", "fy_", "(_", "'", "Configura", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "BASE", "\\u", "NS", "\\u", "1", "\\u", "0_", ")_", ")_", "._", "text_", "=_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "request_", "(_", "node_", ")_", "\\u\\u\\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_", "Action_", "(_", "RP", "C_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Action_", "(_", "RP", "C_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "request_", "(_", "self_", ",_", "action_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "new", "\\u", "ele_", "(_", "\"", "action", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "append_", "(_", "validat", "ed", "\\u", "element_", "(_", "action_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "request_", "(_", "node_", ")_", "\\u\\u\\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_", "Save_", "(_", "RP", "C_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Save_", "(_", "RP", "C_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "request_", "(_", "self_", ",_", "filename_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "new", "\\u", "ele_", "(_", "'", "save", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "ele_", "(_", "node_", ",_", "'", "file", "'_", ")_", "._", "text_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "request_", "(_", "node_", ")_", "\\u\\u\\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_", "Roll", "back_", "(_", "RP", "C_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Roll", "back_", "(_", "RP", "C_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "request_", "(_", "self_", ",_", "filename_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "new", "\\u", "ele_", "(_", "'", "rollback", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "ele_", "(_", "node_", ",_", "'", "file", "'_", ")_", "._", "text_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "request_", "(_", "node_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
twisted/twisted/twisted/test/test_roots.py
[ { "content": " def testExceptions(self):\n request = roots.Request()\n try:\n request.write(b\"blah\")\n except NotImplementedError:\n pass\n else:\n self.fail()\n try:\n request.finish()\n except NotImplementedError:\n pass\n else:\n self.fail()", "metadata": "root.RootsTests.testExceptions", "header": "['class', 'RootsTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 10 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Roo", "ts", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Exceptions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "roots_", "._", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "write_", "(_", "b", "\"", "bla", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", ")_", "\\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 ", " _", "request_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", ")_", "\\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 ]
Unused import
ImageEngine/gaffer/python/GafferSceneUI/SceneViewToolbar.py
[ { "content": "##########################################################################\n#\n# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.\n# Copyright (c) 2014, John Haddon. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above\n# copyright notice, this list of conditions and the following\n# disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided with\n# the distribution.\n#\n# * Neither the name of John Haddon nor the names of\n# any other contributors to this software may be used to endorse or\n# promote products derived from this software without specific prior\n# written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n##########################################################################\n\nimport functools\n\nimport IECore\n\nimport Gaffer\nimport GafferUI\nimport GafferScene\nimport GafferSceneUI\n\nGaffer.Metadata.registerNode(\n\n\tGafferSceneUI.SceneView,\n\n\tplugs = {\n\n\t\t\"shadingMode\" : [\n\n\t\t\t\"toolbarLayout:index\", 2,\n\t\t\t\"toolbarLayout:divider\", True,\n\t\t\t\"plugValueWidget:type\", \"GafferSceneUI.SceneViewToolbar._ShadingModePlugValueWidget\",\n\n\t\t],\n\n\t\t\"minimumExpansionDepth\" : [\n\n\t\t\t\"plugValueWidget:type\", \"GafferSceneUI.SceneViewToolbar._ExpansionPlugValueWidget\",\n\t\t\t\"toolbarLayout:divider\", True,\n\n\t\t],\n\n\t\t\"lookThrough\" : [\n\n\t\t\t\"plugValueWidget:type\", \"GafferSceneUI.SceneViewToolbar._LookThroughPlugValueWidget\",\n\t\t\t\"toolbarLayout:divider\", True,\n\t\t\t\"toolbarLayout:label\", \"\",\n\n\t\t],\n\n\t\t\"lookThrough.enabled\" : [\n\n\t\t\t\"description\",\n\t\t\t\"\"\"\n\t\t\tWhen enabled, locks the view to look through a specific camera in the scene.\n\t\t\tBy default, the current render camera is used, but this can be changed using the lookThrough.camera\n\t\t\tsetting.\n\t\t\t\"\"\",\n\t\t],\n\n\t\t\"lookThrough.camera\" : [\n\n\t\t\t\"description\",\n\t\t\t\"\"\"\n\t\t\tSpecifies the camera to look through when lookThrough.enabled is on. The default value\n\t\t\tmeans that the current render camera will be used - the paths to other cameras may be specified\n\t\t\tto choose another camera.\"\n\t\t\t\"\"\",\n\t\t],\n\n\t\t\"grid\" : [\n\n\t\t\t\"plugValueWidget:type\", \"GafferSceneUI.SceneViewToolbar._GridPlugValueWidget\",\n\n\t\t],\n\n\t\t\"gnomon\" : [\n\n\t\t\t\"plugValueWidget:type\", \"\",\n\n\t\t],\n\n\t}\n\n)\n\n##########################################################################\n# _ShadingModePlugValueWidget\n##########################################################################\n\n\n##########################################################################\n# _ExpansionPlugValueWidget\n##########################################################################\n\n\n##########################################################################\n# _LookThroughPlugValueWidget\n##########################################################################\n\n\n##########################################################################\n# _GridPlugValueWidget\n##########################################################################\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class _ShadingModePlugValueWidget( GafferUI.PlugValueWidget ) :\n\n\n\n\n", "metadata": "root._ShadingModePlugValueWidget", "header": "['module', '___EOS___']", "index": 115 }, { "content": "\t\tdef __init__( self, plug, parenting = None ) :\n\n\t\t\tmenuButton = GafferUI.MenuButton(\n\t\t\t\timage = \"shading.png\",\n\t\t\t\tmenu = GafferUI.Menu( Gaffer.WeakMethod( self.__menuDefinition ) ),\n\t\t\t\thasFrame = False,\n\t\t\t)\n\n\t\t\tGafferUI.PlugValueWidget.__init__( self, menuButton, plug, parenting = parenting )", "metadata": "root._ShadingModePlugValueWidget.__init__", "header": "['class', '_ShadingModePlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 117 }, { "content": "\t\tdef hasLabel( self ) :\n\n\t\t\treturn True", "metadata": "root._ShadingModePlugValueWidget.hasLabel", "header": "['class', '_ShadingModePlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 127 }, { "content": "\t\tdef _updateFromPlug( self ) :\n\n\t\t\tpass", "metadata": "root._ShadingModePlugValueWidget._updateFromPlug", "header": "['class', '_ShadingModePlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 131 }, { "content": "\t\tdef __menuDefinition( self ) :\n\n\t\t\tm = IECore.MenuDefinition()\n\n\t\t\tcurrentName = self.getPlug().getValue()\n\t\t\tfor name in [ \"\" ] + GafferSceneUI.SceneView.registeredShadingModes() :\n\t\t\t\tm.append(\n\t\t\t\t\t\"/\" + name if name else \"Default\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"checkBox\" : name == currentName,\n\t\t\t\t\t\t\"command\" : functools.partial( Gaffer.WeakMethod( self.__setValue ), name if name != currentName else \"\" ),\n\t\t\t\t\t}\n\t\t\t\t)\n\n\t\t\t\tif not name :\n\t\t\t\t\tm.append( \"/DefaultDivider\", { \"divider\" : True } )\n\n\t\t\treturn m", "metadata": "root._ShadingModePlugValueWidget.__menuDefinition", "header": "['class', '_ShadingModePlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 135 }, { "content": "\t\tdef __setValue( self, value, *unused ) :\n\n\t\t\tself.getPlug().setValue( value )", "metadata": "root._ShadingModePlugValueWidget.__setValue", "header": "['class', '_ShadingModePlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 154 }, { "content": "class _ExpansionPlugValueWidget( GafferUI.PlugValueWidget ) :\n\n\n\n\n", "metadata": "root._ExpansionPlugValueWidget", "header": "['module', '___EOS___']", "index": 162 }, { "content": "\tdef __init__( self, plug, parenting = None ) :\n\n\t\tmenu = GafferUI.Menu( Gaffer.WeakMethod( self.__menuDefinition ) )\n\t\tmenuButton = GafferUI.MenuButton( menu=menu, image = \"expansion.png\", hasFrame=False )\n\n\t\tGafferUI.PlugValueWidget.__init__( self, menuButton, plug, parenting = parenting )", "metadata": "root._ExpansionPlugValueWidget.__init__", "header": "['class', '_ExpansionPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 164 }, { "content": "\tdef hasLabel( self ) :\n\n\t\treturn True", "metadata": "root._ExpansionPlugValueWidget.hasLabel", "header": "['class', '_ExpansionPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 171 }, { "content": "\tdef _updateFromPlug( self ) :\n\n\t\tpass", "metadata": "root._ExpansionPlugValueWidget._updateFromPlug", "header": "['class', '_ExpansionPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 175 }, { "content": "\tdef __menuDefinition( self ) :\n\n\t\texpandAll = bool( self.getPlug().getValue() )\n\n\t\tm = IECore.MenuDefinition()\n\t\tm.append( \"/Expand Selection\", { \"command\" : self.getPlug().node().expandSelection, \"active\" : not expandAll, \"shortCut\" : \"Down\" } )\n\t\tm.append( \"/Expand Selection Fully\", { \"command\" : IECore.curry( self.getPlug().node().expandSelection, depth = 999 ), \"active\" : not expandAll, \"shortCut\" : \"Shift+Down\" } )\n\t\tm.append( \"/Collapse Selection\", { \"command\" : self.getPlug().node().collapseSelection, \"active\" : not expandAll, \"shortCut\" : \"Up\" } )\n\t\tm.append( \"/Expand All Divider\", { \"divider\" : True } )\n\t\tm.append( \"/Expand All\", { \"checkBox\" : expandAll, \"command\" : Gaffer.WeakMethod( self.__toggleMinimumExpansionDepth ) } )\n\n\t\treturn m", "metadata": "root._ExpansionPlugValueWidget.__menuDefinition", "header": "['class', '_ExpansionPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 179 }, { "content": "\tdef __toggleMinimumExpansionDepth( self, *unused ) :\n\n\t\tself.getPlug().setValue( 0 if self.getPlug().getValue() else 999 )", "metadata": "root._ExpansionPlugValueWidget.__toggleMinimumExpansionDepth", "header": "['class', '_ExpansionPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 192 }, { "content": "class _LookThroughPlugValueWidget( GafferUI.PlugValueWidget ) :\n\n", "metadata": "root._LookThroughPlugValueWidget", "header": "['module', '___EOS___']", "index": 200 }, { "content": "\tdef __init__( self, plug, parenting = None ) :\n\n\t\trow = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal )\n\n\t\tGafferUI.PlugValueWidget.__init__( self, row, plug, parenting = parenting )\n\n\t\twith row :\n\t\t\tself.__enabledWidget = GafferUI.BoolPlugValueWidget( plug[\"enabled\"], displayMode=GafferUI.BoolWidget.DisplayMode.Switch )\n\t\t\tself.__cameraWidget = GafferSceneUI.ScenePathPlugValueWidget(\n\t\t\t\tplug[\"camera\"],\n\t\t\t\tpath = GafferScene.ScenePath(\n\t\t\t\t\tplug.node()[\"in\"],\n\t\t\t\t\tplug.node().getContext(),\n\t\t\t\t\t\"/\",\n\t\t\t\t\tfilter = GafferScene.ScenePath.createStandardFilter( [ \"__cameras\" ], \"Show only cameras\" )\n\t\t\t\t),\n\t\t\t)\n\t\t\tself.__cameraWidget.pathWidget().setFixedCharacterWidth( 13 )\n\t\t\tif hasattr( self.__cameraWidget.pathWidget()._qtWidget(), \"setPlaceholderText\" ) :\n\t\t\t\tself.__cameraWidget.pathWidget()._qtWidget().setPlaceholderText( \"Render Camera\" )\n\n\t\tself._updateFromPlug()", "metadata": "root._LookThroughPlugValueWidget.__init__", "header": "['class', '_LookThroughPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 202 }, { "content": "\tdef _updateFromPlug( self ) :\n\n\t\twith self.getContext() :\n\t\t\tself.__cameraWidget.setEnabled( self.getPlug()[\"enabled\"].getValue() )", "metadata": "root._LookThroughPlugValueWidget._updateFromPlug", "header": "['class', '_LookThroughPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 225 }, { "content": "class _GridPlugValueWidget( GafferUI.PlugValueWidget ) :\n\n\n\n", "metadata": "root._GridPlugValueWidget", "header": "['module', '___EOS___']", "index": 234 }, { "content": "\tdef __init__( self, plug, parenting = None ) :\n\n\t\tmenu = GafferUI.Menu( Gaffer.WeakMethod( self.__menuDefinition ) )\n\t\tmenuButton = GafferUI.MenuButton( menu=menu, image = \"grid.png\", hasFrame=False )\n\n\t\tGafferUI.PlugValueWidget.__init__( self, menuButton, plug, parenting = parenting )", "metadata": "root._GridPlugValueWidget.__init__", "header": "['class', '_GridPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 236 }, { "content": "\tdef hasLabel( self ) :\n\n\t\treturn True", "metadata": "root._GridPlugValueWidget.hasLabel", "header": "['class', '_GridPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 243 }, { "content": "\tdef _updateFromPlug( self ) :\n\n\t\tpass", "metadata": "root._GridPlugValueWidget._updateFromPlug", "header": "['class', '_GridPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 247 }, { "content": "\tdef __menuDefinition( self ) :\n\n\t\tm = IECore.MenuDefinition()\n\t\tm.append(\n\t\t\t\"/Show Grid\",\n\t\t\t{\n\t\t\t\t\"checkBox\" : self.getPlug()[\"visible\"].getValue(),\n\t\t\t\t\"command\" : self.getPlug()[\"visible\"].setValue,\n\t\t\t}\n\t\t)\n\n\t\tm.append(\n\t\t\t\"/Show Gnomon\",\n\t\t\t{\n\t\t\t\t\"checkBox\" : self.getPlug().node()[\"gnomon\"][\"visible\"].getValue(),\n\t\t\t\t\"command\" : self.getPlug().node()[\"gnomon\"][\"visible\"].setValue,\n\t\t\t}\n\t\t)\n\n\t\treturn m", "metadata": "root._GridPlugValueWidget.__menuDefinition", "header": "['class', '_GridPlugValueWidget', '(', 'GafferUI', '.', 'PlugValueWidget', ')', ':', '___EOS___']", "index": 251 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", ",", " ", "Image", " ", "Engine", " ", "Desig", "n", " ", "Inc", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", ",", " ", "Joh", "n", " ", "Had", "don", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Joh", "n", " ", "Had", "don", " ", "nor", " ", "the", " ", "names", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "any", " ", "other", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "IE", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Ga", "ffer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "Scene_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "Scen", "e", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "_", "._", "Metadata_", "._", "register", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "Scen", "e", "UI_", "._", "Scen", "e", "View_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plug", "s_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "shad", "ing", "Mode", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "toolb", "ar", "Lay", "out", ":", "index", "\"_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "toolb", "ar", "Lay", "out", ":", "divider", "\"_", ",_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"", "Ga", "ffer", "Scen", "e", "UI", ".", "Scen", "e", "View", "Toolb", "ar", ".\\u", "Shad", "ing", "Mode", "Plug", "Value", "Wid", "get", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "minim", "um", "Expa", "nsion", "Dep", "th", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"", "Ga", "ffer", "Scen", "e", "UI", ".", "Scen", "e", "View", "Toolb", "ar", ".\\u", "Expa", "nsion", "Plug", "Value", "Wid", "get", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "toolb", "ar", "Lay", "out", ":", "divider", "\"_", ",_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "look", "Through", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"", "Ga", "ffer", "Scen", "e", "UI", ".", "Scen", "e", "View", "Toolb", "ar", ".\\u", "Look", "Through", "Plug", "Value", "Wid", "get", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "toolb", "ar", "Lay", "out", ":", "divider", "\"_", ",_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "toolb", "ar", "Lay", "out", ":", "label", "\"_", ",_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "look", "Through", ".", "enable", "d", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t\t\t", "Whe", "n", " ", "enable", "d", ",", " ", "lock", "s", " ", "the", " ", "view", " ", "to", " ", "look", " ", "through", " ", "a", " ", "specific", " ", "came", "ra", " ", "in", " ", "the", " ", "scen", "e", ".", "\\", "10", ";", "\t\t\t", "By", " ", "default", ",", " ", "the", " ", "current", " ", "render", " ", "came", "ra", " ", "is", " ", "used", ",", " ", "but", " ", "this", " ", "can", " ", "be", " ", "change", "d", " ", "usi", "ng", " ", "the", " ", "look", "Through", ".", "came", "ra", "\\", "10", ";", "\t\t\t", "setti", "ng", ".", "\\", "10", ";", "\t\t\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "look", "Through", ".", "came", "ra", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t\t\t", "Specifie", "s", " ", "the", " ", "came", "ra", " ", "to", " ", "look", " ", "through", " ", "whe", "n", " ", "look", "Through", ".", "enable", "d", " ", "is", " ", "on", ".", " ", "The", " ", "default", " ", "value", "\\", "10", ";", "\t\t\t", "means", " ", "tha", "t", " ", "the", " ", "current", " ", "render", " ", "came", "ra", " ", "will", " ", "be", " ", "used", " ", "-", " ", "the", " ", "path", "s", " ", "to", " ", "other", " ", "cameras", " ", "may", " ", "be", " ", "specified", "\\", "10", ";", "\t\t\t", "to", " ", "choose", " ", "anot", "her", " ", "came", "ra", ".\"", "\\", "10", ";", "\t\t\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "grid", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"", "Ga", "ffer", "Scen", "e", "UI", ".", "Scen", "e", "View", "Toolb", "ar", ".\\u", "Grid", "Plug", "Value", "Wid", "get", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gno", "mon", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "Shad", "ing", "Mode", "Plug", "Value", "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", "Expa", "nsion", "Plug", "Value", "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", "Look", "Through", "Plug", "Value", "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", "Grid", "Plug", "Value", "Widget_", "\\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_", "\\u", "Shad", "ing", "Mode", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "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_", "\\u", "Shad", "ing", "Mode", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "plug_", ",_", "parent", "ing_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "menu", "Button_", "=_", "Ga", "ffer", "UI_", "._", "Menu", "Button_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "image_", "=_", "\"", "shad", "ing", ".", "png", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "menu_", "=_", "Ga", "ffer", "UI_", "._", "Menu_", "(_", "Ga", "ffer", "_", "._", "Wea", "k", "Method_", "(_", "self_", "._", "\\u\\u", "menu", "Definition_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "has", "Frame_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "menu", "Button_", ",_", "plug_", ",_", "parent", "ing_", "=_", "parent", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Shad", "ing", "Mode", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "Label_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Shad", "ing", "Mode", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "Fro", "m", "Plug", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Shad", "ing", "Mode", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "menu", "Definition_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "m_", "=_", "IE", "Core_", "._", "Menu", "Definition_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "Name_", "=_", "self_", "._", "get", "Plug", "_", "(_", ")_", "._", "get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "[_", "\"\"_", "]_", "+_", "Ga", "ffer", "Scen", "e", "UI_", "._", "Scen", "e", "View_", "._", "register", "ed", "Shad", "ing", "Modes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "m_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/\"_", "+_", "name_", "if_", "name_", "else_", "\"", "Default", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", "Box", "\"_", ":_", "name_", "==_", "current", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "command", "\"_", ":_", "functools_", "._", "partial_", "(_", "Ga", "ffer", "_", "._", "Wea", "k", "Method_", "(_", "self_", "._", "\\u\\u", "set", "Value_", ")_", ",_", "name_", "if_", "name_", "!=_", "current", "Name_", "else_", "\"\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "m_", "._", "append_", "(_", "\"/", "Default", "Divide", "r", "\"_", ",_", "{_", "\"", "divider", "\"_", ":_", "True_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Shad", "ing", "Mode", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "set", "Value_", "(_", "self_", ",_", "value_", ",_", "*_", "unused_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "get", "Plug", "_", "(_", ")_", "._", "set", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Expa", "nsion", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "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_", "\\u", "Expa", "nsion", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "plug_", ",_", "parent", "ing_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "menu_", "=_", "Ga", "ffer", "UI_", "._", "Menu_", "(_", "Ga", "ffer", "_", "._", "Wea", "k", "Method_", "(_", "self_", "._", "\\u\\u", "menu", "Definition_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "menu", "Button_", "=_", "Ga", "ffer", "UI_", "._", "Menu", "Button_", "(_", "menu_", "=_", "menu_", ",_", "image_", "=_", "\"", "expansion", ".", "png", "\"_", ",_", "has", "Frame_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "menu", "Button_", ",_", "plug_", ",_", "parent", "ing_", "=_", "parent", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Expa", "nsion", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "Label_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Expa", "nsion", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "Fro", "m", "Plug", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Expa", "nsion", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "menu", "Definition_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "expand", "All_", "=_", "bool_", "(_", "self_", "._", "get", "Plug", "_", "(_", ")_", "._", "get", "Value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "IE", "Core_", "._", "Menu", "Definition_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "append_", "(_", "\"/", "Expand", " ", "Selecti", "on", "\"_", ",_", "{_", "\"", "command", "\"_", ":_", "self_", "._", "get", "Plug", "_", "(_", ")_", "._", "node_", "(_", ")_", "._", "expand", "Selection_", ",_", "\"", "active", "\"_", ":_", "not_", "expand", "All_", ",_", "\"", "short", "Cut", "\"_", ":_", "\"", "Down", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "append_", "(_", "\"/", "Expand", " ", "Selecti", "on", " ", "Full", "y", "\"_", ",_", "{_", "\"", "command", "\"_", ":_", "IE", "Core_", "._", "curr", "y_", "(_", "self_", "._", "get", "Plug", "_", "(_", ")_", "._", "node_", "(_", ")_", "._", "expand", "Selection_", ",_", "depth_", "=_", "999_", ")_", ",_", "\"", "active", "\"_", ":_", "not_", "expand", "All_", ",_", "\"", "short", "Cut", "\"_", ":_", "\"", "Shi", "ft", "+", "Down", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "append_", "(_", "\"/", "Collaps", "e", " ", "Selecti", "on", "\"_", ",_", "{_", "\"", "command", "\"_", ":_", "self_", "._", "get", "Plug", "_", "(_", ")_", "._", "node_", "(_", ")_", "._", "collapse", "Selection_", ",_", "\"", "active", "\"_", ":_", "not_", "expand", "All_", ",_", "\"", "short", "Cut", "\"_", ":_", "\"", "Up", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "append_", "(_", "\"/", "Expand", " ", "All", " ", "Divide", "r", "\"_", ",_", "{_", "\"", "divider", "\"_", ":_", "True_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "append_", "(_", "\"/", "Expand", " ", "All", "\"_", ",_", "{_", "\"", "check", "Box", "\"_", ":_", "expand", "All_", ",_", "\"", "command", "\"_", ":_", "Ga", "ffer", "_", "._", "Wea", "k", "Method_", "(_", "self_", "._", "\\u\\u", "toggle", "Mini", "mum", "Expa", "nsion", "Depth_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Expa", "nsion", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "toggle", "Mini", "mum", "Expa", "nsion", "Depth_", "(_", "self_", ",_", "*_", "unused_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "get", "Plug", "_", "(_", ")_", "._", "set", "Value_", "(_", "0_", "if_", "self_", "._", "get", "Plug", "_", "(_", ")_", "._", "get", "Value_", "(_", ")_", "else_", "999_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Look", "Through", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "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_", "[SEP]_", "class_", "\\u", "Look", "Through", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "plug_", ",_", "parent", "ing_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "row_", "=_", "Ga", "ffer", "UI_", "._", "List", "Container_", "(_", "Ga", "ffer", "UI_", "._", "List", "Container_", "._", "Orientation_", "._", "Horizontal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "row_", ",_", "plug_", ",_", "parent", "ing_", "=_", "parent", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "\\u\\u", "enable", "d", "Widget_", "=_", "Ga", "ffer", "UI_", "._", "Boo", "l", "Plug", "Value", "Widget_", "(_", "plug_", "[_", "\"", "enable", "d", "\"_", "]_", ",_", "display", "Mode_", "=_", "Ga", "ffer", "UI_", "._", "Boo", "l", "Widget_", "._", "Display", "Mode_", "._", "Switch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "came", "ra", "Widget_", "=_", "Ga", "ffer", "Scen", "e", "UI_", "._", "Scen", "e", "Path", "Plug", "Value", "Widget_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "plug_", "[_", "\"", "came", "ra", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "Ga", "ffer", "Scene_", "._", "Scen", "e", "Path_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "plug_", "._", "node_", "(_", ")_", "[_", "\"", "in", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plug_", "._", "node_", "(_", ")_", "._", "get", "Context_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter_", "=_", "Ga", "ffer", "Scene_", "._", "Scen", "e", "Path_", "._", "create", "Standard", "Filter_", "(_", "[_", "\"\\u\\u", "cameras", "\"_", "]_", ",_", "\"", "Show", " ", "only", " ", "cameras", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "came", "ra", "Widget_", "._", "path", "Widget_", "(_", ")_", "._", "set", "Fix", "ed", "Char", "acte", "r", "Width_", "(_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "\\u\\u", "came", "ra", "Widget_", "._", "path", "Widget_", "(_", ")_", "._", "\\u", "qt", "Widget_", "(_", ")_", ",_", "\"", "set", "Place", "holder", "Text", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "self_", "._", "\\u\\u", "came", "ra", "Widget_", "._", "path", "Widget_", "(_", ")_", "._", "\\u", "qt", "Widget_", "(_", ")_", "._", "set", "Place", "holder", "Text_", "(_", "\"", "Render", " ", "Came", "ra", "\"_", ")_", "\\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", "update", "Fro", "m", "Plug", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Look", "Through", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "Fro", "m", "Plug", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "with_", "self_", "._", "get", "Context_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "\\u\\u", "came", "ra", "Widget_", "._", "set", "Enabled_", "(_", "self_", "._", "get", "Plug", "_", "(_", ")_", "[_", "\"", "enable", "d", "\"_", "]_", "._", "get", "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_", "\\u", "Grid", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "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_", "\\u", "Grid", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "plug_", ",_", "parent", "ing_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "menu_", "=_", "Ga", "ffer", "UI_", "._", "Menu_", "(_", "Ga", "ffer", "_", "._", "Wea", "k", "Method_", "(_", "self_", "._", "\\u\\u", "menu", "Definition_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "menu", "Button_", "=_", "Ga", "ffer", "UI_", "._", "Menu", "Button_", "(_", "menu_", "=_", "menu_", ",_", "image_", "=_", "\"", "grid", ".", "png", "\"_", ",_", "has", "Frame_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "menu", "Button_", ",_", "plug_", ",_", "parent", "ing_", "=_", "parent", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Grid", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "Label_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Grid", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "Fro", "m", "Plug", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Grid", "Plug", "Value", "Widget_", "(_", "Ga", "ffer", "UI_", "._", "Plug", "Value", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "menu", "Definition_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "m_", "=_", "IE", "Core_", "._", "Menu", "Definition_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "Show", " ", "Grid", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", "Box", "\"_", ":_", "self_", "._", "get", "Plug", "_", "(_", ")_", "[_", "\"", "visi", "ble", "\"_", "]_", "._", "get", "Value_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "command", "\"_", ":_", "self_", "._", "get", "Plug", "_", "(_", ")_", "[_", "\"", "visi", "ble", "\"_", "]_", "._", "set", "Value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "Show", " ", "Gn", "omo", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", "Box", "\"_", ":_", "self_", "._", "get", "Plug", "_", "(_", ")_", "._", "node_", "(_", ")_", "[_", "\"", "gno", "mon", "\"_", "]_", "[_", "\"", "visi", "ble", "\"_", "]_", "._", "get", "Value_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "command", "\"_", ":_", "self_", "._", "get", "Plug", "_", "(_", ")_", "._", "node_", "(_", ")_", "[_", "\"", "gno", "mon", "\"_", "]_", "[_", "\"", "visi", "ble", "\"_", "]_", "._", "set", "Value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "m_" ]
[ 4, 4, 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
Imprecise assert
pantsbuild/pants/contrib/android/tests/python/pants_test/contrib/android/test_android_manifest_parser.py
[ { "content": " def test_package_name(self):\n with self.xml_file() as xml:\n manifest = AndroidManifestParser.parse_manifest(xml)\n self.assertEqual(manifest.package_name, 'org.pantsbuild.example.hello')", "metadata": "root.TestAndroidManifestParser.test_package_name", "header": "['class', 'TestAndroidManifestParser', '(', 'XmlTestBase', ')', ':', '___EOS___']", "index": 27 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "And", "roid", "Manifest", "Parser_", "(_", "Xm", "l", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "package", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "xml", "\\u", "file_", "(_", ")_", "as_", "xml_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manifest_", "=_", "And", "roid", "Manifest", "Parser_", "._", "parse", "\\u", "manifest_", "(_", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "manifest_", "._", "package", "\\u", "name_", ",_", "'", "org", ".", "pant", "sbu", "ild", ".", "example", ".", "hell", "o", "'_", ")_", "\\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 ]
Unused import
apache/libcloud/libcloud/test/test_types.py
[ { "content": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License. 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 sys\nimport unittest\n\nfrom libcloud.common.types import LazyList\n\n\n\nif __name__ == '__main__':\n sys.exit(unittest.main())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestLazyList(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestLazyList", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def setUp(self):\n super(TestLazyList, self).setUp\n self._get_more_counter = 0", "metadata": "root.TestLazyList.setUp", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def tearDown(self):\n super(TestLazyList, self).tearDown", "metadata": "root.TestLazyList.tearDown", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 26 }, { "content": " def test_init(self):\n data = [1, 2, 3, 4, 5]\n ll = LazyList(get_more=self._get_more_exhausted)\n ll_list = list(ll)\n self.assertEqual(ll_list, data)", "metadata": "root.TestLazyList.test_init", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_iterator(self):\n data = [1, 2, 3, 4, 5]\n ll = LazyList(get_more=self._get_more_exhausted)\n for i, d in enumerate(ll):\n self.assertEqual(d, data[i])", "metadata": "root.TestLazyList.test_iterator", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 35 }, { "content": " def test_empty_list(self):\n ll = LazyList(get_more=self._get_more_empty)\n\n self.assertEqual(list(ll), [])\n self.assertEqual(len(ll), 0)\n self.assertTrue(10 not in ll)", "metadata": "root.TestLazyList.test_empty_list", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " def test_iterator_not_exhausted(self):\n data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n ll = LazyList(get_more=self._get_more_not_exhausted)\n number_of_iterations = 0\n for i, d in enumerate(ll):\n self.assertEqual(d, data[i])\n number_of_iterations += 1\n self.assertEqual(number_of_iterations, 10)", "metadata": "root.TestLazyList.test_iterator_not_exhausted", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " def test_len(self):\n ll = LazyList(get_more=self._get_more_not_exhausted)\n ll = LazyList(get_more=self._get_more_not_exhausted)\n\n self.assertEqual(len(ll), 10)", "metadata": "root.TestLazyList.test_len", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 57 }, { "content": " def test_contains(self):\n ll = LazyList(get_more=self._get_more_not_exhausted)\n\n self.assertTrue(40 not in ll)\n self.assertTrue(1 in ll)\n self.assertTrue(5 in ll)\n self.assertTrue(10 in ll)", "metadata": "root.TestLazyList.test_contains", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " def test_indexing(self):\n ll = LazyList(get_more=self._get_more_not_exhausted)\n\n self.assertEqual(ll[0], 1)\n self.assertEqual(ll[9], 10)\n self.assertEqual(ll[-1], 10)\n\n try:\n ll[11]\n except IndexError:\n pass\n else:\n self.fail('Exception was not thrown')", "metadata": "root.TestLazyList.test_indexing", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 71 }, { "content": " def test_repr(self):\n ll1 = LazyList(get_more=self._get_more_empty)\n ll2 = LazyList(get_more=self._get_more_exhausted)\n ll3 = LazyList(get_more=self._get_more_not_exhausted)\n\n self.assertEqual(repr(ll1), '[]')\n self.assertEqual(repr(ll2), '[1, 2, 3, 4, 5]')\n self.assertEqual(repr(ll3), '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]')", "metadata": "root.TestLazyList.test_repr", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 85 }, { "content": " def _get_more_empty(self, last_key, value_dict):\n return [], None, True", "metadata": "root.TestLazyList._get_more_empty", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def _get_more_exhausted(self, last_key, value_dict):\n data = [1, 2, 3, 4, 5]\n return data, 5, True", "metadata": "root.TestLazyList._get_more_exhausted", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 97 }, { "content": " def _get_more_not_exhausted(self, last_key, value_dict):\n self._get_more_counter += 1\n if not last_key:\n data, last_key, exhausted = [1, 2, 3, 4, 5], 5, False\n else:\n data, last_key, exhausted = [6, 7, 8, 9, 10], 10, True\n\n return data, last_key, exhausted", "metadata": "root.TestLazyList._get_more_not_exhausted", "header": "['class', 'TestLazyList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 101 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "License", "d", " ", "to", " ", "the", " ", "Ap", "ache", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", " ", "(", "AS", "F", ")", " ", "under", " ", "one", " ", "or", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contributor", " ", "license", " ", "agreement", "s", ".", " ", " ", "See", " ", "the", " ", "NOTICE", " ", "file", " ", "distributed", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "work", " ", "for", " ", "addition", "al", " ", "informati", "on", " ", "regarding", " ", "copyr", "ight", " ", "owner", "ship", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "AS", "F", " ", "license", "s", " ", "this", " ", "file", " ", "to", " ", "You", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "License", ".", " ", " ", "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_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "libc", "loud", "_", "._", "common_", "._", "types_", "import_", "La", "zy", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "unittest_", "._", "main_", "(_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Test", "La", "zy", "List_", ",_", "self_", ")_", "._", "set", "Up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Test", "La", "zy", "List_", ",_", "self_", ")_", "._", "tear", "Down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "exhaust", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll", "\\u", "list_", "=_", "list_", "(_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ll", "\\u", "list_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "iterator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "exhaust", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "d_", "in_", "enumerate_", "(_", "ll_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "d_", ",_", "data_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "empty", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ll_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "empty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "ll_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ll_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "10_", "not_", "in_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "iter", "ator", "\\u", "not", "\\u", "exhaust", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "6_", ",_", "7_", ",_", "8_", ",_", "9_", ",_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "not", "\\u", "exhaust", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number", "\\u", "of", "\\u", "iterations_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "d_", "in_", "enumerate_", "(_", "ll_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "d_", ",_", "data_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number", "\\u", "of", "\\u", "iterations_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "number", "\\u", "of", "\\u", "iterations_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "len_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ll_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "not", "\\u", "exhaust", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "not", "\\u", "exhaust", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ll_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "contains_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ll_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "not", "\\u", "exhaust", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "40_", "not_", "in_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "1_", "in_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "5_", "in_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "10_", "in_", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "indexing", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ll_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "not", "\\u", "exhaust", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ll_", "[_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ll_", "[_", "9_", "]_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ll_", "[_", "-_", "1_", "]_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ll_", "[_", "11_", "]_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Except", "ion", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "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", "repr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ll", "1_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "empty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll", "2_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "exhaust", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll", "3_", "=_", "La", "zy", "List_", "(_", "get", "\\u", "more_", "=_", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "not", "\\u", "exhaust", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "repr_", "(_", "ll", "1_", ")_", ",_", "'[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "repr_", "(_", "ll", "2_", ")_", ",_", "'[", "1", ",", " ", "2", ",", " ", "3", ",", " ", "4", ",", " ", "5", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "repr_", "(_", "ll", "3_", ")_", ",_", "'[", "1", ",", " ", "2", ",", " ", "3", ",", " ", "4", ",", " ", "5", ",", " ", "6", ",", " ", "7", ",", " ", "8", ",", " ", "9", ",", " ", "10", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "more", "\\u", "empty_", "(_", "self_", ",_", "last", "\\u", "key_", ",_", "value", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", ",_", "None_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "more", "\\u", "exhaust", "ed_", "(_", "self_", ",_", "last", "\\u", "key_", ",_", "value", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_", ",_", "5_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "La", "zy", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "more", "\\u", "not", "\\u", "exhaust", "ed_", "(_", "self_", ",_", "last", "\\u", "key_", ",_", "value", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "get", "\\u", "more", "\\u", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "last", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", ",_", "last", "\\u", "key_", ",_", "exhaust", "ed_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", ",_", "5_", ",_", "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 ", " _", "data_", ",_", "last", "\\u", "key_", ",_", "exhaust", "ed_", "=_", "[_", "6_", ",_", "7_", ",_", "8_", ",_", "9_", ",_", "10_", "]_", ",_", "10_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", ",_", "last", "\\u", "key_", ",_", "exhaust", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2 ]
Unused import
05bit/django-smarter/setup.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"Setup file for easy installation\"\"\"\nfrom os.path import join, dirname\nfrom setuptools import setup\n\nversion = '1.1'\n\nLONG_DESCRIPTION = \"\"\"\nSmarter declarative style generic views for Django.\n\"\"\"\n\n\nsetup(name='django-smarter',\n version=version,\n author='Alexey Kinyov',\n author_email='[email protected]',\n description='Smarter declarative style generic views for Django.',\n license='BSD',\n keywords='django, application, scaffolding, crud, views, utility',\n url='https://github.com/05bit/django-smarter',\n packages=['smarter',],\n include_package_data=True,\n long_description=long_description(),\n # install_requires=['Django>=1.4',],\n classifiers=['Development Status :: 4 - Beta',\n 'Operating System :: OS Independent',\n 'License :: OSI Approved :: BSD License',\n 'Intended Audience :: Developers',\n 'Environment :: Web Environment',\n 'Programming Language :: Python :: 2.5',\n 'Programming Language :: Python :: 2.6',\n 'Programming Language :: Python :: 2.7'])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def long_description():\n \"\"\"Return long description from README.rst if it's present\n because it doesn't get installed.\"\"\"\n try:\n return open(join(dirname(__file__), 'README.rst')).read()\n except IOError:\n return LONG_DESCRIPTION", "metadata": "root.long_description", "header": "['module', '___EOS___']", "index": 11 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Set", "up", " ", "file", " ", "for", " ", "easy", " ", "installation", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", ",_", "dirname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "1.1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LONG", "\\u", "DESCRIPTION_", "=_", "\"\"\"", "\\", "10", ";", "Sma", "rte", "r", " ", "declarative", " ", "style", " ", "gener", "ic", " ", "views", " ", "for", " ", "Dj", "ang", "o", ".", "\\", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "name_", "=_", "'", "django", "-", "smart", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Alex", "ey", " ", "Kin", "yo", "v", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "ru", "dy", "@", "05", "bit", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Sma", "rte", "r", " ", "declarative", " ", "style", " ", "gener", "ic", " ", "views", " ", "for", " ", "Dj", "ang", "o", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "BS", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "'", "django", ",", " ", "applica", "tion", ",", " ", "scaffold", "ing", ",", " ", "crud", ",", " ", "views", ",", " ", "utility", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "05", "bit", "/", "django", "-", "smart", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "smart", "er", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "package", "\\u", "data_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "long", "\\u", "description_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", "\\u", "require", "s", "=[", "'", "Dj", "ang", "o", ">=", "1.4", "',", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "4", " ", "-", " ", "Beta", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Environ", "ment", " ", "::", " ", "Web", " ", "Environ", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.7", "'_", "]_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "long", "\\u", "description_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "long", " ", "description", " ", "from", " ", "READ", "ME", ".", "rst", " ", "if", " ", "it", "'", "s", " ", "presen", "t", "\\", "10", ";", " ", " ", " ", " ", "bec", "aus", "e", " ", "it", " ", "doe", "sn", "'", "t", " ", "get", " ", "install", "ed", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "open_", "(_", "join_", "(_", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "READ", "ME", ".", "rst", "'_", ")_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "LONG", "\\u", "DESCRIPTION_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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lib import contextmanager\n\nfrom gevent import sleep\nfrom lockfile import LockFile, AlreadyLocked, LockTimeout\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@contextmanager\ndef lock_file(path, maxdelay=.1, lock_cls=LockFile, timeout=10.0):\n \"\"\"Cooperative file lock. Uses `lockfile.LockFile` polling under the hood.\n\n `maxdelay` defines the interval between individual polls.\n\n \"\"\"\n lock = lock_cls(path)\n max_t = time.time() + timeout\n while True:\n if time.time() >= max_t:\n raise LockTimeout(\"Timeout waiting to acquire lock for %s\" % (path,)) # same exception messages as in lockfile\n try:\n lock.acquire(timeout=0)\n except AlreadyLocked:\n sleep(maxdelay)\n else:\n try:\n yield lock\n break\n finally:\n lock.release()", "metadata": "root.lock_file", "header": "['module', '___EOS___']", "index": 9 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "contextlib_", "import_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gevent_", "import_", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lockfile", "_", "import_", "Lock", "File_", ",_", "Al", "read", "y", "Locke", "d_", ",_", "Lock", "Timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "lock", "\\u", "file_", "(_", "path_", ",_", "maxd", "ela", "y_", "=_", ".1_", ",_", "lock", "\\u", "cls_", "=_", "Lock", "File_", ",_", "timeout_", "=_", "10.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Coo", "perat", "ive", " ", "file", " ", "lock", ".", " ", "Us", "es", " ", "`", "lockfile", ".", "Lock", "File", "`", " ", "polling", " ", "under", " ", "the", " ", "hood", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "maxd", "ela", "y", "`", " ", "defin", "es", " ", "the", " ", "interval", " ", "bet", "ween", " ", "individual", " ", "polls", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lock_", "=_", "lock", "\\u", "cls_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "t_", "=_", "time_", "._", "time_", "(_", ")_", "+_", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "time_", "._", "time_", "(_", ")_", ">=_", "max", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Lock", "Timeout_", "(_", "\"", "Time", "out", " ", "wait", "ing", " ", "to", " ", "acquir", "e", " ", "lock", " ", "for", " ", "%", "s", "\"_", "%_", "(_", "path_", ",_", ")_", ")_", "#", " ", "same", " ", "exception", " ", "message", "s", " ", "as", " ", "in", " ", "lockfile", "_", "\\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 ", " _", "lock_", "._", "acquire_", "(_", "timeout_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Al", "read", "y", "Locke", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sleep_", "(_", "maxd", "ela", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\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 ", " _", "lock_", "._", "release_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
anhstudios/swganh/data/scripts/templates/object/mobile/shared_dressed_dathomir_nightsister_elder.py
[ { "content": "def create(kernel):\n\tresult = Creature()\n\n\tresult.template = \"object/mobile/shared_dressed_dathomir_nightsister_elder.iff\"\n\tresult.attribute_template_id = 9\n\tresult.stfName(\"theme_park_name\",\"nightsister_elder\")\t\t\n\t\n\t#### BEGIN MODIFICATIONS ####\n\t#### END MODIFICATIONS ####\n\t\n\treturn result", "metadata": "root.create", "header": "['module', '___EOS___']", "index": 6 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", "kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "result_", "=_", "Creat", "ure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "template_", "=_", "\"", "object", "/", "mobile", "/", "shared", "\\u", "dress", "ed", "\\u", "dat", "hom", "ir", "\\u", "night", "siste", "r", "\\u", "eld", "er", ".", "iff", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "attribute", "\\u", "template", "\\u", "id_", "=_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "stf", "Name_", "(_", "\"", "them", "e\\u", "park", "\\u", "name", "\"_", ",_", "\"", "night", "siste", "r", "\\u", "eld", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "BEGIN", " ", "MODI", "FICATION", "S", " ", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", " ", "END", " ", "MODI", "FICATION", "S", " ", " ", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "result_" ]
[ 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 ]
Unused local variable
pybrain/pybrain/pybrain/rl/environments/mazes/tasks/shuttle.py
[ { "content": "class ShuttleDocking(MazeTask):\n \"\"\"\n #######\n #. *#\n #######\n\n The spaceship needs to dock backwards into the goal station.\n \"\"\"\n\n actions = 3\n observations = 5\n discount = 0.95\n\n mazeclass = PolarMaze\n\n finalReward = 10\n bangPenalty = -3\n\n initPos = [(1, 1)]\n topology = array([[1] * 7,\n [1, 0, 0, 0, 0, 0, 1],\n [1] * 7, ])\n goal = (1, 5)\n\n Backup = 0\n Forward = 1\n TurnAround = 2\n\n\n\n\n\n", "metadata": "root.ShuttleDocking", "header": "['module', '___EOS___']", "index": 9 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Shutt", "le", "Dock", "ing_", "(_", "Ma", "ze", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "######", "#", "\\", "10", ";", " ", " ", " ", " ", "#.", " ", " ", " ", "*#", "\\", "10", ";", " ", " ", " ", " ", "######", "#", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "space", "ship", " ", "need", "s", " ", "to", " ", "dock", " ", "back", "ward", "s", " ", "int", "o", " ", "the", " ", "goal", " ", "station", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actions_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "observations_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "discount_", "=_", "0.95_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "maze", "class_", "=_", "Pola", "r", "Ma", "ze_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "final", "Reward", "_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bang", "Pen", "alty", "_", "=_", "-_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Pos_", "=_", "[_", "(_", "1_", ",_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topology_", "=_", "array_", "(_", "[_", "[_", "1_", "]_", "*_", "7_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "1_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "1_", "]_", "*_", "7_", ",_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "goal_", "=_", "(_", "1_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Backup_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Forward_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Turn", "Aro", "und_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 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 ]
Testing equality to None
EasyEngine/easyengine/ee/cli/plugins/site.py
[ { "content": " @expose(hide=True)\n def default(self):\n # self.app.render((data), 'default.mustache')\n # Check domain name validation\n data = dict()\n host, port = None, None\n try:\n stype, cache = detSitePar(vars(self.app.pargs))\n except RuntimeError as e:\n Log.debug(self, str(e))\n Log.error(self, \"Please provide valid options to creating site\")\n\n if stype is None and self.app.pargs.proxy:\n stype, cache = 'proxy', ''\n proxyinfo = self.app.pargs.proxy[0].strip()\n if not proxyinfo:\n Log.error(self, \"Please provide proxy server host information\")\n proxyinfo = proxyinfo.split(':')\n host = proxyinfo[0].strip()\n port = '80' if len(proxyinfo) < 2 else proxyinfo[1].strip()\n elif stype is None and not self.app.pargs.proxy:\n stype, cache = 'html', 'basic'\n elif stype and self.app.pargs.proxy:\n Log.error(self, \"proxy should not be used with other site types\")\n if (self.app.pargs.proxy and (self.app.pargs.pagespeed\n or self.app.pargs.hhvm)):\n Log.error(self, \"Proxy site can not run on pagespeed or hhvm\")\n\n if not self.app.pargs.site_name:\n try:\n while not self.app.pargs.site_name:\n # preprocessing before finalize site name\n self.app.pargs.site_name = (input('Enter site name : ')\n .strip())\n except IOError as e:\n Log.debug(self, str(e))\n Log.error(self, \"Unable to input site name, Please try again!\")\n\n self.app.pargs.site_name = self.app.pargs.site_name.strip()\n (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)\n\n if not ee_domain.strip():\n Log.error(\"Invalid domain name, \"\n \"Provide valid domain name\")\n\n ee_site_webroot = EEVariables.ee_webroot + ee_domain\n\n if check_domain_exists(self, ee_domain):\n Log.error(self, \"site {0} already exists\".format(ee_domain))\n elif os.path.isfile('/etc/nginx/sites-available/{0}'\n .format(ee_domain)):\n Log.error(self, \"Nginx configuration /etc/nginx/sites-available/\"\n \"{0} already exists\".format(ee_domain))\n\n if stype == 'proxy':\n data['site_name'] = ee_domain\n data['www_domain'] = ee_www_domain\n data['proxy'] = True\n data['host'] = host\n data['port'] = port\n ee_site_webroot = \"\"\n\n if self.app.pargs.php7:\n data = dict(site_name=ee_domain, www_domain=ee_www_domain,\n static=False, basic=False, php7=True, wp=False, w3tc=False,\n wpfc=False, wpsc=False, multisite=False,\n wpsubdir=False, webroot=ee_site_webroot)\n data['basic'] = True\n\n if stype in ['html', 'php' ]:\n data = dict(site_name=ee_domain, www_domain=ee_www_domain,\n static=True, basic=False, php7=False, wp=False, w3tc=False,\n wpfc=False, wpsc=False, multisite=False,\n wpsubdir=False, webroot=ee_site_webroot)\n\n if stype == 'php':\n data['static'] = False\n data['basic'] = True\n\n elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:\n\n data = dict(site_name=ee_domain, www_domain=ee_www_domain,\n static=False, basic=True, wp=False, w3tc=False,\n wpfc=False, wpsc=False, wpredis=False, multisite=False,\n wpsubdir=False, webroot=ee_site_webroot,\n ee_db_name='', ee_db_user='', ee_db_pass='',\n ee_db_host='')\n\n if stype in ['wp', 'wpsubdir', 'wpsubdomain']:\n data['wp'] = True\n data['basic'] = False\n data[cache] = True\n data['wp-user'] = self.app.pargs.user\n data['wp-email'] = self.app.pargs.email\n data['wp-pass'] = self.app.pargs.wppass\n if stype in ['wpsubdir', 'wpsubdomain']:\n data['multisite'] = True\n if stype == 'wpsubdir':\n data['wpsubdir'] = True\n else:\n pass\n\n if stype == \"html\" and self.app.pargs.hhvm:\n Log.error(self, \"Can not create HTML site with HHVM\")\n\n if data and self.app.pargs.php7:\n if (not self.app.pargs.experimental):\n Log.info(self, \"PHP7.0 is experimental feature and it may not \"\n \"work with all CSS/JS/Cache of your site.\\nDo you wish\"\n \" to install PHP 7.0 now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.info(self, \"Not using PHP 7.0 for site.\")\n data['php7'] = False\n data['basic'] = True\n php7 = 0\n self.app.pargs.php7 = False\n else:\n data['php7'] = True\n php7 = 1\n else:\n data['php7'] = True\n php7 = 1\n elif data:\n data['php7'] = False\n php7 = 0\n\n if (not self.app.pargs.w3tc) and\\\n (not self.app.pargs.wpfc) and (not self.app.pargs.wpsc) and (not self.app.pargs.wpredis) \\\n and (not self.app.pargs.hhvm):\n data['basic'] = True\n\n #for debug purpose\n #for key, value in data.items() :\n # print (key, value)\n\n\n if data and self.app.pargs.hhvm:\n if (not self.app.pargs.experimental):\n Log.info(self, \"HHVM is experimental feature and it may not \"\n \"work with all plugins of your site.\\nYou can \"\n \"disable it by passing --hhvm=off later.\\nDo you wish\"\n \" to enable HHVM now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.info(self, \"Not using HHVM for site.\")\n data['hhvm'] = False\n hhvm = 0\n self.app.pargs.hhvm = False\n else:\n data['hhvm'] = True\n hhvm = 1\n else:\n data['hhvm'] = True\n hhvm = 1\n\n elif data:\n data['hhvm'] = False\n hhvm = 0\n\n if data and self.app.pargs.pagespeed:\n if (not self.app.pargs.experimental):\n Log.info(self, \"PageSpeed is experimental feature and it may not \"\n \"work with all CSS/JS/Cache of your site.\\nYou can \"\n \"disable it by passing --pagespeed=off later.\\nDo you wish\"\n \" to enable PageSpeed now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.info(self, \"Not using PageSpeed for site.\")\n data['pagespeed'] = False\n pagespeed = 0\n self.app.pargs.pagespeed = False\n else:\n data['pagespeed'] = True\n pagespeed = 1\n else:\n data['pagespeed'] = True\n pagespeed = 1\n elif data:\n data['pagespeed'] = False\n pagespeed = 0\n\n if (cache == 'wpredis' and (not self.app.pargs.experimental)):\n Log.info(self, \"Redis is experimental feature and it may not \"\n \"work with all CSS/JS/Cache of your site.\\nYou can \"\n \"disable it by changing cache later.\\nDo you wish\"\n \" to enable Redis now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n Log.error(self, \"Not using Redis for site\")\n cache = 'basic'\n data['wpredis'] = False\n data['basic'] = True\n self.app.pargs.wpredis = False\n\n # self.app.args.print_help()\n # if not data:\n # self.app.close(1)\n\n # Check rerequired packages are installed or not\n ee_auth = site_package_check(self, stype)\n\n try:\n pre_run_checks(self)\n except SiteError as e:\n Log.debug(self, str(e))\n Log.error(self, \"NGINX configuration check failed.\")\n\n try:\n try:\n # setup NGINX configuration, and webroot\n setupdomain(self, data)\n\n # Fix Nginx Hashbucket size error\n hashbucket(self)\n except SiteError as e:\n # call cleanup actions on failure\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'])\n Log.debug(self, str(e))\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n if 'proxy' in data.keys() and data['proxy']:\n addNewSite(self, ee_domain, stype, cache, ee_site_webroot)\n # Service Nginx Reload\n if not EEService.reload_service(self, 'nginx'):\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain)\n deleteSiteInfo(self, ee_domain)\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n if ee_auth and len(ee_auth):\n for msg in ee_auth:\n Log.info(self, Log.ENDC + msg, log=False)\n Log.info(self, \"Successfully created site\"\n \" http://{0}\".format(ee_domain))\n return\n # Update pagespeed config\n if self.app.pargs.pagespeed:\n operateOnPagespeed(self, data)\n\n if data['php7']:\n php_version = \"7.0\"\n else:\n php_version = \"5.6\"\n\n\n addNewSite(self, ee_domain, stype, cache, ee_site_webroot,\n hhvm=hhvm, pagespeed=pagespeed, php_version=php_version)\n\n # Setup database for MySQL site\n if 'ee_db_name' in data.keys() and not data['wp']:\n try:\n data = setupdatabase(self, data)\n # Add database information for site into database\n updateSiteInfo(self, ee_domain, db_name=data['ee_db_name'],\n db_user=data['ee_db_user'],\n db_password=data['ee_db_pass'],\n db_host=data['ee_db_host'])\n except SiteError as e:\n # call cleanup actions on failure\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'],\n dbname=data['ee_db_name'],\n dbuser=data['ee_db_user'],\n dbhost=data['ee_db_host'])\n deleteSiteInfo(self, ee_domain)\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n try:\n eedbconfig = open(\"{0}/ee-config.php\"\n .format(ee_site_webroot),\n encoding='utf-8', mode='w')\n eedbconfig.write(\"<?php \\ndefine('DB_NAME', '{0}');\"\n \"\\ndefine('DB_USER', '{1}'); \"\n \"\\ndefine('DB_PASSWORD', '{2}');\"\n \"\\ndefine('DB_HOST', '{3}');\\n?>\"\n .format(data['ee_db_name'],\n data['ee_db_user'],\n data['ee_db_pass'],\n data['ee_db_host']))\n eedbconfig.close()\n stype = 'mysql'\n except IOError as e:\n Log.debug(self, str(e))\n Log.debug(self, \"Error occured while generating \"\n \"ee-config.php\")\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'],\n dbname=data['ee_db_name'],\n dbuser=data['ee_db_user'],\n dbhost=data['ee_db_host'])\n deleteSiteInfo(self, ee_domain)\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n # Setup WordPress if Wordpress site\n if data['wp']:\n try:\n ee_wp_creds = setupwordpress(self, data)\n # Add database information for site into database\n updateSiteInfo(self, ee_domain, db_name=data['ee_db_name'],\n db_user=data['ee_db_user'],\n db_password=data['ee_db_pass'],\n db_host=data['ee_db_host'])\n except SiteError as e:\n # call cleanup actions on failure\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'],\n dbname=data['ee_db_name'],\n dbuser=data['ee_db_user'],\n dbhost=data['ee_mysql_grant_host'])\n deleteSiteInfo(self, ee_domain)\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n # Service Nginx Reload call cleanup if failed to reload nginx\n if not EEService.reload_service(self, 'nginx'):\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'])\n if 'ee_db_name' in data.keys():\n doCleanupAction(self, domain=ee_domain,\n dbname=data['ee_db_name'],\n dbuser=data['ee_db_user'],\n dbhost=data['ee_mysql_grant_host'])\n deleteSiteInfo(self, ee_domain)\n Log.info(self, Log.FAIL + \"service nginx reload failed.\"\n \" check issues with `nginx -t` command.\")\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n EEGit.add(self, [\"/etc/nginx\"],\n msg=\"{0} created with {1} {2}\"\n .format(ee_www_domain, stype, cache))\n # Setup Permissions for webroot\n try:\n setwebrootpermissions(self, data['webroot'])\n except SiteError as e:\n Log.debug(self, str(e))\n Log.info(self, Log.FAIL + \"Oops Something went wrong !!\")\n Log.info(self, Log.FAIL + \"Calling cleanup actions ...\")\n doCleanupAction(self, domain=ee_domain,\n webroot=data['webroot'])\n if 'ee_db_name' in data.keys():\n print(\"Inside db cleanup\")\n doCleanupAction(self, domain=ee_domain,\n dbname=data['ee_db_name'],\n dbuser=data['ee_db_user'],\n dbhost=data['ee_mysql_grant_host'])\n deleteSiteInfo(self, ee_domain)\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n if ee_auth and len(ee_auth):\n for msg in ee_auth:\n Log.info(self, Log.ENDC + msg, log=False)\n\n if data['wp']:\n Log.info(self, Log.ENDC + \"WordPress admin user :\"\n \" {0}\".format(ee_wp_creds['wp_user']), log=False)\n Log.info(self, Log.ENDC + \"WordPress admin user password : {0}\"\n .format(ee_wp_creds['wp_pass']), log=False)\n\n display_cache_settings(self, data)\n\n Log.info(self, \"Successfully created site\"\n \" http://{0}\".format(ee_domain))\n except SiteError as e:\n Log.error(self, \"Check logs for reason \"\n \"`tail /var/log/ee/ee.log` & Try Again!!!\")\n\n if self.app.pargs.letsencrypt :\n if (not self.app.pargs.experimental):\n if stype in ['wpsubdomain']:\n\t Log.warn(self, \"Wildcard domains are not supported in Lets Encrypt.\\nWP SUBDOMAIN site will get SSL for primary site only.\")\n\n Log.info(self, \"Letsencrypt is currently in beta phase.\"\n \" \\nDo you wish\"\n \" to enable SSl now for {0}?\".format(ee_domain))\n\n # Check prompt\n check_prompt = input(\"Type \\\"y\\\" to continue [n]:\")\n if check_prompt != \"Y\" and check_prompt != \"y\":\n data['letsencrypt'] = False\n letsencrypt = False\n else:\n data['letsencrypt'] = True\n letsencrypt = True\n else:\n data['letsencrypt'] = True\n letsencrypt = True\n\n if data['letsencrypt'] is True:\n setupLetsEncrypt(self, ee_domain)\n httpsRedirect(self,ee_domain)\n Log.info(self,\"Creating Cron Job for cert auto-renewal\")\n EECron.setcron_weekly(self,'ee site update --le=renew --all 2> /dev/null'.format(ee_domain),'Renew all'\n ' letsencrypt SSL cert. Set by EasyEngine')\n\n if not EEService.reload_service(self, 'nginx'):\n Log.error(self, \"service nginx reload failed. \"\n \"check issues with `nginx -t` command\")\n\n Log.info(self, \"Congratulations! Successfully Configured SSl for Site \"\n \" https://{0}\".format(ee_domain))\n\n if (SSL.getExpirationDays(self,ee_domain)>0):\n Log.info(self, \"Your cert will expire within \" + str(SSL.getExpirationDays(self,ee_domain)) + \" days.\")\n else:\n Log.warn(self, \"Your cert already EXPIRED ! .PLEASE renew soon . \")\n\n # Add nginx conf folder into GIT\n EEGit.add(self, [\"{0}/conf/nginx\".format(ee_site_webroot)],\n msg=\"Adding letsencrypts config of site: {0}\"\n .format(ee_domain))\n updateSiteInfo(self, ee_domain, ssl=letsencrypt)\n\n elif data['letsencrypt'] is False:\n Log.info(self, \"Not using Let\\'s encrypt for Site \"\n \" http://{0}\".format(ee_domain))", "metadata": "root.EESiteCreateController.default", "header": "['class', 'EESiteCreateController', '(', 'CementBaseController', ')', ':', '___EOS___']", "index": 384 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "EE", "Site", "Creat", "e", "Controller_", "(_", "Ce", "ment", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "expose_", "(_", "hide_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "app", ".", "render", "((", "data", "),", " ", "'", "default", ".", "must", "ache", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "domain", " ", "name", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", ",_", "port_", "=_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", ",_", "cache_", "=_", "det", "Site", "Par", "_", "(_", "vars_", "(_", "self_", "._", "app_", "._", "pargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Ple", "ase", " ", "provide", " ", "valid", " ", "options", " ", "to", " ", "creati", "ng", " ", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "is_", "None_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", ",_", "cache_", "=_", "'", "proxy", "'_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proxy", "info_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "proxy_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "proxy", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Ple", "ase", " ", "provide", " ", "proxy", " ", "server", " ", "host", " ", "informati", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proxy", "info_", "=_", "proxy", "info_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "proxy", "info_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "'", "80", "'_", "if_", "len_", "(_", "proxy", "info_", ")_", "<_", "2_", "else_", "proxy", "info_", "[_", "1_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stype_", "is_", "None_", "and_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stype_", ",_", "cache_", "=_", "'", "html", "'_", ",_", "'", "basic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stype_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "proxy", " ", "shou", "ld", " ", "not", " ", "be", " ", "used", " ", "with", " ", "other", " ", "site", " ", "types", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "proxy_", "and_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "page", "speed_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Pro", "xy", " ", "site", " ", "can", " ", "not", " ", "run", " ", "on", " ", "page", "speed", " ", "or", " ", "hh", "vm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "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 ", " _", "while_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "preproc", "essi", "ng", " ", "bef", "ore", " ", "finalize", " ", "site", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "(_", "input_", "(_", "'", "Enter", " ", "site", " ", "name", " ", ":", " ", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Una", "ble", " ", "to", " ", "input", " ", "site", " ", "name", ",", " ", "Ple", "ase", " ", "try", " ", "again", "!\"_", ")_", "\\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_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ee", "\\u", "domain_", ",_", "ee", "\\u", "www", "\\u", "domain_", ")_", "=_", "Validate", "Domain_", "(_", "self_", "._", "app_", "._", "pargs_", "._", "site", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ee", "\\u", "domain_", "._", "strip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "\"", "Inva", "lid", " ", "domain", " ", "name", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Prov", "ide", " ", "valid", " ", "domain", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "EE", "Variables_", "._", "ee", "\\u", "webr", "oot_", "+_", "ee", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "check", "\\u", "domain", "\\u", "exists_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "site", " ", "{", "0", "}", " ", "alr", "ead", "y", " ", "exist", "s", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/{", "0", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Ng", "inx", " ", "configura", "tion", " ", "/", "etc", "/", "ngin", "x", "/", "sites", "-", "avail", "able", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "0", "}", " ", "alr", "ead", "y", " ", "exist", "s", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "==_", "'", "proxy", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "site", "\\u", "name", "'_", "]_", "=_", "ee", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "www", "\\u", "domain", "'_", "]_", "=_", "ee", "\\u", "www", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "proxy", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "host", "'_", "]_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "port", "'_", "]_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "\\u", "site", "\\u", "webr", "oot_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "app_", "._", "pargs_", "._", "php", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "site", "\\u", "name_", "=_", "ee", "\\u", "domain_", ",_", "www", "\\u", "domain_", "=_", "ee", "\\u", "www", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "static_", "=_", "False_", ",_", "basic_", "=_", "False_", ",_", "php", "7_", "=_", "True_", ",_", "wp_", "=_", "False_", ",_", "w3", "tc_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wp", "fc_", "=_", "False_", ",_", "wps", "c_", "=_", "False_", ",_", "multisi", "te_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wps", "ub", "dir_", "=_", "False_", ",_", "webr", "oot_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "in_", "[_", "'", "html", "'_", ",_", "'", "php", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "site", "\\u", "name_", "=_", "ee", "\\u", "domain_", ",_", "www", "\\u", "domain_", "=_", "ee", "\\u", "www", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "static_", "=_", "True_", ",_", "basic_", "=_", "False_", ",_", "php", "7_", "=_", "False_", ",_", "wp_", "=_", "False_", ",_", "w3", "tc_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wp", "fc_", "=_", "False_", ",_", "wps", "c_", "=_", "False_", ",_", "multisi", "te_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wps", "ub", "dir_", "=_", "False_", ",_", "webr", "oot_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stype_", "==_", "'", "php", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "static", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "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_", "elif_", "stype_", "in_", "[_", "'", "mysql", "'_", ",_", "'", "wp", "'_", ",_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "site", "\\u", "name_", "=_", "ee", "\\u", "domain_", ",_", "www", "\\u", "domain_", "=_", "ee", "\\u", "www", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "static_", "=_", "False_", ",_", "basic_", "=_", "True_", ",_", "wp_", "=_", "False_", ",_", "w3", "tc_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wp", "fc_", "=_", "False_", ",_", "wps", "c_", "=_", "False_", ",_", "wp", "redis_", "=_", "False_", ",_", "multisi", "te_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wps", "ub", "dir_", "=_", "False_", ",_", "webr", "oot_", "=_", "ee", "\\u", "site", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ee", "\\u", "db", "\\u", "name_", "=_", "''_", ",_", "ee", "\\u", "db", "\\u", "user_", "=_", "''_", ",_", "ee", "\\u", "db", "\\u", "pass_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ee", "\\u", "db", "\\u", "host_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stype_", "in_", "[_", "'", "wp", "'_", ",_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "wp", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "cache_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "-", "user", "'_", "]_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "-", "email", "'_", "]_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "-", "pass", "'_", "]_", "=_", "self_", "._", "app_", "._", "pargs_", "._", "wp", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stype_", "in_", "[_", "'", "wps", "ub", "dir", "'_", ",_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "multisi", "te", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stype_", "==_", "'", "wps", "ub", "dir", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "[_", "'", "wps", "ub", "dir", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stype_", "==_", "\"", "html", "\"_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Can", " ", "not", " ", "create", " ", "HTM", "L", " ", "site", " ", "with", " ", "HH", "VM", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "php", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "PH", "P", "7.0", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "work", " ", "with", " ", "all", " ", "CS", "S", "/", "JS", "/", "Cache", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "install", " ", "PH", "P", " ", "7.0", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "PH", "P", " ", "7.0", " ", "for", " ", "site", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "php", "7_", "=_", "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 ", " ", "_", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "1_", "\\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 ", " _", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "php", "7", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "php", "7_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "w3", "tc_", ")_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "wp", "fc_", ")_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "wps", "c_", ")_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "wp", "redis_", ")_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "basic", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "debug", " ", "purpose", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "key", ",", " ", "value", " ", "in", " ", "data", ".", "items", "()", " ", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "print", " ", "(", "key", ",", " ", "value", ")_", "\\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_", "data_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "HH", "VM", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "work", " ", "with", " ", "all", " ", "plugin", "s", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "You", " ", "can", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", " ", "it", " ", "by", " ", "passi", "ng", " ", "--", "hh", "vm", "=", "off", " ", "late", "r", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "HH", "VM", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "HH", "VM", " ", "for", " ", "site", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "hh", "vm_", "=_", "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 ", " ", "_", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "1_", "\\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 ", " _", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "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_", "elif_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "hh", "vm", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hh", "vm_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "and_", "self_", "._", "app_", "._", "pargs_", "._", "page", "speed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Page", "Spee", "d", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "work", " ", "with", " ", "all", " ", "CS", "S", "/", "JS", "/", "Cache", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "You", " ", "can", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", " ", "it", " ", "by", " ", "passi", "ng", " ", "--", "page", "speed", "=", "off", " ", "late", "r", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "Page", "Spee", "d", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "Page", "Spee", "d", " ", "for", " ", "site", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "page", "speed_", "=_", "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 ", " ", "_", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "1_", "\\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 ", " _", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "page", "speed", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "speed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "cache_", "==_", "'", "wp", "redis", "'_", "and_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "experimental_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Red", "is", " ", "is", " ", "experimental", " ", "feature", " ", "and", " ", "it", " ", "may", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "work", " ", "with", " ", "all", " ", "CS", "S", "/", "JS", "/", "Cache", " ", "of", " ", "your", " ", "site", ".\\\\", "n", "You", " ", "can", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", " ", "it", " ", "by", " ", "chang", "ing", " ", "cache", " ", "late", "r", ".\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "Red", "is", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "Red", "is", " ", "for", " ", "site", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "=_", "'", "basic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "wp", "redis", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "basic", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "pargs_", "._", "wp", "redis_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "app", ".", "args", ".", "print", "\\u", "help", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "data", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "app", ".", "close", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "rer", "equi", "red", " ", "package", "s", " ", "are", " ", "install", "ed", " ", "or", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ee", "\\u", "auth_", "=_", "site", "\\u", "package", "\\u", "check_", "(_", "self_", ",_", "stype_", ")_", "\\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 ", " _", "pre", "\\u", "run", "\\u", "checks_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "NG", "IN", "X", " ", "configura", "tion", " ", "check", " ", "fail", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "setup", " ", "NG", "IN", "X", " ", "configura", "tion", ",", " ", "and", " ", "webr", "oot_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "domain_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fix", " ", "Ng", "inx", " ", "Hash", "bucket", " ", "size", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "hash", "bucket_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "clean", "up", " ", "action", "s", " ", "on", " ", "failure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "proxy", "'_", "in_", "data_", "._", "keys_", "(_", ")_", "and_", "data_", "[_", "'", "proxy", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "New", "Site_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "stype_", ",_", "cache_", ",_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Service", " ", "Ng", "inx", " ", "Relo", "ad_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ee", "\\u", "auth_", "and_", "len_", "(_", "ee", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "msg_", "in_", "ee", "\\u", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "msg_", ",_", "log_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Success", "full", "y", " ", "created", " ", "site", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "page", "speed", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "app_", "._", "pargs_", "._", "page", "speed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "operate", "On", "Page", "speed_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "[_", "'", "php", "7", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "php", "\\u", "version_", "=_", "\"", "7.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 ", " _", "php", "\\u", "version_", "=_", "\"", "5.6", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "New", "Site_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "stype_", ",_", "cache_", ",_", "ee", "\\u", "site", "\\u", "webr", "oot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hh", "vm_", "=_", "hh", "vm_", ",_", "page", "speed_", "=_", "page", "speed_", ",_", "php", "\\u", "version_", "=_", "php", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "databa", "se", " ", "for", " ", "My", "SQL", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "in_", "data_", "._", "keys_", "(_", ")_", "and_", "not_", "data_", "[_", "'", "wp", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "setup", "database_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "databa", "se", " ", "informati", "on", " ", "for", " ", "site", " ", "int", "o", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "db", "\\u", "name_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "user_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "password_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "pass", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "host_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "clean", "up", " ", "action", "s", " ", "on", " ", "failure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbus", "er_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "ost_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\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 ", " ", "_", "eed", "bco", "nfig_", "=_", "open_", "(_", "\"{", "0", "}/", "ee", "-", "config", ".", "php", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "mode_", "=_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eed", "bco", "nfig_", "._", "write_", "(_", "\"<", "?", "php", " ", "\\\\", "ndef", "ine", "('", "DB", "\\u", "NAME", "',", " ", "'{", "0", "}')", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "ndef", "ine", "('", "DB", "\\u", "USER", "',", " ", "'{", "1", "}')", ";", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "ndef", "ine", "('", "DB", "\\u", "PASS", "WORD", "',", " ", "'{", "2", "}')", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "ndef", "ine", "('", "DB", "\\u", "HOST", "',", " ", "'{", "3", "}')", ";\\\\", "n", "?>", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "pass", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eed", "bco", "nfig_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stype_", "=_", "'", "mysql", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "debug_", "(_", "self_", ",_", "\"", "Error", " ", "occure", "d", " ", "whi", "le", " ", "generat", "ing", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ee", "-", "config", ".", "php", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbus", "er_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "ost_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "Word", "Press", " ", "if", " ", "Word", "press", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "[_", "'", "wp", "'_", "]_", ":_", "\\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 ", " ", "_", "ee", "\\u", "wp", "\\u", "creds_", "=_", "setup", "wordpress", "_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "databa", "se", " ", "informati", "on", " ", "for", " ", "site", " ", "int", "o", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "db", "\\u", "name_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "user_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "password_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "pass", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "host_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "clean", "up", " ", "action", "s", " ", "on", " ", "failure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbus", "er_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "ost_", "=_", "data_", "[_", "'", "ee", "\\u", "mysql", "\\u", "grant", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Service", " ", "Ng", "inx", " ", "Relo", "ad", " ", "call", " ", "clean", "up", " ", "if", " ", "fail", "ed", " ", "to", " ", "relo", "ad", " ", "ngin", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "in_", "data_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbus", "er_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "ost_", "=_", "data_", "[_", "'", "ee", "\\u", "mysql", "\\u", "grant", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "EE", "Git", "_", "._", "add_", "(_", "self_", ",_", "[_", "\"/", "etc", "/", "ngin", "x", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"{", "0", "}", " ", "created", " ", "with", " ", "{", "1", "}", " ", "{", "2", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "www", "\\u", "domain_", ",_", "stype_", ",_", "cache_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", "up", " ", "Permi", "ssion", "s", " ", "for", " ", "webr", "oot_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set", "webr", "oot", "permissions_", "(_", "self_", ",_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "debug_", "(_", "self_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Oo", "ps", " ", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "!!\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "FAIL_", "+_", "\"", "Call", "ing", " ", "clean", "up", " ", "action", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "webr", "oot_", "=_", "data_", "[_", "'", "webr", "oot", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "in_", "data_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", "Inside", " ", "db", " ", "clean", "up", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "Clean", "up", "Action_", "(_", "self_", ",_", "domain_", "=_", "ee", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbname_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbus", "er_", "=_", "data_", "[_", "'", "ee", "\\u", "db", "\\u", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "ost_", "=_", "data_", "[_", "'", "ee", "\\u", "mysql", "\\u", "grant", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delete", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ee", "\\u", "auth_", "and_", "len_", "(_", "ee", "\\u", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "msg_", "in_", "ee", "\\u", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "msg_", ",_", "log_", "=_", "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_", "if_", "data_", "[_", "'", "wp", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "\"", "Word", "Press", " ", "admin", " ", "user", " ", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "wp", "\\u", "creds_", "[_", "'", "wp", "\\u", "user", "'_", "]_", ")_", ",_", "log_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "Log_", "._", "ENDC_", "+_", "\"", "Word", "Press", " ", "admin", " ", "user", " ", "password", " ", ":", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "wp", "\\u", "creds_", "[_", "'", "wp", "\\u", "pass", "'_", "]_", ")_", ",_", "log_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "display", "\\u", "cache", "\\u", "settings_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Success", "full", "y", " ", "created", " ", "site", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Site", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "Check", " ", "logs", " ", "for", " ", "reason", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"`", "tail", " ", "/", "var", "/", "log", "/", "ee", "/", "ee", ".", "log", "`", " ", "&", " ", "Tr", "y", " ", "Again", "!!!", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "app_", "._", "pargs_", "._", "lets", "encrypt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "self_", "._", "app_", "._", "pargs_", "._", "experimental_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "stype_", "in_", "[_", "'", "wps", "ub", "domain", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " ", " _", "Log_", "._", "warn_", "(_", "self_", ",_", "\"", "Wildcard", " ", "domains", " ", "are", " ", "not", " ", "support", "ed", " ", "in", " ", "Let", "s", " ", "Encrypt", ".\\\\", "n", "WP", " ", "SUB", "DOM", "AIN", " ", "site", " ", "will", " ", "get", " ", "SS", "L", " ", "for", " ", "primary", " ", "site", " ", "only", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Let", "sen", "crypt", " ", "is", " ", "currentl", "y", " ", "in", " ", "beta", " ", "phase", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "\\\\", "n", "Do", " ", "you", " ", "wish", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "enable", " ", "SS", "l", " ", "now", " ", "for", " ", "{", "0", "}?", "\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "prompt_", "=_", "input_", "(_", "\"", "Type", " ", "\\\\\"", "y", "\\\\\"", " ", "to", " ", "continue", " ", "[", "n", "]:", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "prompt_", "!=_", "\"", "Y", "\"_", "and_", "check", "\\u", "prompt_", "!=_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "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 ", " ", "_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lets", "encrypt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Let", "s", "Encrypt", "_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "https", "Redirect_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Creat", "ing", " ", "Cro", "n", " ", "Jo", "b", " ", "for", " ", "cert", " ", "auto", "-", "renew", "al", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EE", "Cro", "n_", "._", "setc", "ron", "\\u", "week", "ly_", "(_", "self_", ",_", "'", "ee", " ", "site", " ", "update", " ", "--", "le", "=", "renew", " ", "--", "all", " ", "2", ">", " ", "/", "dev", "/", "null", "'_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ",_", "'", "Ren", "ew", " ", "all", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "lets", "encrypt", " ", "SS", "L", " ", "cert", ".", " ", "Set", " ", "by", " ", "Eas", "y", "Engine", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "EE", "Service_", "._", "relo", "ad", "\\u", "service_", "(_", "self_", ",_", "'", "ngin", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "error_", "(_", "self_", ",_", "\"", "service", " ", "ngin", "x", " ", "relo", "ad", " ", "fail", "ed", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "check", " ", "issue", "s", " ", "with", " ", "`", "ngin", "x", " ", "-", "t", "`", " ", "command", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Cong", "rat", "ulation", "s", "!", " ", "Success", "full", "y", " ", "Configure", "d", " ", "SS", "l", " ", "for", " ", "Site", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "https", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "You", "r", " ", "cert", " ", "will", " ", "expir", "e", " ", "within", " ", "\"_", "+_", "str_", "(_", "SSL_", "._", "get", "Expir", "ation", "Days_", "(_", "self_", ",_", "ee", "\\u", "domain_", ")_", ")_", "+_", "\"", " ", "day", "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 ", " ", "_", "Log_", "._", "warn_", "(_", "self_", ",_", "\"", "You", "r", " ", "cert", " ", "alr", "ead", "y", " ", "EXPIRE", "D", " ", "!", " ", ".", "PLE", "AS", "E", " ", "renew", " ", "soo", "n", " ", ".", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "ngin", "x", " ", "conf", " ", "folder", " ", "int", "o", " ", "GIT", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "EE", "Git", "_", "._", "add_", "(_", "self_", ",_", "[_", "\"{", "0", "}/", "conf", "/", "ngin", "x", "\"_", "._", "format_", "(_", "ee", "\\u", "site", "\\u", "webr", "oot_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Add", "ing", " ", "lets", "encrypt", "s", " ", "config", " ", "of", " ", "site", ":", " ", "{", "0", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Site", "Info_", "(_", "self_", ",_", "ee", "\\u", "domain_", ",_", "ssl_", "=_", "lets", "encrypt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", "[_", "'", "lets", "encrypt", "'_", "]_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log_", "._", "info_", "(_", "self_", ",_", "\"", "Not", " ", "usi", "ng", " ", "Let", "\\\\'", "s", " ", "encrypt", " ", "for", " ", "Site", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "http", "://", "{", "0", "}\"_", "._", "format_", "(_", "ee", "\\u", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
kivy/kivy/kivy/tests/perf_test_textinput.py
[ { "content": " def start_test(self, *largs):\n self.but.text = 'test started'\n self.slider.max = len(self.tests)\n\n def test(*l):\n if self.test_done:\n try:\n but = self.tests[int(self.slider.value)]\n self.slider.value += 1\n but.state = 'down'\n print('=====================')\n print('Test:', but.text)\n print('=====================')\n but.test(but)\n except IndexError:\n for but in self.tests:\n but.state = 'normal'\n self.but.text = 'Start Test'\n self.slider.value = 0\n print('===================')\n print('All Tests Completed')\n print('===================')\n Clock.unschedule(test)\n\n Clock.schedule_interval(test, 1)", "metadata": "root.PerfApp.start_test", "header": "['class', 'PerfApp', '(', 'App', ',', 'FloatLayout', ')', ':', '___EOS___']", "index": 159 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Perf", "App_", "(_", "App_", ",_", "Float", "Layout_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "test_", "(_", "self_", ",_", "*_", "lar", "gs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "but", "_", "._", "text_", "=_", "'", "test", " ", "start", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slider_", "._", "max_", "=_", "len_", "(_", "self_", "._", "tests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", "*_", "l_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "test\\u", "done_", ":_", "\\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 ", " ", "_", "but", "_", "=_", "self_", "._", "tests_", "[_", "int_", "(_", "self_", "._", "slider_", "._", "value_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slider_", "._", "value_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "but", "_", "._", "state_", "=_", "'", "down", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'===", "==============", "====", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Test", ":'_", ",_", "but", "_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'===", "==============", "====", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "but", "_", "._", "test_", "(_", "but", "_", ")_", "\\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 ", " ", "_", "for_", "but", "_", "in_", "self_", "._", "tests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "but", "_", "._", "state_", "=_", "'", "normal", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "but", "_", "._", "text_", "=_", "'", "Start", " ", "Test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slider_", "._", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'===", "==============", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "All", " ", "Test", "s", " ", "Complete", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'===", "==============", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Clock_", "._", "unsc", "hedule", "_", "(_", "test_", ")_", "\\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_", "Clock_", "._", "schedule", "\\u", "interval_", "(_", "test_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
yasoob/youtube-dl-GUI/youtube_dl/extractor/exfm.py
[ { "content": " def _real_extract(self, url):\n mobj = re.match(self._VALID_URL, url)\n song_id = mobj.group('id')\n info_url = \"http://ex.fm/api/v3/song/%s\" % song_id\n info = self._download_json(info_url, song_id)['song']\n song_url = info['url']\n if re.match(self._SOUNDCLOUD_URL, song_url) is not None:\n self.to_screen('Soundcloud song detected')\n return self.url_result(song_url.replace('/stream', ''), 'Soundcloud')\n return {\n 'id': song_id,\n 'url': song_url,\n 'ext': 'mp3',\n 'title': info['title'],\n 'thumbnail': info['image']['large'],\n 'uploader': info['artist'],\n 'view_count': info['loved_count'],\n }", "metadata": "root.ExfmIE._real_extract", "header": "['class', 'ExfmIE', '(', 'InfoExtractor', ')', ':', '___EOS___']", "index": 40 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Ex", "fm", "IE_", "(_", "Info", "Extractor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "real", "\\u", "extract_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mobj_", "=_", "re_", "._", "match_", "(_", "self_", "._", "\\u", "VALID", "\\u", "URL_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "song", "\\u", "id_", "=_", "mobj_", "._", "group_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "\\u", "url_", "=_", "\"", "http", "://", "ex", ".", "fm", "/", "api", "/", "v", "3", "/", "song", "/", "%", "s", "\"_", "%_", "song", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "self_", "._", "\\u", "download", "\\u", "json_", "(_", "info", "\\u", "url_", ",_", "song", "\\u", "id_", ")_", "[_", "'", "song", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "song", "\\u", "url_", "=_", "info_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "self_", "._", "\\u", "SOUND", "CLOUD", "\\u", "URL_", ",_", "song", "\\u", "url_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'", "Sound", "cloud", " ", "song", " ", "detect", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "url", "\\u", "result_", "(_", "song", "\\u", "url_", "._", "replace_", "(_", "'/", "stream", "'_", ",_", "''_", ")_", ",_", "'", "Sound", "cloud", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "song", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "song", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ext", "'_", ":_", "'", "mp3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "info_", "[_", "'", "title", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thumbnail", "'_", ":_", "info_", "[_", "'", "image", "'_", "]_", "[_", "'", "large", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uploade", "r", "'_", ":_", "info_", "[_", "'", "artist", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "count", "'_", ":_", "info_", "[_", "'", "love", "d\\u", "count", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
opencollab/debile/tests/test_pylint.py
[ { "content": "# Run with nosetests tests/test_pylint.py:test_pylint\nfrom debile.slave.runners.pylint import pylint, version\nfrom debile.slave.wrappers.pylint import parse_pylint\nfrom firehose.model import (Analysis, Generator, Metadata)\n\nimport unittest\nimport mock\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PylintTestCase(unittest.TestCase):\n filepath = \"tests/resources/python-firehose_0.3-1.dsc\"\n firehose_results = Analysis(\n metadata=Metadata(\n generator=Generator(\n name='pylint'\n ),\n sut=None,\n file_=None,\n stats=None),\n results=[]\n )\n\n\n\n\n\n\n\n", "metadata": "root.PylintTestCase", "header": "['module', '___EOS___']", "index": 9 }, { "content": " @mock.patch('debile.slave.runners.pylint.run_command',\n return_value=(\n 'pylint 1.4.3,\\nastroid 1.3.6, common 0.62.0\\nPython 2.7.10',\n '', 0))\n def test_pylint_version(self, mock):\n name, ver = version()\n\n self.assertEquals(name, 'pylint')\n self.assertEquals(ver, '1.4.3')", "metadata": "root.PylintTestCase.test_pylint_version", "header": "['class', 'PylintTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " @mock.patch('debile.slave.runners.pylint.run_command',\n return_value=('', '', 1))\n def test_pylint_version_with_error(self, mock):\n self.assertRaises(Exception, version)", "metadata": "root.PylintTestCase.test_pylint_version_with_error", "header": "['class', 'PylintTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_pylint(self):\n pylint_analysis = pylint(self.filepath, self.firehose_results)\n content = pylint_analysis[1]\n self.assertTrue(\"Missing method docstring\" in content)\n\n # It think it is safe to say that the string is not 4 chars long\n self.assertTrue(len(content) > 4)", "metadata": "root.PylintTestCase.test_pylint", "header": "['class', 'PylintTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 40 }, { "content": " def test_pylint_wrappers(self):\n pylint_analysis = pylint(self.filepath, self.firehose_results)\n issues = parse_pylint(pylint_analysis[1].splitlines())\n i = 0\n for issue in issues:\n if issue.location.file.givenpath == \\\n \"tests/parsers/test_clanganalyzer_parser.py\" and \\\n issue.location.point.line==22 and issue.location.point.column==0:\n found = issue\n i += 1\n print found\n self.assertEquals(found.testid, \"W0611\")\n self.assertEquals(found.location.file.givenpath,\n \"tests/parsers/test_clanganalyzer_parser.py\")\n self.assertEquals(found.location.point.line, 22)\n self.assertEquals(found.location.point.column, 0)\n self.assertEquals(found.severity, \"warning\")\n self.assertIsNone(found.notes)\n self.assertIsNone(found.customfields)\n self.assertTrue(\n \"[unused-import]Unused Analysis imported from firehose.model\"\n in found.message.text)\n self.assertTrue(i > 500)", "metadata": "root.PylintTestCase.test_pylint_wrappers", "header": "['class', 'PylintTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Run", " ", "with", " ", "nose", "tests", " ", "tests", "/", "test\\u", "pylint", ".", "py", ":", "test\\u", "pylint", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "debi", "le_", "._", "slave_", "._", "runners", "_", "._", "pylint", "_", "import_", "pylint", "_", ",_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "debi", "le_", "._", "slave_", "._", "wrappers_", "._", "pylint", "_", "import_", "parse", "\\u", "pylint", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fire", "hos", "e_", "._", "model_", "import_", "(_", "Analysis_", ",_", "Generator_", ",_", "Metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\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_", "Py", "lint", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filepath_", "=_", "\"", "tests", "/", "resource", "s", "/", "python", "-", "fire", "hos", "e\\u", "0.", "3", "-1", ".", "dsc", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fire", "hos", "e\\u", "results_", "=_", "Analysis_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "Metadata_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "generator_", "=_", "Generator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "pylint", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sut_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file\\u_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Py", "lint", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "debi", "le", ".", "slave", ".", "runners", ".", "pylint", ".", "run", "\\u", "command", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pylint", " ", "1.4", ".3", ",\\\\", "nas", "tro", "id", " ", "1.3", ".6", ",", " ", "common", " ", "0.62", ".0", "\\\\", "n", "Pyth", "on", " ", "2.7", ".1", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "pylint", "\\u", "version_", "(_", "self_", ",_", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "ver_", "=_", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "name_", ",_", "'", "pylint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ver_", ",_", "'", "1.4", ".3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Py", "lint", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "debi", "le", ".", "slave", ".", "runners", ".", "pylint", ".", "run", "\\u", "command", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "(_", "''_", ",_", "''_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "pylint", "\\u", "version", "\\u", "with", "\\u", "error_", "(_", "self_", ",_", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Exception_", ",_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Py", "lint", "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", "pylint", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pylint", "\\u", "analysis_", "=_", "pylint", "_", "(_", "self_", "._", "filepath_", ",_", "self_", "._", "fire", "hos", "e\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "pylint", "\\u", "analysis_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Missing", " ", "method", " ", "docstr", "ing", "\"_", "in_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "think", " ", "it", " ", "is", " ", "safe", " ", "to", " ", "say", " ", "tha", "t", " ", "the", " ", "string", " ", "is", " ", "not", " ", "4", " ", "char", "s", " ", "long_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "content_", ")_", ">_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Py", "lint", "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", "pylint", "\\u", "wrappers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pylint", "\\u", "analysis_", "=_", "pylint", "_", "(_", "self_", "._", "filepath_", ",_", "self_", "._", "fire", "hos", "e\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "issues_", "=_", "parse", "\\u", "pylint", "_", "(_", "pylint", "\\u", "analysis_", "[_", "1_", "]_", "._", "splitlines_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "issue_", "in_", "issues_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "issue_", "._", "location_", "._", "file_", "._", "give", "npa", "th_", "==_", "\"", "tests", "/", "parser", "s", "/", "test\\u", "clang", "analyze", "r", "\\u", "parser", ".", "py", "\"_", "and_", "issue_", "._", "location_", "._", "point_", "._", "line_", "==_", "22_", "and_", "issue_", "._", "location_", "._", "point_", "._", "column_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "issue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "found_", "._", "testi", "d_", ",_", "\"", "W", "061", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "found_", "._", "location_", "._", "file_", "._", "give", "npa", "th_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tests", "/", "parser", "s", "/", "test\\u", "clang", "analyze", "r", "\\u", "parser", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "found_", "._", "location_", "._", "point_", "._", "line_", ",_", "22_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "found_", "._", "location_", "._", "point_", "._", "column_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "found_", "._", "severity_", ",_", "\"", "warn", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "found_", "._", "notes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "found_", "._", "custom", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "unu", "sed", "-", "import", "]", "Un", "used", " ", "Analy", "sis", " ", "import", "ed", " ", "from", " ", "fire", "hos", "e", ".", "model", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "found_", "._", "message_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "i_", ">_", "500_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Missing call to `__init__` during object initialization
datastax/python-driver/cassandra/cqlengine/__init__.py
[ { "content": "class CQLEngineException(Exception):\n pass", "metadata": "root.CQLEngineException", "header": "['module', '___EOS___']", "index": 24 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "CQ", "LE", "ngin", "e", "Exception_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 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 ]
Except block handles 'BaseException'
softlayer/jumpgate/jumpgate/compute/drivers/sl/servers.py
[ { "content": " def _handle_flavor(self, payload, body):\n flavor_id = int(body['server'].get('flavorRef'))\n for flavor in self.flavors:\n if str(flavor_id) == flavor['id']:\n payload['cpus'] = flavor['cpus']\n payload['memory'] = flavor['ram']\n payload['local_disk'] = (False if flavor['disk-type'] == 'SAN'\n else True)\n try:\n port_speed = flavor['portspeed']\n payload['nic_speed'] = port_speed\n except Exception:\n # If port speed is not specified, it is left to SoftLayer\n # to provide the 'default' port speed\n pass\n return\n raise Exception('Flavor could not be found')", "metadata": "root.ServersV2._handle_flavor", "header": "['class', 'ServersV2', '(', 'object', ')', ':', '___EOS___']", "index": 229 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Server", "s", "V2_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "flavor_", "(_", "self_", ",_", "payload_", ",_", "body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flavor", "\\u", "id_", "=_", "int_", "(_", "body_", "[_", "'", "server", "'_", "]_", "._", "get_", "(_", "'", "flavor", "Ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "flavor_", "in_", "self_", "._", "flavors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "str_", "(_", "flavor", "\\u", "id_", ")_", "==_", "flavor_", "[_", "'", "id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "payload_", "[_", "'", "cpus", "'_", "]_", "=_", "flavor_", "[_", "'", "cpus", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "[_", "'", "memory", "'_", "]_", "=_", "flavor_", "[_", "'", "ram", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "[_", "'", "local", "\\u", "disk", "'_", "]_", "=_", "(_", "False_", "if_", "flavor_", "[_", "'", "disk", "-", "type", "'_", "]_", "==_", "'", "SAN", "'_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "port", "\\u", "speed_", "=_", "flavor_", "[_", "'", "port", "speed", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "[_", "'", "nic", "\\u", "speed", "'_", "]_", "=_", "port", "\\u", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "port", " ", "speed", " ", "is", " ", "not", " ", "specified", ",", " ", "it", " ", "is", " ", "left", " ", "to", " ", "Sof", "t", "Layer_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "provide", " ", "the", " ", "'", "default", "'", " ", "port", " ", "speed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Exception_", "(_", "'", "Fla", "vor", " ", "coul", "d", " ", "not", " ", "be", " ", "found", "'_", ")_", "\\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 ]
First parameter of a method is not named 'self'
AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/staticfiles_tests/storage.py
[ { "content": " def _save(self, name, content):\n return 'dummy'", "metadata": "root.DummyStorage._save", "header": "['class', 'DummyStorage', '(', 'storage', '.', 'Storage', ')', ':', '___EOS___']", "index": 9 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Du", "mm", "y", "Storage_", "(_", "storage_", "._", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "save_", "(_", "self_", ",_", "name_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "dummy", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
giampaolo/psutil/psutil/tests/test_linux.py
[ { "content": " def test_net_io_counters(self):\n def ifconfig(nic):\n ret = {}\n out = sh(\"ifconfig %s\" % name)\n ret['packets_recv'] = int(re.findall('RX packets:(\\d+)', out)[0])\n ret['packets_sent'] = int(re.findall('TX packets:(\\d+)', out)[0])\n ret['errin'] = int(re.findall('errors:(\\d+)', out)[0])\n ret['errout'] = int(re.findall('errors:(\\d+)', out)[1])\n ret['dropin'] = int(re.findall('dropped:(\\d+)', out)[0])\n ret['dropout'] = int(re.findall('dropped:(\\d+)', out)[1])\n ret['bytes_recv'] = int(re.findall('RX bytes:(\\d+)', out)[0])\n ret['bytes_sent'] = int(re.findall('TX bytes:(\\d+)', out)[0])\n return ret\n\n for name, stats in psutil.net_io_counters(pernic=True).items():\n try:\n ifconfig_ret = ifconfig(name)\n except RuntimeError:\n continue\n self.assertAlmostEqual(\n stats.bytes_recv, ifconfig_ret['bytes_recv'], delta=1024)\n self.assertAlmostEqual(\n stats.bytes_sent, ifconfig_ret['bytes_sent'], delta=1024)\n self.assertAlmostEqual(\n stats.packets_recv, ifconfig_ret['packets_recv'], delta=512)\n self.assertAlmostEqual(\n stats.packets_sent, ifconfig_ret['packets_sent'], delta=512)\n self.assertAlmostEqual(\n stats.errin, ifconfig_ret['errin'], delta=10)\n self.assertAlmostEqual(\n stats.errout, ifconfig_ret['errout'], delta=10)\n self.assertAlmostEqual(\n stats.dropin, ifconfig_ret['dropin'], delta=10)\n self.assertAlmostEqual(\n stats.dropout, ifconfig_ret['dropout'], delta=10)", "metadata": "root.TestSystemNetwork.test_net_io_counters", "header": "['class', 'TestSystemNetwork', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 352 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "System", "Network_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "net", "\\u", "io", "\\u", "counters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "ifconfig", "_", "(_", "nic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "sh_", "(_", "\"", "ifconfig", " ", "%", "s", "\"_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "packet", "s", "\\u", "recv", "'_", "]_", "=_", "int_", "(_", "re_", "._", "findall_", "(_", "'", "RX", " ", "packet", "s", ":(", "\\\\", "d", "+)'_", ",_", "out_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "packet", "s", "\\u", "sent", "'_", "]_", "=_", "int_", "(_", "re_", "._", "findall_", "(_", "'", "TX", " ", "packet", "s", ":(", "\\\\", "d", "+)'_", ",_", "out_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "err", "in", "'_", "]_", "=_", "int_", "(_", "re_", "._", "findall_", "(_", "'", "error", "s", ":(", "\\\\", "d", "+)'_", ",_", "out_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "erro", "ut", "'_", "]_", "=_", "int_", "(_", "re_", "._", "findall_", "(_", "'", "error", "s", ":(", "\\\\", "d", "+)'_", ",_", "out_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "drop", "in", "'_", "]_", "=_", "int_", "(_", "re_", "._", "findall_", "(_", "'", "dropped", ":(", "\\\\", "d", "+)'_", ",_", "out_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "drop", "out", "'_", "]_", "=_", "int_", "(_", "re_", "._", "findall_", "(_", "'", "dropped", ":(", "\\\\", "d", "+)'_", ",_", "out_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "bytes", "\\u", "recv", "'_", "]_", "=_", "int_", "(_", "re_", "._", "findall_", "(_", "'", "RX", " ", "bytes", ":(", "\\\\", "d", "+)'_", ",_", "out_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "bytes", "\\u", "sent", "'_", "]_", "=_", "int_", "(_", "re_", "._", "findall_", "(_", "'", "TX", " ", "bytes", ":(", "\\\\", "d", "+)'_", ",_", "out_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", ",_", "stats_", "in_", "psutil_", "._", "net", "\\u", "io", "\\u", "counters_", "(_", "per", "nic_", "=_", "True_", ")_", "._", "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 ", " _", "ifconfig", "\\u", "ret_", "=_", "ifconfig", "_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "._", "bytes", "\\u", "recv_", ",_", "ifconfig", "\\u", "ret_", "[_", "'", "bytes", "\\u", "recv", "'_", "]_", ",_", "delta_", "=_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "._", "bytes", "\\u", "sent_", ",_", "ifconfig", "\\u", "ret_", "[_", "'", "bytes", "\\u", "sent", "'_", "]_", ",_", "delta_", "=_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "._", "packet", "s", "\\u", "recv_", ",_", "ifconfig", "\\u", "ret_", "[_", "'", "packet", "s", "\\u", "recv", "'_", "]_", ",_", "delta_", "=_", "512_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "._", "packet", "s", "\\u", "sent_", ",_", "ifconfig", "\\u", "ret_", "[_", "'", "packet", "s", "\\u", "sent", "'_", "]_", ",_", "delta_", "=_", "512_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "._", "err", "in_", ",_", "ifconfig", "\\u", "ret_", "[_", "'", "err", "in", "'_", "]_", ",_", "delta_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "._", "erro", "ut_", ",_", "ifconfig", "\\u", "ret_", "[_", "'", "erro", "ut", "'_", "]_", ",_", "delta_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "._", "drop", "in_", ",_", "ifconfig", "\\u", "ret_", "[_", "'", "drop", "in", "'_", "]_", ",_", "delta_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "._", "dropout_", ",_", "ifconfig", "\\u", "ret_", "[_", "'", "drop", "out", "'_", "]_", ",_", "delta_", "=_", "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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
OpenMDAO/OpenMDAO-Framework/openmdao.devtools/src/openmdao/devtools/locdistbld.py
[ { "content": "\"\"\"\nThis module builds a binary distribution from the specified source directory.\n\"\"\"\n\nimport sys\nimport os\nimport shutil\nimport urllib2\nimport subprocess\nimport codecs\nfrom optparse import OptionParser\n\n\n\n\n\n\n\nif __name__ == '__main__':\n parser = OptionParser(usage=\"%prog [OPTIONS]\")\n parser.add_option(\"-s\",\"--src\", action=\"store\", type='string', \n dest='srcdir',\n help=\"name of directory where the distrib source files are located\")\n parser.add_option(\"-d\",\"--dest\", action=\"store\", type='string', \n dest='destdir', default='.',\n help=\"name of directory where the build distrib will be placed\")\n parser.add_option(\"-b\",\"--bldtype\", action=\"store\", type='string', \n dest='buildtype', default='bdist_egg',\n help=\"setup.py build command. Default is 'bdist_egg'\")\n\n (options, args) = parser.parse_args(sys.argv[1:])\n \n retcode = -1\n \n startdir = os.getcwd()\n \n if not options.srcdir:\n print \"you must supply a source directory\"\n parser.print_help()\n sys.exit(retcode)\n \n srcdir = os.path.abspath(os.path.expanduser(options.srcdir))\n destdir = os.path.abspath(os.path.expanduser(options.destdir))\n \n if not os.path.exists(srcdir):\n print \"source directory %s not found\" % srcdir\n sys.exit(retcode)\n \n try:\n distfile = build_dist(srcdir, destdir, options.buildtype)\n finally:\n os.chdir(startdir)\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def has_setuptools():\n try:\n import setuptools\n except ImportError:\n return False\n return True", "metadata": "root.has_setuptools", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def make_new_setupfile(setupfile):\n \"\"\"If setuptools is not installed, make a new setup file that will\n bootstrap and use setuptools. The new file will be in the same location\n as setupfile and will have '_new_' prepended to the name.\n \"\"\"\n setupfile = os.path.abspath(setupfile)\n newsetupfile = os.path.join(os.path.dirname(setupfile),\n '_new_'+os.path.basename(setupfile))\n \n startdir = os.getcwd()\n \n os.chdir(os.path.dirname(setupfile))\n \n try:\n print \"setuptools is not installed.\"\n if not os.path.isfile('ez_setup.py'):\n print \"Attempting to download ez_setup.py\"\n resp = urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py')\n with open('ez_setup.py', 'wb') as easyf:\n shutil.copyfileobj(resp.fp, easyf)\n print 'successfully downloaded ez_setup.py'\n\n print \"Attempting to update %s to import from ez_setup\" % setupfile\n \n if not os.path.isfile(setupfile):\n raise IOError(\"can't find setup file '%s'\" % setupfile)\n \n setupf = open(setupfile, 'r')\n setup_contents = setupf.read()\n setupf.close()\n \n with open(newsetupfile, 'wb') as newf:\n newf.write(\"from ez_setup import use_setuptools\\n\")\n newf.write(\"use_setuptools(download_delay=0)\\n\\n\")\n newf.write(setup_contents)\n finally:\n os.chdir(startdir)\n \n return newsetupfile", "metadata": "root.make_new_setupfile", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def build_dist(srcdir, destdir='.', build_type='bdist_egg'):\n \"\"\"\n Builds a distribution using the specified source directory and places\n it in the specified destination directory.\n \n srcdir: str\n Source directory for the distribution to be built.\n \n destdir: str\n Directory where the built distribution file will be placed.\n\n build_type: str\n The type of distribution to be built. Default is 'bdist_egg'.\n \"\"\"\n startdir = os.getcwd()\n destdir = os.path.abspath(os.path.expanduser(destdir)).replace('\\\\','/')\n srcdir = os.path.abspath(os.path.expanduser(srcdir)).replace('\\\\','/')\n \n setupname = os.path.join(srcdir, 'setup.py')\n if not has_setuptools():\n setupname = make_new_setupfile(setupname)\n\n dirfiles = set(os.listdir(destdir))\n \n print \"building distribution in %s\" % srcdir\n \n cmd = [sys.executable.replace('\\\\','/'),\n os.path.basename(setupname),\n ]\n cmd.extend(build_type.split(' '))\n cmd.extend(['-d', destdir])\n\n os.chdir(srcdir)\n \n # FIXME: fabric barfs when running this remotely due to some unicode\n # output that it can't handle, so we first save the output to \n # a file with unicode stripped out \n out = codecs.open('_build_.out', 'wb', \n encoding='ascii', errors='replace')\n \n print 'running command: %s' % ' '.join(cmd)\n try:\n p = subprocess.Popen(' '.join(cmd), \n stdout=out, stderr=subprocess.STDOUT,\n shell=True)\n p.wait()\n finally:\n out.close()\n with open('_build_.out', 'r') as f:\n print f.read()\n os.chdir(startdir)\n \n newfiles = set(os.listdir(destdir)) - dirfiles\n if len(newfiles) != 1:\n raise RuntimeError(\"expected one new file in in destination directory but found %s\" % \n list(newfiles))\n if p.returncode != 0:\n raise RuntimeError(\"problem building distribution in %s. (return code = %s)\" %\n (srcdir, p.returncode))\n \n distfile = os.path.join(destdir, newfiles.pop())\n print 'new distribution file is %s' % distfile\n return distfile", "metadata": "root.build_dist", "header": "['module', '___EOS___']", "index": 62 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "module", " ", "builds", " ", "a", " ", "binar", "y", " ", "distribu", "tion", " ", "from", " ", "the", " ", "specified", " ", "source", " ", "director", "y", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "parser_", "=_", "Optio", "n", "Parser_", "(_", "usage_", "=_", "\"%", "prog", " ", "[", "OPTION", "S", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "s", "\"_", ",_", "\"--", "src", "\"_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "'", "string", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "src", "dir", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "name", " ", "of", " ", "director", "y", " ", "where", " ", "the", " ", "distri", "b", " ", "source", " ", "files", " ", "are", " ", "located", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "d", "\"_", ",_", "\"--", "dest", "\"_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "'", "string", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "dest", "dir", "'_", ",_", "default_", "=_", "'.'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "name", " ", "of", " ", "director", "y", " ", "where", " ", "the", " ", "build", " ", "distri", "b", " ", "will", " ", "be", " ", "place", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "b", "\"_", ",_", "\"--", "bld", "type", "\"_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "'", "string", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "build", "type", "'_", ",_", "default_", "=_", "'", "bdist", "\\u", "egg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "setup", ".", "py", " ", "build", " ", "command", ".", " ", "Default", " ", "is", " ", "'", "bdist", "\\u", "egg", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "retcode_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "startd", "ir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "options_", "._", "srcdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "you", " ", "must", " ", "supply", " ", "a", " ", "source", " ", "director", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "retcode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "srcdir_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "options_", "._", "srcdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destdir_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "options_", "._", "destdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "srcdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "source", " ", "director", "y", " ", "%", "s", " ", "not", " ", "found", "\"_", "%_", "srcdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "retcode_", ")_", "\\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 ", " _", "dist", "file_", "=_", "build", "\\u", "dist_", "(_", "srcdir_", ",_", "destdir_", ",_", "options_", "._", "build", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "startd", "ir_", ")_", "\\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_", "has", "\\u", "setuptools_", "(_", ")_", ":_", "\\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_", "setuptools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\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_", "make", "\\u", "new", "\\u", "setup", "file_", "(_", "setup", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "If", " ", "setup", "tool", "s", " ", "is", " ", "not", " ", "install", "ed", ",", " ", "make", " ", "a", " ", "new", " ", "setup", " ", "file", " ", "tha", "t", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", " ", "and", " ", "use", " ", "setup", "tool", "s", ".", " ", "The", " ", "new", " ", "file", " ", "will", " ", "be", " ", "in", " ", "the", " ", "same", " ", "location", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "setup", "file", " ", "and", " ", "will", " ", "have", " ", "'\\u", "new", "\\u", "'", " ", "prepend", "ed", " ", "to", " ", "the", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setup", "file_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "setup", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "news", "etu", "pfile", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "setup", "file_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "new", "\\u'_", "+_", "os_", "._", "path_", "._", "basename_", "(_", "setup", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "startd", "ir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "setup", "file_", ")_", ")_", "\\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 ", " _", "print_", "\"", "setup", "tool", "s", " ", "is", " ", "not", " ", "install", "ed", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "'", "ez", "\\u", "setup", ".", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Atte", "mpt", "ing", " ", "to", " ", "download", " ", "ez", "\\u", "setup", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "urllib2_", "._", "urlopen_", "(_", "'", "http", "://", "peak", ".", "tele", "communi", "ty", ".", "com", "/", "dist", "/", "ez", "\\u", "setup", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "'", "ez", "\\u", "setup", ".", "py", "'_", ",_", "'", "wb", "'_", ")_", "as_", "easy", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "copy", "fileobj_", "(_", "resp_", "._", "fp_", ",_", "easy", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "success", "full", "y", " ", "download", "ed", " ", "ez", "\\u", "setup", ".", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Atte", "mpt", "ing", " ", "to", " ", "update", " ", "%", "s", " ", "to", " ", "import", " ", "from", " ", "ez", "\\u", "setup", "\"_", "%_", "setup", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "setup", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", "(_", "\"", "can", "'", "t", " ", "find", " ", "setup", " ", "file", " ", "'%", "s", "'\"_", "%_", "setup", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "f_", "=_", "open_", "(_", "setup", "file_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setup", "\\u", "contents_", "=_", "setup", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setup", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "news", "etu", "pfile", "_", ",_", "'", "wb", "'_", ")_", "as_", "newf", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newf", "_", "._", "write_", "(_", "\"", "from", " ", "ez", "\\u", "setup", " ", "import", " ", "use", "\\u", "setup", "tool", "s", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newf", "_", "._", "write_", "(_", "\"", "use", "\\u", "setup", "tool", "s", "(", "download", "\\u", "dela", "y", "=", "0", ")\\\\", "n", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newf", "_", "._", "write_", "(_", "setup", "\\u", "contents_", ")_", "\\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_", "._", "chdir_", "(_", "startd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "news", "etu", "pfile", "_", "\\u\\u\\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", "\\u", "dist_", "(_", "srcdir_", ",_", "destdir_", "=_", "'.'_", ",_", "build", "\\u", "type_", "=_", "'", "bdist", "\\u", "egg", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Build", "s", " ", "a", " ", "distribu", "tion", " ", "usi", "ng", " ", "the", " ", "specified", " ", "source", " ", "director", "y", " ", "and", " ", "place", "s", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "in", " ", "the", " ", "specified", " ", "destinat", "ion", " ", "director", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "src", "dir", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Sou", "rce", " ", "director", "y", " ", "for", " ", "the", " ", "distribu", "tion", " ", "to", " ", "be", " ", "bui", "lt", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "dest", "dir", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Director", "y", " ", "where", " ", "the", " ", "bui", "lt", " ", "distribu", "tion", " ", "file", " ", "will", " ", "be", " ", "place", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "build", "\\u", "type", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "type", " ", "of", " ", "distribu", "tion", " ", "to", " ", "be", " ", "bui", "lt", ".", " ", " ", "Default", " ", "is", " ", "'", "bdist", "\\u", "egg", "'.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startd", "ir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destdir_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "destdir_", ")_", ")_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srcdir_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "srcdir_", ")_", ")_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "srcdir_", ",_", "'", "setup", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "has", "\\u", "setuptools_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "name_", "=_", "make", "\\u", "new", "\\u", "setup", "file_", "(_", "setup", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dir", "files_", "=_", "set_", "(_", "os_", "._", "listdir_", "(_", "destdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "buildi", "ng", " ", "distribu", "tion", " ", "in", " ", "%", "s", "\"_", "%_", "srcdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "sys_", "._", "executable_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'/'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "basename_", "(_", "setup", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "build", "\\u", "type_", "._", "split_", "(_", "'", " ", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "[_", "'-", "d", "'_", ",_", "destdir_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "srcdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "fab", "ric", " ", "bar", "fs", " ", "whe", "n", " ", "runn", "ing", " ", "this", " ", "remote", "ly", " ", "due", " ", "to", " ", "some", " ", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", " ", "tha", "t", " ", "it", " ", "can", "'", "t", " ", "handle", ",", " ", "so", " ", "we", " ", "first", " ", "save", " ", "the", " ", "output", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "file", " ", "with", " ", "unicode", " ", "strip", "ped", " ", "out", " _", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "codecs_", "._", "open_", "(_", "'\\u", "build", "\\u.", "out", "'_", ",_", "'", "wb", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "'", "ascii", "'_", ",_", "errors_", "=_", "'", "replace", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "runn", "ing", " ", "command", ":", " ", "%", "s", "'_", "%_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "out_", ",_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "wait_", "(_", ")_", "\\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 ", " _", "out_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "'\\u", "build", "\\u.", "out", "'_", ",_", "'", "r", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "startd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newfile", "s_", "=_", "set_", "(_", "os_", "._", "listdir_", "(_", "destdir_", ")_", ")_", "-_", "dir", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "newfile", "s_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "expected", " ", "one", " ", "new", " ", "file", " ", "in", " ", "in", " ", "destinat", "ion", " ", "director", "y", " ", "but", " ", "found", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "(_", "newfile", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "._", "returncode_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "problem", " ", "buildi", "ng", " ", "distribu", "tion", " ", "in", " ", "%", "s", ".", " ", "(", "return", " ", "code", " ", "=", " ", "%", "s", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "srcdir_", ",_", "p_", "._", "returncode_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dist", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "destdir_", ",_", "newfile", "s_", "._", "pop_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "new", " ", "distribu", "tion", " ", "file", " ", "is", " ", "%", "s", "'_", "%_", "dist", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dist", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
openstack/ooi/ooi/occi/core/mixin.py
[ { "content": "# -*- coding: utf-8 -*-\n\n# Copyright 2015 Spanish National Research Council\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nfrom ooi.occi.core import action\nfrom ooi.occi.core import category\nfrom ooi.occi import helpers\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Mixin(category.Category):\n \"\"\"OCCI Mixin.\n\n An instance of Mixin can be associated with a resource instance, i.e. a\n sub-type of Entity, to \"mix-in\" additional resource capabilities at\n run-time.\n \"\"\"\n\n", "metadata": "root.Mixin", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def __init__(self, scheme, term, title, attributes=None, location=None,\n related=[], actions=[]):\n super(Mixin, self).__init__(scheme, term, title, attributes=attributes,\n location=location)\n\n helpers.check_type(related, Mixin)\n helpers.check_type(actions, action.Action)\n\n self.related = related\n self.actions = actions", "metadata": "root.Mixin.__init__", "header": "['class', 'Mixin', '(', 'category', '.', 'Category', ')', ':', '___EOS___']", "index": 29 }, { "content": " def _class_name(self):\n return \"mixin\"", "metadata": "root.Mixin._class_name", "header": "['class', 'Mixin', '(', 'category', '.', 'Category', ')', ':', '___EOS___']", "index": 40 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "Span", "ish", " ", "Nat", "ional", " ", "Rese", "arch", " ", "Cou", "nci", "l_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "oo", "i_", "._", "occ", "i_", "._", "core_", "import_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oo", "i_", "._", "occ", "i_", "._", "core_", "import_", "category_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oo", "i_", "._", "occ", "i_", "import_", "helpers_", "\\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_", "Mixin_", "(_", "category_", "._", "Category_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "OCC", "I", " ", "Mix", "in", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "of", " ", "Mix", "in", " ", "can", " ", "be", " ", "associate", "d", " ", "with", " ", "a", " ", "resource", " ", "instance", ",", " ", "i", ".", "e", ".", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "sub", "-", "type", " ", "of", " ", "Entit", "y", ",", " ", "to", " ", "\"", "mix", "-", "in", "\"", " ", "addition", "al", " ", "resource", " ", "capab", "ilities", " ", "at", "\\", "10", ";", " ", " ", " ", " ", "run", "-", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mixin_", "(_", "category_", "._", "Category_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "scheme_", ",_", "term_", ",_", "title_", ",_", "attributes_", "=_", "None_", ",_", "location_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "related_", "=_", "[_", "]_", ",_", "actions_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Mixin_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "scheme_", ",_", "term_", ",_", "title_", ",_", "attributes_", "=_", "attributes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "location_", "=_", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "helpers_", "._", "check", "\\u", "type_", "(_", "related_", ",_", "Mixin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "helpers_", "._", "check", "\\u", "type_", "(_", "actions_", ",_", "action_", "._", "Action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "related_", "=_", "related_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "actions_", "=_", "actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mixin_", "(_", "category_", "._", "Category_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "class", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "mix", "in", "\"_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison of constants
CollabQ/CollabQ/vendor/epydoc/checker.py
[ { "content": " def _check_func(self, doc):\n \"\"\"\n Run checks on the function whose APIDoc is C{doc}.\n \n @param doc: The APIDoc of the function to check.\n @type doc: L{APIDoc}\n @rtype: C{None}\n \"\"\"\n name = doc.canonical_name\n if (self._checks & DocChecker.FUNC and\n doc.docstring in (None, UNKNOWN) and\n doc.canonical_name[-1] not in _NO_DOCS):\n self.warning('Undocumented', doc)\n return\n if (self._checks & DocChecker.FUNC and\n doc.canonical_name[-1] not in _NO_BASIC):\n self._check_basic(doc)\n if (self._checks & DocChecker.RETURN and\n doc.canonical_name[-1] not in _NO_RETURN):\n if (doc.return_type in (None, UNKNOWN) and\n doc.return_descr in (None, UNKNOWN)):\n self.warning('No return descr', doc)\n if (self._checks & DocChecker.PARAM and\n doc.canonical_name[-1] not in _NO_PARAM):\n if doc.arg_descrs in (None, UNKNOWN):\n self.warning('No argument info', doc)\n else:\n args_with_descr = []\n for arg, descr in doc.arg_descrs:\n if isinstance(arg, basestring):\n args_with_descr.append(arg)\n else:\n args_with_descr += arg\n for posarg in doc.posargs:\n if (self._checks & DocChecker.DESCR and\n posarg not in args_with_descr):\n self.warning('Argument(s) not described', doc)\n if (self._checks & DocChecker.TYPE and\n posarg not in doc.arg_types):\n self.warning('Argument type(s) not described', doc)", "metadata": "root.DocChecker._check_func", "header": "['class', 'DocChecker', ':', '___EOS___']", "index": 306 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Doc", "Checker_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "func_", "(_", "self_", ",_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "checks", " ", "on", " ", "the", " ", "function", " ", "who", "se", " ", "API", "Doc", " ", "is", " ", "C", "{", "doc", "}.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "doc", ":", " ", "The", " ", "API", "Doc", " ", "of", " ", "the", " ", "function", " ", "to", " ", "check", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "doc", ":", " ", "L", "{", "API", "Doc", "}", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "C", "{", "Non", "e", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "doc_", "._", "canonical", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "checks_", "&_", "Doc", "Checker_", "._", "FUNC", "_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "._", "docstring_", "in_", "(_", "None_", ",_", "UNKNOWN_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "._", "canonical", "\\u", "name_", "[_", "-_", "1_", "]_", "not_", "in_", "\\u", "NO", "\\u", "DOCS", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warning_", "(_", "'", "Und", "ocu", "mented", "'_", ",_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "checks_", "&_", "Doc", "Checker_", "._", "FUNC", "_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "._", "canonical", "\\u", "name_", "[_", "-_", "1_", "]_", "not_", "in_", "\\u", "NO", "\\u", "BASIC", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "basic_", "(_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "checks_", "&_", "Doc", "Checker_", "._", "RETURN_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "._", "canonical", "\\u", "name_", "[_", "-_", "1_", "]_", "not_", "in_", "\\u", "NO", "\\u", "RETURN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "doc_", "._", "return", "\\u", "type_", "in_", "(_", "None_", ",_", "UNKNOWN_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "._", "return", "\\u", "descr_", "in_", "(_", "None_", ",_", "UNKNOWN_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warning_", "(_", "'", "No", " ", "return", " ", "descr", "'_", ",_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "checks_", "&_", "Doc", "Checker_", "._", "PARAM_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "._", "canonical", "\\u", "name_", "[_", "-_", "1_", "]_", "not_", "in_", "\\u", "NO", "\\u", "PARAM_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "doc_", "._", "arg", "\\u", "descr", "s_", "in_", "(_", "None_", ",_", "UNKNOWN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warning_", "(_", "'", "No", " ", "argu", "ment", " ", "info", "'_", ",_", "doc_", ")_", "\\u\\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", "\\u", "with", "\\u", "descr_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", ",_", "descr_", "in_", "doc_", "._", "arg", "\\u", "descr", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "arg_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "args", "\\u", "with", "\\u", "descr_", "._", "append_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "args", "\\u", "with", "\\u", "descr_", "+=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "pos", "arg_", "in_", "doc_", "._", "pos", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "self_", "._", "\\u", "checks_", "&_", "Doc", "Checker_", "._", "DESC", "R_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "pos", "arg_", "not_", "in_", "args", "\\u", "with", "\\u", "descr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "warning_", "(_", "'", "Arg", "ument", "(", "s", ")", " ", "not", " ", "descri", "bed", "'_", ",_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "checks_", "&_", "Doc", "Checker_", "._", "TYPE_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "pos", "arg_", "not_", "in_", "doc_", "._", "arg", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "warning_", "(_", "'", "Arg", "ument", " ", "type", "(", "s", ")", " ", "not", " ", "descri", "bed", "'_", ",_", "doc_", ")_", "\\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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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 ]
Unused import
disqus/gargoyle/gargoyle/helpers.py
[ { "content": "\"\"\"\ngargoyle.helpers\n~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010 DISQUS.\n:license: Apache License 2.0, see LICENSE for more details.\n\"\"\"\n\nfrom django.core.serializers.json import DjangoJSONEncoder\nfrom django.http import HttpRequest\n\nimport datetime\nimport json\nimport uuid\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MockRequest(HttpRequest):\n \"\"\"\n A mock request object which stores a user\n instance and the ip address.\n \"\"\"", "metadata": "root.MockRequest", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def __init__(self, user=None, ip_address=None):\n from django.contrib.auth.models import AnonymousUser\n\n self.user = user or AnonymousUser()\n self.GET = {}\n self.POST = {}\n self.COOKIES = {}\n self.META = {\n 'REMOTE_ADDR': ip_address,\n }", "metadata": "root.MockRequest.__init__", "header": "['class', 'MockRequest', '(', 'HttpRequest', ')', ':', '___EOS___']", "index": 21 }, { "content": "class BetterJSONEncoder(DjangoJSONEncoder):", "metadata": "root.BetterJSONEncoder", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def default(self, obj):\n if isinstance(obj, uuid.UUID):\n return obj.hex\n elif isinstance(obj, datetime.datetime):\n return obj.strftime('%Y-%m-%dT%H:%M:%S.%fZ')\n elif isinstance(obj, (set, frozenset)):\n return list(obj)\n return super(BetterJSONEncoder, self).default(obj)", "metadata": "root.BetterJSONEncoder.default", "header": "['class', 'BetterJSONEncoder', '(', 'DjangoJSONEncoder', ')', ':', '___EOS___']", "index": 34 }, { "content": "def dumps(value, **kwargs):\n return json.dumps(value, cls=BetterJSONEncoder, **kwargs)", "metadata": "root.dumps", "header": "['module', '___EOS___']", "index": 44 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "gar", "go", "yle", ".", "help", "ers", "\\", "10", ";", "~~~~~~~~~~~", "~~~~~", "\\", "10", ";", "\\", "10", ";", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2010", " ", "DIS", "QU", "S", ".", "\\", "10", ";", ":", "license", ":", " ", "Ap", "ache", " ", "License", " ", "2.0", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "serializers_", "._", "json_", "import_", "Dj", "ang", "o", "JSO", "NE", "ncode", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Moc", "k", "Request_", "(_", "Http", "Request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "mock", " ", "request", " ", "object", " ", "whi", "ch", " ", "store", "s", " ", "a", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "instance", " ", "and", " ", "the", " ", "ip", " ", "address", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Request_", "(_", "Http", "Request_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", "=_", "None_", ",_", "ip", "\\u", "address_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "Ano", "nym", "ous", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "=_", "user_", "or_", "Ano", "nym", "ous", "User_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "GET_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "POST_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "COOKIE", "S_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "META_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "REMO", "TE", "\\u", "ADDR", "'_", ":_", "ip", "\\u", "address_", ",_", "\\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_", "class_", "Bet", "ter", "JSO", "NE", "ncode", "r_", "(_", "Dj", "ang", "o", "JSO", "NE", "ncode", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bet", "ter", "JSO", "NE", "ncode", "r_", "(_", "Dj", "ang", "o", "JSO", "NE", "ncode", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "default_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "obj_", ",_", "uuid_", "._", "UUID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "obj_", ",_", "datetime_", "._", "datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "._", "strftime_", "(_", "'%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "S", ".", "%", "f", "Z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "obj_", ",_", "(_", "set_", ",_", "frozenset_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Bet", "ter", "JSO", "NE", "ncode", "r_", ",_", "self_", ")_", "._", "default_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dumps_", "(_", "value_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "dumps_", "(_", "value_", ",_", "cls_", "=_", "Bet", "ter", "JSO", "NE", "ncode", "r_", ",_", "**_", "kwargs_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
amrdraz/kodr/app/brython/www/src/Lib/fractions.py
[ { "content": " def __round__(self, ndigits=None):\n \"\"\"Will be round(self, ndigits) in 3.0.\n\n Rounds half toward even.\n \"\"\"\n if ndigits is None:\n floor, remainder = divmod(self.numerator, self.denominator)\n if remainder * 2 < self.denominator:\n return floor\n elif remainder * 2 > self.denominator:\n return floor + 1\n # Deal with the half case:\n elif floor % 2 == 0:\n return floor\n else:\n return floor + 1\n shift = 10**abs(ndigits)\n # See _operator_fallbacks.forward to check that the results of\n # these operations will always be Fraction and therefore have\n # round().\n if ndigits > 0:\n return Fraction(round(self * shift), shift)\n else:\n return Fraction(round(self / shift) * shift)", "metadata": "root.Fraction.__round__", "header": "['class', 'Fraction', '(', 'numbers', '.', 'Rational', ')', ':', '___EOS___']", "index": 508 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Fraction_", "(_", "numbers_", "._", "Rational", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "round", "\\u\\u_", "(_", "self_", ",_", "ndi", "git", "s_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Wil", "l", " ", "be", " ", "round", "(", "self", ",", " ", "ndi", "git", "s", ")", " ", "in", " ", "3.0", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Round", "s", " ", "half", " ", "tow", "ard", " ", "even", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ndi", "git", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "floor_", ",_", "remainder_", "=_", "divmod_", "(_", "self_", "._", "numerator_", ",_", "self_", "._", "denominator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remainder_", "*_", "2_", "<_", "self_", "._", "denominator_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "floor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "remainder_", "*_", "2_", ">_", "self_", "._", "denominator_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "floor_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Deal", " ", "with", " ", "the", " ", "half", " ", "case", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "floor_", "%_", "2_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "floor_", "\\u\\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_", "floor_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shift_", "=_", "10_", "**_", "abs_", "(_", "ndi", "git", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "\\u", "opera", "tor", "\\u", "fall", "backs", ".", "forward", " ", "to", " ", "check", " ", "tha", "t", " ", "the", " ", "results", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "operati", "ons", " ", "will", " ", "alw", "ay", "s", " ", "be", " ", "Frac", "tion", " ", "and", " ", "there", "fore", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "round", "()", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ndi", "git", "s_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Fraction_", "(_", "round_", "(_", "self_", "*_", "shift_", ")_", ",_", "shift_", ")_", "\\u\\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_", "Fraction_", "(_", "round_", "(_", "self_", "/_", "shift_", ")_", "*_", "shift_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
openstack/networking-cisco/networking_cisco/tests/unit/ml2/drivers/cisco/n1kv/test_cisco_n1kv_ports.py
[ { "content": " def test_create_port_with_default_n1kv_policy_profile_id(\n self, restrict_policy_profiles=False):\n \"\"\"Test port create without passing policy profile id.\"\"\"\n ml2_config.cfg.CONF.set_override(\n 'restrict_policy_profiles',\n restrict_policy_profiles,\n 'ml2_cisco_n1kv')\n with self.port() as port:\n pp = n1kv_db.get_policy_profile_by_name(\n test_cisco_n1kv_mech.DEFAULT_PP)\n profile_binding = n1kv_db.get_policy_binding(port['port']['id'])\n self.assertEqual(profile_binding.profile_id, pp['id'])\n # assert that binding for default port-profile exists\n port_tenant = port['port']['tenant_id']\n self.assert_profile_binding_exists(\n binding='policy_profile_bindings',\n tenant_id=port_tenant,\n profile_id=pp['id']\n )", "metadata": "root.TestN1KVMechDriverPortsV2.test_create_port_with_default_n1kv_policy_profile_id", "header": "['class', 'TestN1KVMechDriverPortsV2', '(', 'test_db_base_plugin_v2', '.', 'TestPortsV2', ',', '___NL___', 'test_cisco_n1kv_mech', '.', 'TestN1KVMechanismDriver', ')', ':', '___EOS___']", "index": 47 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Test", "N1", "KV", "Me", "ch", "Drive", "r", "Port", "s", "V2_", "(_", "test\\u", "db", "\\u", "base", "\\u", "plugin", "\\u", "v2_", "._", "Test", "Port", "s", "V2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "cis", "co", "\\u", "n1", "kv", "\\u", "mech", "_", "._", "Test", "N1", "KV", "Mechani", "sm", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "port", "\\u", "with", "\\u", "default", "\\u", "n1", "kv", "\\u", "policy", "\\u", "profile", "\\u", "id_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "restrict", "\\u", "policy", "\\u", "profiles_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "port", " ", "create", " ", "with", "out", " ", "passi", "ng", " ", "policy", " ", "profile", " ", "id", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ml2", "\\u", "config_", "._", "cfg_", "._", "CONF_", "._", "set\\u", "override_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "restrict", "\\u", "policy", "\\u", "profile", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "restrict", "\\u", "policy", "\\u", "profiles_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ml2", "\\u", "cis", "co", "\\u", "n1", "kv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "port_", "(_", ")_", "as_", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pp_", "=_", "n1", "kv", "\\u", "db_", "._", "get", "\\u", "policy", "\\u", "profile", "\\u", "by", "\\u", "name_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "cis", "co", "\\u", "n1", "kv", "\\u", "mech", "_", "._", "DEF", "AUL", "T", "\\u", "PP", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile", "\\u", "binding_", "=_", "n1", "kv", "\\u", "db_", "._", "get", "\\u", "policy", "\\u", "binding_", "(_", "port_", "[_", "'", "port", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "profile", "\\u", "binding_", "._", "profile", "\\u", "id_", ",_", "pp_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "tha", "t", " ", "bindi", "ng", " ", "for", " ", "default", " ", "port", "-", "profile", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "port", "\\u", "tenant_", "=_", "port_", "[_", "'", "port", "'_", "]_", "[_", "'", "tenan", "t", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "profile", "\\u", "bindi", "ng", "\\u", "exists_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "binding_", "=_", "'", "policy", "\\u", "profile", "\\u", "bindi", "ngs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tenan", "t", "\\u", "id_", "=_", "port", "\\u", "tenant_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "profile", "\\u", "id_", "=_", "pp_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
Arelle/Arelle/arelle/ModelRssItem.py
[ { "content": " @property\n def zippedUrl(self):\n enclosure = XmlUtil.childAttr(self, None, \"enclosure\", \"url\")\n if enclosure:\n # modify url to use zip file\n path, sep, file = self.url.rpartition(\"/\")\n # return path + sep + self.accessionNumber + \"-xbrl.zip\" + sep + file\n return enclosure + sep + file\n else: # no zipped enclosure, just use unzipped file\n return self.url", "metadata": "root.ModelRssItem.zippedUrl", "header": "['class', 'ModelRssItem', '(', 'ModelObject', ')', ':', '___EOS___']", "index": 139 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Model", "Rs", "s", "Item_", "(_", "Model", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "zipped", "Url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enclosure", "_", "=_", "Xm", "l", "Util_", "._", "child", "Attr_", "(_", "self_", ",_", "None_", ",_", "\"", "enclosure", "\"_", ",_", "\"", "url", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "enclosure", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "modif", "y", " ", "url", " ", "to", " ", "use", " ", "zip", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", ",_", "sep_", ",_", "file_", "=_", "self_", "._", "url_", "._", "rpartition_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "path", " ", "+", " ", "sep", " ", "+", " ", "self", ".", "accessi", "on", "Number", " ", "+", " ", "\"-", "xbr", "l", ".", "zip", "\"", " ", "+", " ", "sep", " ", "+", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "enclosure", "_", "+_", "sep_", "+_", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "no", " ", "zipped", " ", "enclosure", ",", " ", "just", " ", "use", " ", "unzip", "ped", " ", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
lisa-lab/pylearn2/pylearn2/linear/conv2d.py
[ { "content": "\"\"\"\n.. todo::\n\n WRITEME\n\"\"\"\n__authors__ = \"Ian Goodfellow\"\n__copyright__ = \"Copyright 2010-2012, Universite de Montreal\"\n__credits__ = [\"Ian Goodfellow\"]\n__license__ = \"3-clause BSD\"\n__maintainer__ = \"LISA Lab\"\n__email__ = \"pylearn-dev@googlegroups\"\n\nimport functools\nimport numpy as np\nfrom theano.compat.six.moves import xrange\nimport theano\nimport theano.tensor as T\nfrom theano.tensor.nnet.conv import conv2d\n\nfrom pylearn2.packaged_dependencies.theano_linear.conv2d \\\n import Conv2d as OrigConv2D\n\nfrom pylearn2.linear.linear_transform import LinearTransform as P2LT\nfrom pylearn2.utils import sharedX\nfrom pylearn2.utils.rng import make_np_rng\n\n\ndefault_seed = [2012, 11, 6, 9]\ndefault_sparse_seed = [2012, 11, 6]\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "..", " ", "todo", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "authors\\u", "\\u_", "=_", "\"", "Ia", "n", " ", "Good", "fel", "low", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "copyright\\u\\u_", "=_", "\"", "Copy", "right", " ", "2010", "-", "2012", ",", " ", "Univers", "ite", " ", "de", " ", "Mont", "real", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "credits\\u\\u_", "=_", "[_", "\"", "Ia", "n", " ", "Good", "fel", "low", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "3", "-", "clause", " ", "BS", "D", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "maintainer\\u\\u_", "=_", "\"", "LIS", "A", " ", "Lab", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "email\\u\\u_", "=_", "\"", "pyl", "earn", "-", "dev", "@", "google", "group", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "compat_", "._", "six_", "._", "moves_", "import_", "xrange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "._", "tensor_", "as_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "tensor_", "._", "nnet", "_", "._", "conv_", "import_", "conv2d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "package", "d\\u", "dependencies_", "._", "theano", "\\u", "linear_", "._", "conv2d_", "import_", "Conv", "2d_", "as_", "Orig", "Conv", "2", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "linear_", "._", "linear", "\\u", "transform_", "import_", "Linea", "r", "Transform_", "as_", "P2", "LT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "utils_", "import_", "shared", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "utils_", "._", "rng_", "import_", "make", "\\u", "np", "\\u", "rng_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "seed_", "=_", "[_", "2012_", ",_", "11_", ",_", "6_", ",_", "9_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "spars", "e\\u", "seed_", "=_", "[_", "2012_", ",_", "11_", ",_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
enthought/pikos/pikos/_internal/function_set.py
[ { "content": " def add(self, function):\n \"\"\" Add the Python function to the list of monitored functions.\n\n Parameters\n ----------\n function : object\n A function or method object to add to the list of monitored\n functions. If the function is already included then the method\n exits silently.\n\n Notes\n -----\n Code adapted from the line_profiler package.\n\n \"\"\"\n try:\n code = function.func_code\n except AttributeError:\n if inspect.isbuiltin(function):\n msg = \"Built-in functions are not supported for: {0}\"\n else:\n msg = \"Could not extract a code object for: {0}\"\n warnings.warn(msg.format(function))\n else:\n if code not in self._code_map:\n self._code_map[code] = {}\n self.functions.append(function)", "metadata": "root.FunctionSet.add", "header": "['class', 'FunctionSet', '(', 'collections', '.', 'MutableSet', ')', ':', '___EOS___']", "index": 58 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Function", "Set_", "(_", "collections_", "._", "Mut", "able", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "self_", ",_", "function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Add", " ", "the", " ", "Pyth", "on", " ", "function", " ", "to", " ", "the", " ", "list", " ", "of", " ", "monitored", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "function", " ", ":", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "function", " ", "or", " ", "method", " ", "object", " ", "to", " ", "add", " ", "to", " ", "the", " ", "list", " ", "of", " ", "monitored", "\\", "10", ";", " ", " ", " ", " ", "function", "s", ".", " ", "If", " ", "the", " ", "function", " ", "is", " ", "alr", "ead", "y", " ", "include", "d", " ", "then", " ", "the", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "exits", " ", "silently", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Code", " ", "adapt", "ed", " ", "from", " ", "the", " ", "line", "\\u", "profiler", " ", "package", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "function_", "._", "func", "\\u", "code_", "\\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 ", " _", "if_", "inspect_", "._", "isb", "uil", "tin", "_", "(_", "function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Bu", "ilt", "-", "in", " ", "function", "s", " ", "are", " ", "not", " ", "support", "ed", " ", "for", ":", " ", "{", "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 ", " _", "msg_", "=_", "\"", "Cou", "ld", " ", "not", " ", "extract", " ", "a", " ", "code", " ", "object", " ", "for", ":", " ", "{", "0", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "msg_", "._", "format_", "(_", "function_", ")_", ")_", "\\u\\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_", "code_", "not_", "in_", "self_", "._", "\\u", "code", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "code", "\\u", "map_", "[_", "code_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "functions_", "._", "append_", "(_", "function_", ")_", "\\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 ]
Use of the return value of a procedure
scipy/scipy/scipy/stats/tests/test_mstats_basic.py
[ { "content": " def test_2D(self):\n a = ma.array(((1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4)),\n mask=((0, 0, 0, 0), (1, 0, 0, 1), (0, 1, 1, 0)))\n actual = mstats.gmean(a)\n desired = np.array((1,2,3,4))\n assert_array_almost_equal(actual, desired, decimal=14)\n\n desired1 = mstats.gmean(a,axis=0)\n assert_array_almost_equal(actual, desired1, decimal=14)\n\n actual = mstats.gmean(a, -1)\n desired = ma.array((np.power(1*2*3*4,1./4.),\n np.power(2*3,1./2.),\n np.power(1*4,1./2.)))\n assert_array_almost_equal(actual, desired, decimal=14)", "metadata": "root.TestGMean.test_2D", "header": "['class', 'TestGMean', '(', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_vs_nonmasked(self):\n np.random.seed(1234567)\n outcome = np.random.randn(20, 4) + [0, 0, 1, 2]\n\n # 1-D inputs\n res1 = stats.ttest_1samp(outcome[:, 0], 1)\n res2 = mstats.ttest_1samp(outcome[:, 0], 1)\n assert_allclose(res1, res2)\n\n # 2-D inputs\n res1 = stats.ttest_1samp(outcome[:, 0], outcome[:, 1], axis=None)\n res2 = mstats.ttest_1samp(outcome[:, 0], outcome[:, 1], axis=None)\n assert_allclose(res1, res2)\n res1 = stats.ttest_1samp(outcome[:, :2], outcome[:, 2:], axis=0)\n res2 = mstats.ttest_1samp(outcome[:, :2], outcome[:, 2:], axis=0)\n assert_allclose(res1, res2)\n\n # Check default is axis=0\n res3 = mstats.ttest_1samp(outcome[:, :2], outcome[:, 2:])\n assert_allclose(res2, res3)", "metadata": "root.TestTtest_1samp.test_vs_nonmasked", "header": "['class', 'TestTtest_1samp', '(', ')', ':', '___EOS___']", "index": 845 } ]
[]
[]
0
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "class_", "Test", "GM", "ean_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "2", "D_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "ma_", "._", "array_", "(_", "(_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ")_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ")_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mask_", "=_", "(_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", ",_", "(_", "1_", ",_", "0_", ",_", "0_", ",_", "1_", ")_", ",_", "(_", "0_", ",_", "1_", ",_", "1_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "mst", "ats_", "._", "gm", "ean_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desired_", "=_", "np_", "._", "array_", "(_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "actual_", ",_", "desired_", ",_", "decimal_", "=_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "1_", "=_", "mst", "ats_", "._", "gm", "ean_", "(_", "a_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "actual_", ",_", "desi", "red", "1_", ",_", "decimal_", "=_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "mst", "ats_", "._", "gm", "ean_", "(_", "a_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desired_", "=_", "ma_", "._", "array_", "(_", "(_", "np_", "._", "power_", "(_", "1_", "*_", "2_", "*_", "3_", "*_", "4_", ",_", "1._", "/_", "4._", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "power_", "(_", "2_", "*_", "3_", ",_", "1._", "/_", "2._", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "power_", "(_", "1_", "*_", "4_", ",_", "1._", "/_", "2._", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "actual_", ",_", "desired_", ",_", "decimal_", "=_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tt", "est", "\\u", "1s", "amp_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "vs", "\\u", "non", "masked_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "np_", "._", "random_", "._", "seed_", "(_", "1234567", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outcome_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "20_", ",_", "4_", ")_", "+_", "[_", "0_", ",_", "0_", ",_", "1_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", "-", "D", " ", "inputs_", "\\u\\u\\uNL\\u\\u\\u_", "res1_", "=_", "stats_", "._", "tte", "st", "\\u", "1s", "amp_", "(_", "outcome_", "[_", ":_", ",_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res2_", "=_", "mst", "ats_", "._", "tte", "st", "\\u", "1s", "amp_", "(_", "outcome_", "[_", ":_", ",_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "res1_", ",_", "res2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", "-", "D", " ", "inputs_", "\\u\\u\\uNL\\u\\u\\u_", "res1_", "=_", "stats_", "._", "tte", "st", "\\u", "1s", "amp_", "(_", "outcome_", "[_", ":_", ",_", "0_", "]_", ",_", "outcome_", "[_", ":_", ",_", "1_", "]_", ",_", "axis_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res2_", "=_", "mst", "ats_", "._", "tte", "st", "\\u", "1s", "amp_", "(_", "outcome_", "[_", ":_", ",_", "0_", "]_", ",_", "outcome_", "[_", ":_", ",_", "1_", "]_", ",_", "axis_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "res1_", ",_", "res2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res1_", "=_", "stats_", "._", "tte", "st", "\\u", "1s", "amp_", "(_", "outcome_", "[_", ":_", ",_", ":_", "2_", "]_", ",_", "outcome_", "[_", ":_", ",_", "2_", ":_", "]_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res2_", "=_", "mst", "ats_", "._", "tte", "st", "\\u", "1s", "amp_", "(_", "outcome_", "[_", ":_", ",_", ":_", "2_", "]_", ",_", "outcome_", "[_", ":_", ",_", "2_", ":_", "]_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "res1_", ",_", "res2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "default", " ", "is", " ", "axis", "=", "0_", "\\u\\u\\uNL\\u\\u\\u_", "res", "3_", "=_", "mst", "ats_", "._", "tte", "st", "\\u", "1s", "amp_", "(_", "outcome_", "[_", ":_", ",_", ":_", "2_", "]_", ",_", "outcome_", "[_", ":_", ",_", "2_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "res2_", ",_", "res", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
JetBrains/python-skeletons/datetime.py
[ { "content": " def date(self):\n \"\"\"Return date object with same year, month and day.\n\n :rtype: _datetime.date\n \"\"\"\n return _datetime.date(0, 0, 0)", "metadata": "root.datetime.date", "header": "['class', 'datetime', '(', 'object', ')', ':', '___EOS___']", "index": 403 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "datetime_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "date_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "date", " ", "object", " ", "with", " ", "same", " ", "year", ",", " ", "month", " ", "and", " ", "day", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "\\u", "datetime", ".", "date", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "datetime_", "._", "date_", "(_", "0_", ",_", "0_", ",_", "0_", ")_", "\\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 ]
First parameter of a method is not named 'self'
cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/contrib/auth/forms.py
[ { "content": " def save(self, commit=True):\n \"\"\"\n Saves the new password.\n \"\"\"\n self.user.set_password(self.cleaned_data[\"password1\"])\n if commit:\n self.user.save()\n return self.user", "metadata": "root.AdminPasswordChangeForm.save", "header": "['class', 'AdminPasswordChangeForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 351 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Admi", "n", "Passw", "ord", "Change", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Save", "s", " ", "the", " ", "new", " ", "password", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "._", "set\\u", "password_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "\"", "password", "1", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "commit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]