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 |
---|---|---|---|---|---|---|---|---|
Comparison of constants | django-leonardo/django-leonardo/leonardo/module/search/tasks.py | [
{
"content": "@shared_task\n@catch_result\ndef sync_search_indexes():\n management.call_command('rebuild_index', interactive=False)\n\n # patch whoosh backend\n haystack = getattr(settings, 'HAYSTACK_CONNECTIONS', None)\n\n if 'default' in haystack and 'whoosh' in haystack['default']['ENGINE']:\n\n try:\n os.remove(os.path.join(\n haystack['default']['PATH'], 'MAIN_WRITELOCK'))\n except:\n pass\n\n return {'result': 'Rebuild index OK'}",
"metadata": "root.sync_search_indexes",
"header": "['module', '___EOS___']",
"index": 9
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"shared",
"\\u",
"task_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"catch",
"\\u",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"sync",
"\\u",
"search",
"\\u",
"indexes_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"management_",
"._",
"call",
"\\u",
"command_",
"(_",
"'",
"rebu",
"ild",
"\\u",
"index",
"'_",
",_",
"interactive_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"patch",
" ",
"who",
"osh",
" ",
"backend_",
"\\u\\u\\uNL\\u\\u\\u_",
"haystack",
"_",
"=_",
"getattr_",
"(_",
"settings_",
",_",
"'",
"HA",
"YST",
"AC",
"K",
"\\u",
"CONNECTION",
"S",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"'",
"default",
"'_",
"in_",
"haystack",
"_",
"and_",
"'",
"who",
"osh",
"'_",
"in_",
"haystack",
"_",
"[_",
"'",
"default",
"'_",
"]_",
"[_",
"'",
"ENGINE",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"remove_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"haystack",
"_",
"[_",
"'",
"default",
"'_",
"]_",
"[_",
"'",
"PATH",
"'_",
"]_",
",_",
"'",
"MAIN",
"\\u",
"WRITE",
"LOCK",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"{_",
"'",
"result",
"'_",
":_",
"'",
"Reb",
"uild",
" ",
"index",
" ",
"OK",
"'_",
"}_"
] | [
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
] |
Import of deprecated module | blaze/blaze/blaze/compute/numpy.py | [
{
"content": "from __future__ import absolute_import, division, print_function\n\nimport datetime\n\nimport numpy as np\nfrom pandas import DataFrame, Series\nfrom datashape import to_numpy, to_numpy_dtype\nfrom numbers import Number\n\nfrom ..expr import (\n Reduction, Field, Projection, Broadcast, Selection, ndim,\n Distinct, Sort, Tail, Head, Label, ReLabel, Expr, Slice, Join,\n std, var, count, nunique, Summary, IsIn,\n BinOp, UnaryOp, USub, Not, nelements, Repeat, Concat, Interp,\n UTCFromTimestamp, DateTimeTruncate,\n Transpose, TensorDot, Coerce, isnan,\n greatest, least, BinaryMath, atan2, Coalesce, Cast\n)\nfrom ..utils import keywords\n\nfrom .core import base, compute\nfrom .pandas import array_coalesce\nfrom ..dispatch import dispatch\nfrom odo import into\nimport pandas as pd\n\n__all__ = ['np']\n\n\n\n\n\n\ntry:\n from .numba import broadcast_numba as broadcast_ndarray\nexcept ImportError:\n\n\ncompute_up.register(Broadcast, np.ndarray)(broadcast_ndarray)\nfor i in range(2, 6):\n compute_up.register(Broadcast, *([(np.ndarray, Number)] * i))(broadcast_ndarray)\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\ninat = np.datetime64('NaT').view('int64')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Note the use of 'week': 'M8[D]' here.\n\n# We truncate week offsets \"manually\" in the compute_up implementation by first\n# converting to days then multiplying our measure by 7 this simplifies our code\n# by only requiring us to calculate the week offset relative to the day of week.\n\nprecision_map = {'year': 'M8[Y]',\n 'month': 'M8[M]',\n 'week': 'M8[D]',\n 'day': 'M8[D]',\n 'hour': 'M8[h]',\n 'minute': 'M8[m]',\n 'second': 'M8[s]',\n 'millisecond': 'M8[ms]',\n 'microsecond': 'M8[us]',\n 'nanosecond': 'M8[ns]'}\n\n\n# these offsets are integers in units of their representation\n\nepoch = datetime.datetime(1970, 1, 1)\noffsets = {\n 'week': epoch.isoweekday(),\n 'day': epoch.toordinal() # number of days since *Python's* epoch (01/01/01)\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ncompute_up.register(Coalesce, np.ndarray, (np.ndarray, base))(array_coalesce)\ncompute_up.register(Coalesce, base, np.ndarray)(array_coalesce)\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Import_",
"of_",
"deprecated_",
"module_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
",_",
"division_",
",_",
"print",
"\\u",
"function_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pandas_",
"import_",
"Data",
"Frame_",
",_",
"Series_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"datas",
"hape_",
"import_",
"to",
"\\u",
"numpy_",
",_",
"to",
"\\u",
"nump",
"y",
"\\u",
"dtype_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"numbers_",
"import_",
"Number_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"._",
"expr_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Redu",
"ction_",
",_",
"Field_",
",_",
"Projection",
"_",
",_",
"Broad",
"cast_",
",_",
"Selection_",
",_",
"ndim_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Dist",
"inc",
"t_",
",_",
"Sort_",
",_",
"Tail",
"_",
",_",
"Head_",
",_",
"Label_",
",_",
"Re",
"Label_",
",_",
"Expr_",
",_",
"Slice_",
",_",
"Join_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"std_",
",_",
"var_",
",_",
"count_",
",_",
"nun",
"ique",
"_",
",_",
"Summary_",
",_",
"Is",
"In_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Bin",
"Op_",
",_",
"Una",
"ry",
"Op_",
",_",
"US",
"ub_",
",_",
"Not_",
",_",
"nele",
"ments_",
",_",
"Repeat",
"_",
",_",
"Concat",
"_",
",_",
"Interp",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"UT",
"CF",
"rom",
"Timestamp_",
",_",
"Date",
"Time",
"Truncate",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Transpose",
"_",
",_",
"Tensor",
"Dot",
"_",
",_",
"Coe",
"rce",
"_",
",_",
"isnan_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"great",
"est_",
",_",
"leas",
"t_",
",_",
"Bin",
"ary",
"Math_",
",_",
"atan2_",
",_",
"Coa",
"les",
"ce_",
",_",
"Cast",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"utils_",
"import_",
"keywords_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"core_",
"import_",
"base_",
",_",
"compute_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"pandas_",
"import_",
"array",
"\\u",
"coalesce",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"dispatch_",
"import_",
"dispatch_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"odo",
"_",
"import_",
"into_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"pandas_",
"as_",
"pd_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"all\\u\\u_",
"=_",
"[_",
"'",
"np",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"._",
"numba_",
"import_",
"broadcast",
"\\u",
"numba_",
"as_",
"broadcast",
"\\u",
"ndarray_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"compute",
"\\u",
"up_",
"._",
"register_",
"(_",
"Broad",
"cast_",
",_",
"np_",
"._",
"ndarray_",
")_",
"(_",
"broadcast",
"\\u",
"ndarray_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"2_",
",_",
"6_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"compute",
"\\u",
"up_",
"._",
"register_",
"(_",
"Broad",
"cast_",
",_",
"*_",
"(_",
"[_",
"(_",
"np_",
"._",
"ndarray_",
",_",
"Number_",
")_",
"]_",
"*_",
"i_",
")_",
")_",
"(_",
"broadcast",
"\\u",
"ndarray_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\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NL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"#",
" ",
"Not",
"e",
" ",
"the",
" ",
"use",
" ",
"of",
" ",
"'",
"week",
"':",
" ",
"'",
"M",
"8",
"[",
"D",
"]'",
" ",
"here",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"truncat",
"e",
" ",
"week",
" ",
"offset",
"s",
" ",
"\"",
"manu",
"ally",
"\"",
" ",
"in",
" ",
"the",
" ",
"compute",
"\\u",
"up",
" ",
"implementation",
" ",
"by",
" ",
"first_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"convert",
"ing",
" ",
"to",
" ",
"day",
"s",
" ",
"then",
" ",
"multipl",
"ying",
" ",
"our",
" ",
"measure",
" ",
"by",
" ",
"7",
" ",
"this",
" ",
"simpli",
"fie",
"s",
" ",
"our",
" ",
"code_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"by",
" ",
"only",
" ",
"requi",
"ring",
" ",
"us",
" ",
"to",
" ",
"calcul",
"ate",
" ",
"the",
" ",
"week",
" ",
"offset",
" ",
"relative",
" ",
"to",
" ",
"the",
" ",
"day",
" ",
"of",
" ",
"week",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"preci",
"sion",
"\\u",
"map_",
"=_",
"{_",
"'",
"year",
"'_",
":_",
"'",
"M",
"8",
"[",
"Y",
"]'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"month",
"'_",
":_",
"'",
"M",
"8",
"[",
"M",
"]'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"week",
"'_",
":_",
"'",
"M",
"8",
"[",
"D",
"]'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"day",
"'_",
":_",
"'",
"M",
"8",
"[",
"D",
"]'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"hour",
"'_",
":_",
"'",
"M",
"8",
"[",
"h",
"]'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"minute",
"'_",
":_",
"'",
"M",
"8",
"[",
"m",
"]'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"second",
"'_",
":_",
"'",
"M",
"8",
"[",
"s",
"]'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"millis",
"econd",
"'_",
":_",
"'",
"M",
"8",
"[",
"ms",
"]'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"microsecond",
"'_",
":_",
"'",
"M",
"8",
"[",
"us",
"]'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"nanos",
"econd",
"'_",
":_",
"'",
"M",
"8",
"[",
"ns",
"]'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"these",
" ",
"offset",
"s",
" ",
"are",
" ",
"integ",
"ers",
" ",
"in",
" ",
"unit",
"s",
" ",
"of",
" ",
"thei",
"r",
" ",
"representation_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"epoch_",
"=_",
"datetime_",
"._",
"datetime_",
"(_",
"1970_",
",_",
"1_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"offsets_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"week",
"'_",
":_",
"epoch_",
"._",
"iso",
"weekday_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"day",
"'_",
":_",
"epoch_",
"._",
"too",
"rdin",
"al_",
"(_",
")_",
"#",
" ",
"number",
" ",
"of",
" ",
"day",
"s",
" ",
"sinc",
"e",
" ",
"*",
"Pyth",
"on",
"'",
"s",
"*",
" ",
"epoch",
" ",
"(",
"01",
"/",
"01",
"/",
"01",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"compute",
"\\u",
"up_",
"._",
"register_",
"(_",
"Coa",
"les",
"ce_",
",_",
"np_",
"._",
"ndarray_",
",_",
"(_",
"np_",
"._",
"ndarray_",
",_",
"base_",
")_",
")_",
"(_",
"array",
"\\u",
"coalesce",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"compute",
"\\u",
"up_",
"._",
"register_",
"(_",
"Coa",
"les",
"ce_",
",_",
"base_",
",_",
"np_",
"._",
"ndarray_",
")_",
"(_",
"array",
"\\u",
"coalesce",
"_",
")_",
"\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused local variable | amrdraz/kodr/app/brython/www/src/Lib/_sre.py | [
{
"content": " def _log(self, context, opname, *args):\n arg_string = (\"%s \" * len(args)) % args\n _log(\"|%s|%s|%s %s\" % (context.pattern_codes,\n context.string_position, opname, arg_string))",
"metadata": "root._OpcodeDispatcher._log",
"header": "['class', '_OpcodeDispatcher', '(', '_Dispatcher', ')', ':', '___EOS___']",
"index": 1158
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"\\u",
"Opcode",
"Dispatcher_",
"(_",
"\\u",
"Dispatcher_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"log_",
"(_",
"self_",
",_",
"context_",
",_",
"opname",
"_",
",_",
"*_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"arg",
"\\u",
"string_",
"=_",
"(_",
"\"%",
"s",
" ",
"\"_",
"*_",
"len_",
"(_",
"args_",
")_",
")_",
"%_",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"log_",
"(_",
"\"|",
"%",
"s",
"|",
"%",
"s",
"|",
"%",
"s",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"context_",
"._",
"pattern",
"\\u",
"codes_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"context_",
"._",
"string",
"\\u",
"position_",
",_",
"opname",
"_",
",_",
"arg",
"\\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
] |
Module is imported with 'import' and 'import from' | scrapinghub/python-hubstorage/tests/test_jobq.py | [
{
"content": "\"\"\"\nTest JobQ\n\"\"\"\nimport os, unittest\nfrom hstestcase import HSTestCase\nfrom hubstorage.jobq import DuplicateJobError\nfrom hubstorage.utils import apipoll\n\n\nEXCLUSIVE = os.environ.get('EXCLUSIVE_STORAGE')\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",
";",
"Test",
" ",
"Jo",
"b",
"Q",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
",_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"hst",
"est",
"case_",
"import_",
"HS",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"hub",
"storage_",
"._",
"job",
"q_",
"import_",
"Duplicate",
"Jo",
"b",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"hub",
"storage_",
"._",
"utils_",
"import_",
"api",
"poll_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"EXC",
"LUS",
"IVE_",
"=_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"'",
"EXC",
"LUS",
"IV",
"E",
"\\u",
"STOR",
"AGE",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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
] |
Unused local variable | yasoob/youtube-dl-GUI/youtube_dl/extractor/archiveorg.py | [
{
"content": "class ArchiveOrgIE(InfoExtractor):\n IE_NAME = 'archive.org'\n IE_DESC = 'archive.org videos'\n _VALID_URL = r'https?://(?:www\\.)?archive\\.org/details/(?P<id>[^?/]+)(?:[?].*)?$'\n _TESTS = [{\n 'url': 'http://archive.org/details/XD300-23_68HighlightsAResearchCntAugHumanIntellect',\n 'md5': '8af1d4cf447933ed3c7f4871162602db',\n 'info_dict': {\n 'id': 'XD300-23_68HighlightsAResearchCntAugHumanIntellect',\n 'ext': 'ogv',\n 'title': '1968 Demo - FJCC Conference Presentation Reel #1',\n 'description': 'md5:1780b464abaca9991d8968c877bb53ed',\n 'upload_date': '19681210',\n 'uploader': 'SRI International'\n }\n }, {\n 'url': 'https://archive.org/details/Cops1922',\n 'md5': '18f2a19e6d89af8425671da1cf3d4e04',\n 'info_dict': {\n 'id': 'Cops1922',\n 'ext': 'ogv',\n 'title': 'Buster Keaton\\'s \"Cops\" (1922)',\n 'description': 'md5:70f72ee70882f713d4578725461ffcc3',\n }\n }]\n",
"metadata": "root.ArchiveOrgIE",
"header": "['module', '___EOS___']",
"index": 6
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Archive",
"Org",
"IE_",
"(_",
"Info",
"Extractor_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"IE",
"\\u",
"NAME_",
"=_",
"'",
"archive",
".",
"org",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"IE",
"\\u",
"DESC_",
"=_",
"'",
"archive",
".",
"org",
" ",
"videos",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"VALID",
"\\u",
"URL_",
"=_",
"r",
"'",
"https",
"?://(?:",
"www",
"\\\\.)",
"?",
"archive",
"\\\\.",
"org",
"/",
"deta",
"il",
"s",
"/(",
"?",
"P",
"<",
"id",
">[",
"^",
"?",
"/]+",
")(?",
":[",
"?]",
".*)",
"?$",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"TESTS_",
"=_",
"[_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"url",
"'_",
":_",
"'",
"http",
"://",
"archive",
".",
"org",
"/",
"deta",
"il",
"s",
"/",
"XD",
"300",
"-",
"23",
"\\u",
"6",
"8",
"Highlight",
"s",
"AR",
"ese",
"arch",
"Cnt",
"Au",
"g",
"Huma",
"n",
"Intel",
"lect",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"md5",
"'_",
":_",
"'",
"8a",
"f1",
"d4",
"cf",
"447",
"933",
"ed",
"3c",
"7f",
"487",
"116",
"260",
"2d",
"b",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"info",
"\\u",
"dict",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"'_",
":_",
"'",
"XD",
"300",
"-",
"23",
"\\u",
"6",
"8",
"Highlight",
"s",
"AR",
"ese",
"arch",
"Cnt",
"Au",
"g",
"Huma",
"n",
"Intel",
"lect",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ext",
"'_",
":_",
"'",
"og",
"v",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"title",
"'_",
":_",
"'",
"196",
"8",
" ",
"Demo",
" ",
"-",
" ",
"FJ",
"CC",
" ",
"Conference",
" ",
"Present",
"ation",
" ",
"Re",
"el",
" ",
"#",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"description",
"'_",
":_",
"'",
"md5",
":",
"178",
"0b",
"464",
"aba",
"ca",
"9991",
"d8",
"968",
"c8",
"7",
"7b",
"b5",
"3e",
"d",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"upload",
"\\u",
"date",
"'_",
":_",
"'",
"196",
"812",
"10",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"uploade",
"r",
"'_",
":_",
"'",
"SR",
"I",
" ",
"Intern",
"ation",
"al",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"url",
"'_",
":_",
"'",
"https",
"://",
"archive",
".",
"org",
"/",
"deta",
"il",
"s",
"/",
"Cop",
"s1",
"922",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"md5",
"'_",
":_",
"'",
"1",
"8f",
"2a",
"1",
"9e",
"6d",
"89",
"af",
"842",
"567",
"1d",
"a1",
"cf",
"3d",
"4e",
"04",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"info",
"\\u",
"dict",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"'_",
":_",
"'",
"Cop",
"s1",
"922",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ext",
"'_",
":_",
"'",
"og",
"v",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"title",
"'_",
":_",
"'",
"Bus",
"ter",
" ",
"Ke",
"ato",
"n",
"\\\\'",
"s",
" ",
"\"",
"Cop",
"s",
"\"",
" ",
"(",
"192",
"2",
")'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"description",
"'_",
":_",
"'",
"md5",
":",
"7",
"0f",
"7",
"2e",
"e7",
"088",
"2f",
"713",
"d4",
"578",
"725",
"461",
"ffc",
"c3",
"'_",
",_",
"\\u\\u\\uNL\\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,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ools/tar.py | [
{
"content": " def checkout(self, url, version='', verbose=False,\n shallow=False, timeout=None):\n \"\"\"\n untars tar at url to self.path.\n If version was given, only the subdirectory 'version' of the\n tar will end up in self.path. Also creates a file next to the\n checkout named *.tar which is a yaml file listing origin url\n and version arguments.\n \"\"\"\n if not ensure_dir_notexists(self.get_path()):\n self.logger.error(\"Can't remove %s\" % self.get_path())\n return False\n tempdir = None\n result = False\n try:\n tempdir = tempfile.mkdtemp()\n if os.path.isfile(url):\n filename = url\n else:\n (filename, _) = urlretrieve_netrc(url)\n # print \"filename\", filename\n temp_tarfile = tarfile.open(filename, 'r:*')\n members = None # means all members in extractall\n if version == '' or version is None:\n subdir = tempdir\n self.logger.warn(\"No tar subdirectory chosen via the 'version' argument for url: %s\" % url)\n else:\n # getmembers lists all files contained in tar with\n # relative path\n subdirs = []\n members = []\n for m in temp_tarfile.getmembers():\n if m.name.startswith(version + '/'):\n members.append(m)\n if m.name.split('/')[0] not in subdirs:\n subdirs.append(m.name.split('/')[0])\n if not members:\n raise VcsError(\"%s is not a subdirectory with contents in members %s\" % (version, subdirs))\n subdir = os.path.join(tempdir, version)\n temp_tarfile.extractall(path=tempdir, members=members)\n\n if not os.path.isdir(subdir):\n raise VcsError(\"%s is not a subdirectory\\n\" % subdir)\n\n try:\n # os.makedirs(os.path.dirname(self._path))\n shutil.move(subdir, self._path)\n except Exception as ex:\n raise VcsError(\"%s failed to move %s to %s\" % (ex, subdir, self._path))\n metadata = yaml.dump({'url': url, 'version': version})\n with open(self.metadata_path, 'w') as mdat:\n mdat.write(metadata)\n result = True\n\n except Exception as exc:\n self.logger.error(\"Tarball download unpack failed: %s\" % str(exc))\n finally:\n if tempdir is not None and os.path.exists(tempdir):\n shutil.rmtree(tempdir)\n return result",
"metadata": "root.TarClient.checkout",
"header": "['class', 'TarClient', '(', 'VcsClientBase', ')', ':', '___EOS___']",
"index": 88
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Tar",
"Client_",
"(_",
"Vc",
"s",
"Client",
"Base_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"checkout_",
"(_",
"self_",
",_",
"url_",
",_",
"version_",
"=_",
"''_",
",_",
"verbose_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shallow",
"_",
"=_",
"False_",
",_",
"timeout_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"unta",
"rs",
" ",
"tar",
" ",
"at",
" ",
"url",
" ",
"to",
" ",
"self",
".",
"path",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"version",
" ",
"was",
" ",
"give",
"n",
",",
" ",
"only",
" ",
"the",
" ",
"subdirectory",
" ",
"'",
"version",
"'",
" ",
"of",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"tar",
" ",
"will",
" ",
"end",
" ",
"up",
" ",
"in",
" ",
"self",
".",
"path",
".",
" ",
" ",
"Al",
"so",
" ",
"create",
"s",
" ",
"a",
" ",
"file",
" ",
"next",
" ",
"to",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"check",
"out",
" ",
"named",
" ",
"*.",
"tar",
" ",
"whi",
"ch",
" ",
"is",
" ",
"a",
" ",
"yaml",
" ",
"file",
" ",
"listi",
"ng",
" ",
"orig",
"in",
" ",
"url",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"version",
" ",
"argu",
"ment",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"ensure",
"\\u",
"dir\\u",
"note",
"xist",
"s_",
"(_",
"self_",
"._",
"get",
"\\u",
"path_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"error_",
"(_",
"\"",
"Can",
"'",
"t",
" ",
"remove",
" ",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"get",
"\\u",
"path_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"tempdir_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tempdir_",
"=_",
"tempfile_",
"._",
"mkdtemp_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"os_",
"._",
"path_",
"._",
"isfile_",
"(_",
"url_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"filename_",
"=_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"(_",
"filename_",
",_",
"\\u_",
")_",
"=_",
"urlr",
"etri",
"eve",
"\\u",
"net",
"rc_",
"(_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"print",
" ",
"\"",
"filename",
"\",",
" ",
"filename_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"temp",
"\\u",
"tarfile_",
"=_",
"tarfile_",
"._",
"open_",
"(_",
"filename_",
",_",
"'",
"r",
":*",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"members_",
"=_",
"None_",
"#",
" ",
"means",
" ",
"all",
" ",
"member",
"s",
" ",
"in",
" ",
"extracta",
"ll_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"version_",
"==_",
"''_",
"or_",
"version_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"subdir_",
"=_",
"tempdir_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"logger_",
"._",
"warn_",
"(_",
"\"",
"No",
" ",
"tar",
" ",
"subdirectory",
" ",
"chosen",
" ",
"via",
" ",
"the",
" ",
"'",
"version",
"'",
" ",
"argu",
"ment",
" ",
"for",
" ",
"url",
":",
" ",
"%",
"s",
"\"_",
"%_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"getmember",
"s",
" ",
"lists",
" ",
"all",
" ",
"files",
" ",
"contain",
"ed",
" ",
"in",
" ",
"tar",
" ",
"with_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"relative",
" ",
"path_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"subdirs_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"members_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"m_",
"in_",
"temp",
"\\u",
"tarfile_",
"._",
"getmember",
"s_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"m_",
"._",
"name_",
"._",
"startswith_",
"(_",
"version_",
"+_",
"'/'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"members_",
"._",
"append_",
"(_",
"m_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"m_",
"._",
"name_",
"._",
"split_",
"(_",
"'/'_",
")_",
"[_",
"0_",
"]_",
"not_",
"in_",
"subdirs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"subdirs_",
"._",
"append_",
"(_",
"m_",
"._",
"name_",
"._",
"split_",
"(_",
"'/'_",
")_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"members_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"raise_",
"Vc",
"s",
"Error_",
"(_",
"\"%",
"s",
" ",
"is",
" ",
"not",
" ",
"a",
" ",
"subdirectory",
" ",
"with",
" ",
"content",
"s",
" ",
"in",
" ",
"member",
"s",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"version_",
",_",
"subdirs_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"subdir_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"tempdir_",
",_",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"temp",
"\\u",
"tarfile_",
"._",
"extracta",
"ll_",
"(_",
"path_",
"=_",
"tempdir_",
",_",
"members_",
"=_",
"members_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"os_",
"._",
"path_",
"._",
"isdir_",
"(_",
"subdir_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Vc",
"s",
"Error_",
"(_",
"\"%",
"s",
" ",
"is",
" ",
"not",
" ",
"a",
" ",
"subdirectory",
"\\\\",
"n",
"\"_",
"%_",
"subdir_",
")_",
"\\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_",
"#",
" ",
"os",
".",
"maked",
"irs",
"(",
"os",
".",
"path",
".",
"dir",
"name",
"(",
"self",
".\\u",
"path",
"))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"shutil_",
"._",
"move_",
"(_",
"subdir_",
",_",
"self_",
"._",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
"as_",
"ex_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Vc",
"s",
"Error_",
"(_",
"\"%",
"s",
" ",
"fail",
"ed",
" ",
"to",
" ",
"move",
" ",
"%",
"s",
" ",
"to",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"ex_",
",_",
"subdir_",
",_",
"self_",
"._",
"\\u",
"path_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"metadata_",
"=_",
"yaml_",
"._",
"dump_",
"(_",
"{_",
"'",
"url",
"'_",
":_",
"url_",
",_",
"'",
"version",
"'_",
":_",
"version_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"open_",
"(_",
"self_",
"._",
"metadata",
"\\u",
"path_",
",_",
"'",
"w",
"'_",
")_",
"as_",
"mdat",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mdat",
"_",
"._",
"write_",
"(_",
"metadata_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
"as_",
"exc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"error_",
"(_",
"\"",
"Tar",
"bal",
"l",
" ",
"download",
" ",
"unpack",
" ",
"fail",
"ed",
":",
" ",
"%",
"s",
"\"_",
"%_",
"str_",
"(_",
"exc_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"finally_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"tempdir_",
"is_",
"not_",
"None_",
"and_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"tempdir_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"shutil_",
"._",
"rmtree_",
"(_",
"tempdir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | Yelp/git-code-debt/git_code_debt/metrics/lines_in_init.py | [
{
"content": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nfrom git_code_debt.metrics.base import SimpleLineCounterBase\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Python__init__LineCount(SimpleLineCounterBase):\n",
"metadata": "root.Python__init__LineCount",
"header": "['module', '___EOS___']",
"index": 6
},
{
"content": " def should_include_file(self, file_diff_stat):\n return file_diff_stat.filename == b'__init__.py'",
"metadata": "root.Python__init__LineCount.should_include_file",
"header": "['class', 'Python__init__LineCount', '(', 'SimpleLineCounterBase', ')', ':', '___EOS___']",
"index": 7
},
{
"content": " def line_matches_metric(self, line, file_diff_stat):\n # All lines in __init__.py match\n return True",
"metadata": "root.Python__init__LineCount.line_matches_metric",
"header": "['class', 'Python__init__LineCount', '(', 'SimpleLineCounterBase', ')', ':', '___EOS___']",
"index": 10
}
] | [] | [] | 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_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"git",
"\\u",
"code",
"\\u",
"debt",
"_",
"._",
"metrics_",
"._",
"base_",
"import_",
"Simple",
"Line",
"Counter",
"Base_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Pyth",
"on",
"\\u\\u",
"init",
"\\u\\u",
"Line",
"Count_",
"(_",
"Simple",
"Line",
"Counter",
"Base_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Pyth",
"on",
"\\u\\u",
"init",
"\\u\\u",
"Line",
"Count_",
"(_",
"Simple",
"Line",
"Counter",
"Base_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"shou",
"ld",
"\\u",
"include",
"\\u",
"file_",
"(_",
"self_",
",_",
"file",
"\\u",
"diff",
"\\u",
"stat_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"file",
"\\u",
"diff",
"\\u",
"stat_",
"._",
"filename_",
"==_",
"b",
"'\\u",
"\\u",
"init",
"\\u\\u",
".",
"py",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Pyth",
"on",
"\\u\\u",
"init",
"\\u\\u",
"Line",
"Count_",
"(_",
"Simple",
"Line",
"Counter",
"Base_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"line",
"\\u",
"matche",
"s",
"\\u",
"metric_",
"(_",
"self_",
",_",
"line_",
",_",
"file",
"\\u",
"diff",
"\\u",
"stat_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"All",
" ",
"lines",
" ",
"in",
" ",
"\\u\\u",
"init",
"\\u\\u",
".",
"py",
" ",
"match_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"True_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Except block handles 'BaseException' | rietveld-codereview/rietveld/codereview/notify_xmpp.py | [
{
"content": "def must_invite(account):\n logging.info('Sending XMPP invite to %s', account.email)\n try:\n xmpp.send_invite(account.email)\n except Exception:\n # XXX How to tell user it failed?\n logging.error('XMPP invite to %s failed', account.email)",
"metadata": "root.must_invite",
"header": "['module', '___EOS___']",
"index": 52
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"must",
"\\u",
"invite_",
"(_",
"account_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"'",
"Sen",
"ding",
" ",
"XMPP",
" ",
"invite",
" ",
"to",
" ",
"%",
"s",
"'_",
",_",
"account_",
"._",
"email_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"xmpp_",
"._",
"send",
"\\u",
"invite_",
"(_",
"account_",
"._",
"email_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"XX",
"X",
" ",
"Ho",
"w",
" ",
"to",
" ",
"tell",
" ",
"user",
" ",
"it",
" ",
"fail",
"ed",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"error_",
"(_",
"'",
"XMPP",
" ",
"invite",
" ",
"to",
" ",
"%",
"s",
" ",
"fail",
"ed",
"'_",
",_",
"account_",
"._",
"email_",
")_",
"\\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
] |
Variable defined multiple times | django/django/django/contrib/admin/options.py | [
{
"content": " def get_formset(self, request, obj=None, **kwargs):\n \"\"\"Returns a BaseInlineFormSet class for use in admin add/change views.\"\"\"\n if 'fields' in kwargs:\n fields = kwargs.pop('fields')\n else:\n fields = flatten_fieldsets(self.get_fieldsets(request, obj))\n if self.exclude is None:\n exclude = []\n else:\n exclude = list(self.exclude)\n exclude.extend(self.get_readonly_fields(request, obj))\n if self.exclude is None and hasattr(self.form, '_meta') and self.form._meta.exclude:\n # Take the custom ModelForm's Meta.exclude into account only if the\n # InlineModelAdmin doesn't define its own.\n exclude.extend(self.form._meta.exclude)\n # If exclude is an empty list we use None, since that's the actual\n # default.\n exclude = exclude or None\n can_delete = self.can_delete and self.has_delete_permission(request, obj)\n defaults = {\n \"form\": self.form,\n \"formset\": self.formset,\n \"fk_name\": self.fk_name,\n \"fields\": fields,\n \"exclude\": exclude,\n \"formfield_callback\": partial(self.formfield_for_dbfield, request=request),\n \"extra\": self.get_extra(request, obj, **kwargs),\n \"min_num\": self.get_min_num(request, obj, **kwargs),\n \"max_num\": self.get_max_num(request, obj, **kwargs),\n \"can_delete\": can_delete,\n }\n\n defaults.update(kwargs)\n base_model_form = defaults['form']\n\n class DeleteProtectedModelForm(base_model_form):\n def hand_clean_DELETE(self):\n \"\"\"\n We don't validate the 'DELETE' field itself because on\n templates it's not rendered using the field information, but\n just using a generic \"deletion_field\" of the InlineModelAdmin.\n \"\"\"\n if self.cleaned_data.get(DELETION_FIELD_NAME, False):\n using = router.db_for_write(self._meta.model)\n collector = NestedObjects(using=using)\n if self.instance.pk is None:\n return\n collector.collect([self.instance])\n if collector.protected:\n objs = []\n for p in collector.protected:\n objs.append(\n # Translators: Model verbose name and instance representation,\n # suitable to be an item in a list.\n _('%(class_name)s %(instance)s') % {\n 'class_name': p._meta.verbose_name,\n 'instance': p}\n )\n params = {'class_name': self._meta.model._meta.verbose_name,\n 'instance': self.instance,\n 'related_objects': get_text_list(objs, _('and'))}\n msg = _(\"Deleting %(class_name)s %(instance)s would require \"\n \"deleting the following protected related objects: \"\n \"%(related_objects)s\")\n raise ValidationError(msg, code='deleting_protected', params=params)\n\n def is_valid(self):\n result = super(DeleteProtectedModelForm, self).is_valid()\n self.hand_clean_DELETE()\n return result\n\n defaults['form'] = DeleteProtectedModelForm\n\n if defaults['fields'] is None and not modelform_defines_fields(defaults['form']):\n defaults['fields'] = forms.ALL_FIELDS\n\n return inlineformset_factory(self.parent_model, self.model, **defaults)",
"metadata": "root.InlineModelAdmin.get_formset",
"header": "['class', 'InlineModelAdmin', '(', 'BaseModelAdmin', ')', ':', '___EOS___']",
"index": 1872
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"In",
"line",
"Model",
"Admin_",
"(_",
"Base",
"Model",
"Admin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"formset_",
"(_",
"self_",
",_",
"request_",
",_",
"obj_",
"=_",
"None_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"a",
" ",
"Base",
"In",
"line",
"Form",
"Set",
" ",
"class",
" ",
"for",
" ",
"use",
" ",
"in",
" ",
"admin",
" ",
"add",
"/",
"change",
" ",
"views",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"'",
"fields",
"'_",
"in_",
"kwargs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"kwargs_",
"._",
"pop_",
"(_",
"'",
"fields",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"flat",
"ten",
"\\u",
"fieldsets_",
"(_",
"self_",
"._",
"get",
"\\u",
"fieldsets_",
"(_",
"request_",
",_",
"obj_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"exclude_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exclude_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exclude_",
"=_",
"list_",
"(_",
"self_",
"._",
"exclude_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"exclude_",
"._",
"extend_",
"(_",
"self_",
"._",
"get",
"\\u",
"read",
"only",
"\\u",
"fields_",
"(_",
"request_",
",_",
"obj_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"exclude_",
"is_",
"None_",
"and_",
"hasattr_",
"(_",
"self_",
"._",
"form_",
",_",
"'\\u",
"meta",
"'_",
")_",
"and_",
"self_",
"._",
"form_",
"._",
"\\u",
"meta_",
"._",
"exclude_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Tak",
"e",
" ",
"the",
" ",
"custom",
" ",
"Model",
"Form",
"'",
"s",
" ",
"Meta",
".",
"exclu",
"de",
" ",
"int",
"o",
" ",
"account",
" ",
"only",
" ",
"if",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"In",
"line",
"Model",
"Admi",
"n",
" ",
"doe",
"sn",
"'",
"t",
" ",
"defin",
"e",
" ",
"its",
" ",
"own",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exclude_",
"._",
"extend_",
"(_",
"self_",
"._",
"form_",
"._",
"\\u",
"meta_",
"._",
"exclude_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"exclu",
"de",
" ",
"is",
" ",
"an",
" ",
"empty",
" ",
"list",
" ",
"we",
" ",
"use",
" ",
"Non",
"e",
",",
" ",
"sinc",
"e",
" ",
"tha",
"t",
"'",
"s",
" ",
"the",
" ",
"actual_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"default",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"exclude_",
"=_",
"exclude_",
"or_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"can",
"\\u",
"delete_",
"=_",
"self_",
"._",
"can",
"\\u",
"delete_",
"and_",
"self_",
"._",
"has",
"\\u",
"delete",
"\\u",
"permission_",
"(_",
"request_",
",_",
"obj_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"defaults_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"form",
"\"_",
":_",
"self_",
"._",
"form_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"formset",
"\"_",
":_",
"self_",
"._",
"formset_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"fk",
"\\u",
"name",
"\"_",
":_",
"self_",
"._",
"fk",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"fields",
"\"_",
":_",
"fields_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"exclu",
"de",
"\"_",
":_",
"exclude_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"formfi",
"eld",
"\\u",
"callback",
"\"_",
":_",
"partial_",
"(_",
"self_",
"._",
"formfi",
"eld",
"\\u",
"for",
"\\u",
"dbf",
"ield_",
",_",
"request_",
"=_",
"request_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"extra",
"\"_",
":_",
"self_",
"._",
"get",
"\\u",
"extra_",
"(_",
"request_",
",_",
"obj_",
",_",
"**_",
"kwargs_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"min",
"\\u",
"num",
"\"_",
":_",
"self_",
"._",
"get",
"\\u",
"min",
"\\u",
"num_",
"(_",
"request_",
",_",
"obj_",
",_",
"**_",
"kwargs_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"max",
"\\u",
"num",
"\"_",
":_",
"self_",
"._",
"get",
"\\u",
"max",
"\\u",
"num_",
"(_",
"request_",
",_",
"obj_",
",_",
"**_",
"kwargs_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"can",
"\\u",
"delete",
"\"_",
":_",
"can",
"\\u",
"delete_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"defaults_",
"._",
"update_",
"(_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"base",
"\\u",
"model",
"\\u",
"form_",
"=_",
"defaults_",
"[_",
"'",
"form",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Delete",
"Protect",
"ed",
"Model",
"Form_",
"(_",
"base",
"\\u",
"model",
"\\u",
"form_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"hand",
"\\u",
"clean",
"\\u",
"DELETE_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"We",
" ",
"don",
"'",
"t",
" ",
"validat",
"e",
" ",
"the",
" ",
"'",
"DELET",
"E",
"'",
" ",
"field",
" ",
"its",
"elf",
" ",
"bec",
"aus",
"e",
" ",
"on",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"template",
"s",
" ",
"it",
"'",
"s",
" ",
"not",
" ",
"render",
"ed",
" ",
"usi",
"ng",
" ",
"the",
" ",
"field",
" ",
"informati",
"on",
",",
" ",
"but",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"just",
" ",
"usi",
"ng",
" ",
"a",
" ",
"gener",
"ic",
" ",
"\"",
"deletion",
"\\u",
"field",
"\"",
" ",
"of",
" ",
"the",
" ",
"In",
"line",
"Model",
"Admi",
"n",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"._",
"get_",
"(_",
"DELET",
"ION",
"\\u",
"FIE",
"LD",
"\\u",
"NAME_",
",_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"using_",
"=_",
"router_",
"._",
"db",
"\\u",
"for",
"\\u",
"write_",
"(_",
"self_",
"._",
"\\u",
"meta_",
"._",
"model_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"collector_",
"=_",
"Nest",
"ed",
"Objects_",
"(_",
"using_",
"=_",
"using_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"instance_",
"._",
"pk_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"collector_",
"._",
"collect_",
"(_",
"[_",
"self_",
"._",
"instance_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"collector_",
"._",
"protected_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"objs_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"p_",
"in_",
"collector_",
"._",
"protected_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"objs_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Translat",
"ors",
":",
" ",
"Model",
" ",
"verbo",
"se",
" ",
"name",
" ",
"and",
" ",
"instance",
" ",
"represent",
"ation",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"suit",
"able",
" ",
"to",
" ",
"be",
" ",
"an",
" ",
"item",
" ",
"in",
" ",
"a",
" ",
"list",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u_",
"(_",
"'%",
"(",
"class",
"\\u",
"name",
")",
"s",
" ",
"%",
"(",
"instance",
")",
"s",
"'_",
")_",
"%_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"class",
"\\u",
"name",
"'_",
":_",
"p_",
"._",
"\\u",
"meta_",
"._",
"verbo",
"se",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"instance",
"'_",
":_",
"p_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"params_",
"=_",
"{_",
"'",
"class",
"\\u",
"name",
"'_",
":_",
"self_",
"._",
"\\u",
"meta_",
"._",
"model_",
"._",
"\\u",
"meta_",
"._",
"verbo",
"se",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"instance",
"'_",
":_",
"self_",
"._",
"instance_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"relate",
"d\\u",
"object",
"s",
"'_",
":_",
"get",
"\\u",
"text",
"\\u",
"list_",
"(_",
"objs_",
",_",
"\\u_",
"(_",
"'",
"and",
"'_",
")_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"=_",
"\\u_",
"(_",
"\"",
"Del",
"eti",
"ng",
" ",
"%",
"(",
"class",
"\\u",
"name",
")",
"s",
" ",
"%",
"(",
"instance",
")",
"s",
" ",
"wou",
"ld",
" ",
"require",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"delet",
"ing",
" ",
"the",
" ",
"follow",
"ing",
" ",
"protect",
"ed",
" ",
"relate",
"d",
" ",
"object",
"s",
":",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"%",
"(",
"relate",
"d\\u",
"object",
"s",
")",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Validat",
"ion",
"Error_",
"(_",
"msg_",
",_",
"code_",
"=_",
"'",
"delet",
"ing",
"\\u",
"protect",
"ed",
"'_",
",_",
"params_",
"=_",
"params_",
")_",
"\\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_",
"def_",
"is",
"\\u",
"valid_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"super_",
"(_",
"Delete",
"Protect",
"ed",
"Model",
"Form_",
",_",
"self_",
")_",
"._",
"is",
"\\u",
"valid_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"hand",
"\\u",
"clean",
"\\u",
"DELETE_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"defaults_",
"[_",
"'",
"form",
"'_",
"]_",
"=_",
"Delete",
"Protect",
"ed",
"Model",
"Form_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"defaults_",
"[_",
"'",
"fields",
"'_",
"]_",
"is_",
"None_",
"and_",
"not_",
"modelf",
"orm",
"\\u",
"defin",
"es",
"\\u",
"fields_",
"(_",
"defaults_",
"[_",
"'",
"form",
"'_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"defaults_",
"[_",
"'",
"fields",
"'_",
"]_",
"=_",
"forms_",
"._",
"ALL",
"\\u",
"FIELDS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"inline",
"formset",
"\\u",
"factory_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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
] |
Implicit string concatenation in a list | awslabs/aws-shell/awsshell/app.py | [
{
"content": " def load_config(self):\n \"\"\"Load the config from the config file or template.\"\"\"\n config = Config()\n self.config_obj = config.load('awsshellrc')\n self.config_section = self.config_obj['aws-shell']\n self.model_completer.match_fuzzy = self.config_section.as_bool(\n 'match_fuzzy')\n self.enable_vi_bindings = self.config_section.as_bool(\n 'enable_vi_bindings')\n self.show_completion_columns = self.config_section.as_bool(\n 'show_completion_columns')\n self.show_help = self.config_section.as_bool('show_help')\n self.theme = self.config_section['theme']",
"metadata": "root.AWSShell.load_config",
"header": "['class', 'AWSShell', '(', 'object', ')', ':', '___EOS___']",
"index": 247
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Implicit",
"_",
"string_",
"concate",
"nation_",
"in_",
"a_",
"list_",
"[SEP]_",
"class_",
"AW",
"SS",
"hell",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"load",
"\\u",
"config_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Load",
" ",
"the",
" ",
"config",
" ",
"from",
" ",
"the",
" ",
"config",
" ",
"file",
" ",
"or",
" ",
"template",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"config_",
"=_",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"config",
"\\u",
"obj_",
"=_",
"config_",
"._",
"load_",
"(_",
"'",
"aws",
"shell",
"rc",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"config",
"\\u",
"section_",
"=_",
"self_",
"._",
"config",
"\\u",
"obj_",
"[_",
"'",
"aws",
"-",
"shell",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"model",
"\\u",
"completer_",
"._",
"match",
"\\u",
"fuzzy_",
"=_",
"self_",
"._",
"config",
"\\u",
"section_",
"._",
"as",
"\\u",
"bool_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"match",
"\\u",
"fuzz",
"y",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"enable",
"\\u",
"vi",
"\\u",
"bindings_",
"=_",
"self_",
"._",
"config",
"\\u",
"section_",
"._",
"as",
"\\u",
"bool_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"enable",
"\\u",
"vi",
"\\u",
"bindi",
"ngs",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"show",
"\\u",
"completion",
"\\u",
"columns_",
"=_",
"self_",
"._",
"config",
"\\u",
"section_",
"._",
"as",
"\\u",
"bool_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"show",
"\\u",
"completion",
"\\u",
"column",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"show",
"\\u",
"help_",
"=_",
"self_",
"._",
"config",
"\\u",
"section_",
"._",
"as",
"\\u",
"bool_",
"(_",
"'",
"show",
"\\u",
"help",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"theme_",
"=_",
"self_",
"._",
"config",
"\\u",
"section_",
"[_",
"'",
"them",
"e",
"'_",
"]_",
"\\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
] |
First parameter of a method is not named 'self' | bitxbay/BitXBay/electru/build/lib/electrum_plugins/pointofsale.py | [
{
"content": " def description(self):\n return _('Show QR code window and amounts requested for each address. Add menu item to request amount.')+_(' Note: This requires the exchange rate plugin to be installed.')",
"metadata": "root.Plugin.description",
"header": "['class', 'Plugin', '(', 'BasePlugin', ')', ':', '___EOS___']",
"index": 108
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"Plugin_",
"(_",
"Base",
"Plugin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"description_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u_",
"(_",
"'",
"Show",
" ",
"QR",
" ",
"code",
" ",
"window",
" ",
"and",
" ",
"amounts",
" ",
"request",
"ed",
" ",
"for",
" ",
"each",
" ",
"address",
".",
" ",
"Add",
" ",
"menu",
" ",
"item",
" ",
"to",
" ",
"request",
" ",
"amo",
"unt",
".'_",
")_",
"+_",
"\\u_",
"(_",
"'",
" ",
"Not",
"e",
":",
" ",
"Thi",
"s",
" ",
"require",
"s",
" ",
"the",
" ",
"exchange",
" ",
"rate",
" ",
"plugin",
" ",
"to",
" ",
"be",
" ",
"install",
"ed",
".'_",
")_",
"\\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
] |
Unused local variable | eevee/sanpera/sanpera/constants.py | [
{
"content": "class Channel(CEnum):\n __ctype__ = ffi.typeof('ChannelType')\n red = 'RedChannel'\n blue = 'BlueChannel'\n green = 'GreenChannel'",
"metadata": "root.Channel",
"header": "['module', '___EOS___']",
"index": 28
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Channel_",
"(_",
"CE",
"num_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u\\u",
"ctype",
"\\u\\u_",
"=_",
"ffi_",
"._",
"typeof",
"_",
"(_",
"'",
"Chan",
"nel",
"Type",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"red_",
"=_",
"'",
"Red",
"Chan",
"nel",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"blue_",
"=_",
"'",
"Blue",
"Chan",
"nel",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"green_",
"=_",
"'",
"Green",
"Chan",
"nel",
"'_"
] | [
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
] |
Implicit string concatenation in a list | ardekantur/pyglet/contrib/wydget/wydget/event.py | [
{
"content": "'''Implement event handling for wydget GUIs.\n\nThe `GUIEventDispatcher` class is automatically mixed into the `wydget.GUI`\nclass and is activated by pushing the gui onto a window's event handlers\nstack::\n\n gui = GUI(window)\n window.push_handlers(gui)\n\n\nEvents\n------\n\nStandard pyglet events are passed through if handled. The first argument is\nalways the \"active\" element (see below `determining the active element`_):\n\n- `on_mouse_motion(element, x, y, dx, dy)`\n- `on_mouse_press(element, x, y, button, modifiers)`\n- `on_mouse_release(element, x, y, button, modifiers)`\n- `on_mouse_drag(element, x, y, dx, dy, buttons, modifiers)`\n- `on_mouse_scroll(element, x, y, dx, dy)`\n- `on_key_press(element, symbol, modifiers)`\n- `on_text(element, text)`\n- `on_text_motion(element, motion)`\n- `on_text_motion_select(element, motion)`\n\nNew events generated by wydget:\n\n`on_change(element, value)`\n The element's \"value\" changed (eg. text in a TextInput, selection\n choice for a Selection)\n\n`on_click(element, x, y, buttons, modifiers, click_count)`\n The element was clicked. the click_count argument indicates how\n many times the element has been clicked in rapid succession.\n\n`on_element_enter(element, x, y)`\n The mouse is over the element. Note that this event will be\n automatically propogated to all parents of the element directly under\n the mouse.\n\n If an element implements the `on_element_enter` handler but does not\n wish to receive an `on_element_leave` event when the mouse\n departs it should return `EVENT_UNHANDLED`. Returning `EVENT_HANDLED`\n implies that `on_element_leave` be generated once the mouse leaves the\n element.\n\n`on_element_leave(element, x, y)`\n The mouse is no longer over the element.\n\n`on_drag(element, x, y, dx, dy, buttons, modifiers)`\n Press on listening element followed by mouse movement. If the handler\n returns `EVENT_UNHANDLED` then the element is not considered to be being\n dragged, and thus no further `on_drag_*` events will be generated, nor\n an `on_drop`.\n\n`on_drag_enter(element, x, y, dragged_element)`\n The dragged_element is being dragged over the stationary element.\n\n`on_drag_leave(element, x, y, dragged_element)`\n The dragged_element is no longer being dragged over the\n stationary element.\n\n`on_drag_complete(element, x, y, buttons, modifiers, ok)`\n Release after dragging listening element, ok is return code\n from dropped-on element's `on_drop`.\n\n`on_drop(element, x, y, button, modifiers, element)`\n Element has been drag-n-dropped on listening element.\n\n`on_gain_focus(element, source)`\n Listening element gains focus from \"source\" ('tab', 'mouse' or 'code').\n\n`on_lose_focus(element)`\n Listening element loses focus.\n\n`on_delete(element)`\n The element is about to be deleted from the gui.\n\n`on_eos(element)`\n The movie or music element has reached the end of the stream it was\n playing.\n\n\nDetermining the Active Element\n------------------------------\n\nThe element passed into the event handlers above is usually the element\ndirectly under the mouse. There are some situations where this is not\nthe case:\n\n- it's not if ``element.is_transparent == True``\n- it's not if ``element.isEnabled() == False``\n- `on_text`, `on_text_motion` and `on_text_motion_select` are passed to the\n *currently focused element* regardless of the mouse position\n- if an `on_drag` or `on_mouse_drag` events are passed to the\n `mouse_press_element` (ie. the one identified on an `on_mouse_press` event)\n- `on_mouse_release` events are always passed to the `mouse_press_element`\n regardless of where the mouse pointer happens to be\n- `on_click` is only generated for the `mouse_press_element` if the\n `on_mouse_release` event is received over that element\n- `on_element_enter` and `on_element_leave` are generated for all elements up\n the active element's branch of the element tree\n- in all other cases, the event may be propogated (see `event propogation`_\n below)\n\n\nEvent Propogation\n-----------------\n\nEvents are automatically propogated up to element parents if an event\nhandler either does not exist or the handler returns `EVENT_UNHANDLED`.\n\n\nKeyboard Focusing\n-----------------\n\nFocus events include the source of the focus event:\n\n'tab' -- tab-key cycling through is_focusable elements\n'mouse' -- mouse click on an element\n'code' -- code called setFocus() to explicitly focus an element\n\nElements marked is_focusable=True will participate in tab-key focus\nmovement.\n\n'''\n\nimport inspect\nimport time\n\nfrom pyglet.event import (EventDispatcher, EVENT_UNHANDLED, EVENT_HANDLED,\n EventException)\nfrom pyglet.window import key\n\nfrom layout.css import Rule, RuleSet, Selector, SimpleSelector\n\n# partially snarfed from layout.gl.event\n# Instead of each stack layer being a dictionary mapping event-name to\n# event-function, each layer is a dictionary mapping event-name to \n# RuleSet\n\n\n\n# EVENTS IN and OUT\nGUIEventDispatcher.register_event_type('on_mouse_motion')\nGUIEventDispatcher.register_event_type('on_mouse_press')\nGUIEventDispatcher.register_event_type('on_mouse_release')\nGUIEventDispatcher.register_event_type('on_mouse_enter')\nGUIEventDispatcher.register_event_type('on_mouse_leave')\nGUIEventDispatcher.register_event_type('on_mouse_drag')\nGUIEventDispatcher.register_event_type('on_mouse_scroll')\n\nGUIEventDispatcher.register_event_type('on_key_press')\nGUIEventDispatcher.register_event_type('on_text')\nGUIEventDispatcher.register_event_type('on_text_motion')\nGUIEventDispatcher.register_event_type('on_text_motion_select')\n\n# EVENTS OUT\nGUIEventDispatcher.register_event_type('on_change')\nGUIEventDispatcher.register_event_type('on_click')\nGUIEventDispatcher.register_event_type('on_drag')\nGUIEventDispatcher.register_event_type('on_drag_enter')\nGUIEventDispatcher.register_event_type('on_drag_leave')\nGUIEventDispatcher.register_event_type('on_drag_complete')\nGUIEventDispatcher.register_event_type('on_drop')\nGUIEventDispatcher.register_event_type('on_element_enter')\nGUIEventDispatcher.register_event_type('on_element_leave')\nGUIEventDispatcher.register_event_type('on_gain_focus')\nGUIEventDispatcher.register_event_type('on_lose_focus')\nGUIEventDispatcher.register_event_type('on_delete')\nGUIEventDispatcher.register_event_type('on_eos')\n \n\n\n\n\n\nuniversal_selector = Selector(SimpleSelector(None, None, (), (), ()), ())\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Implicit",
"_",
"string_",
"concate",
"nation_",
"in_",
"a_",
"list_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"'''",
"Impl",
"ement",
" ",
"event",
" ",
"handling",
" ",
"for",
" ",
"wy",
"dget",
" ",
"GU",
"Is",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"The",
" ",
"`",
"GU",
"IE",
"vent",
"Dispatcher",
"`",
" ",
"class",
" ",
"is",
" ",
"automati",
"call",
"y",
" ",
"mixed",
" ",
"int",
"o",
" ",
"the",
" ",
"`",
"wy",
"dget",
".",
"GU",
"I",
"`",
"\\",
"10",
";",
"class",
" ",
"and",
" ",
"is",
" ",
"activat",
"ed",
" ",
"by",
" ",
"push",
"ing",
" ",
"the",
" ",
"gui",
" ",
"onto",
" ",
"a",
" ",
"window",
"'",
"s",
" ",
"event",
" ",
"handler",
"s",
"\\",
"10",
";",
"stack",
"::",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"gui",
" ",
"=",
" ",
"GU",
"I",
"(",
"window",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"window",
".",
"push",
"\\u",
"handler",
"s",
"(",
"gui",
")",
"\\",
"10",
";",
"\\",
"10",
";",
"\\",
"10",
";",
"Event",
"s",
"\\",
"10",
";",
"------",
"\\",
"10",
";",
"\\",
"10",
";",
"Standard",
" ",
"pyg",
"let",
" ",
"events",
" ",
"are",
" ",
"pass",
"ed",
" ",
"through",
" ",
"if",
" ",
"handle",
"d",
".",
" ",
"The",
" ",
"first",
" ",
"argu",
"ment",
" ",
"is",
"\\",
"10",
";",
"alw",
"ay",
"s",
" ",
"the",
" ",
"\"",
"active",
"\"",
" ",
"element",
" ",
"(",
"see",
" ",
"belo",
"w",
" ",
"`",
"determini",
"ng",
" ",
"the",
" ",
"active",
" ",
"element",
"`\\u",
"):",
"\\",
"10",
";",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"mouse",
"\\u",
"moti",
"on",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"dx",
",",
" ",
"dy",
")`",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"mouse",
"\\u",
"press",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"button",
",",
" ",
"modifiers",
")`",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"mouse",
"\\u",
"release",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"button",
",",
" ",
"modifiers",
")`",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"mouse",
"\\u",
"drag",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"dx",
",",
" ",
"dy",
",",
" ",
"buttons",
",",
" ",
"modifiers",
")`",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"mouse",
"\\u",
"scroll",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"dx",
",",
" ",
"dy",
")`",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"key",
"\\u",
"press",
"(",
"element",
",",
" ",
"symbol",
",",
" ",
"modifiers",
")`",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"text",
"(",
"element",
",",
" ",
"text",
")`",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"text",
"\\u",
"moti",
"on",
"(",
"element",
",",
" ",
"moti",
"on",
")`",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"text",
"\\u",
"moti",
"on",
"\\u",
"select",
"(",
"element",
",",
" ",
"moti",
"on",
")`",
"\\",
"10",
";",
"\\",
"10",
";",
"New",
" ",
"events",
" ",
"generat",
"ed",
" ",
"by",
" ",
"wy",
"dget",
":",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"change",
"(",
"element",
",",
" ",
"value",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"The",
" ",
"element",
"'",
"s",
" ",
"\"",
"value",
"\"",
" ",
"change",
"d",
" ",
"(",
"eg",
".",
" ",
"text",
" ",
"in",
" ",
"a",
" ",
"Text",
"Inp",
"ut",
",",
" ",
"selection",
"\\",
"10",
";",
" ",
" ",
" ",
"choice",
" ",
"for",
" ",
"a",
" ",
"Selecti",
"on",
")",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"click",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"buttons",
",",
" ",
"modifiers",
",",
" ",
"click",
"\\u",
"count",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"The",
" ",
"element",
" ",
"was",
" ",
"click",
"ed",
".",
" ",
"the",
" ",
"click",
"\\u",
"count",
" ",
"argu",
"ment",
" ",
"indicat",
"es",
" ",
"how",
"\\",
"10",
";",
" ",
" ",
" ",
"many",
" ",
"times",
" ",
"the",
" ",
"element",
" ",
"has",
" ",
"bee",
"n",
" ",
"click",
"ed",
" ",
"in",
" ",
"rapid",
" ",
"success",
"ion",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"element",
"\\u",
"enter",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"The",
" ",
"mouse",
" ",
"is",
" ",
"over",
" ",
"the",
" ",
"element",
".",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"this",
" ",
"event",
" ",
"will",
" ",
"be",
"\\",
"10",
";",
" ",
" ",
" ",
"automati",
"call",
"y",
" ",
"prop",
"oga",
"ted",
" ",
"to",
" ",
"all",
" ",
"parents",
" ",
"of",
" ",
"the",
" ",
"element",
" ",
"direct",
"ly",
" ",
"under",
"\\",
"10",
";",
" ",
" ",
" ",
"the",
" ",
"mouse",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
"If",
" ",
"an",
" ",
"element",
" ",
"implement",
"s",
" ",
"the",
" ",
"`",
"on",
"\\u",
"element",
"\\u",
"enter",
"`",
" ",
"handler",
" ",
"but",
" ",
"doe",
"s",
" ",
"not",
"\\",
"10",
";",
" ",
" ",
" ",
"wish",
" ",
"to",
" ",
"receive",
" ",
"an",
" ",
"`",
"on",
"\\u",
"element",
"\\u",
"lea",
"ve",
"`",
" ",
"event",
" ",
"whe",
"n",
" ",
"the",
" ",
"mouse",
"\\",
"10",
";",
" ",
" ",
" ",
"depart",
"s",
" ",
"it",
" ",
"shou",
"ld",
" ",
"return",
" ",
"`",
"EVENT",
"\\u",
"UN",
"HANDLE",
"D",
"`.",
" ",
"Return",
"ing",
" ",
"`",
"EVENT",
"\\u",
"HANDLE",
"D",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
"implies",
" ",
"tha",
"t",
" ",
"`",
"on",
"\\u",
"element",
"\\u",
"lea",
"ve",
"`",
" ",
"be",
" ",
"generat",
"ed",
" ",
"onc",
"e",
" ",
"the",
" ",
"mouse",
" ",
"lea",
"ves",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
"element",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"element",
"\\u",
"lea",
"ve",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"The",
" ",
"mouse",
" ",
"is",
" ",
"no",
" ",
"long",
"er",
" ",
"over",
" ",
"the",
" ",
"element",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"drag",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"dx",
",",
" ",
"dy",
",",
" ",
"buttons",
",",
" ",
"modifiers",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"Press",
" ",
"on",
" ",
"listen",
"ing",
" ",
"element",
" ",
"followe",
"d",
" ",
"by",
" ",
"mouse",
" ",
"movement",
".",
" ",
"If",
" ",
"the",
" ",
"handler",
"\\",
"10",
";",
" ",
" ",
" ",
"return",
"s",
" ",
"`",
"EVENT",
"\\u",
"UN",
"HANDLE",
"D",
"`",
" ",
"then",
" ",
"the",
" ",
"element",
" ",
"is",
" ",
"not",
" ",
"consider",
"ed",
" ",
"to",
" ",
"be",
" ",
"bei",
"ng",
"\\",
"10",
";",
" ",
" ",
" ",
"dragg",
"ed",
",",
" ",
"and",
" ",
"thu",
"s",
" ",
"no",
" ",
"fur",
"ther",
" ",
"`",
"on",
"\\u",
"drag",
"\\u*",
"`",
" ",
"events",
" ",
"will",
" ",
"be",
" ",
"generat",
"ed",
",",
" ",
"nor",
"\\",
"10",
";",
" ",
" ",
" ",
"an",
" ",
"`",
"on",
"\\u",
"drop",
"`.",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"drag",
"\\u",
"enter",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"dragg",
"ed",
"\\u",
"element",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"The",
" ",
"dragg",
"ed",
"\\u",
"element",
" ",
"is",
" ",
"bei",
"ng",
" ",
"dragg",
"ed",
" ",
"over",
" ",
"the",
" ",
"station",
"ary",
" ",
"element",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"drag",
"\\u",
"lea",
"ve",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"dragg",
"ed",
"\\u",
"element",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"The",
" ",
"dragg",
"ed",
"\\u",
"element",
" ",
"is",
" ",
"no",
" ",
"long",
"er",
" ",
"bei",
"ng",
" ",
"dragg",
"ed",
" ",
"over",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
"station",
"ary",
" ",
"element",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"drag",
"\\u",
"complete",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"buttons",
",",
" ",
"modifiers",
",",
" ",
"ok",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"Release",
" ",
"after",
" ",
"dragg",
"ing",
" ",
"listen",
"ing",
" ",
"element",
",",
" ",
"ok",
" ",
"is",
" ",
"return",
" ",
"code",
"\\",
"10",
";",
" ",
" ",
" ",
"from",
" ",
"dropped",
"-",
"on",
" ",
"element",
"'",
"s",
" ",
"`",
"on",
"\\u",
"drop",
"`.",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"drop",
"(",
"element",
",",
" ",
"x",
",",
" ",
"y",
",",
" ",
"button",
",",
" ",
"modifiers",
",",
" ",
"element",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"Element",
" ",
"has",
" ",
"bee",
"n",
" ",
"drag",
"-",
"n",
"-",
"dropped",
" ",
"on",
" ",
"listen",
"ing",
" ",
"element",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"gain",
"\\u",
"foc",
"us",
"(",
"element",
",",
" ",
"source",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"Listen",
"ing",
" ",
"element",
" ",
"gains",
" ",
"foc",
"us",
" ",
"from",
" ",
"\"",
"source",
"\"",
" ",
"('",
"tab",
"',",
" ",
"'",
"mouse",
"'",
" ",
"or",
" ",
"'",
"code",
"')",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"lose",
"\\u",
"foc",
"us",
"(",
"element",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"Listen",
"ing",
" ",
"element",
" ",
"lose",
"s",
" ",
"foc",
"us",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"delete",
"(",
"element",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"The",
" ",
"element",
" ",
"is",
" ",
"abo",
"ut",
" ",
"to",
" ",
"be",
" ",
"delete",
"d",
" ",
"from",
" ",
"the",
" ",
"gui",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"`",
"on",
"\\u",
"eos",
"(",
"element",
")`",
"\\",
"10",
";",
" ",
" ",
" ",
"The",
" ",
"movie",
" ",
"or",
" ",
"music",
" ",
"element",
" ",
"has",
" ",
"reache",
"d",
" ",
"the",
" ",
"end",
" ",
"of",
" ",
"the",
" ",
"stream",
" ",
"it",
" ",
"was",
"\\",
"10",
";",
" ",
" ",
" ",
"play",
"ing",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"\\",
"10",
";",
"Determini",
"ng",
" ",
"the",
" ",
"Activ",
"e",
" ",
"Element",
"\\",
"10",
";",
"--------------",
"--------------",
"--",
"\\",
"10",
";",
"\\",
"10",
";",
"The",
" ",
"element",
" ",
"pass",
"ed",
" ",
"int",
"o",
" ",
"the",
" ",
"event",
" ",
"handler",
"s",
" ",
"above",
" ",
"is",
" ",
"usual",
"ly",
" ",
"the",
" ",
"element",
"\\",
"10",
";",
"direct",
"ly",
" ",
"under",
" ",
"the",
" ",
"mouse",
".",
" ",
"There",
" ",
"are",
" ",
"some",
" ",
"situation",
"s",
" ",
"where",
" ",
"this",
" ",
"is",
" ",
"not",
"\\",
"10",
";",
"the",
" ",
"case",
":",
"\\",
"10",
";",
"\\",
"10",
";",
"-",
" ",
"it",
"'",
"s",
" ",
"not",
" ",
"if",
" ",
"``",
"element",
".",
"is",
"\\u",
"transp",
"arent",
" ",
"==",
" ",
"Tru",
"e",
"``",
"\\",
"10",
";",
"-",
" ",
"it",
"'",
"s",
" ",
"not",
" ",
"if",
" ",
"``",
"element",
".",
"is",
"Enable",
"d",
"()",
" ",
"==",
" ",
"Fal",
"se",
"``",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"text",
"`",
",",
" ",
"`",
"on",
"\\u",
"text",
"\\u",
"moti",
"on",
"`",
" ",
"and",
" ",
"`",
"on",
"\\u",
"text",
"\\u",
"moti",
"on",
"\\u",
"select",
"`",
" ",
"are",
" ",
"pass",
"ed",
" ",
"to",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
"*",
"currentl",
"y",
" ",
"focused",
" ",
"element",
"*",
" ",
"rega",
"rd",
"less",
" ",
"of",
" ",
"the",
" ",
"mouse",
" ",
"position",
"\\",
"10",
";",
"-",
" ",
"if",
" ",
"an",
" ",
"`",
"on",
"\\u",
"drag",
"`",
" ",
"or",
" ",
"`",
"on",
"\\u",
"mouse",
"\\u",
"drag",
"`",
" ",
"events",
" ",
"are",
" ",
"pass",
"ed",
" ",
"to",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
"`",
"mouse",
"\\u",
"press",
"\\u",
"element",
"`",
" ",
"(",
"ie",
".",
" ",
"the",
" ",
"one",
" ",
"identifi",
"ed",
" ",
"on",
" ",
"an",
" ",
"`",
"on",
"\\u",
"mouse",
"\\u",
"press",
"`",
" ",
"event",
")",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"mouse",
"\\u",
"release",
"`",
" ",
"events",
" ",
"are",
" ",
"alw",
"ay",
"s",
" ",
"pass",
"ed",
" ",
"to",
" ",
"the",
" ",
"`",
"mouse",
"\\u",
"press",
"\\u",
"element",
"`",
"\\",
"10",
";",
" ",
" ",
"rega",
"rd",
"less",
" ",
"of",
" ",
"where",
" ",
"the",
" ",
"mouse",
" ",
"point",
"er",
" ",
"happ",
"ens",
" ",
"to",
" ",
"be",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"click",
"`",
" ",
"is",
" ",
"only",
" ",
"generat",
"ed",
" ",
"for",
" ",
"the",
" ",
"`",
"mouse",
"\\u",
"press",
"\\u",
"element",
"`",
" ",
"if",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
"`",
"on",
"\\u",
"mouse",
"\\u",
"release",
"`",
" ",
"event",
" ",
"is",
" ",
"receive",
"d",
" ",
"over",
" ",
"tha",
"t",
" ",
"element",
"\\",
"10",
";",
"-",
" ",
"`",
"on",
"\\u",
"element",
"\\u",
"enter",
"`",
" ",
"and",
" ",
"`",
"on",
"\\u",
"element",
"\\u",
"lea",
"ve",
"`",
" ",
"are",
" ",
"generat",
"ed",
" ",
"for",
" ",
"all",
" ",
"element",
"s",
" ",
"up",
"\\",
"10",
";",
" ",
" ",
"the",
" ",
"active",
" ",
"element",
"'",
"s",
" ",
"branch",
" ",
"of",
" ",
"the",
" ",
"element",
" ",
"tree",
"\\",
"10",
";",
"-",
" ",
"in",
" ",
"all",
" ",
"other",
" ",
"case",
"s",
",",
" ",
"the",
" ",
"event",
" ",
"may",
" ",
"be",
" ",
"prop",
"oga",
"ted",
" ",
"(",
"see",
" ",
"`",
"event",
" ",
"prop",
"oga",
"tion",
"`\\u",
"\\",
"10",
";",
" ",
" ",
"belo",
"w",
")",
"\\",
"10",
";",
"\\",
"10",
";",
"\\",
"10",
";",
"Event",
" ",
"Prop",
"oga",
"tion",
"\\",
"10",
";",
"--------------",
"---",
"\\",
"10",
";",
"\\",
"10",
";",
"Event",
"s",
" ",
"are",
" ",
"automati",
"call",
"y",
" ",
"prop",
"oga",
"ted",
" ",
"up",
" ",
"to",
" ",
"element",
" ",
"parents",
" ",
"if",
" ",
"an",
" ",
"event",
"\\",
"10",
";",
"handler",
" ",
"eit",
"her",
" ",
"doe",
"s",
" ",
"not",
" ",
"exist",
" ",
"or",
" ",
"the",
" ",
"handler",
" ",
"return",
"s",
" ",
"`",
"EVENT",
"\\u",
"UN",
"HANDLE",
"D",
"`.",
"\\",
"10",
";",
"\\",
"10",
";",
"\\",
"10",
";",
"Key",
"board",
" ",
"Foc",
"usi",
"ng",
"\\",
"10",
";",
"--------------",
"---",
"\\",
"10",
";",
"\\",
"10",
";",
"Foc",
"us",
" ",
"events",
" ",
"include",
" ",
"the",
" ",
"source",
" ",
"of",
" ",
"the",
" ",
"foc",
"us",
" ",
"event",
":",
"\\",
"10",
";",
"\\",
"10",
";'",
"tab",
"'",
" ",
" ",
" ",
"--",
" ",
"tab",
"-",
"key",
" ",
"cycl",
"ing",
" ",
"through",
" ",
"is",
"\\u",
"foc",
"usable",
" ",
"element",
"s",
"\\",
"10",
";'",
"mouse",
"'",
" ",
"--",
" ",
"mouse",
" ",
"click",
" ",
"on",
" ",
"an",
" ",
"element",
"\\",
"10",
";'",
"code",
"'",
" ",
" ",
"--",
" ",
"code",
" ",
"call",
"ed",
" ",
"set",
"Foc",
"us",
"()",
" ",
"to",
" ",
"explicit",
"ly",
" ",
"foc",
"us",
" ",
"an",
" ",
"element",
"\\",
"10",
";",
"\\",
"10",
";",
"Element",
"s",
" ",
"marked",
" ",
"is",
"\\u",
"foc",
"usable",
"=",
"Tru",
"e",
" ",
"will",
" ",
"participa",
"te",
" ",
"in",
" ",
"tab",
"-",
"key",
" ",
"foc",
"us",
"\\",
"10",
";",
"movement",
".",
"\\",
"10",
";",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"inspect_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"pyglet_",
"._",
"event_",
"import_",
"(_",
"Event",
"Dispatcher_",
",_",
"EVENT",
"\\u",
"UN",
"HANDLE",
"D_",
",_",
"EVENT",
"\\u",
"HANDLE",
"D_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Event",
"Exception_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pyglet_",
"._",
"window_",
"import_",
"key_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"layout_",
"._",
"css_",
"import_",
"Rule_",
",_",
"Rule",
"Set_",
",_",
"Selector_",
",_",
"Simple",
"Selector_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"partial",
"ly",
" ",
"sna",
"rf",
"ed",
" ",
"from",
" ",
"layout",
".",
"gl",
".",
"event_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ins",
"tea",
"d",
" ",
"of",
" ",
"each",
" ",
"stack",
" ",
"layer",
" ",
"bei",
"ng",
" ",
"a",
" ",
"dictionar",
"y",
" ",
"mapping",
" ",
"event",
"-",
"name",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"event",
"-",
"function",
",",
" ",
"each",
" ",
"layer",
" ",
"is",
" ",
"a",
" ",
"dictionar",
"y",
" ",
"mapping",
" ",
"event",
"-",
"name",
" ",
"to",
" _",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Rule",
"Set_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"EVENTS",
" ",
"IN",
" ",
"and",
" ",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"mouse",
"\\u",
"moti",
"on",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"mouse",
"\\u",
"press",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"mouse",
"\\u",
"release",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"mouse",
"\\u",
"enter",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"mouse",
"\\u",
"lea",
"ve",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"mouse",
"\\u",
"drag",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"mouse",
"\\u",
"scroll",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"key",
"\\u",
"press",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"text",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"text",
"\\u",
"moti",
"on",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"text",
"\\u",
"moti",
"on",
"\\u",
"select",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"EVENTS",
" ",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"change",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"click",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"drag",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"drag",
"\\u",
"enter",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"drag",
"\\u",
"lea",
"ve",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"drag",
"\\u",
"complete",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"drop",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"element",
"\\u",
"enter",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"element",
"\\u",
"lea",
"ve",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"gain",
"\\u",
"foc",
"us",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"lose",
"\\u",
"foc",
"us",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"delete",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GU",
"IE",
"vent",
"Dispatcher_",
"._",
"register",
"\\u",
"event",
"\\u",
"type_",
"(_",
"'",
"on",
"\\u",
"eos",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | WGBH/django-versatileimagefield/versatileimagefield/utils.py | [
{
"content": "from __future__ import unicode_literals\n\nfrom functools import reduce\n\nimport os\n\nfrom django.core.exceptions import ImproperlyConfigured\n\nfrom .settings import (\n IMAGE_SETS,\n QUAL,\n VERSATILEIMAGEFIELD_POST_PROCESSOR,\n VERSATILEIMAGEFIELD_SIZED_DIRNAME,\n VERSATILEIMAGEFIELD_FILTERED_DIRNAME\n)\n\n# PIL-supported file formats as found here:\n# https://infohost.nmt.edu/tcc/help/pubs/pil/formats.html\n# (PIL Identifier, mime type)\nBMP = ('BMP', 'image/bmp')\nDCX = ('DCX', 'image/dcx')\nEPS = ('eps', 'image/eps')\nGIF = ('GIF', 'image/gif')\nJPEG = ('JPEG', 'image/jpeg')\nPCD = ('PCD', 'image/pcd')\nPCX = ('PCX', 'image/pcx')\nPDF = ('PDF', 'application/pdf')\nPNG = ('PNG', 'image/png')\nPPM = ('PPM', 'image/x-ppm')\nPSD = ('PSD', 'image/psd')\nTIFF = ('TIFF', 'image/tiff')\nXBM = ('XBM', 'image/x-xbitmap')\nXPM = ('XPM', 'image/x-xpm')\n\n# Mapping file extensions to PIL types/mime types\nFILE_EXTENSION_MAP = {\n 'png': PNG,\n 'jpe': JPEG,\n 'jpeg': JPEG,\n 'jpg': JPEG,\n 'gif': GIF,\n 'bmp': BMP,\n 'dib': BMP,\n 'dcx': DCX,\n 'eps': EPS,\n 'ps': EPS,\n 'pcd': PCD,\n 'pcx': PCX,\n 'pdf': PDF,\n 'pbm': PPM,\n 'pgm': PPM,\n 'ppm': PPM,\n 'psd': PSD,\n 'tif': TIFF,\n 'tiff': TIFF,\n 'xbm': XBM,\n 'xpm': XPM\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class InvalidSizeKeySet(Exception):\n pass",
"metadata": "root.InvalidSizeKeySet",
"header": "['module', '___EOS___']",
"index": 60
},
{
"content": "class InvalidSizeKey(Exception):\n pass",
"metadata": "root.InvalidSizeKey",
"header": "['module', '___EOS___']",
"index": 64
},
{
"content": "def post_process_image_key(image_key):\n \"\"\"Apply the processor function associated with settings.VER\"\"\"\n if VERSATILEIMAGEFIELD_POST_PROCESSOR is None:\n return image_key\n else:\n return VERSATILEIMAGEFIELD_POST_PROCESSOR(image_key)",
"metadata": "root.post_process_image_key",
"header": "['module', '___EOS___']",
"index": 68
},
{
"content": "def get_resized_filename(filename, width, height, filename_key):\n \"\"\"\n Return the 'resized filename' (according to `width`, `height` and\n `filename_key`) in the following format:\n `filename`-`filename_key`-`width`x`height`.ext\n \"\"\"\n try:\n image_name, ext = filename.rsplit('.', 1)\n except ValueError:\n image_name = filename\n ext = 'jpg'\n\n resized_template = \"%(filename_key)s-%(width)dx%(height)d\"\n if ext.lower() in ['jpg', 'jpeg']:\n resized_template = resized_template + \"-%(quality)d\"\n\n resized_key = resized_template % ({\n 'filename_key': filename_key,\n 'width': width,\n 'height': height,\n 'quality': QUAL\n })\n\n return \"%(image_name)s-%(image_key)s.%(ext)s\" % ({\n 'image_name': image_name,\n 'image_key': post_process_image_key(resized_key),\n 'ext': ext\n })",
"metadata": "root.get_resized_filename",
"header": "['module', '___EOS___']",
"index": 76
},
{
"content": "def get_resized_path(path_to_image, width, height,\n filename_key, storage):\n \"\"\"\n Return a 2-tuple to `path_to_image` location on `storage` (position 0)\n and it's web-accessible URL (position 1) as dictated by `width`, `height`\n and `filename_key`\n \"\"\"\n containing_folder, filename = os.path.split(path_to_image)\n\n resized_filename = get_resized_filename(\n filename,\n width,\n height,\n filename_key\n )\n\n joined_path = os.path.join(*[\n VERSATILEIMAGEFIELD_SIZED_DIRNAME,\n containing_folder,\n resized_filename\n ]).replace(' ', '') # Removing spaces so this path is memcached friendly\n\n return (\n joined_path,\n storage.url(joined_path)\n )",
"metadata": "root.get_resized_path",
"header": "['module', '___EOS___']",
"index": 106
},
{
"content": "def get_filtered_filename(filename, filename_key):\n \"\"\"\n Return the 'filtered filename' (according to `filename_key`)\n in the following format:\n `filename`__`filename_key`__.ext\n \"\"\"\n try:\n image_name, ext = filename.rsplit('.', 1)\n except ValueError:\n image_name = filename\n ext = 'jpg'\n return \"%(image_name)s__%(filename_key)s__.%(ext)s\" % ({\n 'image_name': image_name,\n 'filename_key': filename_key,\n 'ext': ext\n })",
"metadata": "root.get_filtered_filename",
"header": "['module', '___EOS___']",
"index": 134
},
{
"content": "def get_filtered_path(path_to_image, filename_key, storage):\n \"\"\"\n Return the 'filtered path' & URL of `path_to_image`\n \"\"\"\n containing_folder, filename = os.path.split(path_to_image)\n\n filtered_filename = get_filtered_filename(filename, filename_key)\n path_to_return = os.path.join(*[\n containing_folder,\n VERSATILEIMAGEFIELD_FILTERED_DIRNAME,\n filtered_filename\n ])\n # Removing spaces so this path is memcached key friendly\n path_to_return = path_to_return.replace(' ', '')\n return (\n path_to_return,\n storage.url(path_to_return)\n )",
"metadata": "root.get_filtered_path",
"header": "['module', '___EOS___']",
"index": 152
},
{
"content": "def get_image_metadata_from_file_ext(file_ext):\n \"\"\"\n Receive a valid image file format and returns a 2-tuple of two strings:\n [0]: Image format (i.e. 'jpg', 'gif' or 'png')\n [1]: InMemoryUploadedFile-friendly save format (i.e. 'image/jpeg')\n image_format, in_memory_file_type\n \"\"\"\n return FILE_EXTENSION_MAP.get(file_ext, JPEG)",
"metadata": "root.get_image_metadata_from_file_ext",
"header": "['module', '___EOS___']",
"index": 172
},
{
"content": "def validate_versatileimagefield_sizekey_list(sizes):\n \"\"\"\n Validate a list of size keys.\n\n `sizes`: An iterable of 2-tuples, both strings. Example:\n [\n ('large', 'url'),\n ('medium', 'crop__400x400'),\n ('small', 'thumbnail__100x100')\n ]\n \"\"\"\n try:\n for key, size_key in sizes:\n size_key_split = size_key.split('__')\n if size_key_split[-1] != 'url' and (\n 'x' not in size_key_split[-1]\n ):\n raise InvalidSizeKey(\n \"{0} is an invalid size. All sizes must be either \"\n \"'url' or made up of at least two segments separated \"\n \"by double underscores. Examples: 'crop__400x400', \"\n \"filters__invert__url\".format(size_key)\n )\n except ValueError:\n raise InvalidSizeKeySet(\n '{} is an invalid size key set. Size key sets must be an '\n 'iterable of 2-tuples'.format(str(sizes))\n )\n return list(set(sizes))",
"metadata": "root.validate_versatileimagefield_sizekey_list",
"header": "['module', '___EOS___']",
"index": 182
},
{
"content": "def get_url_from_image_key(image_instance, image_key):\n \"\"\"Build a URL from `image_key`.\"\"\"\n img_key_split = image_key.split('__')\n if 'x' in img_key_split[-1]:\n size_key = img_key_split.pop(-1)\n else:\n size_key = None\n img_url = reduce(getattr, img_key_split, image_instance)\n if size_key:\n img_url = img_url[size_key].url\n return img_url",
"metadata": "root.get_url_from_image_key",
"header": "['module', '___EOS___']",
"index": 213
},
{
"content": "def build_versatileimagefield_url_set(image_instance, size_set, request=None):\n \"\"\"\n Return a dictionary of urls corresponding to size_set\n - `image_instance`: A VersatileImageFieldFile\n - `size_set`: An iterable of 2-tuples, both strings. Example:\n [\n ('large', 'url'),\n ('medium', 'crop__400x400'),\n ('small', 'thumbnail__100x100')\n ]\n\n The above would lead to the following response:\n {\n 'large': 'http://some.url/image.jpg',\n 'medium': 'http://some.url/__sized__/image-crop-400x400.jpg',\n 'small': 'http://some.url/__sized__/image-thumbnail-100x100.jpg',\n }\n - `request`:\n \"\"\"\n size_set = validate_versatileimagefield_sizekey_list(size_set)\n to_return = {}\n if image_instance:\n for key, image_key in size_set:\n img_url = get_url_from_image_key(image_instance, image_key)\n if request is not None:\n img_url = request.build_absolute_uri(img_url)\n to_return[key] = img_url\n return to_return",
"metadata": "root.build_versatileimagefield_url_set",
"header": "['module', '___EOS___']",
"index": 226
},
{
"content": "def get_rendition_key_set(key):\n \"\"\"\n Retrieve a validated and prepped Rendition Key Set from\n settings.VERSATILEIMAGEFIELD_RENDITION_KEY_SETS\n \"\"\"\n try:\n rendition_key_set = IMAGE_SETS[key]\n except KeyError:\n raise ImproperlyConfigured(\n \"No Rendition Key Set exists at \"\n \"settings.VERSATILEIMAGEFIELD_RENDITION_KEY_SETS['{}']\".format(key)\n )\n else:\n return validate_versatileimagefield_sizekey_list(rendition_key_set)",
"metadata": "root.get_rendition_key_set",
"header": "['module', '___EOS___']",
"index": 256
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"functools_",
"import_",
"reduce_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"._",
"exceptions_",
"import_",
"Impro",
"perl",
"y",
"Configured_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"settings_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"IMA",
"GE",
"\\u",
"SET",
"S_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"QUAL",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"VER",
"SAT",
"ILE",
"IMA",
"GE",
"FIE",
"LD",
"\\u",
"POST",
"\\u",
"PROCESSOR",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"VER",
"SAT",
"ILE",
"IMA",
"GE",
"FIE",
"LD",
"\\u",
"SIZE",
"D",
"\\u",
"DIR",
"NAME_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"VER",
"SAT",
"ILE",
"IMA",
"GE",
"FIE",
"LD",
"\\u",
"FILTER",
"ED",
"\\u",
"DIR",
"NAME_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"PI",
"L",
"-",
"support",
"ed",
" ",
"file",
" ",
"formats",
" ",
"as",
" ",
"found",
" ",
"here",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"https",
"://",
"info",
"host",
".",
"nm",
"t",
".",
"edu",
"/",
"tc",
"c",
"/",
"help",
"/",
"pubs",
"/",
"pil",
"/",
"formats",
".",
"html_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"PI",
"L",
" ",
"Identifie",
"r",
",",
" ",
"mime",
" ",
"type",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"BM",
"P_",
"=_",
"(_",
"'",
"BM",
"P",
"'_",
",_",
"'",
"image",
"/",
"bm",
"p",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"DC",
"X_",
"=_",
"(_",
"'",
"DC",
"X",
"'_",
",_",
"'",
"image",
"/",
"dc",
"x",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"EPS",
"_",
"=_",
"(_",
"'",
"eps",
"'_",
",_",
"'",
"image",
"/",
"eps",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"GIF",
"_",
"=_",
"(_",
"'",
"GIF",
"'_",
",_",
"'",
"image",
"/",
"gif",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"JP",
"EG",
"_",
"=_",
"(_",
"'",
"JP",
"EG",
"'_",
",_",
"'",
"image",
"/",
"jpeg",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PC",
"D_",
"=_",
"(_",
"'",
"PC",
"D",
"'_",
",_",
"'",
"image",
"/",
"pc",
"d",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PC",
"X_",
"=_",
"(_",
"'",
"PC",
"X",
"'_",
",_",
"'",
"image",
"/",
"pc",
"x",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PDF_",
"=_",
"(_",
"'",
"PD",
"F",
"'_",
",_",
"'",
"applica",
"tion",
"/",
"pdf",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PNG",
"_",
"=_",
"(_",
"'",
"PNG",
"'_",
",_",
"'",
"image",
"/",
"png",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PP",
"M_",
"=_",
"(_",
"'",
"PP",
"M",
"'_",
",_",
"'",
"image",
"/",
"x",
"-",
"ppm",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PS",
"D_",
"=_",
"(_",
"'",
"PS",
"D",
"'_",
",_",
"'",
"image",
"/",
"psd",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"TIF",
"F_",
"=_",
"(_",
"'",
"TIF",
"F",
"'_",
",_",
"'",
"image",
"/",
"tiff",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"XB",
"M_",
"=_",
"(_",
"'",
"XB",
"M",
"'_",
",_",
"'",
"image",
"/",
"x",
"-",
"xb",
"itm",
"ap",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"XP",
"M_",
"=_",
"(_",
"'",
"XP",
"M",
"'_",
",_",
"'",
"image",
"/",
"x",
"-",
"xp",
"m",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Map",
"ping",
" ",
"file",
" ",
"extensi",
"ons",
" ",
"to",
" ",
"PI",
"L",
" ",
"types",
"/",
"mime",
" ",
"types_",
"\\u\\u\\uNL\\u\\u\\u_",
"FILE",
"\\u",
"EXTENSION",
"\\u",
"MAP_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"png",
"'_",
":_",
"PNG",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"jp",
"e",
"'_",
":_",
"JP",
"EG",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"jpeg",
"'_",
":_",
"JP",
"EG",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"jp",
"g",
"'_",
":_",
"JP",
"EG",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"gif",
"'_",
":_",
"GIF",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bm",
"p",
"'_",
":_",
"BM",
"P_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"di",
"b",
"'_",
":_",
"BM",
"P_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"dc",
"x",
"'_",
":_",
"DC",
"X_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"eps",
"'_",
":_",
"EPS",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ps",
"'_",
":_",
"EPS",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pc",
"d",
"'_",
":_",
"PC",
"D_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pc",
"x",
"'_",
":_",
"PC",
"X_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pdf",
"'_",
":_",
"PDF_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pbm",
"'_",
":_",
"PP",
"M_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pgm",
"'_",
":_",
"PP",
"M_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ppm",
"'_",
":_",
"PP",
"M_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"psd",
"'_",
":_",
"PS",
"D_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"tif",
"'_",
":_",
"TIF",
"F_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"tiff",
"'_",
":_",
"TIF",
"F_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"xb",
"m",
"'_",
":_",
"XB",
"M_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"xp",
"m",
"'_",
":_",
"XP",
"M_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
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\\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_",
"Inva",
"lid",
"Size",
"Key_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"post",
"\\u",
"process",
"\\u",
"image",
"\\u",
"key_",
"(_",
"image",
"\\u",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Apply",
" ",
"the",
" ",
"process",
"or",
" ",
"function",
" ",
"associate",
"d",
" ",
"with",
" ",
"settings",
".",
"VER",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"VER",
"SAT",
"ILE",
"IMA",
"GE",
"FIE",
"LD",
"\\u",
"POST",
"\\u",
"PROCESSOR",
"_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"image",
"\\u",
"key_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"VER",
"SAT",
"ILE",
"IMA",
"GE",
"FIE",
"LD",
"\\u",
"POST",
"\\u",
"PROCESSOR",
"_",
"(_",
"image",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"resized",
"\\u",
"filename_",
"(_",
"filename_",
",_",
"width_",
",_",
"height_",
",_",
"filename",
"\\u",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"the",
" ",
"'",
"resized",
" ",
"filename",
"'",
" ",
"(",
"according",
" ",
"to",
" ",
"`",
"widt",
"h",
"`",
",",
" ",
"`",
"height",
"`",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"`",
"filename",
"\\u",
"key",
"`)",
" ",
"in",
" ",
"the",
" ",
"follow",
"ing",
" ",
"format",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"`",
"filename",
"`-",
"`",
"filename",
"\\u",
"key",
"`-",
"`",
"widt",
"h",
"`",
"x",
"`",
"height",
"`.",
"ext",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"image",
"\\u",
"name_",
",_",
"ext_",
"=_",
"filename_",
"._",
"rsplit_",
"(_",
"'.'_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"image",
"\\u",
"name_",
"=_",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ext_",
"=_",
"'",
"jp",
"g",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"resized",
"\\u",
"template_",
"=_",
"\"%",
"(",
"filename",
"\\u",
"key",
")",
"s",
"-%",
"(",
"widt",
"h",
")",
"dx",
"%",
"(",
"height",
")",
"d",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"ext_",
"._",
"lower_",
"(_",
")_",
"in_",
"[_",
"'",
"jp",
"g",
"'_",
",_",
"'",
"jpeg",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"resized",
"\\u",
"template_",
"=_",
"resized",
"\\u",
"template_",
"+_",
"\"-",
"%",
"(",
"quali",
"ty",
")",
"d",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"resized",
"\\u",
"key_",
"=_",
"resized",
"\\u",
"template_",
"%_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"filename",
"\\u",
"key",
"'_",
":_",
"filename",
"\\u",
"key_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"widt",
"h",
"'_",
":_",
"width_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"height",
"'_",
":_",
"height_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"quali",
"ty",
"'_",
":_",
"QUAL",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"\"%",
"(",
"image",
"\\u",
"name",
")",
"s",
"-%",
"(",
"image",
"\\u",
"key",
")",
"s",
".",
"%",
"(",
"ext",
")",
"s",
"\"_",
"%_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"image",
"\\u",
"name",
"'_",
":_",
"image",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"image",
"\\u",
"key",
"'_",
":_",
"post",
"\\u",
"process",
"\\u",
"image",
"\\u",
"key_",
"(_",
"resized",
"\\u",
"key_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ext",
"'_",
":_",
"ext_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"resized",
"\\u",
"path_",
"(_",
"path",
"\\u",
"to",
"\\u",
"image_",
",_",
"width_",
",_",
"height_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"filename",
"\\u",
"key_",
",_",
"storage_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"a",
" ",
"2",
"-",
"tuple",
" ",
"to",
" ",
"`",
"path",
"\\u",
"to",
"\\u",
"image",
"`",
" ",
"location",
" ",
"on",
" ",
"`",
"storage",
"`",
" ",
"(",
"position",
" ",
"0",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"it",
"'",
"s",
" ",
"web",
"-",
"accessible",
" ",
"URL",
" ",
"(",
"position",
" ",
"1",
")",
" ",
"as",
" ",
"dict",
"ated",
" ",
"by",
" ",
"`",
"widt",
"h",
"`",
",",
" ",
"`",
"height",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"`",
"filename",
"\\u",
"key",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"contain",
"ing",
"\\u",
"folder_",
",_",
"filename_",
"=_",
"os_",
"._",
"path_",
"._",
"split_",
"(_",
"path",
"\\u",
"to",
"\\u",
"image_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"resized",
"\\u",
"filename_",
"=_",
"get",
"\\u",
"resized",
"\\u",
"filename_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"filename_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"width_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"height_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"filename",
"\\u",
"key_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"joine",
"d\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"*_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"VER",
"SAT",
"ILE",
"IMA",
"GE",
"FIE",
"LD",
"\\u",
"SIZE",
"D",
"\\u",
"DIR",
"NAME_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"contain",
"ing",
"\\u",
"folder_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"resized",
"\\u",
"filename_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"._",
"replace_",
"(_",
"'",
" ",
"'_",
",_",
"''_",
")_",
"#",
" ",
"Remo",
"ving",
" ",
"space",
"s",
" ",
"so",
" ",
"this",
" ",
"path",
" ",
"is",
" ",
"memcached",
" ",
"frie",
"ndl",
"y_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"joine",
"d\\u",
"path_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"storage_",
"._",
"url_",
"(_",
"joine",
"d\\u",
"path_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"filter",
"ed",
"\\u",
"filename_",
"(_",
"filename_",
",_",
"filename",
"\\u",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"the",
" ",
"'",
"filter",
"ed",
" ",
"filename",
"'",
" ",
"(",
"according",
" ",
"to",
" ",
"`",
"filename",
"\\u",
"key",
"`)",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"in",
" ",
"the",
" ",
"follow",
"ing",
" ",
"format",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"`",
"filename",
"`\\u",
"\\u`",
"filename",
"\\u",
"key",
"`\\u",
"\\u.",
"ext",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"image",
"\\u",
"name_",
",_",
"ext_",
"=_",
"filename_",
"._",
"rsplit_",
"(_",
"'.'_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"image",
"\\u",
"name_",
"=_",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ext_",
"=_",
"'",
"jp",
"g",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\"%",
"(",
"image",
"\\u",
"name",
")",
"s",
"\\u\\u",
"%",
"(",
"filename",
"\\u",
"key",
")",
"s",
"\\u\\u",
".",
"%",
"(",
"ext",
")",
"s",
"\"_",
"%_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"image",
"\\u",
"name",
"'_",
":_",
"image",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"filename",
"\\u",
"key",
"'_",
":_",
"filename",
"\\u",
"key_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ext",
"'_",
":_",
"ext_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"filter",
"ed",
"\\u",
"path_",
"(_",
"path",
"\\u",
"to",
"\\u",
"image_",
",_",
"filename",
"\\u",
"key_",
",_",
"storage_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"the",
" ",
"'",
"filter",
"ed",
" ",
"path",
"'",
" ",
"&",
" ",
"URL",
" ",
"of",
" ",
"`",
"path",
"\\u",
"to",
"\\u",
"image",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"contain",
"ing",
"\\u",
"folder_",
",_",
"filename_",
"=_",
"os_",
"._",
"path_",
"._",
"split_",
"(_",
"path",
"\\u",
"to",
"\\u",
"image_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"filter",
"ed",
"\\u",
"filename_",
"=_",
"get",
"\\u",
"filter",
"ed",
"\\u",
"filename_",
"(_",
"filename_",
",_",
"filename",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"path",
"\\u",
"to",
"\\u",
"return_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"*_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"contain",
"ing",
"\\u",
"folder_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"VER",
"SAT",
"ILE",
"IMA",
"GE",
"FIE",
"LD",
"\\u",
"FILTER",
"ED",
"\\u",
"DIR",
"NAME_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"filter",
"ed",
"\\u",
"filename_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Remo",
"ving",
" ",
"space",
"s",
" ",
"so",
" ",
"this",
" ",
"path",
" ",
"is",
" ",
"memcached",
" ",
"key",
" ",
"frie",
"ndl",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"path",
"\\u",
"to",
"\\u",
"return_",
"=_",
"path",
"\\u",
"to",
"\\u",
"return_",
"._",
"replace_",
"(_",
"'",
" ",
"'_",
",_",
"''_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"path",
"\\u",
"to",
"\\u",
"return_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"storage_",
"._",
"url_",
"(_",
"path",
"\\u",
"to",
"\\u",
"return_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"image",
"\\u",
"metadata",
"\\u",
"from",
"\\u",
"file",
"\\u",
"ext_",
"(_",
"file",
"\\u",
"ext_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Receive",
" ",
"a",
" ",
"valid",
" ",
"image",
" ",
"file",
" ",
"format",
" ",
"and",
" ",
"return",
"s",
" ",
"a",
" ",
"2",
"-",
"tuple",
" ",
"of",
" ",
"two",
" ",
"string",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"[",
"0",
"]:",
" ",
"Image",
" ",
"format",
" ",
"(",
"i",
".",
"e",
".",
" ",
"'",
"jp",
"g",
"',",
" ",
"'",
"gif",
"'",
" ",
"or",
" ",
"'",
"png",
"')",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"[",
"1",
"]:",
" ",
"In",
"Memo",
"ry",
"Upload",
"ed",
"File",
"-",
"frie",
"ndl",
"y",
" ",
"save",
" ",
"format",
" ",
"(",
"i",
".",
"e",
".",
" ",
"'",
"image",
"/",
"jpeg",
"')",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"image",
"\\u",
"format",
",",
" ",
"in",
"\\u",
"memory",
"\\u",
"file",
"\\u",
"type",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"FILE",
"\\u",
"EXTENSION",
"\\u",
"MAP_",
"._",
"get_",
"(_",
"file",
"\\u",
"ext_",
",_",
"JP",
"EG",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"validat",
"e\\u",
"versa",
"tile",
"imagef",
"iel",
"d\\u",
"size",
"key",
"\\u",
"list_",
"(_",
"sizes_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Validate",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"size",
" ",
"keys",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"`",
"size",
"s",
"`",
":",
" ",
"An",
" ",
"iterable",
" ",
"of",
" ",
"2",
"-",
"tuple",
"s",
",",
" ",
"bot",
"h",
" ",
"string",
"s",
".",
" ",
"Exam",
"ple",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"[",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"('",
"large",
"',",
" ",
"'",
"url",
"')",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"('",
"medium",
"',",
" ",
"'",
"crop",
"\\u\\u",
"400",
"x4",
"00",
"')",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"('",
"small",
"',",
" ",
"'",
"thumbnail",
"\\u\\u",
"100",
"x1",
"00",
"')",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"]",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"key_",
",_",
"size",
"\\u",
"key_",
"in_",
"sizes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"size",
"\\u",
"key",
"\\u",
"split_",
"=_",
"size",
"\\u",
"key_",
"._",
"split_",
"(_",
"'\\u\\u'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"size",
"\\u",
"key",
"\\u",
"split_",
"[_",
"-_",
"1_",
"]_",
"!=_",
"'",
"url",
"'_",
"and_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"x",
"'_",
"not_",
"in_",
"size",
"\\u",
"key",
"\\u",
"split_",
"[_",
"-_",
"1_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Inva",
"lid",
"Size",
"Key_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"{",
"0",
"}",
" ",
"is",
" ",
"an",
" ",
"invalid",
" ",
"size",
".",
" ",
"All",
" ",
"size",
"s",
" ",
"must",
" ",
"be",
" ",
"eit",
"her",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"'",
"url",
"'",
" ",
"or",
" ",
"made",
" ",
"up",
" ",
"of",
" ",
"at",
" ",
"leas",
"t",
" ",
"two",
" ",
"segments",
" ",
"separate",
"d",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"by",
" ",
"double",
" ",
"underscore",
"s",
".",
" ",
"Exam",
"ples",
":",
" ",
"'",
"crop",
"\\u\\u",
"400",
"x4",
"00",
"',",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"filter",
"s",
"\\u\\u",
"invert",
"\\u\\u",
"url",
"\"_",
"._",
"format_",
"(_",
"size",
"\\u",
"key_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Inva",
"lid",
"Size",
"Key",
"Set_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'{}",
" ",
"is",
" ",
"an",
" ",
"invalid",
" ",
"size",
" ",
"key",
" ",
"set",
".",
" ",
"Size",
" ",
"key",
" ",
"sets",
" ",
"must",
" ",
"be",
" ",
"an",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"iterable",
" ",
"of",
" ",
"2",
"-",
"tuple",
"s",
"'_",
"._",
"format_",
"(_",
"str_",
"(_",
"sizes_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"list_",
"(_",
"set_",
"(_",
"sizes_",
")_",
")_",
"\\u\\u\\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",
"url",
"\\u",
"from",
"\\u",
"image",
"\\u",
"key_",
"(_",
"image",
"\\u",
"instance_",
",_",
"image",
"\\u",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Build",
" ",
"a",
" ",
"URL",
" ",
"from",
" ",
"`",
"image",
"\\u",
"key",
"`.\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"img",
"\\u",
"key",
"\\u",
"split_",
"=_",
"image",
"\\u",
"key_",
"._",
"split_",
"(_",
"'\\u\\u'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"'",
"x",
"'_",
"in_",
"img",
"\\u",
"key",
"\\u",
"split_",
"[_",
"-_",
"1_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"size",
"\\u",
"key_",
"=_",
"img",
"\\u",
"key",
"\\u",
"split_",
"._",
"pop_",
"(_",
"-_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"size",
"\\u",
"key_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"img",
"\\u",
"url_",
"=_",
"reduce_",
"(_",
"getattr_",
",_",
"img",
"\\u",
"key",
"\\u",
"split_",
",_",
"image",
"\\u",
"instance_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"size",
"\\u",
"key_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"img",
"\\u",
"url_",
"=_",
"img",
"\\u",
"url_",
"[_",
"size",
"\\u",
"key_",
"]_",
"._",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"img",
"\\u",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"build",
"\\u",
"versa",
"tile",
"imagef",
"iel",
"d\\u",
"url",
"\\u",
"set_",
"(_",
"image",
"\\u",
"instance_",
",_",
"size",
"\\u",
"set_",
",_",
"request_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"a",
" ",
"dictionar",
"y",
" ",
"of",
" ",
"urls",
" ",
"correspond",
"ing",
" ",
"to",
" ",
"size",
"\\u",
"set",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"`",
"image",
"\\u",
"instance",
"`",
":",
" ",
"A",
" ",
"Vers",
"ati",
"le",
"Image",
"Field",
"File",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"`",
"size",
"\\u",
"set",
"`",
":",
" ",
"An",
" ",
"iterable",
" ",
"of",
" ",
"2",
"-",
"tuple",
"s",
",",
" ",
"bot",
"h",
" ",
"string",
"s",
".",
" ",
"Exam",
"ple",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"[",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"('",
"large",
"',",
" ",
"'",
"url",
"')",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"('",
"medium",
"',",
" ",
"'",
"crop",
"\\u\\u",
"400",
"x4",
"00",
"')",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"('",
"small",
"',",
" ",
"'",
"thumbnail",
"\\u\\u",
"100",
"x1",
"00",
"')",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"]",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"above",
" ",
"wou",
"ld",
" ",
"lead",
" ",
"to",
" ",
"the",
" ",
"follow",
"ing",
" ",
"response",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"{",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"large",
"':",
" ",
"'",
"http",
"://",
"some",
".",
"url",
"/",
"image",
".",
"jp",
"g",
"',",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"medium",
"':",
" ",
"'",
"http",
"://",
"some",
".",
"url",
"/\\u",
"\\u",
"sized",
"\\u\\u",
"/",
"image",
"-",
"crop",
"-",
"400",
"x4",
"00",
".",
"jp",
"g",
"',",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"small",
"':",
" ",
"'",
"http",
"://",
"some",
".",
"url",
"/\\u",
"\\u",
"sized",
"\\u\\u",
"/",
"image",
"-",
"thumbnail",
"-1",
"00",
"x1",
"00",
".",
"jp",
"g",
"',",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"`",
"request",
"`",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"size",
"\\u",
"set_",
"=_",
"validat",
"e\\u",
"versa",
"tile",
"imagef",
"iel",
"d\\u",
"size",
"key",
"\\u",
"list_",
"(_",
"size",
"\\u",
"set_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"to",
"\\u",
"return_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"image",
"\\u",
"instance_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"key_",
",_",
"image",
"\\u",
"key_",
"in_",
"size",
"\\u",
"set_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"img",
"\\u",
"url_",
"=_",
"get",
"\\u",
"url",
"\\u",
"from",
"\\u",
"image",
"\\u",
"key_",
"(_",
"image",
"\\u",
"instance_",
",_",
"image",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"request_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"img",
"\\u",
"url_",
"=_",
"request_",
"._",
"build",
"\\u",
"abs",
"olute",
"\\u",
"uri_",
"(_",
"img",
"\\u",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"to",
"\\u",
"return_",
"[_",
"key_",
"]_",
"=_",
"img",
"\\u",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"to",
"\\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_",
"def_",
"get",
"\\u",
"rend",
"ition",
"\\u",
"key",
"\\u",
"set_",
"(_",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Retrieve",
" ",
"a",
" ",
"validat",
"ed",
" ",
"and",
" ",
"prep",
"ped",
" ",
"Ren",
"dition",
" ",
"Key",
" ",
"Set",
" ",
"from",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"settings",
".",
"VER",
"SAT",
"ILE",
"IMA",
"GE",
"FIE",
"LD",
"\\u",
"REN",
"DI",
"TIO",
"N",
"\\u",
"KEY",
"\\u",
"SET",
"S",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rend",
"ition",
"\\u",
"key",
"\\u",
"set_",
"=_",
"IMA",
"GE",
"\\u",
"SET",
"S_",
"[_",
"key_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Key",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Impro",
"perl",
"y",
"Configured_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"No",
" ",
"Ren",
"dition",
" ",
"Key",
" ",
"Set",
" ",
"exist",
"s",
" ",
"at",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"settings",
".",
"VER",
"SAT",
"ILE",
"IMA",
"GE",
"FIE",
"LD",
"\\u",
"REN",
"DI",
"TIO",
"N",
"\\u",
"KEY",
"\\u",
"SET",
"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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | ImageEngine/gaffer/python/GafferUI/NumericWidget.py | [
{
"content": "\tdef valueChangedSignal( self ) :\n\n\t\ttry :\n\t\t\treturn self.__valueChangedSignal\n\t\texcept AttributeError :\n\t\t\tself.__valueChangedSignal = Gaffer.Signal2()\n\n\t\treturn self.__valueChangedSignal",
"metadata": "root.NumericWidget.valueChangedSignal",
"header": "['class', 'NumericWidget', '(', 'GafferUI', '.', 'TextWidget', ')', ':', '___EOS___']",
"index": 80
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Numer",
"ic",
"Widget_",
"(_",
"Ga",
"ffer",
"UI_",
"._",
"Text",
"Widget_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"value",
"Change",
"d",
"Signal_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"return_",
"self_",
"._",
"\\u\\u",
"value",
"Change",
"d",
"Signal_",
"\\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\t",
"\t\t_",
"self_",
"._",
"\\u\\u",
"value",
"Change",
"d",
"Signal_",
"=_",
"Ga",
"ffer",
"_",
"._",
"Signal",
"2_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u\\u",
"value",
"Change",
"d",
"Signal_",
"\\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
] |
Unused import | jgorset/fandjango/setup.py | [
{
"content": "#!/usr/bin/env python\n\nfrom setuptools import setup\n\nexecfile('fandjango/version.py')\n\nreadme = open('README.rst').read()\nhistory = open('HISTORY.rst').read()\n\nsetup(\n name = 'fandjango',\n version = __version__,\n description = \"Fandjango makes it stupidly easy to create Facebook applications with Django.\",\n long_description = readme + '\\n\\n' + history,\n author = \"Johannes Gorset\",\n author_email = \"[email protected]\",\n url = \"http://github.com/jgorset/fandjango\",\n packages = [\n 'fandjango',\n 'fandjango.migrations',\n 'fandjango.templatetags'\n ],\n package_data = {\n 'fandjango': [\n 'templates/fandjango/*',\n 'locale/no_NB/LC_MESSAGES/*'\n ]\n },\n install_requires = [\n 'facepy >= 0.8',\n 'requests >= 0.8'\n ],\n classifiers = [\n 'Development Status :: 5 - Production/Stable',\n 'Intended Audience :: Developers',\n 'Natural Language :: English',\n 'License :: OSI Approved :: MIT License',\n 'Programming Language :: Python',\n 'Programming Language :: Python :: 2.6',\n 'Programming Language :: Python :: 2.7'\n ]\n)\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_",
"from_",
"setuptools_",
"import_",
"setup_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"execfile",
"_",
"(_",
"'",
"fan",
"django",
"/",
"version",
".",
"py",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"readme_",
"=_",
"open_",
"(_",
"'",
"READ",
"ME",
".",
"rst",
"'_",
")_",
"._",
"read_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"history_",
"=_",
"open_",
"(_",
"'",
"HISTORY",
".",
"rst",
"'_",
")_",
"._",
"read_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"setup_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"fan",
"django",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"version_",
"=_",
"\\u\\u",
"version\\u\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"\"",
"Fan",
"django",
" ",
"make",
"s",
" ",
"it",
" ",
"stu",
"pid",
"ly",
" ",
"easy",
" ",
"to",
" ",
"create",
" ",
"Face",
"book",
" ",
"applica",
"tion",
"s",
" ",
"with",
" ",
"Dj",
"ang",
"o",
".\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"long",
"\\u",
"description_",
"=_",
"readme_",
"+_",
"'\\\\",
"n",
"\\\\",
"n",
"'_",
"+_",
"history_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"author_",
"=_",
"\"",
"Joh",
"anne",
"s",
" ",
"Go",
"rse",
"t",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"author",
"\\u",
"email_",
"=_",
"\"",
"jg",
"ors",
"et",
"@",
"gma",
"il",
".",
"com",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"=_",
"\"",
"http",
"://",
"git",
"hub",
".",
"com",
"/",
"jg",
"ors",
"et",
"/",
"fan",
"django",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"packages_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fan",
"django",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fan",
"django",
".",
"migrati",
"ons",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fan",
"django",
".",
"templatet",
"ags",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"package",
"\\u",
"data_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fan",
"django",
"'_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"template",
"s",
"/",
"fan",
"django",
"/*'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"locale",
"/",
"no",
"\\u",
"NB",
"/",
"LC",
"\\u",
"MESSAGE",
"S",
"/*'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"install",
"\\u",
"requires_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"face",
"py",
" ",
">=",
" ",
"0.",
"8",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"request",
"s",
" ",
">=",
" ",
"0.",
"8",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"classifiers_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Dev",
"elo",
"pme",
"nt",
" ",
"Status",
" ",
"::",
" ",
"5",
" ",
"-",
" ",
"Product",
"ion",
"/",
"Sta",
"ble",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Inten",
"ded",
" ",
"Audi",
"ence",
" ",
"::",
" ",
"Dev",
"elope",
"rs",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Nat",
"ural",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Eng",
"lish",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"License",
" ",
"::",
" ",
"OSI",
" ",
"Appro",
"ved",
" ",
"::",
" ",
"MIT",
" ",
"License",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",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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
] |
Unused local variable | JT5D/Alfred-Popclip-Sublime/Sublime Text 2/Default/transform.py | [
{
"content": "class LowerCaseCommand(Transformer):\n transformer = string.lower,",
"metadata": "root.LowerCaseCommand",
"header": "['module', '___EOS___']",
"index": 22
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Lower",
"Case",
"Command_",
"(_",
"Transformer_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"transformer_",
"=_",
"string_",
"._",
"lower_",
",_",
"\\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
] |
Unreachable code | truemped/dopplr/vows/solr/dismax_vows.py | [
{
"content": "@Vows.batch\nclass WithTheDisMax(Vows.Context):\n\n class WithDefaultParams(Vows.Context):\n\n def topic(self):\n q = DisMax('title^2 body^1', edismax=False)\n return q.get_params()\n\n def theDefTypeMustMatch(self, topic):\n expect(topic).to_include(('defType', 'dismax'))\n\n def theQueryFieldsMatch(self, topic):\n expect(topic).to_include(('qf', 'title^2 body^1'))\n\n def noUnexpectedArgs(self, topic):\n expect(topic).to_length(2)\n\n class WithOptionalParameters(WithDefaultParams):\n\n def topic(self):\n valid_params = [\n 'alt',\n 'mm',\n 'pf',\n 'ps',\n 'qs',\n 'tie',\n 'bq',\n 'bf'\n ]\n\n for v in valid_params:\n kwargs = {v: 'a'}\n q = DisMax('title^2 body^1', edismax=False, **kwargs)\n yield (v, q.get_params())\n\n def theDefTypeMustMatch(self, (field, params)):\n expect(params).to_include(('defType', 'dismax'))\n\n def theQueryFieldsMatch(self, (field, params)):\n expect(params).to_include(('qf', 'title^2 body^1'))\n\n def noUnexpectedArgs(self, (field, params)):\n expect(params).to_length(3)\n\n def theQueryMustMatch(self, (field, params)):\n if field == 'alt':\n field = 'q.alt'\n expect(params).to_include((field, 'a'))",
"metadata": "root.WithTheDisMax",
"header": "['module', '___EOS___']",
"index": 23
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"Vo",
"ws_",
"._",
"batch_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"class_",
"With",
"The",
"Dis",
"Max_",
"(_",
"Vo",
"ws_",
"._",
"Context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"class_",
"With",
"Default",
"Params_",
"(_",
"Vo",
"ws_",
"._",
"Context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"topic_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"q_",
"=_",
"Dis",
"Max_",
"(_",
"'",
"title",
"^",
"2",
" ",
"body",
"^",
"1",
"'_",
",_",
"edi",
"sma",
"x_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"q_",
"._",
"get",
"\\u",
"params_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"the",
"Def",
"Type",
"Mus",
"t",
"Match_",
"(_",
"self_",
",_",
"topic_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expect_",
"(_",
"topic_",
")_",
"._",
"to",
"\\u",
"include_",
"(_",
"(_",
"'",
"def",
"Type",
"'_",
",_",
"'",
"dis",
"max",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"the",
"Query",
"Field",
"s",
"Match_",
"(_",
"self_",
",_",
"topic_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expect_",
"(_",
"topic_",
")_",
"._",
"to",
"\\u",
"include_",
"(_",
"(_",
"'",
"qf",
"'_",
",_",
"'",
"title",
"^",
"2",
" ",
"body",
"^",
"1",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"no",
"Une",
"xpe",
"cte",
"d",
"Args_",
"(_",
"self_",
",_",
"topic_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expect_",
"(_",
"topic_",
")_",
"._",
"to",
"\\u",
"length_",
"(_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"With",
"Optio",
"nal",
"Parameters_",
"(_",
"With",
"Default",
"Params_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"topic_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"valid",
"\\u",
"params_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"alt",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"mm",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pf",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ps",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"qs",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"tie",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bq",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bf",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"v_",
"in_",
"valid",
"\\u",
"params_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"kwargs_",
"=_",
"{_",
"v_",
":_",
"'",
"a",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"q_",
"=_",
"Dis",
"Max_",
"(_",
"'",
"title",
"^",
"2",
" ",
"body",
"^",
"1",
"'_",
",_",
"edi",
"sma",
"x_",
"=_",
"False_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yield_",
"(_",
"v_",
",_",
"q_",
"._",
"get",
"\\u",
"params_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"the",
"Def",
"Type",
"Mus",
"t",
"Match_",
"(_",
"self_",
",_",
"(_",
"field_",
",_",
"params_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expect_",
"(_",
"params_",
")_",
"._",
"to",
"\\u",
"include_",
"(_",
"(_",
"'",
"def",
"Type",
"'_",
",_",
"'",
"dis",
"max",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"the",
"Query",
"Field",
"s",
"Match_",
"(_",
"self_",
",_",
"(_",
"field_",
",_",
"params_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expect_",
"(_",
"params_",
")_",
"._",
"to",
"\\u",
"include_",
"(_",
"(_",
"'",
"qf",
"'_",
",_",
"'",
"title",
"^",
"2",
" ",
"body",
"^",
"1",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"no",
"Une",
"xpe",
"cte",
"d",
"Args_",
"(_",
"self_",
",_",
"(_",
"field_",
",_",
"params_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expect_",
"(_",
"params_",
")_",
"._",
"to",
"\\u",
"length_",
"(_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"the",
"Query",
"Mus",
"t",
"Match_",
"(_",
"self_",
",_",
"(_",
"field_",
",_",
"params_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"field_",
"==_",
"'",
"alt",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"field_",
"=_",
"'",
"q",
".",
"alt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"expect_",
"(_",
"params_",
")_",
"._",
"to",
"\\u",
"include_",
"(_",
"(_",
"field_",
",_",
"'",
"a",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused local variable | open-cloud/xos/xos/core/models/billing.py | [
{
"content": "class Charge(PlCoreBase):\n KIND_CHOICES = (('besteffort', 'besteffort'), ('reservation', 'reservation'), ('monthlyfee', 'monthlyfee'))\n STATE_CHOICES = (('pending', 'pending'), ('invoiced', 'invoiced'))\n\n account = models.ForeignKey(Account, related_name=\"charges\")\n slice = models.ForeignKey(Slice, related_name=\"charges\", null=True, blank=True)\n kind = StrippedCharField(max_length=30, choices=KIND_CHOICES, default=\"besteffort\")\n state = StrippedCharField(max_length=30, choices=STATE_CHOICES, default=\"pending\")\n date = models.DateTimeField()\n object = models.ForeignKey(UsableObject)\n amount = models.FloatField(default=0.0)\n coreHours = models.FloatField(default=0.0)\n invoice = models.ForeignKey(Invoice, blank=True, null=True, related_name=\"charges\")\n",
"metadata": "root.Charge",
"header": "['module', '___EOS___']",
"index": 59
}
] | [] | [] | 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_",
"class_",
"Charge",
"_",
"(_",
"Pl",
"Core",
"Base_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"KIND",
"\\u",
"CHOICES_",
"=_",
"(_",
"(_",
"'",
"best",
"effort",
"'_",
",_",
"'",
"best",
"effort",
"'_",
")_",
",_",
"(_",
"'",
"reserva",
"tion",
"'_",
",_",
"'",
"reserva",
"tion",
"'_",
")_",
",_",
"(_",
"'",
"month",
"ly",
"fe",
"e",
"'_",
",_",
"'",
"month",
"ly",
"fe",
"e",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"STATE",
"\\u",
"CHOICES_",
"=_",
"(_",
"(_",
"'",
"pend",
"ing",
"'_",
",_",
"'",
"pend",
"ing",
"'_",
")_",
",_",
"(_",
"'",
"invoic",
"ed",
"'_",
",_",
"'",
"invoic",
"ed",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"account_",
"=_",
"models_",
"._",
"Fore",
"ign",
"Key_",
"(_",
"Account_",
",_",
"relate",
"d\\u",
"name_",
"=_",
"\"",
"charge",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"slice_",
"=_",
"models_",
"._",
"Fore",
"ign",
"Key_",
"(_",
"Slice_",
",_",
"relate",
"d\\u",
"name_",
"=_",
"\"",
"charge",
"s",
"\"_",
",_",
"null_",
"=_",
"True_",
",_",
"blank_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kind_",
"=_",
"Strip",
"ped",
"Char",
"Field_",
"(_",
"max",
"\\u",
"length_",
"=_",
"30_",
",_",
"choices_",
"=_",
"KIND",
"\\u",
"CHOICES_",
",_",
"default_",
"=_",
"\"",
"best",
"effort",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"state_",
"=_",
"Strip",
"ped",
"Char",
"Field_",
"(_",
"max",
"\\u",
"length_",
"=_",
"30_",
",_",
"choices_",
"=_",
"STATE",
"\\u",
"CHOICES_",
",_",
"default_",
"=_",
"\"",
"pend",
"ing",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"date_",
"=_",
"models_",
"._",
"Date",
"Time",
"Field_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"object_",
"=_",
"models_",
"._",
"Fore",
"ign",
"Key_",
"(_",
"Us",
"able",
"Object_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"amount_",
"=_",
"models_",
"._",
"Float",
"Field_",
"(_",
"default_",
"=_",
"0.0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"core",
"Hour",
"s_",
"=_",
"models_",
"._",
"Float",
"Field_",
"(_",
"default_",
"=_",
"0.0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"invoice_",
"=_",
"models_",
"._",
"Fore",
"ign",
"Key_",
"(_",
"Invoice",
"_",
",_",
"blank_",
"=_",
"True_",
",_",
"null_",
"=_",
"True_",
",_",
"relate",
"d\\u",
"name_",
"=_",
"\"",
"charge",
"s",
"\"_",
")_",
"\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | enthought/comtypes/comtypes/automation.py | [
{
"content": "class IDispatch(IUnknown):\n _iid_ = GUID(\"{00020400-0000-0000-C000-000000000046}\")\n _methods_ = [\n COMMETHOD([], HRESULT, 'GetTypeInfoCount',\n (['out'], POINTER(UINT) ) ),\n COMMETHOD([], HRESULT, 'GetTypeInfo',\n (['in'], UINT, 'index'),\n (['in'], LCID, 'lcid', 0),\n## Normally, we would declare this parameter in this way:\n## (['out'], POINTER(POINTER(ITypeInfo)) ) ),\n## but we cannot import comtypes.typeinfo at the top level (recursive imports!).\n (['out'], POINTER(POINTER(IUnknown)) ) ),\n STDMETHOD(HRESULT, 'GetIDsOfNames', [POINTER(IID), POINTER(c_wchar_p),\n UINT, LCID, POINTER(DISPID)]),\n STDMETHOD(HRESULT, 'Invoke', [DISPID, POINTER(IID), LCID, WORD,\n POINTER(DISPPARAMS), POINTER(VARIANT),\n POINTER(EXCEPINFO), POINTER(UINT)]),\n ]\n\n\n\n\n\n # XXX Would separate methods for _METHOD, _PROPERTYGET and _PROPERTYPUT be better?",
"metadata": "root.IDispatch",
"header": "['module', '___EOS___']",
"index": 676
}
] | [] | [] | 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_",
"ID",
"isp",
"atch_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"iid",
"\\u_",
"=_",
"GUID",
"_",
"(_",
"\"{",
"0002",
"0400",
"-0",
"000",
"-0",
"000",
"-",
"C0",
"00",
"-0",
"000000000",
"4",
"6",
"}\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"method",
"s\\u_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Get",
"Type",
"Info",
"Count",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"UINT_",
")_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Get",
"Type",
"Info",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"in",
"'_",
"]_",
",_",
"UINT_",
",_",
"'",
"index",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"in",
"'_",
"]_",
",_",
"LC",
"ID_",
",_",
"'",
"lc",
"id",
"'_",
",_",
"0_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Normal",
"ly",
",",
" ",
"we",
" ",
"wou",
"ld",
" ",
"declar",
"e",
" ",
"this",
" ",
"parameter",
" ",
"in",
" ",
"this",
" ",
"way",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
" ",
" ",
" ",
" ",
" ",
"([",
"'",
"out",
"']",
",",
" ",
"POINTER",
"(",
"POINTER",
"(",
"IT",
"ype",
"Info",
"))",
" ",
")",
" ",
"),",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"but",
" ",
"we",
" ",
"cann",
"ot",
" ",
"import",
" ",
"com",
"types",
".",
"type",
"info",
" ",
"at",
" ",
"the",
" ",
"top",
" ",
"level",
" ",
"(",
"recurs",
"ive",
" ",
"import",
"s",
"!)",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"POINTER_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
")_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"STD",
"METHOD_",
"(_",
"HRESULT_",
",_",
"'",
"Get",
"ID",
"s",
"Of",
"Names",
"'_",
",_",
"[_",
"POINTER_",
"(_",
"II",
"D_",
")_",
",_",
"POINTER_",
"(_",
"c\\u",
"wchar",
"\\u",
"p_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"UINT_",
",_",
"LC",
"ID_",
",_",
"POINTER_",
"(_",
"DISP",
"ID_",
")_",
"]_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"STD",
"METHOD_",
"(_",
"HRESULT_",
",_",
"'",
"Invok",
"e",
"'_",
",_",
"[_",
"DISP",
"ID_",
",_",
"POINTER_",
"(_",
"II",
"D_",
")_",
",_",
"LC",
"ID_",
",_",
"WORD_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"POINTER_",
"(_",
"DISP",
"PARAMS_",
")_",
",_",
"POINTER_",
"(_",
"VARIAN",
"T_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"POINTER_",
"(_",
"EXCE",
"PIN",
"FO",
"_",
")_",
",_",
"POINTER_",
"(_",
"UINT_",
")_",
"]_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | andrewgodwin/channels/channels/staticfiles.py | [
{
"content": " def get_response(self, request):\n from django.http import Http404\n\n if self._should_handle(request.path):\n try:\n return self.serve(request)\n except Http404 as e:\n if settings.DEBUG:\n from django.views import debug\n return debug.technical_404_response(request, e)\n return super(StaticFilesHandler, self).get_response(request)",
"metadata": "root.StaticFilesHandler.get_response",
"header": "['class', 'StaticFilesHandler', '(', 'AsgiHandler', ')', ':', '___EOS___']",
"index": 46
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Static",
"Files",
"Handler_",
"(_",
"As",
"gi",
"Handler_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"response_",
"(_",
"self_",
",_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"django_",
"._",
"http_",
"import_",
"Http404_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"shou",
"ld",
"\\u",
"handle_",
"(_",
"request_",
"._",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"serve_",
"(_",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Http404_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"settings_",
"._",
"DEBUG_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"from_",
"django_",
"._",
"views_",
"import_",
"debug_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"debug_",
"._",
"technical",
"\\u",
"404",
"\\u",
"response_",
"(_",
"request_",
",_",
"e_",
")_",
"\\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_",
"super_",
"(_",
"Static",
"Files",
"Handler_",
",_",
"self_",
")_",
"._",
"get",
"\\u",
"response_",
"(_",
"request_",
")_",
"\\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
] |
Unused import | django/django/tests/model_fields/test_durationfield.py | [
{
"content": "import datetime\nimport json\n\nfrom django import forms\nfrom django.core import exceptions, serializers\nfrom django.db import models\nfrom django.test import SimpleTestCase, TestCase\n\nfrom .models import DurationModel, NullDurationModel\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TestSaveLoad(TestCase):\n\n\n",
"metadata": "root.TestSaveLoad",
"header": "['module', '___EOS___']",
"index": 11
},
{
"content": " def test_simple_roundtrip(self):\n duration = datetime.timedelta(days=123, seconds=123, microseconds=123)\n DurationModel.objects.create(field=duration)\n loaded = DurationModel.objects.get()\n self.assertEqual(loaded.field, duration)",
"metadata": "root.TestSaveLoad.test_simple_roundtrip",
"header": "['class', 'TestSaveLoad', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 13
},
{
"content": " def test_create_empty(self):\n NullDurationModel.objects.create()\n loaded = NullDurationModel.objects.get()\n self.assertEqual(loaded.field, None)",
"metadata": "root.TestSaveLoad.test_create_empty",
"header": "['class', 'TestSaveLoad', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 19
},
{
"content": " def test_fractional_seconds(self):\n value = datetime.timedelta(seconds=2.05)\n d = DurationModel.objects.create(field=value)\n d.refresh_from_db()\n self.assertEqual(d.field, value)",
"metadata": "root.TestSaveLoad.test_fractional_seconds",
"header": "['class', 'TestSaveLoad', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 24
},
{
"content": "class TestQuerying(TestCase):\n\n\n",
"metadata": "root.TestQuerying",
"header": "['module', '___EOS___']",
"index": 31
},
{
"content": " @classmethod\n def setUpTestData(cls):\n cls.objs = [\n DurationModel.objects.create(field=datetime.timedelta(days=1)),\n DurationModel.objects.create(field=datetime.timedelta(seconds=1)),\n DurationModel.objects.create(field=datetime.timedelta(seconds=-1)),\n ]",
"metadata": "root.TestQuerying.setUpTestData",
"header": "['class', 'TestQuerying', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 33
},
{
"content": " def test_exact(self):\n self.assertSequenceEqual(\n DurationModel.objects.filter(field=datetime.timedelta(days=1)),\n [self.objs[0]]\n )",
"metadata": "root.TestQuerying.test_exact",
"header": "['class', 'TestQuerying', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 41
},
{
"content": " def test_gt(self):\n self.assertSequenceEqual(\n DurationModel.objects.filter(field__gt=datetime.timedelta(days=0)),\n [self.objs[0], self.objs[1]]\n )",
"metadata": "root.TestQuerying.test_gt",
"header": "['class', 'TestQuerying', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 47
},
{
"content": "class TestSerialization(SimpleTestCase):\n test_data = '[{\"fields\": {\"field\": \"1 01:00:00\"}, \"model\": \"model_fields.durationmodel\", \"pk\": null}]'\n\n",
"metadata": "root.TestSerialization",
"header": "['module', '___EOS___']",
"index": 54
},
{
"content": " def test_dumping(self):\n instance = DurationModel(field=datetime.timedelta(days=1, hours=1))\n data = serializers.serialize('json', [instance])\n self.assertEqual(json.loads(data), json.loads(self.test_data))",
"metadata": "root.TestSerialization.test_dumping",
"header": "['class', 'TestSerialization', '(', 'SimpleTestCase', ')', ':', '___EOS___']",
"index": 57
},
{
"content": " def test_loading(self):\n instance = list(serializers.deserialize('json', self.test_data))[0].object\n self.assertEqual(instance.field, datetime.timedelta(days=1, hours=1))",
"metadata": "root.TestSerialization.test_loading",
"header": "['class', 'TestSerialization', '(', 'SimpleTestCase', ')', ':', '___EOS___']",
"index": 62
},
{
"content": "class TestValidation(SimpleTestCase):\n",
"metadata": "root.TestValidation",
"header": "['module', '___EOS___']",
"index": 67
},
{
"content": " def test_invalid_string(self):\n field = models.DurationField()\n with self.assertRaises(exceptions.ValidationError) as cm:\n field.clean('not a datetime', None)\n self.assertEqual(cm.exception.code, 'invalid')\n self.assertEqual(\n cm.exception.message % cm.exception.params,\n \"'not a datetime' value has an invalid format. \"\n \"It must be in [DD] [HH:[MM:]]ss[.uuuuuu] format.\"\n )",
"metadata": "root.TestValidation.test_invalid_string",
"header": "['class', 'TestValidation', '(', 'SimpleTestCase', ')', ':', '___EOS___']",
"index": 69
},
{
"content": "class TestFormField(SimpleTestCase):\n # Tests for forms.DurationField are in the forms_tests app.\n",
"metadata": "root.TestFormField",
"header": "['module', '___EOS___']",
"index": 81
},
{
"content": " def test_formfield(self):\n field = models.DurationField()\n self.assertIsInstance(field.formfield(), forms.DurationField)",
"metadata": "root.TestFormField.test_formfield",
"header": "['class', 'TestFormField', '(', 'SimpleTestCase', ')', ':', '___NEWLINE___', '# Tests for forms.DurationField are in the forms_tests app.', '___NL___', '___EOS___']",
"index": 84
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"json_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"import_",
"forms_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"import_",
"exceptions_",
",_",
"serializers_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"models_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"test_",
"import_",
"Simple",
"Test",
"Case_",
",_",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"models_",
"import_",
"Dur",
"ation",
"Model_",
",_",
"Null",
"Dur",
"ation",
"Model_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Test",
"Save",
"Load_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Save",
"Load_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"simple",
"\\u",
"roundtrip",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"duration_",
"=_",
"datetime_",
"._",
"timedelta_",
"(_",
"days_",
"=_",
"123_",
",_",
"seconds_",
"=_",
"123_",
",_",
"microseconds_",
"=_",
"123_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Dur",
"ation",
"Model_",
"._",
"objects_",
"._",
"create_",
"(_",
"field_",
"=_",
"duration_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"loaded_",
"=_",
"Dur",
"ation",
"Model_",
"._",
"objects_",
"._",
"get_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"loaded_",
"._",
"field_",
",_",
"duration_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Save",
"Load_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"create",
"\\u",
"empty_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Null",
"Dur",
"ation",
"Model_",
"._",
"objects_",
"._",
"create_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"loaded_",
"=_",
"Null",
"Dur",
"ation",
"Model_",
"._",
"objects_",
"._",
"get_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"loaded_",
"._",
"field_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Save",
"Load_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"fractional",
"\\u",
"seconds_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"datetime_",
"._",
"timedelta_",
"(_",
"seconds_",
"=_",
"2.0",
"5_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"=_",
"Dur",
"ation",
"Model_",
"._",
"objects_",
"._",
"create_",
"(_",
"field_",
"=_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"._",
"refre",
"sh",
"\\u",
"from",
"\\u",
"db_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"d_",
"._",
"field_",
",_",
"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_",
"Test",
"Query",
"ing_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Query",
"ing_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"set",
"Up",
"Test",
"Data_",
"(_",
"cls_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cls_",
"._",
"objs_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"Dur",
"ation",
"Model_",
"._",
"objects_",
"._",
"create_",
"(_",
"field_",
"=_",
"datetime_",
"._",
"timedelta_",
"(_",
"days_",
"=_",
"1_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Dur",
"ation",
"Model_",
"._",
"objects_",
"._",
"create_",
"(_",
"field_",
"=_",
"datetime_",
"._",
"timedelta_",
"(_",
"seconds_",
"=_",
"1_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Dur",
"ation",
"Model_",
"._",
"objects_",
"._",
"create_",
"(_",
"field_",
"=_",
"datetime_",
"._",
"timedelta_",
"(_",
"seconds_",
"=_",
"-_",
"1_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Query",
"ing_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"exact_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Sequ",
"ence",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Dur",
"ation",
"Model_",
"._",
"objects_",
"._",
"filter_",
"(_",
"field_",
"=_",
"datetime_",
"._",
"timedelta_",
"(_",
"days_",
"=_",
"1_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"self_",
"._",
"objs_",
"[_",
"0_",
"]_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Query",
"ing_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"gt_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Sequ",
"ence",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Dur",
"ation",
"Model_",
"._",
"objects_",
"._",
"filter_",
"(_",
"field",
"\\u\\u",
"gt_",
"=_",
"datetime_",
"._",
"timedelta_",
"(_",
"days_",
"=_",
"0_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"self_",
"._",
"objs_",
"[_",
"0_",
"]_",
",_",
"self_",
"._",
"objs_",
"[_",
"1_",
"]_",
"]_",
"\\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_",
"Test",
"Serializa",
"tion_",
"(_",
"Simple",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"test\\u",
"data_",
"=_",
"'[{",
"\"",
"fields",
"\":",
" ",
"{",
"\"",
"field",
"\":",
" ",
"\"",
"1",
" ",
"01",
":",
"00",
":",
"00",
"\"},",
" ",
"\"",
"model",
"\":",
" ",
"\"",
"model",
"\\u",
"fields",
".",
"duration",
"model",
"\",",
" ",
"\"",
"pk",
"\":",
" ",
"null",
"}]'_",
"\\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",
"Serializa",
"tion_",
"(_",
"Simple",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"test\\u",
"dump",
"ing_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"instance_",
"=_",
"Dur",
"ation",
"Model_",
"(_",
"field_",
"=_",
"datetime_",
"._",
"timedelta_",
"(_",
"days_",
"=_",
"1_",
",_",
"hours_",
"=_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"serializers_",
"._",
"serialize_",
"(_",
"'",
"json",
"'_",
",_",
"[_",
"instance_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"json_",
"._",
"loads_",
"(_",
"data_",
")_",
",_",
"json_",
"._",
"loads_",
"(_",
"self_",
"._",
"test\\u",
"data_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Serializa",
"tion_",
"(_",
"Simple",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"loading_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"instance_",
"=_",
"list_",
"(_",
"serializers_",
"._",
"deserialize_",
"(_",
"'",
"json",
"'_",
",_",
"self_",
"._",
"test\\u",
"data_",
")_",
")_",
"[_",
"0_",
"]_",
"._",
"object_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"instance_",
"._",
"field_",
",_",
"datetime_",
"._",
"timedelta_",
"(_",
"days_",
"=_",
"1_",
",_",
"hours_",
"=_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Test",
"Validation_",
"(_",
"Simple",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Validation_",
"(_",
"Simple",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"invalid",
"\\u",
"string_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"field_",
"=_",
"models_",
"._",
"Dur",
"ation",
"Field_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"exceptions_",
"._",
"Validat",
"ion",
"Error_",
")_",
"as_",
"cm_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"field_",
"._",
"clean_",
"(_",
"'",
"not",
" ",
"a",
" ",
"datetime",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"cm_",
"._",
"exception_",
"._",
"code_",
",_",
"'",
"invalid",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"cm_",
"._",
"exception_",
"._",
"message_",
"%_",
"cm_",
"._",
"exception_",
"._",
"params_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"'",
"not",
" ",
"a",
" ",
"datetime",
"'",
" ",
"value",
" ",
"has",
" ",
"an",
" ",
"invalid",
" ",
"format",
".",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"It",
" ",
"must",
" ",
"be",
" ",
"in",
" ",
"[",
"DD",
"]",
" ",
"[",
"HH",
":[",
"MM",
":]",
"]",
"ss",
"[.",
"uu",
"uu",
"uu",
"]",
" ",
"format",
".\"_",
"\\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_",
"Test",
"Form",
"Field_",
"(_",
"Simple",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Test",
"s",
" ",
"for",
" ",
"forms",
".",
"Dur",
"ation",
"Field",
" ",
"are",
" ",
"in",
" ",
"the",
" ",
"forms",
"\\u",
"tests",
" ",
"app",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Form",
"Field_",
"(_",
"Simple",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Test",
"s",
" ",
"for",
" ",
"forms",
".",
"Dur",
"ation",
"Field",
" ",
"are",
" ",
"in",
" ",
"the",
" ",
"forms",
"\\u",
"tests",
" ",
"app",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"formfi",
"eld_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"field_",
"=_",
"models_",
"._",
"Dur",
"ation",
"Field_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Instance_",
"(_",
"field_",
"._",
"formfi",
"eld_",
"(_",
")_",
",_",
"forms_",
"._",
"Dur",
"ation",
"Field_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused import | monkeylearn/monkeylearn-python/monkeylearn/exceptions.py | [
{
"content": "# -*- coding: utf-8 -*-\nfrom __future__ import (\n print_function, unicode_literals, division, absolute_import)\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class MonkeyLearnException(Exception):",
"metadata": "root.MonkeyLearnException",
"header": "['module', '___EOS___']",
"index": 5
},
{
"content": " def __init__(self, detail):\n super(Exception, self).__init__(\n 'Error: ' + detail\n )",
"metadata": "root.MonkeyLearnException.__init__",
"header": "['class', 'MonkeyLearnException', '(', 'Exception', ')', ':', '___EOS___']",
"index": 6
}
] | [] | [] | 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_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"print",
"\\u",
"function_",
",_",
"unicode",
"\\u",
"literals_",
",_",
"division_",
",_",
"abs",
"olute",
"\\u",
"import_",
")_",
"\\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_",
"Mon",
"key",
"Learn",
"Exception_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Mon",
"key",
"Learn",
"Exception_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"detail_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Exception_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Error",
":",
" ",
"'_",
"+_",
"detail_",
"\\u\\u\\uNL\\u\\u\\u_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused import | Axelrod-Python/Axelrod/axelrod/strategies/retaliate.py | [
{
"content": "from collections import defaultdict\n\nfrom axelrod import Actions, Player, init_args\n\nC, D = Actions.C, Actions.D\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Retaliate(Player):\n \"\"\"\n A player starts by cooperating but will retaliate once the opponent\n has won more than 10 percent times the number of defections the player has.\n \"\"\"\n classifier = {\n 'memory_depth': float('inf'), # Long memory\n 'stochastic': False,\n 'inspects_source': False,\n 'makes_use_of': set(),\n 'manipulates_source': False,\n 'manipulates_state': False\n }\n\n\n",
"metadata": "root.Retaliate",
"header": "['module', '___EOS___']",
"index": 7
},
{
"content": " @init_args\n def __init__(self, retaliation_threshold=0.1):\n \"\"\"\n Uses the basic init from the Player class, but also set the name to\n include the retaliation setting.\n \"\"\"\n Player.__init__(self)\n self.retaliation_threshold = retaliation_threshold\n self.name = (\n 'Retaliate (' +\n str(self.retaliation_threshold) + ')')\n self.play_counts = defaultdict(int)",
"metadata": "root.Retaliate.__init__",
"header": "['class', 'Retaliate', '(', 'Player', ')', ':', '___EOS___']",
"index": 21
},
{
"content": " def strategy(self, opponent):\n \"\"\"\n If the opponent has played D to my C more often than x% of the time\n that I've done the same to him, play D. Otherwise, play C.\n \"\"\"\n\n if len(self.history):\n last_round = (self.history[-1], opponent.history[-1])\n self.play_counts[last_round] += 1\n CD_count = self.play_counts[(C, D)]\n DC_count = self.play_counts[(D, C)]\n if CD_count > DC_count * self.retaliation_threshold:\n return D\n return C",
"metadata": "root.Retaliate.strategy",
"header": "['class', 'Retaliate', '(', 'Player', ')', ':', '___EOS___']",
"index": 34
},
{
"content": " def reset(self):\n Player.reset(self)\n self.play_counts = defaultdict(int)",
"metadata": "root.Retaliate.reset",
"header": "['class', 'Retaliate', '(', 'Player', ')', ':', '___EOS___']",
"index": 49
},
{
"content": "class Retaliate2(Retaliate):\n \"\"\"\n Retaliate player with a threshold of 8 percent.\n \"\"\"\n",
"metadata": "root.Retaliate2",
"header": "['module', '___EOS___']",
"index": 53
},
{
"content": " def __init__(self, retaliation_threshold=0.08):\n super(Retaliate2, self).__init__(\n retaliation_threshold=retaliation_threshold)",
"metadata": "root.Retaliate2.__init__",
"header": "['class', 'Retaliate2', '(', 'Retaliate', ')', ':', '___EOS___']",
"index": 58
},
{
"content": "class Retaliate3(Retaliate):\n \"\"\"\n Retaliate player with a threshold of 5 percent.\n \"\"\"\n",
"metadata": "root.Retaliate3",
"header": "['module', '___EOS___']",
"index": 63
},
{
"content": " def __init__(self, retaliation_threshold=0.05):\n super(Retaliate3, self).__init__(\n retaliation_threshold=retaliation_threshold)",
"metadata": "root.Retaliate3.__init__",
"header": "['class', 'Retaliate3', '(', 'Retaliate', ')', ':', '___EOS___']",
"index": 68
},
{
"content": "class LimitedRetaliate(Player):\n \"\"\"\n A player that co-operates unless the opponent defects and wins.\n It will then retaliate by defecting. It stops when either, it has beaten\n the opponent 10 times more often that it has lost or it reaches the\n retaliation limit (20 defections).\n \"\"\"\n\n classifier = {\n 'memory_depth': float('inf'), # Long memory\n 'stochastic': False,\n 'makes_use_of': set(),\n 'inspects_source': False,\n 'manipulates_source': False,\n 'manipulates_state': False\n }\n\n\n",
"metadata": "root.LimitedRetaliate",
"header": "['module', '___EOS___']",
"index": 73
},
{
"content": " @init_args\n def __init__(self, retaliation_threshold=0.1, retaliation_limit=20):\n \"\"\"\n Parameters\n ----------\n retaliation_threshold, float\n The threshold of the difference in defections, previous rounds of\n (C, D) versus (D, C)\n retaliation_limit, int\n The maximum number of retaliations until the strategy returns to\n cooperation\n \"\"\"\n Player.__init__(self)\n self.retaliating = False\n self.retaliation_count = 0\n self.retaliation_threshold = retaliation_threshold\n self.retaliation_limit = retaliation_limit\n self.play_counts = defaultdict(int)\n self.init_args = (retaliation_threshold, retaliation_limit)\n\n self.name = (\n 'Limited Retaliate (' +\n str(self.retaliation_threshold) +\n '/' + str(self.retaliation_limit) + ')')",
"metadata": "root.LimitedRetaliate.__init__",
"header": "['class', 'LimitedRetaliate', '(', 'Player', ')', ':', '___EOS___']",
"index": 90
},
{
"content": " def strategy(self, opponent):\n \"\"\"\n If the opponent has played D to my C more often than x% of the time\n that I've done the same to him, retaliate by playing D but stop doing\n so once I've hit the retaliation limit.\n \"\"\"\n\n if len(self.history):\n last_round = (self.history[-1], opponent.history[-1])\n self.play_counts[last_round] += 1\n CD_count = self.play_counts[(C, D)]\n DC_count = self.play_counts[(D, C)]\n if CD_count > DC_count * self.retaliation_threshold:\n self.retaliating = True\n else:\n self.retaliating = False\n self.retaliation_count = 0\n\n if self.retaliating:\n if self.retaliation_count < self.retaliation_limit:\n self.retaliation_count += 1\n return D\n else:\n self.retaliation_count = 0\n self.retaliating = False\n\n return C",
"metadata": "root.LimitedRetaliate.strategy",
"header": "['class', 'LimitedRetaliate', '(', 'Player', ')', ':', '___EOS___']",
"index": 115
},
{
"content": " def reset(self):\n Player.reset(self)\n self.play_counts = defaultdict(int)\n self.retaliating = False\n self.retaliation_count = 0",
"metadata": "root.LimitedRetaliate.reset",
"header": "['class', 'LimitedRetaliate', '(', 'Player', ')', ':', '___EOS___']",
"index": 143
},
{
"content": "class LimitedRetaliate2(LimitedRetaliate):\n \"\"\"\n LimitedRetaliate player with a threshold of 8 percent and a\n retaliation limit of 15.\n \"\"\"\n",
"metadata": "root.LimitedRetaliate2",
"header": "['module', '___EOS___']",
"index": 150
},
{
"content": " def __init__(self, retaliation_threshold=0.08, retaliation_limit=15):\n super(LimitedRetaliate2, self).__init__(\n retaliation_threshold=retaliation_threshold,\n retaliation_limit=retaliation_limit)",
"metadata": "root.LimitedRetaliate2.__init__",
"header": "['class', 'LimitedRetaliate2', '(', 'LimitedRetaliate', ')', ':', '___EOS___']",
"index": 156
},
{
"content": "class LimitedRetaliate3(LimitedRetaliate):\n \"\"\"\n LimitedRetaliate player with a threshold of 5 percent and a\n retaliation limit of 20.\n \"\"\"\n",
"metadata": "root.LimitedRetaliate3",
"header": "['module', '___EOS___']",
"index": 162
},
{
"content": " def __init__(self, retaliation_threshold=0.05, retaliation_limit=20):\n super(LimitedRetaliate3, self).__init__(\n retaliation_threshold=retaliation_threshold,\n retaliation_limit=retaliation_limit)",
"metadata": "root.LimitedRetaliate3.__init__",
"header": "['class', 'LimitedRetaliate3', '(', 'LimitedRetaliate', ')', ':', '___EOS___']",
"index": 168
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"collections_",
"import_",
"defaultdict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"axe",
"lro",
"d_",
"import_",
"Actions_",
",_",
"Player_",
",_",
"init",
"\\u",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"C_",
",_",
"D_",
"=_",
"Actions_",
"._",
"C_",
",_",
"Actions_",
"._",
"D_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"Ret",
"ali",
"ate_",
"(_",
"Player_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"player",
" ",
"starts",
" ",
"by",
" ",
"coop",
"erat",
"ing",
" ",
"but",
" ",
"will",
" ",
"reta",
"liat",
"e",
" ",
"onc",
"e",
" ",
"the",
" ",
"opponent",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"has",
" ",
"won",
" ",
"more",
" ",
"than",
" ",
"10",
" ",
"percent",
" ",
"times",
" ",
"the",
" ",
"number",
" ",
"of",
" ",
"defect",
"ion",
"s",
" ",
"the",
" ",
"player",
" ",
"has",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"classifier_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"memory",
"\\u",
"depth",
"'_",
":_",
"float_",
"(_",
"'",
"inf",
"'_",
")_",
",_",
"#",
" ",
"Long",
" ",
"memory_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"stochastic",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"inspect",
"s",
"\\u",
"source",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"make",
"s",
"\\u",
"use",
"\\u",
"of",
"'_",
":_",
"set_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"manipulate",
"s",
"\\u",
"source",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"manipulate",
"s",
"\\u",
"state",
"'_",
":_",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Ret",
"ali",
"ate_",
"(_",
"Player_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"init",
"\\u",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"0.1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Us",
"es",
" ",
"the",
" ",
"basic",
" ",
"init",
" ",
"from",
" ",
"the",
" ",
"Player",
" ",
"class",
",",
" ",
"but",
" ",
"als",
"o",
" ",
"set",
" ",
"the",
" ",
"name",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"include",
" ",
"the",
" ",
"reta",
"liat",
"ion",
" ",
"setti",
"ng",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Player_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"name_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Ret",
"ali",
"ate",
" ",
"('_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"str_",
"(_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
")_",
"+_",
"')'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"play",
"\\u",
"counts_",
"=_",
"defaultdict_",
"(_",
"int_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Ret",
"ali",
"ate_",
"(_",
"Player_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"strategy_",
"(_",
"self_",
",_",
"opponent",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"opponent",
" ",
"has",
" ",
"played",
" ",
"D",
" ",
"to",
" ",
"my",
" ",
"C",
" ",
"more",
" ",
"oft",
"en",
" ",
"than",
" ",
"x",
"%",
" ",
"of",
" ",
"the",
" ",
"time",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"tha",
"t",
" ",
"I",
"'",
"ve",
" ",
"don",
"e",
" ",
"the",
" ",
"same",
" ",
"to",
" ",
"him",
",",
" ",
"play",
" ",
"D",
".",
" ",
"Ot",
"her",
"wis",
"e",
",",
" ",
"play",
" ",
"C",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"self_",
"._",
"history_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"last",
"\\u",
"round_",
"=_",
"(_",
"self_",
"._",
"history_",
"[_",
"-_",
"1_",
"]_",
",_",
"opponent",
"_",
"._",
"history_",
"[_",
"-_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"play",
"\\u",
"counts_",
"[_",
"last",
"\\u",
"round_",
"]_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"CD",
"\\u",
"count_",
"=_",
"self_",
"._",
"play",
"\\u",
"counts_",
"[_",
"(_",
"C_",
",_",
"D_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"DC",
"\\u",
"count_",
"=_",
"self_",
"._",
"play",
"\\u",
"counts_",
"[_",
"(_",
"D_",
",_",
"C_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"CD",
"\\u",
"count_",
">_",
"DC",
"\\u",
"count_",
"*_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"D_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"C_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Ret",
"ali",
"ate_",
"(_",
"Player_",
")_",
":_",
"\\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 ",
" _",
"Player_",
"._",
"reset_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"play",
"\\u",
"counts_",
"=_",
"defaultdict_",
"(_",
"int_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Ret",
"ali",
"ate",
"2_",
"(_",
"Ret",
"ali",
"ate_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ret",
"ali",
"ate",
" ",
"player",
" ",
"with",
" ",
"a",
" ",
"threshol",
"d",
" ",
"of",
" ",
"8",
" ",
"percent",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Ret",
"ali",
"ate",
"2_",
"(_",
"Ret",
"ali",
"ate_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"0.08_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Ret",
"ali",
"ate",
"2_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
")_",
"\\u\\u\\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_",
"Ret",
"ali",
"ate",
"3_",
"(_",
"Ret",
"ali",
"ate_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ret",
"ali",
"ate",
" ",
"player",
" ",
"with",
" ",
"a",
" ",
"threshol",
"d",
" ",
"of",
" ",
"5",
" ",
"percent",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Ret",
"ali",
"ate",
"3_",
"(_",
"Ret",
"ali",
"ate_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"0.05_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Ret",
"ali",
"ate",
"3_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
")_",
"\\u\\u\\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_",
"Limit",
"ed",
"Ret",
"ali",
"ate_",
"(_",
"Player_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"player",
" ",
"tha",
"t",
" ",
"co",
"-",
"operate",
"s",
" ",
"unl",
"ess",
" ",
"the",
" ",
"opponent",
" ",
"defect",
"s",
" ",
"and",
" ",
"wins",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"It",
" ",
"will",
" ",
"then",
" ",
"reta",
"liat",
"e",
" ",
"by",
" ",
"defect",
"ing",
".",
" ",
"It",
" ",
"stop",
"s",
" ",
"whe",
"n",
" ",
"eit",
"her",
",",
" ",
"it",
" ",
"has",
" ",
"beat",
"en",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"opponent",
" ",
"10",
" ",
"times",
" ",
"more",
" ",
"oft",
"en",
" ",
"tha",
"t",
" ",
"it",
" ",
"has",
" ",
"lost",
" ",
"or",
" ",
"it",
" ",
"reache",
"s",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"reta",
"liat",
"ion",
" ",
"limit",
" ",
"(",
"20",
" ",
"defect",
"ion",
"s",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"classifier_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"memory",
"\\u",
"depth",
"'_",
":_",
"float_",
"(_",
"'",
"inf",
"'_",
")_",
",_",
"#",
" ",
"Long",
" ",
"memory_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"stochastic",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"make",
"s",
"\\u",
"use",
"\\u",
"of",
"'_",
":_",
"set_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"inspect",
"s",
"\\u",
"source",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"manipulate",
"s",
"\\u",
"source",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"manipulate",
"s",
"\\u",
"state",
"'_",
":_",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Limit",
"ed",
"Ret",
"ali",
"ate_",
"(_",
"Player_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"init",
"\\u",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"0.1_",
",_",
"reta",
"liat",
"ion",
"\\u",
"limit_",
"=_",
"20_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"reta",
"liat",
"ion",
"\\u",
"threshol",
"d",
",",
" ",
"float",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"threshol",
"d",
" ",
"of",
" ",
"the",
" ",
"difference",
" ",
"in",
" ",
"defect",
"ion",
"s",
",",
" ",
"previ",
"ous",
" ",
"round",
"s",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(",
"C",
",",
" ",
"D",
")",
" ",
"vers",
"us",
" ",
"(",
"D",
",",
" ",
"C",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"reta",
"liat",
"ion",
"\\u",
"limit",
",",
" ",
"int",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"maxim",
"um",
" ",
"number",
" ",
"of",
" ",
"reta",
"liat",
"ion",
"s",
" ",
"unti",
"l",
" ",
"the",
" ",
"strat",
"eg",
"y",
" ",
"return",
"s",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"coop",
"eratio",
"n",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Player_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"reta",
"liat",
"ing_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"count_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"limit_",
"=_",
"reta",
"liat",
"ion",
"\\u",
"limit_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"play",
"\\u",
"counts_",
"=_",
"defaultdict_",
"(_",
"int_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"init",
"\\u",
"args_",
"=_",
"(_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
",_",
"reta",
"liat",
"ion",
"\\u",
"limit_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"name_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Limit",
"ed",
" ",
"Ret",
"ali",
"ate",
" ",
"('_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"str_",
"(_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
")_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'/'_",
"+_",
"str_",
"(_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"limit_",
")_",
"+_",
"')'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Limit",
"ed",
"Ret",
"ali",
"ate_",
"(_",
"Player_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"strategy_",
"(_",
"self_",
",_",
"opponent",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"opponent",
" ",
"has",
" ",
"played",
" ",
"D",
" ",
"to",
" ",
"my",
" ",
"C",
" ",
"more",
" ",
"oft",
"en",
" ",
"than",
" ",
"x",
"%",
" ",
"of",
" ",
"the",
" ",
"time",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"tha",
"t",
" ",
"I",
"'",
"ve",
" ",
"don",
"e",
" ",
"the",
" ",
"same",
" ",
"to",
" ",
"him",
",",
" ",
"reta",
"liat",
"e",
" ",
"by",
" ",
"play",
"ing",
" ",
"D",
" ",
"but",
" ",
"stop",
" ",
"doi",
"ng",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"so",
" ",
"onc",
"e",
" ",
"I",
"'",
"ve",
" ",
"hit",
" ",
"the",
" ",
"reta",
"liat",
"ion",
" ",
"limit",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"self_",
"._",
"history_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"last",
"\\u",
"round_",
"=_",
"(_",
"self_",
"._",
"history_",
"[_",
"-_",
"1_",
"]_",
",_",
"opponent",
"_",
"._",
"history_",
"[_",
"-_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"play",
"\\u",
"counts_",
"[_",
"last",
"\\u",
"round_",
"]_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"CD",
"\\u",
"count_",
"=_",
"self_",
"._",
"play",
"\\u",
"counts_",
"[_",
"(_",
"C_",
",_",
"D_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"DC",
"\\u",
"count_",
"=_",
"self_",
"._",
"play",
"\\u",
"counts_",
"[_",
"(_",
"D_",
",_",
"C_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"CD",
"\\u",
"count_",
">_",
"DC",
"\\u",
"count_",
"*_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"reta",
"liat",
"ing_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"reta",
"liat",
"ing_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"count_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"reta",
"liat",
"ing_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"count_",
"<_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"limit_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"count_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"D_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"count_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"reta",
"liat",
"ing_",
"=_",
"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_",
"return_",
"C_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Limit",
"ed",
"Ret",
"ali",
"ate_",
"(_",
"Player_",
")_",
":_",
"\\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 ",
" _",
"Player_",
"._",
"reset_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"play",
"\\u",
"counts_",
"=_",
"defaultdict_",
"(_",
"int_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"reta",
"liat",
"ing_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"reta",
"liat",
"ion",
"\\u",
"count_",
"=_",
"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_",
"Limit",
"ed",
"Ret",
"ali",
"ate",
"2_",
"(_",
"Limit",
"ed",
"Ret",
"ali",
"ate_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Limit",
"ed",
"Ret",
"ali",
"ate",
" ",
"player",
" ",
"with",
" ",
"a",
" ",
"threshol",
"d",
" ",
"of",
" ",
"8",
" ",
"percent",
" ",
"and",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"reta",
"liat",
"ion",
" ",
"limit",
" ",
"of",
" ",
"15.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Limit",
"ed",
"Ret",
"ali",
"ate",
"2_",
"(_",
"Limit",
"ed",
"Ret",
"ali",
"ate_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"0.08_",
",_",
"reta",
"liat",
"ion",
"\\u",
"limit_",
"=_",
"15_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Limit",
"ed",
"Ret",
"ali",
"ate",
"2_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"reta",
"liat",
"ion",
"\\u",
"limit_",
"=_",
"reta",
"liat",
"ion",
"\\u",
"limit_",
")_",
"\\u\\u\\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_",
"Limit",
"ed",
"Ret",
"ali",
"ate",
"3_",
"(_",
"Limit",
"ed",
"Ret",
"ali",
"ate_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Limit",
"ed",
"Ret",
"ali",
"ate",
" ",
"player",
" ",
"with",
" ",
"a",
" ",
"threshol",
"d",
" ",
"of",
" ",
"5",
" ",
"percent",
" ",
"and",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"reta",
"liat",
"ion",
" ",
"limit",
" ",
"of",
" ",
"20.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Limit",
"ed",
"Ret",
"ali",
"ate",
"3_",
"(_",
"Limit",
"ed",
"Ret",
"ali",
"ate_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"0.05_",
",_",
"reta",
"liat",
"ion",
"\\u",
"limit_",
"=_",
"20_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Limit",
"ed",
"Ret",
"ali",
"ate",
"3_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
"=_",
"reta",
"liat",
"ion",
"\\u",
"threshold_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"reta",
"liat",
"ion",
"\\u",
"limit_",
"=_",
"reta",
"liat",
"ion",
"\\u",
"limit_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
First parameter of a method is not named 'self' | scanny/python-pptx/tests/opc/test_rels.py | [
{
"content": " def it_raises_KeyError_on_part_with_rId_not_found(self, rels):\n with pytest.raises(KeyError):\n rels.related_parts['rId666']",
"metadata": "root.DescribeRelationshipCollection.it_raises_KeyError_on_part_with_rId_not_found",
"header": "['class', 'DescribeRelationshipCollection', '(', 'object', ')', ':', '___EOS___']",
"index": 105
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"Describe",
"Relationship",
"Collection_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"it",
"\\u",
"raise",
"s",
"\\u",
"Key",
"Error",
"\\u",
"on",
"\\u",
"part",
"\\u",
"with",
"\\u",
"r",
"Id",
"\\u",
"not",
"\\u",
"found_",
"(_",
"self_",
",_",
"rels_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"pytest_",
"._",
"raises_",
"(_",
"Key",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rels_",
"._",
"relate",
"d\\u",
"parts_",
"[_",
"'",
"r",
"Id",
"666",
"'_",
"]_",
"\\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
] |
Unused local variable | ibagrak/algae/gae/core/model.py | [
{
"content": " @classmethod\n def delete1(cls, i):\n item = cls.get_by_id(i)\n if item: \n item.delete()\n return True\n \n return False",
"metadata": "root.RESTModel.delete1",
"header": "['class', 'RESTModel', '(', 'db', '.', 'Model', ')', ':', '___NEWLINE___', '# implemented by subclasses', '___NL___', '___EOS___']",
"index": 83
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"REST",
"Model_",
"(_",
"db_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"implemented",
" ",
"by",
" ",
"subclasses",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"delete",
"1_",
"(_",
"cls_",
",_",
"i_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"item_",
"=_",
"cls_",
"._",
"get",
"\\u",
"by",
"\\u",
"id_",
"(_",
"i_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"item_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"item_",
"._",
"delete_",
"(_",
")_",
"\\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_"
] | [
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
] |
Unused import | apache/libcloud/libcloud/test/loadbalancer/test_slb.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.compute.base import Node\nfrom libcloud.compute.types import NodeState\nfrom libcloud.loadbalancer.base import Member, Algorithm\nfrom libcloud.loadbalancer.drivers.slb import SLBDriver, \\\n SLBLoadBalancerHttpListener, SLBLoadBalancerHttpsListener, \\\n SLBLoadBalancerTcpListener, SLBLoadBalancerUdpListener\nfrom libcloud.loadbalancer.types import State\nfrom libcloud.test.file_fixtures import LoadBalancerFileFixtures\nfrom libcloud.test import MockHttpTestCase\nfrom libcloud.test.secrets import LB_SLB_PARAMS\nfrom libcloud.utils.py3 import httplib\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n sys.exit(unittest.main())\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class SLBDriverTestCases(unittest.TestCase):\n region = LB_SLB_PARAMS[2]\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.SLBDriverTestCases",
"header": "['module', '___EOS___']",
"index": 31
},
{
"content": " def setUp(self):\n SLBMockHttp.test = self\n SLBDriver.connectionCls.conn_classes = (None,\n SLBMockHttp)\n SLBMockHttp.type = None\n SLBMockHttp.use_param = 'Action'\n\n self.driver = SLBDriver(*LB_SLB_PARAMS)",
"metadata": "root.SLBDriverTestCases.setUp",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 34
},
{
"content": " def test_list_protocols(self):\n protocols = self.driver.list_protocols()\n self.assertEqual(4, len(protocols))\n expected = ['tcp', 'udp', 'http', 'https']\n diff = set(expected) - set(protocols)\n self.assertEqual(0, len(diff))",
"metadata": "root.SLBDriverTestCases.test_list_protocols",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 43
},
{
"content": " def test_list_balancers(self):\n balancers = self.driver.list_balancers()\n\n self.assertEqual(len(balancers), 1)\n balancer = balancers[0]\n self.assertEqual('15229f88562-cn-hangzhou-dg-a01', balancer.id)\n self.assertEqual('abc', balancer.name)\n self.assertEqual(State.RUNNING, balancer.state)\n self.assertEqual('120.27.186.149', balancer.ip)\n self.assertTrue(balancer.port is None)\n self.assertEqual(self.driver, balancer.driver)\n expected_extra = {\n 'create_timestamp': 1452403099000,\n 'address_type': 'internet',\n 'region_id': 'cn-hangzhou-dg-a01',\n 'region_id_alias': 'cn-hangzhou',\n 'create_time': '2016-01-10T13:18Z',\n 'master_zone_id': 'cn-hangzhou-d',\n 'slave_zone_id': 'cn-hangzhou-b',\n 'network_type': 'classic'\n }\n self._validate_extras(expected_extra, balancer.extra)",
"metadata": "root.SLBDriverTestCases.test_list_balancers",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 50
},
{
"content": " def _validate_extras(self, expected, actual):\n self.assertTrue(actual is not None)\n for key, value in iter(expected.items()):\n self.assertTrue(key in actual)\n self.assertEqual(value, actual[key], ('extra %(key)s not equal, '\n 'expected: \"%(expected)s\", '\n 'actual: \"%(actual)s\"' %\n {'key': key,\n 'expected': value,\n 'actual': actual[key]}))",
"metadata": "root.SLBDriverTestCases._validate_extras",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 73
},
{
"content": " def test_list_balancers_with_ids(self):\n SLBMockHttp.type = 'list_balancers_ids'\n self.balancer_ids = ['id1', 'id2']\n balancers = self.driver.list_balancers(\n ex_balancer_ids=self.balancer_ids)\n self.assertTrue(balancers is not None)",
"metadata": "root.SLBDriverTestCases.test_list_balancers_with_ids",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 84
},
{
"content": " def test_list_balancers_with_ex_filters(self):\n SLBMockHttp.type = 'list_balancers_filters'\n self.ex_filters = {'AddressType': 'internet'}\n balancers = self.driver.list_balancers(ex_filters=self.ex_filters)\n self.assertTrue(balancers is not None)",
"metadata": "root.SLBDriverTestCases.test_list_balancers_with_ex_filters",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 91
},
{
"content": " def test_get_balancer(self):\n SLBMockHttp.type = 'get_balancer'\n balancer = self.driver.get_balancer(balancer_id='tests')\n\n self.assertEqual(balancer.id, '15229f88562-cn-hangzhou-dg-a01')\n self.assertEqual(balancer.name, 'abc')\n self.assertEqual(balancer.state, State.RUNNING)",
"metadata": "root.SLBDriverTestCases.test_get_balancer",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 97
},
{
"content": " def test_destroy_balancer(self):\n balancer = self.driver.get_balancer(balancer_id='tests')\n\n self.assertTrue(self.driver.destroy_balancer(balancer))",
"metadata": "root.SLBDriverTestCases.test_destroy_balancer",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 105
},
{
"content": " def test_create_balancer(self):\n self.name = 'balancer1'\n self.port = 80\n self.protocol = 'http'\n self.algorithm = Algorithm.WEIGHTED_ROUND_ROBIN\n self.extra = {\n 'ex_address_type': 'internet',\n 'ex_internet_charge_type': 'paybytraffic',\n 'ex_bandwidth': 1,\n 'ex_master_zone_id': 'cn-hangzhou-d',\n 'ex_slave_zone_id': 'cn-hangzhou-b',\n 'StickySession': 'on',\n 'HealthCheck': 'on'}\n self.members = [Member('node1', None, None)]\n\n balancer = self.driver.create_balancer(name=self.name, port=self.port,\n protocol=self.protocol,\n algorithm=self.algorithm,\n members=self.members,\n **self.extra)\n\n self.assertEqual(balancer.name, self.name)\n self.assertEqual(balancer.port, self.port)\n self.assertEqual(balancer.state, State.UNKNOWN)",
"metadata": "root.SLBDriverTestCases.test_create_balancer",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 110
},
{
"content": " def test_create_balancer_no_port_exception(self):\n self.assertRaises(AttributeError, self.driver.create_balancer,\n None, None, 'http', Algorithm.WEIGHTED_ROUND_ROBIN,\n None)",
"metadata": "root.SLBDriverTestCases.test_create_balancer_no_port_exception",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 135
},
{
"content": " def test_create_balancer_unsupport_protocol_exception(self):\n self.assertRaises(AttributeError, self.driver.create_balancer,\n None, 443, 'ssl', Algorithm.WEIGHTED_ROUND_ROBIN,\n None)",
"metadata": "root.SLBDriverTestCases.test_create_balancer_unsupport_protocol_exception",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 140
},
{
"content": " def test_create_balancer_multiple_member_ports_exception(self):\n members = [Member('m1', '1.2.3.4', 80),\n Member('m2', '1.2.3.5', 81)]\n self.assertRaises(AttributeError, self.driver.create_balancer,\n None, 80, 'http', Algorithm.WEIGHTED_ROUND_ROBIN,\n members)",
"metadata": "root.SLBDriverTestCases.test_create_balancer_multiple_member_ports_exception",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 145
},
{
"content": " def test_create_balancer_bandwidth_value_error(self):\n self.assertRaises(AttributeError, self.driver.create_balancer,\n None, 80, 'http', Algorithm.WEIGHTED_ROUND_ROBIN,\n None, ex_bandwidth='NAN')",
"metadata": "root.SLBDriverTestCases.test_create_balancer_bandwidth_value_error",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 152
},
{
"content": " def test_create_balancer_paybybandwidth_without_bandwidth_exception(self):\n self.assertRaises(AttributeError, self.driver.create_balancer,\n None, 80, 'http', Algorithm.WEIGHTED_ROUND_ROBIN,\n None, ex_internet_charge_type='paybybandwidth')",
"metadata": "root.SLBDriverTestCases.test_create_balancer_paybybandwidth_without_bandwidth_exception",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 157
},
{
"content": " def test_balancer_list_members(self):\n balancer = self.driver.get_balancer(balancer_id='tests')\n members = balancer.list_members()\n\n self.assertEqual(len(members), 1)\n self.assertEqual(members[0].balancer, balancer)\n self.assertEqual('i-23tshnsdq', members[0].id)",
"metadata": "root.SLBDriverTestCases.test_balancer_list_members",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 162
},
{
"content": " def test_balancer_list_listeners(self):\n balancer = self.driver.get_balancer(balancer_id='tests')\n listeners = self.driver.ex_list_listeners(balancer)\n\n self.assertEqual(1, len(listeners))\n listener = listeners[0]\n self.assertEqual('80', listener.port)",
"metadata": "root.SLBDriverTestCases.test_balancer_list_listeners",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 170
},
{
"content": " def test_balancer_detach_member(self):\n self.balancer = self.driver.get_balancer(balancer_id='tests')\n self.member = Member('i-23tshnsdq', None, None)\n\n self.assertTrue(self.balancer.detach_member(self.member))",
"metadata": "root.SLBDriverTestCases.test_balancer_detach_member",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 178
},
{
"content": " def test_balancer_attach_compute_node(self):\n SLBMockHttp.type = 'attach_compute_node'\n self.balancer = self.driver.get_balancer(balancer_id='tests')\n self.node = Node(id='node1', name='node-name',\n state=NodeState.RUNNING,\n public_ips=['1.2.3.4'], private_ips=['4.3.2.1'],\n driver=self.driver)\n member = self.driver.balancer_attach_compute_node(\n self.balancer, self.node)\n self.assertEqual(self.node.id, member.id)\n self.assertEqual(self.node.public_ips[0], member.ip)\n self.assertEqual(self.balancer.port, member.port)",
"metadata": "root.SLBDriverTestCases.test_balancer_attach_compute_node",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 184
},
{
"content": " def test_ex_create_listener(self):\n SLBMockHttp.type = 'create_listener'\n self.balancer = self.driver.get_balancer(balancer_id='tests')\n self.backend_port = 80\n self.protocol = 'http'\n self.algorithm = Algorithm.WEIGHTED_ROUND_ROBIN\n self.bandwidth = 1\n self.extra = {'StickySession': 'off', 'HealthCheck': 'off'}\n self.assertTrue(self.driver.ex_create_listener(self.balancer,\n self.backend_port,\n self.protocol,\n self.algorithm,\n self.bandwidth,\n **self.extra))",
"metadata": "root.SLBDriverTestCases.test_ex_create_listener",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 197
},
{
"content": " def test_ex_create_listener_override_port(self):\n SLBMockHttp.type = 'create_listener_override_port'\n self.balancer = self.driver.get_balancer(balancer_id='tests')\n self.backend_port = 80\n self.protocol = 'http'\n self.algorithm = Algorithm.WEIGHTED_ROUND_ROBIN\n self.bandwidth = 1\n self.extra = {'StickySession': 'off',\n 'HealthCheck': 'off',\n 'ListenerPort': 8080}\n self.assertTrue(self.driver.ex_create_listener(self.balancer,\n self.backend_port,\n self.protocol,\n self.algorithm,\n self.bandwidth,\n **self.extra))",
"metadata": "root.SLBDriverTestCases.test_ex_create_listener_override_port",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 212
},
{
"content": " def test_ex_start_listener(self):\n SLBMockHttp.type = 'start_listener'\n balancer = self.driver.get_balancer(balancer_id='tests')\n self.port = 80\n self.assertTrue(self.driver.ex_start_listener(balancer, self.port))",
"metadata": "root.SLBDriverTestCases.test_ex_start_listener",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 229
},
{
"content": " def test_ex_stop_listener(self):\n SLBMockHttp.type = 'stop_listener'\n balancer = self.driver.get_balancer(balancer_id='tests')\n self.port = 80\n self.assertTrue(self.driver.ex_stop_listener(balancer, self.port))",
"metadata": "root.SLBDriverTestCases.test_ex_stop_listener",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 235
},
{
"content": " def test_ex_upload_certificate(self):\n self.name = 'cert1'\n self.cert = 'cert-data'\n self.key = 'key-data'\n certificate = self.driver.ex_upload_certificate(self.name, self.cert,\n self.key)\n self.assertEqual(self.name, certificate.name)\n self.assertEqual('01:DF:AB:CD', certificate.fingerprint)",
"metadata": "root.SLBDriverTestCases.test_ex_upload_certificate",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 241
},
{
"content": " def test_ex_list_certificates(self):\n certs = self.driver.ex_list_certificates()\n self.assertEqual(2, len(certs))\n cert = certs[0]\n self.assertEqual('139a00604ad-cn-east-hangzhou-01', cert.id)\n self.assertEqual('abe', cert.name)\n self.assertEqual('A:B:E', cert.fingerprint)",
"metadata": "root.SLBDriverTestCases.test_ex_list_certificates",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 250
},
{
"content": " def test_ex_list_certificates_ids(self):\n SLBMockHttp.type = 'list_certificates_ids'\n self.cert_ids = ['cert1', 'cert2']\n certs = self.driver.ex_list_certificates(certificate_ids=self.cert_ids)\n self.assertTrue(certs is not None)",
"metadata": "root.SLBDriverTestCases.test_ex_list_certificates_ids",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 258
},
{
"content": " def test_ex_delete_certificate(self):\n self.cert_id = 'cert1'\n self.assertTrue(self.driver.ex_delete_certificate(self.cert_id))",
"metadata": "root.SLBDriverTestCases.test_ex_delete_certificate",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 264
},
{
"content": " def test_ex_set_certificate_name(self):\n self.cert_id = 'cert1'\n self.cert_name = 'cert-name'\n self.assertTrue(self.driver.ex_set_certificate_name(self.cert_id,\n self.cert_name))",
"metadata": "root.SLBDriverTestCases.test_ex_set_certificate_name",
"header": "['class', 'SLBDriverTestCases', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 268
},
{
"content": "class SLBMockHttp(MockHttpTestCase):\n fixtures = LoadBalancerFileFixtures('slb')\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.SLBMockHttp",
"header": "['module', '___EOS___']",
"index": 275
},
{
"content": " def _DescribeLoadBalancers(self, method, url, body, headers):\n body = self.fixtures.load('describe_load_balancers.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._DescribeLoadBalancers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 278
},
{
"content": " def _list_balancers_ids_DescribeLoadBalancers(self, method, url, body,\n headers):\n params = {'LoadBalancerId': ','.join(self.test.balancer_ids)}\n self.assertUrlContainsQueryParams(url, params)\n body = self.fixtures.load('describe_load_balancers.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._list_balancers_ids_DescribeLoadBalancers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 282
},
{
"content": " def _list_balancers_filters_DescribeLoadBalancers(self, method, url, body,\n headers):\n params = {'AddressType': 'internet'}\n self.assertUrlContainsQueryParams(url, params)\n body = self.fixtures.load('describe_load_balancers.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._list_balancers_filters_DescribeLoadBalancers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 289
},
{
"content": " def _get_balancer_DescribeLoadBalancers(self, method, url, body, headers):\n params = {'LoadBalancerId': 'tests'}\n self.assertUrlContainsQueryParams(url, params)\n return self._DescribeLoadBalancers(method, url, body, headers)",
"metadata": "root.SLBMockHttp._get_balancer_DescribeLoadBalancers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 296
},
{
"content": " def _DeleteLoadBalancer(self, method, url, body, headers):\n params = {'LoadBalancerId': '15229f88562-cn-hangzhou-dg-a01'}\n self.assertUrlContainsQueryParams(url, params)\n body = self.fixtures.load('delete_load_balancer.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._DeleteLoadBalancer",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 301
},
{
"content": " def _DescribeLoadBalancerAttribute(self, method, url, body, headers):\n body = self.fixtures.load('describe_load_balancer_attribute.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._DescribeLoadBalancerAttribute",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 307
},
{
"content": " def _CreateLoadBalancer(self, method, url, body, headers):\n params = {'RegionId': self.test.region,\n 'LoadBalancerName': self.test.name}\n balancer_keys = {\n 'AddressType': 'ex_address_type',\n 'InternetChargeType': 'ex_internet_charge_type',\n 'Bandwidth': 'ex_bandwidth',\n 'MasterZoneId': 'ex_master_zone_id',\n 'SlaveZoneId': 'ex_slave_zone_id'\n }\n for key in balancer_keys:\n params[key] = str(self.test.extra[balancer_keys[key]])\n\n self.assertUrlContainsQueryParams(url, params)\n body = self.fixtures.load('create_load_balancer.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._CreateLoadBalancer",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 311
},
{
"content": " def _AddBackendServers(self, method, url, body, headers):\n _id = self.test.members[0].id\n self.assertTrue(\"ServerId\" in url and _id in url)\n self.assertTrue(\"Weight\" in url and \"100\" in url)\n body = self.fixtures.load('add_backend_servers.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._AddBackendServers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 328
},
{
"content": " def _CreateLoadBalancerHTTPListener(self, method, url, body, headers):\n body = self.fixtures.load('create_load_balancer_http_listener.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._CreateLoadBalancerHTTPListener",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 335
},
{
"content": " def _StartLoadBalancerListener(self, method, url, body, headers):\n body = self.fixtures.load('start_load_balancer_listener.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._StartLoadBalancerListener",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 339
},
{
"content": " def _RemoveBackendServers(self, method, url, body, headers):\n _id = self.test.member.id\n servers_json = '[\"%s\"]' % _id\n params = {'LoadBalancerId': self.test.balancer.id,\n 'BackendServers': servers_json}\n self.assertUrlContainsQueryParams(url, params)\n body = self.fixtures.load('add_backend_servers.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._RemoveBackendServers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 343
},
{
"content": " def _attach_compute_node_DescribeLoadBalancers(self, method, url, body,\n headers):\n body = self.fixtures.load('describe_load_balancers.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._attach_compute_node_DescribeLoadBalancers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 352
},
{
"content": " def _attach_compute_node_AddBackendServers(self, method, url, body,\n headers):\n _id = self.test.node.id\n self.assertTrue(\"ServerId\" in url and _id in url)\n self.assertTrue(\"Weight\" in url and \"100\" in url)\n body = self.fixtures.load('add_backend_servers.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._attach_compute_node_AddBackendServers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 357
},
{
"content": " def _create_listener_CreateLoadBalancerHTTPListener(self, method, url,\n body, headers):\n params = {'LoadBalancerId': self.test.balancer.id,\n 'RegionId': self.test.region,\n 'ListenerPort': str(self.test.balancer.port),\n 'BackendServerPort': str(self.test.backend_port),\n 'Scheduler': 'wrr',\n 'Bandwidth': '1',\n 'StickySession': 'off',\n 'HealthCheck': 'off'}\n self.assertUrlContainsQueryParams(url, params)\n body = self.fixtures.load('create_load_balancer_http_listener.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._create_listener_CreateLoadBalancerHTTPListener",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 365
},
{
"content": " def _create_listener_DescribeLoadBalancers(self, method, url, body,\n headers):\n body = self.fixtures.load('describe_load_balancers.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._create_listener_DescribeLoadBalancers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 379
},
{
"content": " def _create_listener_override_port_CreateLoadBalancerHTTPListener(\n self, method, url, body, headers):\n params = {'LoadBalancerId': self.test.balancer.id,\n 'RegionId': self.test.region,\n 'ListenerPort': str(self.test.extra['ListenerPort']),\n 'BackendServerPort': str(self.test.backend_port),\n 'Scheduler': 'wrr',\n 'Bandwidth': '1',\n 'StickySession': 'off',\n 'HealthCheck': 'off'}\n self.assertUrlContainsQueryParams(url, params)\n body = self.fixtures.load('create_load_balancer_http_listener.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._create_listener_override_port_CreateLoadBalancerHTTPListener",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 384
},
{
"content": " def _create_listener_override_port_DescribeLoadBalancers(\n self, method, url, body, headers):\n body = self.fixtures.load('describe_load_balancers.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._create_listener_override_port_DescribeLoadBalancers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 398
},
{
"content": " def _start_listener_DescribeLoadBalancers(self, method, url, body,\n headers):\n return self._DescribeLoadBalancers(method, url, body, headers)",
"metadata": "root.SLBMockHttp._start_listener_DescribeLoadBalancers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 403
},
{
"content": " def _start_listener_StartLoadBalancerListener(self, method, url, body,\n headers):\n params = {'ListenerPort': str(self.test.port)}\n self.assertUrlContainsQueryParams(url, params)\n return self._StartLoadBalancerListener(method, url, body, headers)",
"metadata": "root.SLBMockHttp._start_listener_StartLoadBalancerListener",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 407
},
{
"content": " def _stop_listener_DescribeLoadBalancers(self, method, url, body,\n headers):\n return self._DescribeLoadBalancers(method, url, body, headers)",
"metadata": "root.SLBMockHttp._stop_listener_DescribeLoadBalancers",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 413
},
{
"content": " def _stop_listener_StopLoadBalancerListener(self, method, url, body,\n headers):\n params = {'ListenerPort': str(self.test.port)}\n self.assertUrlContainsQueryParams(url, params)\n return self._StartLoadBalancerListener(method, url, body, headers)",
"metadata": "root.SLBMockHttp._stop_listener_StopLoadBalancerListener",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 417
},
{
"content": " def _UploadServerCertificate(self, method, url, body, headers):\n body = self.fixtures.load('upload_server_certificate.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._UploadServerCertificate",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 423
},
{
"content": " def _DescribeServerCertificates(self, method, url, body, headers):\n body = self.fixtures.load('describe_server_certificates.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._DescribeServerCertificates",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 427
},
{
"content": " def _list_certificates_ids_DescribeServerCertificates(self, method, url,\n body, headers):\n params = {'RegionId': self.test.region,\n 'ServerCertificateId': ','.join(self.test.cert_ids)}\n self.assertUrlContainsQueryParams(url, params)\n body = self.fixtures.load('describe_server_certificates.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._list_certificates_ids_DescribeServerCertificates",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 431
},
{
"content": " def _DeleteServerCertificate(self, method, url, body, headers):\n params = {'RegionId': self.test.region,\n 'ServerCertificateId': self.test.cert_id}\n self.assertUrlContainsQueryParams(url, params)\n body = self.fixtures.load('delete_server_certificate.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._DeleteServerCertificate",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 439
},
{
"content": " def _SetServerCertificateName(self, method, url, body, headers):\n params = {'RegionId': self.test.region,\n 'ServerCertificateId': self.test.cert_id,\n 'ServerCertificateName': self.test.cert_name}\n self.assertUrlContainsQueryParams(url, params)\n body = self.fixtures.load('set_server_certificate_name.xml')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])",
"metadata": "root.SLBMockHttp._SetServerCertificateName",
"header": "['class', 'SLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']",
"index": 446
},
{
"content": "class AssertDictMixin(object):",
"metadata": "root.AssertDictMixin",
"header": "['module', '___EOS___']",
"index": 455
},
{
"content": " def assert_dict_equals(self, expected, actual):\n expected_keys = set(expected.keys())\n actual_keys = set(actual.keys())\n self.assertEqual(len(expected_keys), len(actual_keys))\n self.assertEqual(0, len(expected_keys - actual_keys))\n for key in expected:\n self.assertEqual(expected[key], actual[key])",
"metadata": "root.AssertDictMixin.assert_dict_equals",
"header": "['class', 'AssertDictMixin', '(', 'object', ')', ':', '___EOS___']",
"index": 456
},
{
"content": "class SLBLoadBalancerHttpListenerTestCase(unittest.TestCase, AssertDictMixin):\n\n\n",
"metadata": "root.SLBLoadBalancerHttpListenerTestCase",
"header": "['module', '___EOS___']",
"index": 465
},
{
"content": " def setUp(self):\n self.listener = SLBLoadBalancerHttpListener.create(\n 80, 8080, Algorithm.WEIGHTED_ROUND_ROBIN, 1,\n extra={'StickySession': 'on',\n 'StickySessionType': 'insert',\n 'HealthCheck': 'on'}\n )",
"metadata": "root.SLBLoadBalancerHttpListenerTestCase.setUp",
"header": "['class', 'SLBLoadBalancerHttpListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 466
},
{
"content": " def test_get_required_params(self):\n expected = {'Action': 'CreateLoadBalancerHTTPListener',\n 'ListenerPort': 80,\n 'BackendServerPort': 8080,\n 'Scheduler': 'wrr',\n 'Bandwidth': 1,\n 'StickySession': 'on',\n 'HealthCheck': 'on'}\n self.assert_dict_equals(expected,\n self.listener.get_required_params())",
"metadata": "root.SLBLoadBalancerHttpListenerTestCase.test_get_required_params",
"header": "['class', 'SLBLoadBalancerHttpListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 474
},
{
"content": " def test_get_optional_params(self):\n expected = {'StickySessionType': 'insert'}\n self.assert_dict_equals(expected, self.listener.get_optional_params())",
"metadata": "root.SLBLoadBalancerHttpListenerTestCase.test_get_optional_params",
"header": "['class', 'SLBLoadBalancerHttpListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 485
},
{
"content": " def test_repr(self):\n self.assertTrue('SLBLoadBalancerHttpListener' in str(self.listener))",
"metadata": "root.SLBLoadBalancerHttpListenerTestCase.test_repr",
"header": "['class', 'SLBLoadBalancerHttpListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 489
},
{
"content": "class SLBLoadBalancerHttpsListenerTestCase(unittest.TestCase, AssertDictMixin):\n\n",
"metadata": "root.SLBLoadBalancerHttpsListenerTestCase",
"header": "['module', '___EOS___']",
"index": 493
},
{
"content": " def setUp(self):\n self.listener = SLBLoadBalancerHttpsListener.create(\n 80, 8080, Algorithm.WEIGHTED_ROUND_ROBIN, 1,\n extra={'StickySession': 'on',\n 'StickySessionType': 'insert',\n 'HealthCheck': 'on',\n 'ServerCertificateId': 'fake-cert1'}\n )",
"metadata": "root.SLBLoadBalancerHttpsListenerTestCase.setUp",
"header": "['class', 'SLBLoadBalancerHttpsListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 494
},
{
"content": " def test_get_required_params(self):\n expected = {'Action': 'CreateLoadBalancerHTTPSListener',\n 'ListenerPort': 80,\n 'BackendServerPort': 8080,\n 'Scheduler': 'wrr',\n 'Bandwidth': 1,\n 'StickySession': 'on',\n 'HealthCheck': 'on',\n 'ServerCertificateId': 'fake-cert1'}\n self.assert_dict_equals(expected,\n self.listener.get_required_params())",
"metadata": "root.SLBLoadBalancerHttpsListenerTestCase.test_get_required_params",
"header": "['class', 'SLBLoadBalancerHttpsListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 503
},
{
"content": " def test_get_optional_params(self):\n expected = {'StickySessionType': 'insert'}\n self.assert_dict_equals(expected, self.listener.get_optional_params())",
"metadata": "root.SLBLoadBalancerHttpsListenerTestCase.test_get_optional_params",
"header": "['class', 'SLBLoadBalancerHttpsListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 515
},
{
"content": "class SLBLoadBalancerTcpListenerTestCase(unittest.TestCase, AssertDictMixin):\n\n",
"metadata": "root.SLBLoadBalancerTcpListenerTestCase",
"header": "['module', '___EOS___']",
"index": 520
},
{
"content": " def setUp(self):\n self.listener = SLBLoadBalancerTcpListener.create(\n 80, 8080, Algorithm.WEIGHTED_ROUND_ROBIN, 1,\n extra={'PersistenceTimeout': 0,\n 'HealthCheckDomain': ''}\n )",
"metadata": "root.SLBLoadBalancerTcpListenerTestCase.setUp",
"header": "['class', 'SLBLoadBalancerTcpListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 521
},
{
"content": " def test_get_required_params(self):\n expected = {'Action': 'CreateLoadBalancerTCPListener',\n 'ListenerPort': 80,\n 'BackendServerPort': 8080,\n 'Scheduler': 'wrr',\n 'Bandwidth': 1}\n self.assert_dict_equals(expected,\n self.listener.get_required_params())",
"metadata": "root.SLBLoadBalancerTcpListenerTestCase.test_get_required_params",
"header": "['class', 'SLBLoadBalancerTcpListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 528
},
{
"content": " def test_get_optional_params(self):\n expected = {'PersistenceTimeout': 0,\n 'HealthCheckDomain': ''}\n self.assert_dict_equals(expected, self.listener.get_optional_params())",
"metadata": "root.SLBLoadBalancerTcpListenerTestCase.test_get_optional_params",
"header": "['class', 'SLBLoadBalancerTcpListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 537
},
{
"content": "class SLBLoadBalancerUdpListenerTestCase(unittest.TestCase, AssertDictMixin):\n\n",
"metadata": "root.SLBLoadBalancerUdpListenerTestCase",
"header": "['module', '___EOS___']",
"index": 543
},
{
"content": " def setUp(self):\n self.listener = SLBLoadBalancerUdpListener.create(\n 80, 8080, Algorithm.WEIGHTED_ROUND_ROBIN, 1,\n extra={'PersistenceTimeout': 0}\n )",
"metadata": "root.SLBLoadBalancerUdpListenerTestCase.setUp",
"header": "['class', 'SLBLoadBalancerUdpListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 544
},
{
"content": " def test_get_required_params(self):\n expected = {'Action': 'CreateLoadBalancerUDPListener',\n 'ListenerPort': 80,\n 'BackendServerPort': 8080,\n 'Scheduler': 'wrr',\n 'Bandwidth': 1}\n self.assert_dict_equals(expected,\n self.listener.get_required_params())",
"metadata": "root.SLBLoadBalancerUdpListenerTestCase.test_get_required_params",
"header": "['class', 'SLBLoadBalancerUdpListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 550
},
{
"content": " def test_get_optional_params(self):\n expected = {'PersistenceTimeout': 0}\n self.assert_dict_equals(expected, self.listener.get_optional_params())",
"metadata": "root.SLBLoadBalancerUdpListenerTestCase.test_get_optional_params",
"header": "['class', 'SLBLoadBalancerUdpListenerTestCase', '(', 'unittest', '.', 'TestCase', ',', 'AssertDictMixin', ')', ':', '___EOS___']",
"index": 559
}
] | [] | [] | 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",
"_",
"._",
"compute_",
"._",
"base_",
"import_",
"Node_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"compute_",
"._",
"types_",
"import_",
"Node",
"State_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"loadbalancer",
"_",
"._",
"base_",
"import_",
"Member_",
",_",
"Algorithm_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"loadbalancer",
"_",
"._",
"drivers_",
"._",
"sl",
"b_",
"import_",
"SL",
"BD",
"river",
"_",
",_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"Listener_",
",_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"s",
"Listener_",
",_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Tc",
"p",
"Listener_",
",_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Udp",
"Listener_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"loadbalancer",
"_",
"._",
"types_",
"import_",
"State_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"test_",
"._",
"file",
"\\u",
"fixtures_",
"import_",
"Load",
"Balance",
"r",
"File",
"Fix",
"tures",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"test_",
"import_",
"Moc",
"k",
"Http",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"test_",
"._",
"secrets_",
"import_",
"LB",
"\\u",
"SL",
"B",
"\\u",
"PARAMS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"libc",
"loud",
"_",
"._",
"utils_",
"._",
"py3",
"_",
"import_",
"httplib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"\"\\u\\u",
"main",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"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_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"region_",
"=_",
"LB",
"\\u",
"SL",
"B",
"\\u",
"PARAMS_",
"[_",
"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\\uN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\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"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 ",
" _",
"SL",
"BM",
"ock",
"Http_",
"._",
"test_",
"=_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"SL",
"BD",
"river",
"_",
"._",
"connecti",
"on",
"Cls",
"_",
"._",
"conn",
"\\u",
"classes_",
"=_",
"(_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"SL",
"BM",
"ock",
"Http_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"SL",
"BM",
"ock",
"Http_",
"._",
"type_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"SL",
"BM",
"ock",
"Http_",
"._",
"use",
"\\u",
"param_",
"=_",
"'",
"Action",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"driver_",
"=_",
"SL",
"BD",
"river",
"_",
"(_",
"*_",
"LB",
"\\u",
"SL",
"B",
"\\u",
"PARAMS_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"list",
"\\u",
"protocols_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"protocols_",
"=_",
"self_",
"._",
"driver_",
"._",
"list",
"\\u",
"protocols_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"4_",
",_",
"len_",
"(_",
"protocols_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"[_",
"'",
"tcp",
"'_",
",_",
"'",
"ud",
"p",
"'_",
",_",
"'",
"http",
"'_",
",_",
"'",
"https",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"diff_",
"=_",
"set_",
"(_",
"expected_",
")_",
"-_",
"set_",
"(_",
"protocols_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"0_",
",_",
"len_",
"(_",
"diff_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"list",
"\\u",
"balancer",
"s_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"balancer",
"s_",
"=_",
"self_",
"._",
"driver_",
"._",
"list",
"\\u",
"balancer",
"s_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"balancer",
"s_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"balancer",
"_",
"=_",
"balancer",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"152",
"2",
"9",
"f8",
"856",
"2",
"-",
"cn",
"-",
"hang",
"zh",
"ou",
"-",
"dg",
"-",
"a0",
"1",
"'_",
",_",
"balancer",
"_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"abc",
"'_",
",_",
"balancer",
"_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"State_",
"._",
"RUNNING_",
",_",
"balancer",
"_",
"._",
"state_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"120",
".2",
"7.1",
"86",
".1",
"4",
"9",
"'_",
",_",
"balancer",
"_",
"._",
"ip_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"balancer",
"_",
"._",
"port_",
"is_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"driver_",
",_",
"balancer",
"_",
"._",
"driver_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"extra_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"create",
"\\u",
"timestamp",
"'_",
":_",
"145",
"240",
"309",
"9000",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"address",
"\\u",
"type",
"'_",
":_",
"'",
"interne",
"t",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"region",
"\\u",
"id",
"'_",
":_",
"'",
"cn",
"-",
"hang",
"zh",
"ou",
"-",
"dg",
"-",
"a0",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"region",
"\\u",
"id",
"\\u",
"alias",
"'_",
":_",
"'",
"cn",
"-",
"hang",
"zh",
"ou",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"create",
"\\u",
"time",
"'_",
":_",
"'",
"2016",
"-0",
"1",
"-1",
"0",
"T1",
"3",
":",
"1",
"8",
"Z",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"master",
"\\u",
"zone",
"\\u",
"id",
"'_",
":_",
"'",
"cn",
"-",
"hang",
"zh",
"ou",
"-",
"d",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"slave",
"\\u",
"zone",
"\\u",
"id",
"'_",
":_",
"'",
"cn",
"-",
"hang",
"zh",
"ou",
"-",
"b",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"network",
"\\u",
"type",
"'_",
":_",
"'",
"classic",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"validat",
"e\\u",
"extras_",
"(_",
"expected",
"\\u",
"extra_",
",_",
"balancer",
"_",
"._",
"extra_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"validat",
"e\\u",
"extras_",
"(_",
"self_",
",_",
"expected_",
",_",
"actual_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"True_",
"(_",
"actual_",
"is_",
"not_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"key_",
",_",
"value_",
"in_",
"iter_",
"(_",
"expected_",
"._",
"items_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"True_",
"(_",
"key_",
"in_",
"actual_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"value_",
",_",
"actual_",
"[_",
"key_",
"]_",
",_",
"(_",
"'",
"extra",
" ",
"%",
"(",
"key",
")",
"s",
" ",
"not",
" ",
"equal",
",",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"expected",
":",
" ",
"\"%",
"(",
"expected",
")",
"s",
"\",",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"actual",
":",
" ",
"\"%",
"(",
"actual",
")",
"s",
"\"'_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"key",
"'_",
":_",
"key_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"expected",
"'_",
":_",
"value_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"actual",
"'_",
":_",
"actual_",
"[_",
"key_",
"]_",
"}_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"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",
"list",
"\\u",
"balancer",
"s",
"\\u",
"with",
"\\u",
"ids_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"SL",
"BM",
"ock",
"Http_",
"._",
"type_",
"=_",
"'",
"list",
"\\u",
"balancer",
"s",
"\\u",
"ids",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"balancer",
"\\u",
"ids_",
"=_",
"[_",
"'",
"id",
"1",
"'_",
",_",
"'",
"id2",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"balancer",
"s_",
"=_",
"self_",
"._",
"driver_",
"._",
"list",
"\\u",
"balancer",
"s_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"ex",
"\\u",
"balancer",
"\\u",
"ids_",
"=_",
"self_",
"._",
"balancer",
"\\u",
"ids_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"balancer",
"s_",
"is_",
"not_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"list",
"\\u",
"balancer",
"s",
"\\u",
"with",
"\\u",
"ex",
"\\u",
"filters_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"SL",
"BM",
"ock",
"Http_",
"._",
"type_",
"=_",
"'",
"list",
"\\u",
"balancer",
"s",
"\\u",
"filter",
"s",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ex",
"\\u",
"filters_",
"=_",
"{_",
"'",
"Address",
"Type",
"'_",
":_",
"'",
"interne",
"t",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"balancer",
"s_",
"=_",
"self_",
"._",
"driver_",
"._",
"list",
"\\u",
"balancer",
"s_",
"(_",
"ex",
"\\u",
"filters_",
"=_",
"self_",
"._",
"ex",
"\\u",
"filters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"balancer",
"s_",
"is_",
"not_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"balancer",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"SL",
"BM",
"ock",
"Http_",
"._",
"type_",
"=_",
"'",
"get",
"\\u",
"balancer",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"\\u",
"id_",
"=_",
"'",
"tests",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"balancer",
"_",
"._",
"id_",
",_",
"'",
"152",
"2",
"9",
"f8",
"856",
"2",
"-",
"cn",
"-",
"hang",
"zh",
"ou",
"-",
"dg",
"-",
"a0",
"1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"balancer",
"_",
"._",
"name_",
",_",
"'",
"abc",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"balancer",
"_",
"._",
"state_",
",_",
"State_",
"._",
"RUNNING_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"destroy",
"\\u",
"balancer",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"\\u",
"id_",
"=_",
"'",
"tests",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"self_",
"._",
"driver_",
"._",
"destroy",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"create",
"\\u",
"balancer",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"name_",
"=_",
"'",
"balancer",
"1",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"port_",
"=_",
"80_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"protocol_",
"=_",
"'",
"http",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"algorithm_",
"=_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"extra_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ex",
"\\u",
"address",
"\\u",
"type",
"'_",
":_",
"'",
"interne",
"t",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ex",
"\\u",
"interne",
"t",
"\\u",
"charge",
"\\u",
"type",
"'_",
":_",
"'",
"pay",
"byt",
"raf",
"fic",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ex",
"\\u",
"bandwi",
"dth",
"'_",
":_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ex",
"\\u",
"master",
"\\u",
"zone",
"\\u",
"id",
"'_",
":_",
"'",
"cn",
"-",
"hang",
"zh",
"ou",
"-",
"d",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ex",
"\\u",
"slave",
"\\u",
"zone",
"\\u",
"id",
"'_",
":_",
"'",
"cn",
"-",
"hang",
"zh",
"ou",
"-",
"b",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Stick",
"y",
"Sess",
"ion",
"'_",
":_",
"'",
"on",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Health",
"Check",
"'_",
":_",
"'",
"on",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"members_",
"=_",
"[_",
"Member_",
"(_",
"'",
"node",
"1",
"'_",
",_",
"None_",
",_",
"None_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"create",
"\\u",
"balancer",
"_",
"(_",
"name_",
"=_",
"self_",
"._",
"name_",
",_",
"port_",
"=_",
"self_",
"._",
"port_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"protocol_",
"=_",
"self_",
"._",
"protocol_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"algorithm_",
"=_",
"self_",
"._",
"algorithm_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"members_",
"=_",
"self_",
"._",
"members_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"self_",
"._",
"extra_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"balancer",
"_",
"._",
"name_",
",_",
"self_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"balancer",
"_",
"._",
"port_",
",_",
"self_",
"._",
"port_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"balancer",
"_",
"._",
"state_",
",_",
"State_",
"._",
"UNKNOWN_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"create",
"\\u",
"balancer",
"\\u",
"no",
"\\u",
"port",
"\\u",
"exception_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Attribute",
"Error_",
",_",
"self_",
"._",
"driver_",
"._",
"create",
"\\u",
"balancer",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
",_",
"None_",
",_",
"'",
"http",
"'_",
",_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"create",
"\\u",
"balancer",
"\\u",
"unsup",
"port",
"\\u",
"protoc",
"ol",
"\\u",
"exception_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Attribute",
"Error_",
",_",
"self_",
"._",
"driver_",
"._",
"create",
"\\u",
"balancer",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
",_",
"443_",
",_",
"'",
"ssl",
"'_",
",_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"create",
"\\u",
"balancer",
"\\u",
"multiple",
"\\u",
"member",
"\\u",
"port",
"s",
"\\u",
"exception_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"members_",
"=_",
"[_",
"Member_",
"(_",
"'",
"m1",
"'_",
",_",
"'",
"1.2",
".3",
".4",
"'_",
",_",
"80_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Member_",
"(_",
"'",
"m2",
"'_",
",_",
"'",
"1.2",
".3",
".5",
"'_",
",_",
"81_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Attribute",
"Error_",
",_",
"self_",
"._",
"driver_",
"._",
"create",
"\\u",
"balancer",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
",_",
"80_",
",_",
"'",
"http",
"'_",
",_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"members_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"create",
"\\u",
"balancer",
"\\u",
"bandwi",
"dth",
"\\u",
"value",
"\\u",
"error_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Attribute",
"Error_",
",_",
"self_",
"._",
"driver_",
"._",
"create",
"\\u",
"balancer",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
",_",
"80_",
",_",
"'",
"http",
"'_",
",_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
",_",
"ex",
"\\u",
"bandwidth_",
"=_",
"'",
"NAN",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"create",
"\\u",
"balancer",
"\\u",
"pay",
"by",
"bandwi",
"dth",
"\\u",
"with",
"out",
"\\u",
"bandwi",
"dth",
"\\u",
"exception_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Attribute",
"Error_",
",_",
"self_",
"._",
"driver_",
"._",
"create",
"\\u",
"balancer",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
",_",
"80_",
",_",
"'",
"http",
"'_",
",_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
",_",
"ex",
"\\u",
"interne",
"t",
"\\u",
"charge",
"\\u",
"type_",
"=_",
"'",
"pay",
"by",
"bandwi",
"dth",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"balancer",
"\\u",
"list",
"\\u",
"members_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"\\u",
"id_",
"=_",
"'",
"tests",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"members_",
"=_",
"balancer",
"_",
"._",
"list",
"\\u",
"members_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"members_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"members_",
"[_",
"0_",
"]_",
"._",
"balancer",
"_",
",_",
"balancer",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"i",
"-",
"23",
"tsh",
"ns",
"dq",
"'_",
",_",
"members_",
"[_",
"0_",
"]_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"balancer",
"\\u",
"list",
"\\u",
"listeners_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"\\u",
"id_",
"=_",
"'",
"tests",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"listeners_",
"=_",
"self_",
"._",
"driver_",
"._",
"ex",
"\\u",
"list",
"\\u",
"listeners_",
"(_",
"balancer",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"1_",
",_",
"len_",
"(_",
"listeners_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"listener_",
"=_",
"listeners_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"80",
"'_",
",_",
"listener_",
"._",
"port_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"balancer",
"\\u",
"deta",
"ch",
"\\u",
"member_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"\\u",
"id_",
"=_",
"'",
"tests",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"member_",
"=_",
"Member_",
"(_",
"'",
"i",
"-",
"23",
"tsh",
"ns",
"dq",
"'_",
",_",
"None_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"self_",
"._",
"balancer",
"_",
"._",
"deta",
"ch",
"\\u",
"member_",
"(_",
"self_",
"._",
"member_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"balancer",
"\\u",
"attach",
"\\u",
"compute",
"\\u",
"node_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"SL",
"BM",
"ock",
"Http_",
"._",
"type_",
"=_",
"'",
"attach",
"\\u",
"compute",
"\\u",
"node",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"\\u",
"id_",
"=_",
"'",
"tests",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"node_",
"=_",
"Node_",
"(_",
"id_",
"=_",
"'",
"node",
"1",
"'_",
",_",
"name_",
"=_",
"'",
"node",
"-",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"state_",
"=_",
"Node",
"State_",
"._",
"RUNNING_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"public",
"\\u",
"ips_",
"=_",
"[_",
"'",
"1.2",
".3",
".4",
"'_",
"]_",
",_",
"private",
"\\u",
"ips_",
"=_",
"[_",
"'",
"4.3",
".2",
".1",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"driver_",
"=_",
"self_",
"._",
"driver_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"member_",
"=_",
"self_",
"._",
"driver_",
"._",
"balancer",
"\\u",
"attach",
"\\u",
"compute",
"\\u",
"node_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"balancer",
"_",
",_",
"self_",
"._",
"node_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"node_",
"._",
"id_",
",_",
"member_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"node_",
"._",
"public",
"\\u",
"ips_",
"[_",
"0_",
"]_",
",_",
"member_",
"._",
"ip_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"balancer",
"_",
"._",
"port_",
",_",
"member_",
"._",
"port_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ex",
"\\u",
"create",
"\\u",
"listener_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"SL",
"BM",
"ock",
"Http_",
"._",
"type_",
"=_",
"'",
"create",
"\\u",
"listen",
"er",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"\\u",
"id_",
"=_",
"'",
"tests",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"back",
"end",
"\\u",
"port_",
"=_",
"80_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"protocol_",
"=_",
"'",
"http",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"algorithm_",
"=_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bandwidth_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"extra_",
"=_",
"{_",
"'",
"Stick",
"y",
"Sess",
"ion",
"'_",
":_",
"'",
"off",
"'_",
",_",
"'",
"Health",
"Check",
"'_",
":_",
"'",
"off",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"self_",
"._",
"driver_",
"._",
"ex",
"\\u",
"create",
"\\u",
"listener_",
"(_",
"self_",
"._",
"balancer",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"back",
"end",
"\\u",
"port_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"protocol_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"algorithm_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"bandwidth_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"self_",
"._",
"extra_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ex",
"\\u",
"create",
"\\u",
"listen",
"er",
"\\u",
"override",
"\\u",
"port_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"SL",
"BM",
"ock",
"Http_",
"._",
"type_",
"=_",
"'",
"create",
"\\u",
"listen",
"er",
"\\u",
"override",
"\\u",
"port",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"\\u",
"id_",
"=_",
"'",
"tests",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"back",
"end",
"\\u",
"port_",
"=_",
"80_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"protocol_",
"=_",
"'",
"http",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"algorithm_",
"=_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bandwidth_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"extra_",
"=_",
"{_",
"'",
"Stick",
"y",
"Sess",
"ion",
"'_",
":_",
"'",
"off",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Health",
"Check",
"'_",
":_",
"'",
"off",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Listen",
"er",
"Port",
"'_",
":_",
"8080_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"self_",
"._",
"driver_",
"._",
"ex",
"\\u",
"create",
"\\u",
"listener_",
"(_",
"self_",
"._",
"balancer",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"back",
"end",
"\\u",
"port_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"protocol_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"algorithm_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"bandwidth_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"self_",
"._",
"extra_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ex",
"\\u",
"start",
"\\u",
"listener_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"SL",
"BM",
"ock",
"Http_",
"._",
"type_",
"=_",
"'",
"start",
"\\u",
"listen",
"er",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"\\u",
"id_",
"=_",
"'",
"tests",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"port_",
"=_",
"80_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"self_",
"._",
"driver_",
"._",
"ex",
"\\u",
"start",
"\\u",
"listener_",
"(_",
"balancer",
"_",
",_",
"self_",
"._",
"port_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ex",
"\\u",
"stop",
"\\u",
"listener_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"SL",
"BM",
"ock",
"Http_",
"._",
"type_",
"=_",
"'",
"stop",
"\\u",
"listen",
"er",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"balancer",
"_",
"=_",
"self_",
"._",
"driver_",
"._",
"get",
"\\u",
"balancer",
"_",
"(_",
"balancer",
"\\u",
"id_",
"=_",
"'",
"tests",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"port_",
"=_",
"80_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"self_",
"._",
"driver_",
"._",
"ex",
"\\u",
"stop",
"\\u",
"listener_",
"(_",
"balancer",
"_",
",_",
"self_",
"._",
"port_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ex",
"\\u",
"upload",
"\\u",
"certificate_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"name_",
"=_",
"'",
"cert",
"1",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"cert_",
"=_",
"'",
"cert",
"-",
"data",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"key_",
"=_",
"'",
"key",
"-",
"data",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"certificate_",
"=_",
"self_",
"._",
"driver_",
"._",
"ex",
"\\u",
"upload",
"\\u",
"certificate_",
"(_",
"self_",
"._",
"name_",
",_",
"self_",
"._",
"cert_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"name_",
",_",
"certificate_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"01",
":",
"DF",
":",
"AB",
":",
"CD",
"'_",
",_",
"certificate_",
"._",
"fingerprint_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ex",
"\\u",
"list",
"\\u",
"certificates",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"certs_",
"=_",
"self_",
"._",
"driver_",
"._",
"ex",
"\\u",
"list",
"\\u",
"certificates",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"2_",
",_",
"len_",
"(_",
"certs_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cert_",
"=_",
"certs_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"139",
"a0",
"060",
"4a",
"d",
"-",
"cn",
"-",
"east",
"-",
"hang",
"zh",
"ou",
"-0",
"1",
"'_",
",_",
"cert_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"abe",
"'_",
",_",
"cert_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"A",
":",
"B",
":",
"E",
"'_",
",_",
"cert_",
"._",
"fingerprint_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ex",
"\\u",
"list",
"\\u",
"certificates",
"\\u",
"ids_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"SL",
"BM",
"ock",
"Http_",
"._",
"type_",
"=_",
"'",
"list",
"\\u",
"certificates",
"\\u",
"ids",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"cert",
"\\u",
"ids_",
"=_",
"[_",
"'",
"cert",
"1",
"'_",
",_",
"'",
"cert",
"2",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"certs_",
"=_",
"self_",
"._",
"driver_",
"._",
"ex",
"\\u",
"list",
"\\u",
"certificates",
"_",
"(_",
"certifica",
"te",
"\\u",
"ids_",
"=_",
"self_",
"._",
"cert",
"\\u",
"ids_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"certs_",
"is_",
"not_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ex",
"\\u",
"delete",
"\\u",
"certificate_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"cert",
"\\u",
"id_",
"=_",
"'",
"cert",
"1",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"self_",
"._",
"driver_",
"._",
"ex",
"\\u",
"delete",
"\\u",
"certificate_",
"(_",
"self_",
"._",
"cert",
"\\u",
"id_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BD",
"river",
"Test",
"Cases_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ex",
"\\u",
"set\\u",
"certifica",
"te",
"\\u",
"name_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"cert",
"\\u",
"id_",
"=_",
"'",
"cert",
"1",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"cert",
"\\u",
"name_",
"=_",
"'",
"cert",
"-",
"name",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"self_",
"._",
"driver_",
"._",
"ex",
"\\u",
"set\\u",
"certifica",
"te",
"\\u",
"name_",
"(_",
"self_",
"._",
"cert",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"cert",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fixtures_",
"=_",
"Load",
"Balance",
"r",
"File",
"Fix",
"tures",
"_",
"(_",
"'",
"sl",
"b",
"'_",
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\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"descri",
"be",
"\\u",
"load",
"\\u",
"balancer",
"s",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"list",
"\\u",
"balancer",
"s",
"\\u",
"ids",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Load",
"Balance",
"r",
"Id",
"'_",
":_",
"','_",
"._",
"join_",
"(_",
"self_",
"._",
"test_",
"._",
"balancer",
"\\u",
"ids_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"descri",
"be",
"\\u",
"load",
"\\u",
"balancer",
"s",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"list",
"\\u",
"balancer",
"s",
"\\u",
"filter",
"s",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Address",
"Type",
"'_",
":_",
"'",
"interne",
"t",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"descri",
"be",
"\\u",
"load",
"\\u",
"balancer",
"s",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"get",
"\\u",
"balancer",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Load",
"Balance",
"r",
"Id",
"'_",
":_",
"'",
"tests",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Delete",
"Load",
"Balance",
"r_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Load",
"Balance",
"r",
"Id",
"'_",
":_",
"'",
"152",
"2",
"9",
"f8",
"856",
"2",
"-",
"cn",
"-",
"hang",
"zh",
"ou",
"-",
"dg",
"-",
"a0",
"1",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"delete",
"\\u",
"load",
"\\u",
"balancer",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Describe",
"Load",
"Balance",
"r",
"Attribute_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"descri",
"be",
"\\u",
"load",
"\\u",
"balancer",
"\\u",
"attribute",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Creat",
"e",
"Load",
"Balance",
"r_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Region",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"region_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Load",
"Balance",
"r",
"Name",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"name_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"balancer",
"\\u",
"keys_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Address",
"Type",
"'_",
":_",
"'",
"ex",
"\\u",
"address",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Intern",
"et",
"Charge",
"Type",
"'_",
":_",
"'",
"ex",
"\\u",
"interne",
"t",
"\\u",
"charge",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Band",
"widt",
"h",
"'_",
":_",
"'",
"ex",
"\\u",
"bandwi",
"dth",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Master",
"Zon",
"e",
"Id",
"'_",
":_",
"'",
"ex",
"\\u",
"master",
"\\u",
"zone",
"\\u",
"id",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Sla",
"ve",
"Zon",
"e",
"Id",
"'_",
":_",
"'",
"ex",
"\\u",
"slave",
"\\u",
"zone",
"\\u",
"id",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"key_",
"in_",
"balancer",
"\\u",
"keys_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"[_",
"key_",
"]_",
"=_",
"str_",
"(_",
"self_",
"._",
"test_",
"._",
"extra_",
"[_",
"balancer",
"\\u",
"keys_",
"[_",
"key_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"create",
"\\u",
"load",
"\\u",
"balancer",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Add",
"Back",
"end",
"Server",
"s_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"id_",
"=_",
"self_",
"._",
"test_",
"._",
"members_",
"[_",
"0_",
"]_",
"._",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"\"",
"Server",
"Id",
"\"_",
"in_",
"url_",
"and_",
"\\u",
"id_",
"in_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"\"",
"Weig",
"ht",
"\"_",
"in_",
"url_",
"and_",
"\"",
"100",
"\"_",
"in_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"add",
"\\u",
"back",
"end",
"\\u",
"server",
"s",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Creat",
"e",
"Load",
"Balance",
"r",
"HTTP",
"Listener_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"create",
"\\u",
"load",
"\\u",
"balancer",
"\\u",
"http",
"\\u",
"listen",
"er",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Start",
"Load",
"Balance",
"r",
"Listener_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"start",
"\\u",
"load",
"\\u",
"balancer",
"\\u",
"listen",
"er",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Remove",
"Back",
"end",
"Server",
"s_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"id_",
"=_",
"self_",
"._",
"test_",
"._",
"member_",
"._",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"server",
"s",
"\\u",
"json_",
"=_",
"'[",
"\"%",
"s",
"\"]'_",
"%_",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"{_",
"'",
"Load",
"Balance",
"r",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"balancer",
"_",
"._",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Back",
"end",
"Server",
"s",
"'_",
":_",
"server",
"s",
"\\u",
"json_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"add",
"\\u",
"back",
"end",
"\\u",
"server",
"s",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"attach",
"\\u",
"compute",
"\\u",
"node",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"descri",
"be",
"\\u",
"load",
"\\u",
"balancer",
"s",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"attach",
"\\u",
"compute",
"\\u",
"node",
"\\u",
"Add",
"Back",
"end",
"Server",
"s_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"id_",
"=_",
"self_",
"._",
"test_",
"._",
"node_",
"._",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"\"",
"Server",
"Id",
"\"_",
"in_",
"url_",
"and_",
"\\u",
"id_",
"in_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"\"",
"Weig",
"ht",
"\"_",
"in_",
"url_",
"and_",
"\"",
"100",
"\"_",
"in_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"add",
"\\u",
"back",
"end",
"\\u",
"server",
"s",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"create",
"\\u",
"listen",
"er",
"\\u",
"Creat",
"e",
"Load",
"Balance",
"r",
"HTTP",
"Listener_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Load",
"Balance",
"r",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"balancer",
"_",
"._",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Region",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"region_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Listen",
"er",
"Port",
"'_",
":_",
"str_",
"(_",
"self_",
"._",
"test_",
"._",
"balancer",
"_",
"._",
"port_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Back",
"end",
"Server",
"Port",
"'_",
":_",
"str_",
"(_",
"self_",
"._",
"test_",
"._",
"back",
"end",
"\\u",
"port_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Schedule",
"r",
"'_",
":_",
"'",
"wr",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Band",
"widt",
"h",
"'_",
":_",
"'",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Stick",
"y",
"Sess",
"ion",
"'_",
":_",
"'",
"off",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Health",
"Check",
"'_",
":_",
"'",
"off",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"create",
"\\u",
"load",
"\\u",
"balancer",
"\\u",
"http",
"\\u",
"listen",
"er",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"create",
"\\u",
"listen",
"er",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"descri",
"be",
"\\u",
"load",
"\\u",
"balancer",
"s",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"create",
"\\u",
"listen",
"er",
"\\u",
"override",
"\\u",
"port",
"\\u",
"Creat",
"e",
"Load",
"Balance",
"r",
"HTTP",
"Listener_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Load",
"Balance",
"r",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"balancer",
"_",
"._",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Region",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"region_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Listen",
"er",
"Port",
"'_",
":_",
"str_",
"(_",
"self_",
"._",
"test_",
"._",
"extra_",
"[_",
"'",
"Listen",
"er",
"Port",
"'_",
"]_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Back",
"end",
"Server",
"Port",
"'_",
":_",
"str_",
"(_",
"self_",
"._",
"test_",
"._",
"back",
"end",
"\\u",
"port_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Schedule",
"r",
"'_",
":_",
"'",
"wr",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Band",
"widt",
"h",
"'_",
":_",
"'",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Stick",
"y",
"Sess",
"ion",
"'_",
":_",
"'",
"off",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Health",
"Check",
"'_",
":_",
"'",
"off",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"create",
"\\u",
"load",
"\\u",
"balancer",
"\\u",
"http",
"\\u",
"listen",
"er",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"create",
"\\u",
"listen",
"er",
"\\u",
"override",
"\\u",
"port",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"descri",
"be",
"\\u",
"load",
"\\u",
"balancer",
"s",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"start",
"\\u",
"listen",
"er",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"start",
"\\u",
"listen",
"er",
"\\u",
"Start",
"Load",
"Balance",
"r",
"Listener_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Listen",
"er",
"Port",
"'_",
":_",
"str_",
"(_",
"self_",
"._",
"test_",
"._",
"port_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"Start",
"Load",
"Balance",
"r",
"Listener_",
"(_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"stop",
"\\u",
"listen",
"er",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"Describe",
"Load",
"Balance",
"rs_",
"(_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"stop",
"\\u",
"listen",
"er",
"\\u",
"Sto",
"p",
"Load",
"Balance",
"r",
"Listener_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Listen",
"er",
"Port",
"'_",
":_",
"str_",
"(_",
"self_",
"._",
"test_",
"._",
"port_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"Start",
"Load",
"Balance",
"r",
"Listener_",
"(_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Upload",
"Server",
"Certificate_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"upload",
"\\u",
"server",
"\\u",
"certifica",
"te",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Describe",
"Server",
"Certificat",
"es_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"descri",
"be",
"\\u",
"server",
"\\u",
"certificates",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"list",
"\\u",
"certificates",
"\\u",
"ids",
"\\u",
"Describe",
"Server",
"Certificat",
"es_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Region",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"region_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Server",
"Certificat",
"e",
"Id",
"'_",
":_",
"','_",
"._",
"join_",
"(_",
"self_",
"._",
"test_",
"._",
"cert",
"\\u",
"ids_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"descri",
"be",
"\\u",
"server",
"\\u",
"certificates",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Delete",
"Server",
"Certificate_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Region",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"region_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Server",
"Certificat",
"e",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"cert",
"\\u",
"id_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"delete",
"\\u",
"server",
"\\u",
"certifica",
"te",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BM",
"ock",
"Http_",
"(_",
"Moc",
"k",
"Http",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Set",
"Server",
"Certificat",
"e",
"Name_",
"(_",
"self_",
",_",
"method_",
",_",
"url_",
",_",
"body_",
",_",
"headers_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"=_",
"{_",
"'",
"Region",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"region_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Server",
"Certificat",
"e",
"Id",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"cert",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Server",
"Certificat",
"e",
"Name",
"'_",
":_",
"self_",
"._",
"test_",
"._",
"cert",
"\\u",
"name_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Ur",
"l",
"Contain",
"s",
"Query",
"Params_",
"(_",
"url_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"self_",
"._",
"fixtures_",
"._",
"load_",
"(_",
"'",
"set\\u",
"server",
"\\u",
"certifica",
"te",
"\\u",
"name",
".",
"xml",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"httplib_",
"._",
"OK_",
",_",
"body_",
",_",
"{_",
"}_",
",_",
"httplib_",
"._",
"responses_",
"[_",
"httplib_",
"._",
"OK_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Assert",
"Dict",
"Mixin_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Assert",
"Dict",
"Mixin_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"assert",
"\\u",
"dict",
"\\u",
"equals_",
"(_",
"self_",
",_",
"expected_",
",_",
"actual_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected",
"\\u",
"keys_",
"=_",
"set_",
"(_",
"expected_",
"._",
"keys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"actual",
"\\u",
"keys_",
"=_",
"set_",
"(_",
"actual_",
"._",
"keys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"expected",
"\\u",
"keys_",
")_",
",_",
"len_",
"(_",
"actual",
"\\u",
"keys_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"0_",
",_",
"len_",
"(_",
"expected",
"\\u",
"keys_",
"-_",
"actual",
"\\u",
"keys_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"key_",
"in_",
"expected_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected_",
"[_",
"key_",
"]_",
",_",
"actual_",
"[_",
"key_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"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_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\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 ",
" _",
"self_",
"._",
"listener_",
"=_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"Listener_",
"._",
"create_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"80_",
",_",
"8080_",
",_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
",_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"{_",
"'",
"Stick",
"y",
"Sess",
"ion",
"'_",
":_",
"'",
"on",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Stick",
"y",
"Sess",
"ion",
"Type",
"'_",
":_",
"'",
"insert",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Health",
"Check",
"'_",
":_",
"'",
"on",
"'_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"require",
"d\\u",
"params_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected_",
"=_",
"{_",
"'",
"Action",
"'_",
":_",
"'",
"Creat",
"e",
"Load",
"Balance",
"r",
"HTTP",
"Listen",
"er",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Listen",
"er",
"Port",
"'_",
":_",
"80_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Back",
"end",
"Server",
"Port",
"'_",
":_",
"8080_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Schedule",
"r",
"'_",
":_",
"'",
"wr",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Band",
"widt",
"h",
"'_",
":_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Stick",
"y",
"Sess",
"ion",
"'_",
":_",
"'",
"on",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Health",
"Check",
"'_",
":_",
"'",
"on",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"\\u",
"dict",
"\\u",
"equals_",
"(_",
"expected_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"listener_",
"._",
"get",
"\\u",
"require",
"d\\u",
"params_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"option",
"al",
"\\u",
"params_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected_",
"=_",
"{_",
"'",
"Stick",
"y",
"Sess",
"ion",
"Type",
"'_",
":_",
"'",
"insert",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"\\u",
"dict",
"\\u",
"equals_",
"(_",
"expected_",
",_",
"self_",
"._",
"listener_",
"._",
"get",
"\\u",
"option",
"al",
"\\u",
"params_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\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 ",
" _",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"Listen",
"er",
"'_",
"in_",
"str_",
"(_",
"self_",
"._",
"listener_",
")_",
")_",
"\\u\\u\\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_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"s",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"s",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\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 ",
" _",
"self_",
"._",
"listener_",
"=_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"s",
"Listener_",
"._",
"create_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"80_",
",_",
"8080_",
",_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
",_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"{_",
"'",
"Stick",
"y",
"Sess",
"ion",
"'_",
":_",
"'",
"on",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Stick",
"y",
"Sess",
"ion",
"Type",
"'_",
":_",
"'",
"insert",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Health",
"Check",
"'_",
":_",
"'",
"on",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Server",
"Certificat",
"e",
"Id",
"'_",
":_",
"'",
"fake",
"-",
"cert",
"1",
"'_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"s",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"require",
"d\\u",
"params_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected_",
"=_",
"{_",
"'",
"Action",
"'_",
":_",
"'",
"Creat",
"e",
"Load",
"Balance",
"r",
"HTTP",
"SL",
"iste",
"ner",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Listen",
"er",
"Port",
"'_",
":_",
"80_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Back",
"end",
"Server",
"Port",
"'_",
":_",
"8080_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Schedule",
"r",
"'_",
":_",
"'",
"wr",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Band",
"widt",
"h",
"'_",
":_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Stick",
"y",
"Sess",
"ion",
"'_",
":_",
"'",
"on",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Health",
"Check",
"'_",
":_",
"'",
"on",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Server",
"Certificat",
"e",
"Id",
"'_",
":_",
"'",
"fake",
"-",
"cert",
"1",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"\\u",
"dict",
"\\u",
"equals_",
"(_",
"expected_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"listener_",
"._",
"get",
"\\u",
"require",
"d\\u",
"params_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Http",
"s",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"option",
"al",
"\\u",
"params_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected_",
"=_",
"{_",
"'",
"Stick",
"y",
"Sess",
"ion",
"Type",
"'_",
":_",
"'",
"insert",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"\\u",
"dict",
"\\u",
"equals_",
"(_",
"expected_",
",_",
"self_",
"._",
"listener_",
"._",
"get",
"\\u",
"option",
"al",
"\\u",
"params_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Tc",
"p",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Tc",
"p",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\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 ",
" _",
"self_",
"._",
"listener_",
"=_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Tc",
"p",
"Listener_",
"._",
"create_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"80_",
",_",
"8080_",
",_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
",_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"{_",
"'",
"Persisten",
"ce",
"Time",
"out",
"'_",
":_",
"0_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Health",
"Check",
"Doma",
"in",
"'_",
":_",
"''_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Tc",
"p",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"require",
"d\\u",
"params_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected_",
"=_",
"{_",
"'",
"Action",
"'_",
":_",
"'",
"Creat",
"e",
"Load",
"Balance",
"r",
"TC",
"PL",
"iste",
"ner",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Listen",
"er",
"Port",
"'_",
":_",
"80_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Back",
"end",
"Server",
"Port",
"'_",
":_",
"8080_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Schedule",
"r",
"'_",
":_",
"'",
"wr",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Band",
"widt",
"h",
"'_",
":_",
"1_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"\\u",
"dict",
"\\u",
"equals_",
"(_",
"expected_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"listener_",
"._",
"get",
"\\u",
"require",
"d\\u",
"params_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Tc",
"p",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"option",
"al",
"\\u",
"params_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected_",
"=_",
"{_",
"'",
"Persisten",
"ce",
"Time",
"out",
"'_",
":_",
"0_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Health",
"Check",
"Doma",
"in",
"'_",
":_",
"''_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"\\u",
"dict",
"\\u",
"equals_",
"(_",
"expected_",
",_",
"self_",
"._",
"listener_",
"._",
"get",
"\\u",
"option",
"al",
"\\u",
"params_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Udp",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Udp",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\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 ",
" _",
"self_",
"._",
"listener_",
"=_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Udp",
"Listener_",
"._",
"create_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"80_",
",_",
"8080_",
",_",
"Algorithm_",
"._",
"WEIGHT",
"ED",
"\\u",
"ROUND",
"\\u",
"ROB",
"IN_",
",_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra_",
"=_",
"{_",
"'",
"Persisten",
"ce",
"Time",
"out",
"'_",
":_",
"0_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Udp",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"require",
"d\\u",
"params_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected_",
"=_",
"{_",
"'",
"Action",
"'_",
":_",
"'",
"Creat",
"e",
"Load",
"Balance",
"r",
"UD",
"PL",
"iste",
"ner",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Listen",
"er",
"Port",
"'_",
":_",
"80_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Back",
"end",
"Server",
"Port",
"'_",
":_",
"8080_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Schedule",
"r",
"'_",
":_",
"'",
"wr",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Band",
"widt",
"h",
"'_",
":_",
"1_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"\\u",
"dict",
"\\u",
"equals_",
"(_",
"expected_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"listener_",
"._",
"get",
"\\u",
"require",
"d\\u",
"params_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"SL",
"BL",
"oad",
"Balance",
"r",
"Udp",
"Listen",
"er",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
",_",
"Assert",
"Dict",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"option",
"al",
"\\u",
"params_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected_",
"=_",
"{_",
"'",
"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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
] |
Variable defined multiple times | OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/utils/__init__.py | [
{
"content": "\"\"\"\nA selection of cross-compatible functions for Python 2 and 3.\n\nThis module exports useful functions for 2/3 compatible code:\n\n * bind_method: binds functions to classes\n * ``native_str_to_bytes`` and ``bytes_to_native_str``\n * ``native_str``: always equal to the native platform string object (because\n this may be shadowed by imports from future.builtins)\n * lists: lrange(), lmap(), lzip(), lfilter()\n * iterable method compatibility:\n - iteritems, iterkeys, itervalues\n - viewitems, viewkeys, viewvalues\n\n These use the original method if available, otherwise they use items,\n keys, values.\n\n * types:\n\n * text_type: unicode in Python 2, str in Python 3\n * binary_type: str in Python 2, bythes in Python 3\n * string_types: basestring in Python 2, str in Python 3\n\n * bchr(c):\n Take an integer and make a 1-character byte string\n * bord(c)\n Take the result of indexing on a byte string and make an integer\n * tobytes(s)\n Take a text string, a byte string, or a sequence of characters taken\n from a byte string, and make a byte string.\n \n * raise_from()\n * raise_with_traceback()\n\nThis module also defines these decorators:\n\n * ``python_2_unicode_compatible``\n * ``with_metaclass``\n * ``implements_iterator``\n\nSome of the functions in this module come from the following sources:\n\n * Jinja2 (BSD licensed: see\n https://github.com/mitsuhiko/jinja2/blob/master/LICENSE)\n * Pandas compatibility module pandas.compat\n * six.py by Benjamin Peterson\n * Django\n\"\"\"\n\nimport types\nimport sys\nimport numbers\nimport functools\nimport copy\nimport inspect\n\n\nPY3 = sys.version_info[0] == 3\nPY2 = sys.version_info[0] == 2\nPY26 = sys.version_info[0:2] == (2, 6)\nPY27 = sys.version_info[0:2] == (2, 7)\nPYPY = hasattr(sys, 'pypy_translation_info')\n\n\n\n\n\n\n# Definitions from pandas.compat and six.py follow:\nif PY3:\n\n string_types = str,\n integer_types = int,\n class_types = type,\n text_type = str\n binary_type = bytes\n\nelse:\n # Python 2\n\n string_types = basestring,\n integer_types = (int, long)\n class_types = (type, types.ClassType)\n text_type = unicode\n binary_type = str\n\n###\n\nif PY3:\nelse:\n # Python 2\n\ntobytes.__doc__ = \"\"\"\n Encodes to latin-1 (where the first 256 chars are the same as\n ASCII.)\n \"\"\"\n\nif PY3:\n\n\nelse:\n # Python 2\n\n\n\nnative_str_to_bytes.__doc__ = \"\"\"\n On Py3, returns an encoded string.\n On Py2, returns a newbytes type, ignoring the ``encoding`` argument.\n \"\"\"\n\nif PY3:\n # list-producing versions of the major Python iterating functions\n\n\n\nelse:\n import __builtin__\n # Python 2-builtin ranges produce lists\n lrange = __builtin__.range\n lzip = __builtin__.zip\n lmap = __builtin__.map\n lfilter = __builtin__.filter\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 PY3:\n\n\n\nelse:\n\n exec('''\ndef raise_(tp, value=None, tb=None):\n raise tp, value, tb\n\ndef raise_with_traceback(exc, traceback=Ellipsis):\n if traceback == Ellipsis:\n _, _, traceback = sys.exc_info()\n raise exc, None, traceback\n'''.strip())\n\n\nraise_with_traceback.__doc__ = (\n\"\"\"Raise exception with existing traceback.\nIf traceback is not passed, uses sys.exc_info() to get traceback.\"\"\"\n)\n\n\n# Deprecated alias for backward compatibility with ``future`` versions < 0.11:\nreraise = raise_\n\n\n\nif PY3:\n get_next = lambda x: x.next\nelse:\n get_next = lambda x: x.__next__\n\n\n\n\n\n# The native platform string and bytes types. Useful because ``str`` and\n# ``bytes`` are redefined on Py2 by ``from future.builtins import *``.\nnative_str = str\nnative_bytes = bytes\n\n\n\n\n\n\n\n\n\n\n\n\n# Implementation of exec_ is from ``six``:\nif PY3:\n import builtins\n exec_ = getattr(builtins, \"exec\")\nelse:\n\n\n# Defined here for backward compatibility:\n\n\n\n# listvalues and listitems definitions from Nick Coghlan's (withdrawn)\n# PEP 496:\ntry:\n dict.iteritems\nexcept AttributeError:\n # Python 3\nelse:\n # Python 2\n\nif PY3:\nelse:\n\n\n__all__ = ['PY2', 'PY26', 'PY3', 'PYPY',\n 'as_native_str', 'bind_method', 'bord', 'bstr',\n 'bytes_to_native_str', 'encode_filename', 'ensure_new_type',\n 'exec_', 'get_next', 'getexception', 'implements_iterator',\n 'is_new_style', 'isbytes', 'isidentifier', 'isint',\n 'isnewbytes', 'istext', 'iteritems', 'iterkeys', 'itervalues',\n 'lfilter', 'listitems', 'listvalues', 'lmap', 'lrange',\n 'lzip', 'native', 'native_bytes', 'native_str',\n 'native_str_to_bytes', 'old_div',\n 'python_2_unicode_compatible', 'raise_',\n 'raise_with_traceback', 'reraise', 'text_to_native_str',\n 'tobytes', 'viewitems', 'viewkeys', 'viewvalues',\n 'with_metaclass'\n ]\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"A",
" ",
"selection",
" ",
"of",
" ",
"cross",
"-",
"compatible",
" ",
"function",
"s",
" ",
"for",
" ",
"Pyth",
"on",
" ",
"2",
" ",
"and",
" ",
"3",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Thi",
"s",
" ",
"module",
" ",
"export",
"s",
" ",
"usef",
"ul",
" ",
"function",
"s",
" ",
"for",
" ",
"2",
"/",
"3",
" ",
"compatible",
" ",
"code",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"bind",
"\\u",
"method",
":",
" ",
"bind",
"s",
" ",
"function",
"s",
" ",
"to",
" ",
"classe",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"``",
"nativ",
"e\\u",
"str",
"\\u",
"to",
"\\u",
"bytes",
"``",
" ",
"and",
" ",
"``",
"bytes",
"\\u",
"to",
"\\u",
"nativ",
"e\\u",
"str",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"``",
"nativ",
"e\\u",
"str",
"``",
":",
" ",
"alw",
"ay",
"s",
" ",
"equal",
" ",
"to",
" ",
"the",
" ",
"nativ",
"e",
" ",
"platform",
" ",
"string",
" ",
"object",
" ",
"(",
"bec",
"aus",
"e",
"\\",
"10",
";",
" ",
" ",
"this",
" ",
"may",
" ",
"be",
" ",
"shadow",
"ed",
" ",
"by",
" ",
"import",
"s",
" ",
"from",
" ",
"future",
".",
"bui",
"lti",
"ns",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"lists",
":",
" ",
"lra",
"nge",
"()",
",",
" ",
"lma",
"p",
"()",
",",
" ",
"lz",
"ip",
"()",
",",
" ",
"lfil",
"ter",
"()",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"iterable",
" ",
"method",
" ",
"compatibility",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"iter",
"items",
",",
" ",
"iter",
"keys",
",",
" ",
"iter",
"values",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"view",
"items",
",",
" ",
"view",
"keys",
",",
" ",
"view",
"values",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
"se",
" ",
"use",
" ",
"the",
" ",
"original",
" ",
"method",
" ",
"if",
" ",
"avail",
"able",
",",
" ",
"other",
"wis",
"e",
" ",
"the",
"y",
" ",
"use",
" ",
"items",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"keys",
",",
" ",
"values",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"types",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"text",
"\\u",
"type",
":",
" ",
"unicode",
" ",
"in",
" ",
"Pyth",
"on",
" ",
"2",
",",
" ",
"str",
" ",
"in",
" ",
"Pyth",
"on",
" ",
"3",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"binar",
"y",
"\\u",
"type",
":",
" ",
"str",
" ",
"in",
" ",
"Pyth",
"on",
" ",
"2",
",",
" ",
"byt",
"hes",
" ",
"in",
" ",
"Pyth",
"on",
" ",
"3",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"string",
"\\u",
"types",
":",
" ",
"basest",
"ring",
" ",
"in",
" ",
"Pyth",
"on",
" ",
"2",
",",
" ",
"str",
" ",
"in",
" ",
"Pyth",
"on",
" ",
"3",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"bc",
"hr",
"(",
"c",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Tak",
"e",
" ",
"an",
" ",
"integ",
"er",
" ",
"and",
" ",
"make",
" ",
"a",
" ",
"1",
"-",
"character",
" ",
"byte",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"bor",
"d",
"(",
"c",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Tak",
"e",
" ",
"the",
" ",
"result",
" ",
"of",
" ",
"indexing",
" ",
"on",
" ",
"a",
" ",
"byte",
" ",
"string",
" ",
"and",
" ",
"make",
" ",
"an",
" ",
"integ",
"er",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"tob",
"ytes",
"(",
"s",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Tak",
"e",
" ",
"a",
" ",
"text",
" ",
"string",
",",
" ",
"a",
" ",
"byte",
" ",
"string",
",",
" ",
"or",
" ",
"a",
" ",
"sequence",
" ",
"of",
" ",
"character",
"s",
" ",
"take",
"n",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"from",
" ",
"a",
" ",
"byte",
" ",
"string",
",",
" ",
"and",
" ",
"make",
" ",
"a",
" ",
"byte",
" ",
"string",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"raise",
"\\u",
"from",
"()",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"raise",
"\\u",
"with",
"\\u",
"traceback",
"()",
"\\",
"10",
";",
"\\",
"10",
";",
"Thi",
"s",
" ",
"module",
" ",
"als",
"o",
" ",
"defin",
"es",
" ",
"these",
" ",
"decorat",
"ors",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"``",
"python",
"\\u",
"2",
"\\u",
"unicode",
"\\u",
"compatible",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"``",
"with",
"\\u",
"metaclass",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"``",
"implement",
"s",
"\\u",
"iter",
"ator",
"``",
"\\",
"10",
";",
"\\",
"10",
";",
"Some",
" ",
"of",
" ",
"the",
" ",
"function",
"s",
" ",
"in",
" ",
"this",
" ",
"module",
" ",
"come",
" ",
"from",
" ",
"the",
" ",
"follow",
"ing",
" ",
"source",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"Jin",
"ja",
"2",
" ",
"(",
"BS",
"D",
" ",
"license",
"d",
":",
" ",
"see",
"\\",
"10",
";",
" ",
" ",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"mit",
"su",
"hi",
"ko",
"/",
"jin",
"ja",
"2",
"/",
"blob",
"/",
"master",
"/",
"LICENSE",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"Pan",
"das",
" ",
"compatibility",
" ",
"module",
" ",
"panda",
"s",
".",
"compa",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"si",
"x",
".",
"py",
" ",
"by",
" ",
"Ben",
"jam",
"in",
" ",
"Peter",
"son",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"Dj",
"ang",
"o",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"types_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"numbers_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"functools_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"copy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"inspect_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"PY",
"3_",
"=_",
"sys_",
"._",
"version",
"\\u",
"info_",
"[_",
"0_",
"]_",
"==_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PY",
"2_",
"=_",
"sys_",
"._",
"version",
"\\u",
"info_",
"[_",
"0_",
"]_",
"==_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PY",
"26_",
"=_",
"sys_",
"._",
"version",
"\\u",
"info_",
"[_",
"0_",
":_",
"2_",
"]_",
"==_",
"(_",
"2_",
",_",
"6_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PY",
"27_",
"=_",
"sys_",
"._",
"version",
"\\u",
"info_",
"[_",
"0_",
":_",
"2_",
"]_",
"==_",
"(_",
"2_",
",_",
"7_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PY",
"PY",
"_",
"=_",
"hasattr_",
"(_",
"sys_",
",_",
"'",
"pypy",
"\\u",
"translatio",
"n",
"\\u",
"info",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Definit",
"ion",
"s",
" ",
"from",
" ",
"panda",
"s",
".",
"compa",
"t",
" ",
"and",
" ",
"si",
"x",
".",
"py",
" ",
"follow",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"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_",
"string",
"\\u",
"types_",
"=_",
"str_",
",_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"integ",
"er",
"\\u",
"types_",
"=_",
"int_",
",_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"class",
"\\u",
"types_",
"=_",
"type_",
",_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"text",
"\\u",
"type_",
"=_",
"str_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"binar",
"y",
"\\u",
"type_",
"=_",
"bytes_",
"\\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_",
"#",
" ",
"Pyth",
"on",
" ",
"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_",
"string",
"\\u",
"types_",
"=_",
"basestring_",
",_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"integ",
"er",
"\\u",
"types_",
"=_",
"(_",
"int_",
",_",
"long_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"class",
"\\u",
"types_",
"=_",
"(_",
"type_",
",_",
"types_",
"._",
"Class",
"Type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"text",
"\\u",
"type_",
"=_",
"unicode_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"binar",
"y",
"\\u",
"type_",
"=_",
"str_",
"\\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_",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Pyth",
"on",
" ",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"tob",
"ytes_",
"._",
"\\u\\u",
"doc\\u\\u_",
"=_",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Encode",
"s",
" ",
"to",
" ",
"latin",
"-1",
" ",
"(",
"where",
" ",
"the",
" ",
"first",
" ",
"256",
" ",
"char",
"s",
" ",
"are",
" ",
"the",
" ",
"same",
" ",
"as",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ASCII",
".)",
"\\",
"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\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Pyth",
"on",
" ",
"2_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"nativ",
"e\\u",
"str",
"\\u",
"to",
"\\u",
"bytes_",
"._",
"\\u\\u",
"doc\\u\\u_",
"=_",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"On",
" ",
"Py",
"3",
",",
" ",
"return",
"s",
" ",
"an",
" ",
"encode",
"d",
" ",
"string",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"On",
" ",
"Py",
"2",
",",
" ",
"return",
"s",
" ",
"a",
" ",
"newb",
"ytes",
" ",
"type",
",",
" ",
"ign",
"orin",
"g",
" ",
"the",
" ",
"``",
"encoding",
"``",
" ",
"argu",
"ment",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"PY",
"3_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"list",
"-",
"produc",
"ing",
" ",
"version",
"s",
" ",
"of",
" ",
"the",
" ",
"major",
" ",
"Pyth",
"on",
" ",
"iterati",
"ng",
" ",
"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\\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 ",
" _",
"import_",
"\\u\\u",
"builtin\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Pyth",
"on",
" ",
"2",
"-",
"bui",
"lti",
"n",
" ",
"ranges",
" ",
"produce",
" ",
"lists_",
"\\u\\u\\uNL\\u\\u\\u_",
"lra",
"nge_",
"=_",
"\\u\\u",
"builtin\\u\\u_",
"._",
"range_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lz",
"ip_",
"=_",
"\\u\\u",
"builtin\\u\\u_",
"._",
"zip_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lma",
"p_",
"=_",
"\\u\\u",
"builtin\\u\\u_",
"._",
"map_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lfil",
"ter_",
"=_",
"\\u\\u",
"builtin\\u\\u_",
"._",
"filter_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",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\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"exec_",
"(_",
"'''",
"\\",
"10",
";",
"def",
" ",
"raise",
"\\u(",
"tp",
",",
" ",
"value",
"=",
"Non",
"e",
",",
" ",
"tb",
"=",
"Non",
"e",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"raise",
" ",
"tp",
",",
" ",
"value",
",",
" ",
"tb",
"\\",
"10",
";",
"\\",
"10",
";",
"def",
" ",
"raise",
"\\u",
"with",
"\\u",
"traceback",
"(",
"exc",
",",
" ",
"traceback",
"=",
"Ellips",
"is",
"):",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"if",
" ",
"traceback",
" ",
"==",
" ",
"Ellips",
"is",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\u",
",",
" ",
"\\u",
",",
" ",
"traceback",
" ",
"=",
" ",
"sys",
".",
"exc",
"\\u",
"info",
"()",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"raise",
" ",
"exc",
",",
" ",
"Non",
"e",
",",
" ",
"traceback",
"\\",
"10",
";'",
"''_",
"._",
"strip_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"raise",
"\\u",
"with",
"\\u",
"traceback_",
"._",
"\\u\\u",
"doc\\u\\u_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"Rai",
"se",
" ",
"exception",
" ",
"with",
" ",
"exist",
"ing",
" ",
"traceback",
".",
"\\",
"10",
";",
"If",
" ",
"traceback",
" ",
"is",
" ",
"not",
" ",
"pass",
"ed",
",",
" ",
"use",
"s",
" ",
"sys",
".",
"exc",
"\\u",
"info",
"()",
" ",
"to",
" ",
"get",
" ",
"traceback",
".\"\"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Dep",
"reca",
"ted",
" ",
"alias",
" ",
"for",
" ",
"back",
"ward",
" ",
"compatibility",
" ",
"with",
" ",
"``",
"future",
"``",
" ",
"version",
"s",
" ",
"<",
" ",
"0.11",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"reraise",
"_",
"=_",
"raise",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\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_",
"PY",
"3_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"get",
"\\u",
"next_",
"=_",
"lambda_",
"x_",
":_",
"x_",
"._",
"next_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"get",
"\\u",
"next_",
"=_",
"lambda_",
"x_",
":_",
"x_",
"._",
"\\u\\u",
"next\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"nativ",
"e",
" ",
"platform",
" ",
"string",
" ",
"and",
" ",
"bytes",
" ",
"types",
".",
" ",
"Us",
"efu",
"l",
" ",
"bec",
"aus",
"e",
" ",
"``",
"str",
"``",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"``",
"bytes",
"``",
" ",
"are",
" ",
"rede",
"fined",
" ",
"on",
" ",
"Py",
"2",
" ",
"by",
" ",
"``",
"from",
" ",
"future",
".",
"bui",
"lti",
"ns",
" ",
"import",
" ",
"*",
"``.",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"nativ",
"e\\u",
"str_",
"=_",
"str_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"nativ",
"e\\u",
"bytes_",
"=_",
"bytes_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Implementation",
" ",
"of",
" ",
"exec",
"\\u",
" ",
"is",
" ",
"from",
" ",
"``",
"si",
"x",
"``",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"PY",
"3_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"builtins_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"exec\\u_",
"=_",
"getattr_",
"(_",
"builtins_",
",_",
"\"",
"exec",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Define",
"d",
" ",
"here",
" ",
"for",
" ",
"back",
"ward",
" ",
"compatibility",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"list",
"values",
" ",
"and",
" ",
"listi",
"tem",
"s",
" ",
"definit",
"ion",
"s",
" ",
"from",
" ",
"Nick",
" ",
"Cog",
"hla",
"n",
"'",
"s",
" ",
"(",
"withdraw",
"n",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"PE",
"P",
" ",
"496",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dict_",
"._",
"iteritems_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Attribute",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Pyth",
"on",
" ",
"3_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Pyth",
"on",
" ",
"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_",
"\\u\\u\\uDEDENT\\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\\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",
"all\\u\\u_",
"=_",
"[_",
"'",
"PY",
"2",
"'_",
",_",
"'",
"PY",
"2",
"6",
"'_",
",_",
"'",
"PY",
"3",
"'_",
",_",
"'",
"PY",
"PY",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"as",
"\\u",
"nativ",
"e\\u",
"str",
"'_",
",_",
"'",
"bind",
"\\u",
"method",
"'_",
",_",
"'",
"bor",
"d",
"'_",
",_",
"'",
"bst",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bytes",
"\\u",
"to",
"\\u",
"nativ",
"e\\u",
"str",
"'_",
",_",
"'",
"encode",
"\\u",
"filename",
"'_",
",_",
"'",
"ensure",
"\\u",
"new",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"exec",
"\\u'_",
",_",
"'",
"get",
"\\u",
"next",
"'_",
",_",
"'",
"gete",
"xcept",
"ion",
"'_",
",_",
"'",
"implement",
"s",
"\\u",
"iter",
"ator",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"is",
"\\u",
"new",
"\\u",
"style",
"'_",
",_",
"'",
"isb",
"ytes",
"'_",
",_",
"'",
"isi",
"denti",
"fier",
"'_",
",_",
"'",
"isin",
"t",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"isn",
"ew",
"bytes",
"'_",
",_",
"'",
"iste",
"xt",
"'_",
",_",
"'",
"iter",
"items",
"'_",
",_",
"'",
"iter",
"keys",
"'_",
",_",
"'",
"iter",
"values",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"lfil",
"ter",
"'_",
",_",
"'",
"listi",
"tem",
"s",
"'_",
",_",
"'",
"list",
"values",
"'_",
",_",
"'",
"lma",
"p",
"'_",
",_",
"'",
"lra",
"nge",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"lz",
"ip",
"'_",
",_",
"'",
"nativ",
"e",
"'_",
",_",
"'",
"nativ",
"e\\u",
"bytes",
"'_",
",_",
"'",
"nativ",
"e\\u",
"str",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"nativ",
"e\\u",
"str",
"\\u",
"to",
"\\u",
"bytes",
"'_",
",_",
"'",
"old",
"\\u",
"div",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"python",
"\\u",
"2",
"\\u",
"unicode",
"\\u",
"compatible",
"'_",
",_",
"'",
"raise",
"\\u'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"raise",
"\\u",
"with",
"\\u",
"traceback",
"'_",
",_",
"'",
"reraise",
"'_",
",_",
"'",
"text",
"\\u",
"to",
"\\u",
"nativ",
"e\\u",
"str",
"'_",
",_",
"\\u\\u\\uNL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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | pebble/cloudpebble/utils/s3.py | [
{
"content": "import boto\nfrom boto.s3.key import Key\nfrom boto.s3.connection import OrdinaryCallingFormat\nfrom django.conf import settings\nimport urllib\n\n\nif settings.AWS_ENABLED:\n if settings.AWS_S3_FAKE_S3 is None:\n _s3 = boto.connect_s3(settings.AWS_ACCESS_KEY_ID, settings.AWS_SECRET_ACCESS_KEY)\n else:\n host, port = (settings.AWS_S3_FAKE_S3.split(':', 2) + [80])[:2]\n port = int(port)\n _s3 = boto.connect_s3(\"key_id\", \"secret_key\", is_secure=False, port=port,\n host=host, calling_format=OrdinaryCallingFormat())\n _ensure_bucket_exists(_s3, settings.AWS_S3_SOURCE_BUCKET)\n _ensure_bucket_exists(_s3, settings.AWS_S3_EXPORT_BUCKET)\n _ensure_bucket_exists(_s3, settings.AWS_S3_BUILDS_BUCKET)\n\n _buckets = {\n 'source': _s3.get_bucket(settings.AWS_S3_SOURCE_BUCKET),\n 'export': _s3.get_bucket(settings.AWS_S3_EXPORT_BUCKET),\n 'builds': _s3.get_bucket(settings.AWS_S3_BUILDS_BUCKET),\n }\nelse:\n _s3 = None\n _buckets = None\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"boto_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"boto_",
"._",
"s3_",
"._",
"key_",
"import_",
"Key_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"boto_",
"._",
"s3_",
"._",
"connection_",
"import_",
"Ord",
"inary",
"Call",
"ing",
"Format_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"urllib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"settings_",
"._",
"AW",
"S",
"\\u",
"ENABLED_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"settings_",
"._",
"AW",
"S",
"\\u",
"S",
"3",
"\\u",
"FAKE",
"\\u",
"S3_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"s3_",
"=_",
"boto_",
"._",
"connect",
"\\u",
"s3_",
"(_",
"settings_",
"._",
"AW",
"S",
"\\u",
"ACCESS",
"\\u",
"KEY",
"\\u",
"ID_",
",_",
"settings_",
"._",
"AW",
"S",
"\\u",
"SEC",
"RET",
"\\u",
"ACCESS",
"\\u",
"KEY_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"host_",
",_",
"port_",
"=_",
"(_",
"settings_",
"._",
"AW",
"S",
"\\u",
"S",
"3",
"\\u",
"FAKE",
"\\u",
"S3_",
"._",
"split_",
"(_",
"':'_",
",_",
"2_",
")_",
"+_",
"[_",
"80_",
"]_",
")_",
"[_",
":_",
"2_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"port_",
"=_",
"int_",
"(_",
"port_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"s3_",
"=_",
"boto_",
"._",
"connect",
"\\u",
"s3_",
"(_",
"\"",
"key",
"\\u",
"id",
"\"_",
",_",
"\"",
"secret",
"\\u",
"key",
"\"_",
",_",
"is",
"\\u",
"secure_",
"=_",
"False_",
",_",
"port_",
"=_",
"port_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"host_",
"=_",
"host_",
",_",
"calling",
"\\u",
"format_",
"=_",
"Ord",
"inary",
"Call",
"ing",
"Format_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"ensure",
"\\u",
"bucket",
"\\u",
"exists_",
"(_",
"\\u",
"s3_",
",_",
"settings_",
"._",
"AW",
"S",
"\\u",
"S",
"3",
"\\u",
"SOU",
"RC",
"E",
"\\u",
"BUCKET",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"ensure",
"\\u",
"bucket",
"\\u",
"exists_",
"(_",
"\\u",
"s3_",
",_",
"settings_",
"._",
"AW",
"S",
"\\u",
"S",
"3",
"\\u",
"EXPORT",
"\\u",
"BUCKET",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"ensure",
"\\u",
"bucket",
"\\u",
"exists_",
"(_",
"\\u",
"s3_",
",_",
"settings_",
"._",
"AW",
"S",
"\\u",
"S",
"3",
"\\u",
"BUILD",
"S",
"\\u",
"BUCKET",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u",
"buckets_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"source",
"'_",
":_",
"\\u",
"s3_",
"._",
"get",
"\\u",
"bucket_",
"(_",
"settings_",
"._",
"AW",
"S",
"\\u",
"S",
"3",
"\\u",
"SOU",
"RC",
"E",
"\\u",
"BUCKET",
"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"export",
"'_",
":_",
"\\u",
"s3_",
"._",
"get",
"\\u",
"bucket_",
"(_",
"settings_",
"._",
"AW",
"S",
"\\u",
"S",
"3",
"\\u",
"EXPORT",
"\\u",
"BUCKET",
"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"builds",
"'_",
":_",
"\\u",
"s3_",
"._",
"get",
"\\u",
"bucket_",
"(_",
"settings_",
"._",
"AW",
"S",
"\\u",
"S",
"3",
"\\u",
"BUILD",
"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akes.scripts.pyflakes as flakes\n except ImportError:\n print(\"Audit requires PyFlakes installed in your system.\")\n sys.exit(-1)\n\n dirs = ['bulbs', 'tests']\n # Add example directories\n #for dir in ['blog',]:\n # dirs.append(os.path.join('examples', dir))\n # TODO: Add test subdirectories\n warns = 0\n for dir in dirs:\n for filename in os.listdir(dir):\n if filename.endswith('.py') and filename != '__init__.py':\n warns += flakes.checkPath(os.path.join(dir, filename))\n if warns > 0:\n print((\"Audit finished with total %d warnings.\" % warns))\n else:\n print(\"No problems found in sourcecode.\")",
"metadata": "root.run_audit.run",
"header": "['class', 'run_audit', '(', 'Command', ')', ':', '___EOS___']",
"index": 25
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"run",
"\\u",
"audit_",
"(_",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"run_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"os_",
",_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"pyfl",
"ake",
"s_",
"._",
"scripts_",
"._",
"pyfl",
"ake",
"s_",
"as_",
"flake",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"\"",
"Audi",
"t",
" ",
"require",
"s",
" ",
"Py",
"Fla",
"kes",
" ",
"install",
"ed",
" ",
"in",
" ",
"your",
" ",
"system",
".\"_",
")_",
"\\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_",
"dirs_",
"=_",
"[_",
"'",
"bulb",
"s",
"'_",
",_",
"'",
"tests",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"example",
" ",
"directories_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"for",
" ",
"dir",
" ",
"in",
" ",
"['",
"blog",
"',",
"]:",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"dirs",
".",
"append",
"(",
"os",
".",
"path",
".",
"join",
"('",
"example",
"s",
"',",
" ",
"dir",
"))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"Add",
" ",
"test",
" ",
"subdir",
"ector",
"ies_",
"\\u\\u\\uNL\\u\\u\\u_",
"warns",
"_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"dir_",
"in_",
"dirs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"filename_",
"in_",
"os_",
"._",
"listdir_",
"(_",
"dir_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"filename_",
"._",
"endswith_",
"(_",
"'.",
"py",
"'_",
")_",
"and_",
"filename_",
"!=_",
"'\\u",
"\\u",
"init",
"\\u\\u",
".",
"py",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"warns",
"_",
"+=_",
"flake",
"s_",
"._",
"check",
"Path_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"dir_",
",_",
"filename_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"warns",
"_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"(_",
"\"",
"Audi",
"t",
" ",
"finish",
"ed",
" ",
"with",
" ",
"total",
" ",
"%",
"d",
" ",
"warn",
"ings",
".\"_",
"%_",
"warns",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"\"",
"No",
" ",
"problem",
"s",
" ",
"found",
" ",
"in",
" ",
"source",
"code",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Implicit string concatenation in a list | jmcnamara/XlsxWriter/examples/chart_combined.py | [
{
"content": "#######################################################################\n#\n# An example of a Combined chart in XlsxWriter.\n#\n# Copyright 2013, John McNamara, [email protected]\n#\nfrom xlsxwriter.workbook import Workbook\n\nworkbook = Workbook('chart_combined.xlsx')\nworksheet = workbook.add_worksheet()\n\n# Add a format for the headings.\nbold = workbook.add_format({'bold': True})\n\n# Add the worksheet data that the charts will refer to.\nheadings = ['Number', 'Batch 1', 'Batch 2']\ndata = [\n [2, 3, 4, 5, 6, 7],\n [10, 40, 50, 20, 10, 50],\n [30, 60, 70, 50, 40, 30],\n]\n\nworksheet.write_row('A1', headings, bold)\nworksheet.write_column('A2', data[0])\nworksheet.write_column('B2', data[1])\nworksheet.write_column('C2', data[2])\n\n#\n# In the first example we will create a combined column and line chart.\n# They will share the same X and Y axes.\n#\n\n# Create a new column chart. This will use this as the primary chart.\ncolumn_chart1 = workbook.add_chart({'type': 'column'})\n\n# Configure the data series for the primary chart.\ncolumn_chart1.add_series({\n 'name': '=Sheet1!$B$1',\n 'categories': '=Sheet1!$A$2:$A$7',\n 'values': '=Sheet1!$B$2:$B$7',\n})\n\n# Create a new column chart. This will use this as the secondary chart.\nline_chart1 = workbook.add_chart({'type': 'line'})\n\n# Configure the data series for the secondary chart.\nline_chart1.add_series({\n 'name': '=Sheet1!$C$1',\n 'categories': '=Sheet1!$A$2:$A$7',\n 'values': '=Sheet1!$C$2:$C$7',\n})\n\n# Combine the charts.\ncolumn_chart1.combine(line_chart1)\n\n# Add a chart title and some axis labels. Note, this is done via the\n# primary chart.\ncolumn_chart1.set_title({ 'name': 'Combined chart - same Y axis'})\ncolumn_chart1.set_x_axis({'name': 'Test number'})\ncolumn_chart1.set_y_axis({'name': 'Sample length (mm)'})\n\n# Insert the chart into the worksheet\nworksheet.insert_chart('E2', column_chart1)\n\n#\n# In the second example we will create a similar combined column and line\n# chart except that the secondary chart will have a secondary Y axis.\n#\n\n# Create a new column chart. This will use this as the primary chart.\ncolumn_chart2 = workbook.add_chart({'type': 'column'})\n\n# Configure the data series for the primary chart.\ncolumn_chart2.add_series({\n 'name': '=Sheet1!$B$1',\n 'categories': '=Sheet1!$A$2:$A$7',\n 'values': '=Sheet1!$B$2:$B$7',\n})\n\n# Create a new column chart. This will use this as the secondary chart.\nline_chart2 = workbook.add_chart({'type': 'line'})\n\n# Configure the data series for the secondary chart. We also set a\n# secondary Y axis via (y2_axis). This is the only difference between\n# this and the first example, apart from the axis label below.\nline_chart2.add_series({\n 'name': '=Sheet1!$C$1',\n 'categories': '=Sheet1!$A$2:$A$7',\n 'values': '=Sheet1!$C$2:$C$7',\n 'y2_axis': True,\n})\n\n# Combine the charts.\ncolumn_chart2.combine(line_chart2)\n\n# Add a chart title and some axis labels.\ncolumn_chart2.set_title({ 'name': 'Combine chart - secondary Y axis'})\ncolumn_chart2.set_x_axis({ 'name': 'Test number'})\ncolumn_chart2.set_y_axis({ 'name': 'Sample length (mm)'})\n\n# Note: the y2 properties are on the secondary chart.\nline_chart2.set_y2_axis({'name': 'Target length (mm)'})\n\n# Insert the chart into the worksheet\nworksheet.insert_chart('E18', column_chart2)\n\nworkbook.close()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Implicit",
"_",
"string_",
"concate",
"nation_",
"in_",
"a_",
"list_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"#####",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"An",
" ",
"example",
" ",
"of",
" ",
"a",
" ",
"Combine",
"d",
" ",
"chart",
" ",
"in",
" ",
"Xl",
"sx",
"Write",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2013",
",",
" ",
"Joh",
"n",
" ",
"Mc",
"Nam",
"ara",
",",
" ",
"jm",
"cn",
"amar",
"a",
"@",
"cpa",
"n",
".",
"org_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"xls",
"xw",
"riter",
"_",
"._",
"workbook_",
"import_",
"Workbook",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"workbook_",
"=_",
"Workbook",
"_",
"(_",
"'",
"chart",
"\\u",
"combin",
"ed",
".",
"xls",
"x",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"worksheet_",
"=_",
"workbook_",
"._",
"add",
"\\u",
"worksheet_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"a",
" ",
"format",
" ",
"for",
" ",
"the",
" ",
"heading",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"bold_",
"=_",
"workbook_",
"._",
"add",
"\\u",
"format_",
"(_",
"{_",
"'",
"bold",
"'_",
":_",
"True_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"the",
" ",
"worksheet",
" ",
"data",
" ",
"tha",
"t",
" ",
"the",
" ",
"charts",
" ",
"will",
" ",
"refer",
" ",
"to",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"headings_",
"=_",
"[_",
"'",
"Number",
"'_",
",_",
"'",
"Bat",
"ch",
" ",
"1",
"'_",
",_",
"'",
"Bat",
"ch",
" ",
"2",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"2_",
",_",
"3_",
",_",
"4_",
",_",
"5_",
",_",
"6_",
",_",
"7_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"10_",
",_",
"40_",
",_",
"50_",
",_",
"20_",
",_",
"10_",
",_",
"50_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"30_",
",_",
"60_",
",_",
"70_",
",_",
"50_",
",_",
"40_",
",_",
"30_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"worksheet_",
"._",
"write",
"\\u",
"row_",
"(_",
"'",
"A1",
"'_",
",_",
"headings_",
",_",
"bold_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"worksheet_",
"._",
"write",
"\\u",
"column_",
"(_",
"'",
"A2",
"'_",
",_",
"data_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"worksheet_",
"._",
"write",
"\\u",
"column_",
"(_",
"'",
"B2",
"'_",
",_",
"data_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"worksheet_",
"._",
"write",
"\\u",
"column_",
"(_",
"'",
"C2",
"'_",
",_",
"data_",
"[_",
"2_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"In",
" ",
"the",
" ",
"first",
" ",
"example",
" ",
"we",
" ",
"will",
" ",
"create",
" ",
"a",
" ",
"combin",
"ed",
" ",
"column",
" ",
"and",
" ",
"line",
" ",
"chart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
"y",
" ",
"will",
" ",
"share",
" ",
"the",
" ",
"same",
" ",
"X",
" ",
"and",
" ",
"Y",
" ",
"axes",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"a",
" ",
"new",
" ",
"column",
" ",
"chart",
".",
" ",
"Thi",
"s",
" ",
"will",
" ",
"use",
" ",
"this",
" ",
"as",
" ",
"the",
" ",
"primary",
" ",
"chart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"column",
"\\u",
"chart",
"1_",
"=_",
"workbook_",
"._",
"add",
"\\u",
"chart_",
"(_",
"{_",
"'",
"type",
"'_",
":_",
"'",
"column",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Configure",
" ",
"the",
" ",
"data",
" ",
"series",
" ",
"for",
" ",
"the",
" ",
"primary",
" ",
"chart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"column",
"\\u",
"chart",
"1_",
"._",
"add",
"\\u",
"series_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"B",
"$",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"categor",
"ies",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"A",
"$",
"2",
":$",
"A",
"$",
"7",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"values",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"B",
"$",
"2",
":$",
"B",
"$",
"7",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"a",
" ",
"new",
" ",
"column",
" ",
"chart",
".",
" ",
"Thi",
"s",
" ",
"will",
" ",
"use",
" ",
"this",
" ",
"as",
" ",
"the",
" ",
"second",
"ary",
" ",
"chart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"line",
"\\u",
"chart",
"1_",
"=_",
"workbook_",
"._",
"add",
"\\u",
"chart_",
"(_",
"{_",
"'",
"type",
"'_",
":_",
"'",
"line",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Configure",
" ",
"the",
" ",
"data",
" ",
"series",
" ",
"for",
" ",
"the",
" ",
"second",
"ary",
" ",
"chart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"line",
"\\u",
"chart",
"1_",
"._",
"add",
"\\u",
"series_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"C",
"$",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"categor",
"ies",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"A",
"$",
"2",
":$",
"A",
"$",
"7",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"values",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"C",
"$",
"2",
":$",
"C",
"$",
"7",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Combine",
" ",
"the",
" ",
"charts",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"column",
"\\u",
"chart",
"1_",
"._",
"combine_",
"(_",
"line",
"\\u",
"chart",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"a",
" ",
"chart",
" ",
"title",
" ",
"and",
" ",
"some",
" ",
"axis",
" ",
"labels",
".",
" ",
"Not",
"e",
",",
" ",
"this",
" ",
"is",
" ",
"don",
"e",
" ",
"via",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"primary",
" ",
"chart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"column",
"\\u",
"chart",
"1_",
"._",
"set\\u",
"title_",
"(_",
"{_",
"'",
"name",
"'_",
":_",
"'",
"Combine",
"d",
" ",
"chart",
" ",
"-",
" ",
"same",
" ",
"Y",
" ",
"axis",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"column",
"\\u",
"chart",
"1_",
"._",
"set\\u",
"x",
"\\u",
"axis_",
"(_",
"{_",
"'",
"name",
"'_",
":_",
"'",
"Test",
" ",
"number",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"column",
"\\u",
"chart",
"1_",
"._",
"set\\u",
"y",
"\\u",
"axis_",
"(_",
"{_",
"'",
"name",
"'_",
":_",
"'",
"Sampl",
"e",
" ",
"length",
" ",
"(",
"mm",
")'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Insert",
" ",
"the",
" ",
"chart",
" ",
"int",
"o",
" ",
"the",
" ",
"worksheet_",
"\\u\\u\\uNL\\u\\u\\u_",
"worksheet_",
"._",
"insert",
"\\u",
"chart_",
"(_",
"'",
"E2",
"'_",
",_",
"column",
"\\u",
"chart",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"In",
" ",
"the",
" ",
"second",
" ",
"example",
" ",
"we",
" ",
"will",
" ",
"create",
" ",
"a",
" ",
"similar",
" ",
"combin",
"ed",
" ",
"column",
" ",
"and",
" ",
"line_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"chart",
" ",
"except",
" ",
"tha",
"t",
" ",
"the",
" ",
"second",
"ary",
" ",
"chart",
" ",
"will",
" ",
"have",
" ",
"a",
" ",
"second",
"ary",
" ",
"Y",
" ",
"axis",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"a",
" ",
"new",
" ",
"column",
" ",
"chart",
".",
" ",
"Thi",
"s",
" ",
"will",
" ",
"use",
" ",
"this",
" ",
"as",
" ",
"the",
" ",
"primary",
" ",
"chart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"column",
"\\u",
"chart",
"2_",
"=_",
"workbook_",
"._",
"add",
"\\u",
"chart_",
"(_",
"{_",
"'",
"type",
"'_",
":_",
"'",
"column",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Configure",
" ",
"the",
" ",
"data",
" ",
"series",
" ",
"for",
" ",
"the",
" ",
"primary",
" ",
"chart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"column",
"\\u",
"chart",
"2_",
"._",
"add",
"\\u",
"series_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"B",
"$",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"categor",
"ies",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"A",
"$",
"2",
":$",
"A",
"$",
"7",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"values",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"B",
"$",
"2",
":$",
"B",
"$",
"7",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"a",
" ",
"new",
" ",
"column",
" ",
"chart",
".",
" ",
"Thi",
"s",
" ",
"will",
" ",
"use",
" ",
"this",
" ",
"as",
" ",
"the",
" ",
"second",
"ary",
" ",
"chart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"line",
"\\u",
"chart",
"2_",
"=_",
"workbook_",
"._",
"add",
"\\u",
"chart_",
"(_",
"{_",
"'",
"type",
"'_",
":_",
"'",
"line",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Configure",
" ",
"the",
" ",
"data",
" ",
"series",
" ",
"for",
" ",
"the",
" ",
"second",
"ary",
" ",
"chart",
".",
" ",
"We",
" ",
"als",
"o",
" ",
"set",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"second",
"ary",
" ",
"Y",
" ",
"axis",
" ",
"via",
" ",
"(",
"y2",
"\\u",
"axis",
").",
" ",
"Thi",
"s",
" ",
"is",
" ",
"the",
" ",
"only",
" ",
"difference",
" ",
"between_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"and",
" ",
"the",
" ",
"first",
" ",
"example",
",",
" ",
"apart",
" ",
"from",
" ",
"the",
" ",
"axis",
" ",
"label",
" ",
"belo",
"w",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"line",
"\\u",
"chart",
"2_",
"._",
"add",
"\\u",
"series_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"C",
"$",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"categor",
"ies",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"A",
"$",
"2",
":$",
"A",
"$",
"7",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"values",
"'_",
":_",
"'=",
"She",
"et",
"1",
"!",
"$",
"C",
"$",
"2",
":$",
"C",
"$",
"7",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"y2",
"\\u",
"axis",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Combine",
" ",
"the",
" ",
"charts",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"column",
"\\u",
"chart",
"2_",
"._",
"combine_",
"(_",
"line",
"\\u",
"chart",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"a",
" ",
"chart",
" ",
"title",
" ",
"and",
" ",
"some",
" ",
"axis",
" ",
"labels",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"column",
"\\u",
"chart",
"2_",
"._",
"set\\u",
"title_",
"(_",
"{_",
"'",
"name",
"'_",
":_",
"'",
"Combine",
" ",
"chart",
" ",
"-",
" ",
"second",
"ary",
" ",
"Y",
" ",
"axis",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"column",
"\\u",
"chart",
"2_",
"._",
"set\\u",
"x",
"\\u",
"axis_",
"(_",
"{_",
"'",
"name",
"'_",
":_",
"'",
"Test",
" ",
"number",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"column",
"\\u",
"chart",
"2_",
"._",
"set\\u",
"y",
"\\u",
"axis_",
"(_",
"{_",
"'",
"name",
"'_",
":_",
"'",
"Sampl",
"e",
" ",
"length",
" ",
"(",
"mm",
")'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Not",
"e",
":",
" ",
"the",
" ",
"y2",
" ",
"proper",
"ties",
" ",
"are",
" ",
"on",
" ",
"the",
" ",
"second",
"ary",
" ",
"chart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"line",
"\\u",
"chart",
"2_",
"._",
"set\\u",
"y2",
"\\u",
"axis_",
"(_",
"{_",
"'",
"name",
"'_",
":_",
"'",
"Target",
" ",
"length",
" ",
"(",
"mm",
")'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Insert",
" ",
"the",
" ",
"chart",
" ",
"int",
"o",
" ",
"the",
" ",
"worksheet_",
"\\u\\u\\uNL\\u\\u\\u_",
"worksheet_",
"._",
"insert",
"\\u",
"chart_",
"(_",
"'",
"E1",
"8",
"'_",
",_",
"column",
"\\u",
"chart",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"workbook_",
"._",
"close_",
"(_",
")_"
] | [
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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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
] |
Unused import | ella/ella/ella/core/templatetags/custom_urls_tags.py | [
{
"content": "\"\"\"\nLot of what you see here has been stolen from Django's ``{% url %}`` tag.\n\"\"\"\nfrom django.core.urlresolvers import NoReverseMatch\nfrom django.template import Node, TemplateSyntaxError, Library, Variable\nfrom django.utils.encoding import smart_str\n\nfrom ella.core import custom_urls\n\nregister = Library()\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class CustomURLNode(Node):\n",
"metadata": "root.CustomURLNode",
"header": "['module', '___EOS___']",
"index": 11
},
{
"content": " def __init__(self, obj, view_name, args, kwargs, asvar, resolver=None):\n self.obj = obj\n self.view_name = view_name\n self.args = args\n self.kwargs = kwargs\n self.asvar = asvar\n self.resolver = resolver or custom_urls.resolver",
"metadata": "root.CustomURLNode.__init__",
"header": "['class', 'CustomURLNode', '(', 'Node', ')', ':', '___EOS___']",
"index": 12
},
{
"content": " def render(self, context):\n args = [arg.resolve(context) for arg in self.args]\n kwargs = dict([(smart_str(k, 'ascii'), v.resolve(context))\n for k, v in self.kwargs.items()])\n obj = self.obj.resolve(context)\n\n if not obj:\n return\n\n url = ''\n try:\n url = self.resolver.reverse(obj, self.view_name, *args, **kwargs)\n except NoReverseMatch, e:\n if self.asvar is None:\n raise e\n\n if self.asvar:\n context[self.asvar] = url\n return ''\n else:\n return url",
"metadata": "root.CustomURLNode.render",
"header": "['class', 'CustomURLNode', '(', 'Node', ')', ':', '___EOS___']",
"index": 20
},
{
"content": "@register.tag\ndef custom_url(parser, token):\n \"\"\"\n Get URL using Ella custom URL resolver and return it or save it in \n context variable.\n \n Syntax::\n \n {% custom_url <FOR_VARIABLE> <VIEWNAME>[[[ <ARGS>] <KWARGS>] as <VAR>] %}\n \n Examples::\n \n {% custom_url object send_by_email %}\n {% custom_url object send_by_email 1 %}\n {% custom_url object send_by_email pk=1 %}\n {% custom_url object send_by_email pk=1 as saved_url %}\n \n \"\"\"\n bits = token.split_contents()\n return _parse_custom_url(bits)",
"metadata": "root.custom_url",
"header": "['module', '___EOS___']",
"index": 42
},
{
"content": "def _parse_custom_url(bits, resolver=None):\n if len(bits) < 3:\n raise TemplateSyntaxError(\"'%s' takes at least one argument\"\n \" (path to a view)\" % bits[0])\n obj = Variable(bits[1])\n viewname = bits[2]\n args = []\n kwargs = {}\n asvar = None\n\n if len(bits) > 3:\n bits = iter(bits[3:])\n for bit in bits:\n if bit == 'as':\n asvar = bits.next()\n break\n else:\n for arg in bit.split(\",\"):\n if '=' in arg:\n k, v = arg.split('=', 1)\n k = k.strip()\n kwargs[k] = Variable(v)\n elif arg:\n args.append(Variable(arg))\n return CustomURLNode(obj, viewname, args, kwargs, asvar, resolver=resolver)",
"metadata": "root._parse_custom_url",
"header": "['module', '___EOS___']",
"index": 63
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Lot",
" ",
"of",
" ",
"what",
" ",
"you",
" ",
"see",
" ",
"here",
" ",
"has",
" ",
"bee",
"n",
" ",
"sto",
"len",
" ",
"from",
" ",
"Dj",
"ang",
"o",
"'",
"s",
" ",
"``",
"{%",
" ",
"url",
" ",
"%}",
"``",
" ",
"tag",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"._",
"urlresolvers_",
"import_",
"No",
"Revers",
"e",
"Match_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"template_",
"import_",
"Node_",
",_",
"Templa",
"te",
"Syntax",
"Error_",
",_",
"Library_",
",_",
"Variable_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"encoding_",
"import_",
"smart",
"\\u",
"str_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ella",
"_",
"._",
"core_",
"import_",
"custom",
"\\u",
"urls_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"register_",
"=_",
"Library_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Custom",
"URL",
"Node_",
"(_",
"Node_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Custom",
"URL",
"Node_",
"(_",
"Node_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"obj_",
",_",
"view",
"\\u",
"name_",
",_",
"args_",
",_",
"kwargs_",
",_",
"as",
"var_",
",_",
"resolver_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"obj_",
"=_",
"obj_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"view",
"\\u",
"name_",
"=_",
"view",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"args_",
"=_",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"kwargs_",
"=_",
"kwargs_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"as",
"var_",
"=_",
"as",
"var_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"resolver_",
"=_",
"resolver_",
"or_",
"custom",
"\\u",
"urls_",
"._",
"resolver_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Custom",
"URL",
"Node_",
"(_",
"Node_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render_",
"(_",
"self_",
",_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"=_",
"[_",
"arg_",
"._",
"resolve_",
"(_",
"context_",
")_",
"for_",
"arg_",
"in_",
"self_",
"._",
"args_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kwargs_",
"=_",
"dict_",
"(_",
"[_",
"(_",
"smart",
"\\u",
"str_",
"(_",
"k_",
",_",
"'",
"ascii",
"'_",
")_",
",_",
"v_",
"._",
"resolve_",
"(_",
"context_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"k_",
",_",
"v_",
"in_",
"self_",
"._",
"kwargs_",
"._",
"items_",
"(_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"obj_",
"=_",
"self_",
"._",
"obj_",
"._",
"resolve_",
"(_",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"obj_",
":_",
"\\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_",
"url_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"url_",
"=_",
"self_",
"._",
"resolver_",
"._",
"reverse_",
"(_",
"obj_",
",_",
"self_",
"._",
"view",
"\\u",
"name_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"No",
"Revers",
"e",
"Match_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"as",
"var_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"e_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"as",
"var_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"self_",
"._",
"as",
"var_",
"]_",
"=_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"register_",
"._",
"tag_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"custom",
"\\u",
"url_",
"(_",
"parser_",
",_",
"token_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Get",
" ",
"URL",
" ",
"usi",
"ng",
" ",
"Ell",
"a",
" ",
"custom",
" ",
"URL",
" ",
"resolver",
" ",
"and",
" ",
"return",
" ",
"it",
" ",
"or",
" ",
"save",
" ",
"it",
" ",
"in",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"context",
" ",
"variab",
"le",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Syntax",
"::",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"{%",
" ",
"custom",
"\\u",
"url",
" ",
"<",
"FOR",
"\\u",
"VARIABLE",
">",
" ",
"<",
"VIEW",
"NAME",
">[",
"[[",
" ",
"<",
"ARG",
"S",
">]",
" ",
"<",
"KW",
"ARG",
"S",
">]",
" ",
"as",
" ",
"<",
"VAR",
">]",
" ",
"%}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Exam",
"ples",
"::",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"{%",
" ",
"custom",
"\\u",
"url",
" ",
"object",
" ",
"send",
"\\u",
"by",
"\\u",
"email",
" ",
"%}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"{%",
" ",
"custom",
"\\u",
"url",
" ",
"object",
" ",
"send",
"\\u",
"by",
"\\u",
"email",
" ",
"1",
" ",
"%}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"{%",
" ",
"custom",
"\\u",
"url",
" ",
"object",
" ",
"send",
"\\u",
"by",
"\\u",
"email",
" ",
"pk",
"=",
"1",
" ",
"%}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"{%",
" ",
"custom",
"\\u",
"url",
" ",
"object",
" ",
"send",
"\\u",
"by",
"\\u",
"email",
" ",
"pk",
"=",
"1",
" ",
"as",
" ",
"saved",
"\\u",
"url",
" ",
"%}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bits_",
"=_",
"token_",
"._",
"split",
"\\u",
"contents_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u",
"parse",
"\\u",
"custom",
"\\u",
"url_",
"(_",
"bits_",
")_",
"\\u\\u\\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",
"parse",
"\\u",
"custom",
"\\u",
"url_",
"(_",
"bits_",
",_",
"resolver_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"len_",
"(_",
"bits_",
")_",
"<_",
"3_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Templa",
"te",
"Syntax",
"Error_",
"(_",
"\"'",
"%",
"s",
"'",
" ",
"take",
"s",
" ",
"at",
" ",
"leas",
"t",
" ",
"one",
" ",
"argu",
"ment",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
" ",
"(",
"path",
" ",
"to",
" ",
"a",
" ",
"view",
")\"_",
"%_",
"bits_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"obj_",
"=_",
"Variable_",
"(_",
"bits_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"view",
"name_",
"=_",
"bits_",
"[_",
"2_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kwargs_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"as",
"var_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"bits_",
")_",
">_",
"3_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bits_",
"=_",
"iter_",
"(_",
"bits_",
"[_",
"3_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"bit_",
"in_",
"bits_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"bit_",
"==_",
"'",
"as",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"as",
"var_",
"=_",
"bits_",
"._",
"next_",
"(_",
")_",
"\\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 ",
" _",
"for_",
"arg_",
"in_",
"bit_",
"._",
"split_",
"(_",
"\",\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"'='_",
"in_",
"arg_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"k_",
",_",
"v_",
"=_",
"arg_",
"._",
"split_",
"(_",
"'='_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"k_",
"=_",
"k_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kwargs_",
"[_",
"k_",
"]_",
"=_",
"Variable_",
"(_",
"v_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"arg_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"args_",
"._",
"append_",
"(_",
"Variable_",
"(_",
"arg_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"Custom",
"URL",
"Node_",
"(_",
"obj_",
",_",
"view",
"name_",
",_",
"args_",
",_",
"kwargs_",
",_",
"as",
"var_",
",_",
"resolver_",
"=_",
"resolver_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused import | wiki-ai/revscoring/revscoring/languages/features/regex_matches/tests/test_regexes.py | [
{
"content": "import pickle\n\nfrom nose.tools import eq_\n\nfrom .....datasources import revision_oriented\nfrom .....dependencies import solve\nfrom ..regex_matches import RegexMatches\n\nbadwords = RegexMatches(\n \"english.badwords\",\n [r'\\w*bad\\w*', r'butts'],\n\n)\nr_text = revision_oriented.revision.text\np_text = revision_oriented.revision.parent.text\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def test_regexes():\n cache = {p_text: \"This is good. There're bad words butts already.\",\n r_text: \"This is bad superbadword. There're bad words already.\"}\n\n eq_(solve(badwords.revision.datasources.matches, cache=cache),\n ['bad', 'superbadword', 'bad'])\n eq_(solve(badwords.revision.matches, cache=cache), 3)\n eq_(solve(badwords.revision.parent.datasources.matches, cache=cache),\n ['bad', 'butts'])\n eq_(solve(badwords.revision.parent.matches, cache=cache), 2)\n\n diff = badwords.revision.diff\n eq_(solve(diff.datasources.matches_added, cache=cache),\n ['bad', 'superbadword'])\n eq_(solve(diff.matches_added, cache=cache), 2)\n eq_(solve(diff.datasources.matches_removed, cache=cache),\n ['butts'])\n eq_(solve(diff.matches_removed, cache=cache), 1)\n\n eq_(solve(diff.datasources.match_delta, cache=cache),\n {'bad': 1, 'superbadword': 1, 'butts': -1})\n pd = solve(diff.datasources.match_prop_delta, cache=cache)\n eq_(pd.keys(), {'bad', 'superbadword', 'butts'})\n eq_(round(pd['bad'], 2), 0.50)\n eq_(round(pd['superbadword'], 2), 1)\n eq_(round(pd['butts'], 2), -1)\n\n eq_(round(solve(diff.match_delta_sum, cache=cache), 2), 1)\n eq_(round(solve(diff.match_prop_delta_sum, cache=cache), 2), 0.50)",
"metadata": "root.test_regexes",
"header": "['module', '___EOS___']",
"index": 17
},
{
"content": "def test_pickling():\n eq_(pickle.loads(pickle.dumps(badwords.revision.matches)),\n badwords.revision.matches)\n eq_(pickle.loads(pickle.dumps(badwords.revision.parent.matches)),\n badwords.revision.parent.matches)\n\n eq_(pickle.loads(pickle.dumps(badwords.revision.diff.matches_added)),\n badwords.revision.diff.matches_added)\n eq_(pickle.loads(pickle.dumps(badwords.revision.diff.matches_removed)),\n badwords.revision.diff.matches_removed)\n\n eq_(pickle.loads(pickle.dumps(badwords.revision.diff.matches_added)),\n badwords.revision.diff.matches_added)\n eq_(pickle.loads(pickle.dumps(badwords.revision.diff.matches_removed)),\n badwords.revision.diff.matches_removed)",
"metadata": "root.test_pickling",
"header": "['module', '___EOS___']",
"index": 48
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"pickle_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"nose_",
"._",
"tools_",
"import_",
"eq\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"..._",
"._",
"._",
"datasources",
"_",
"import_",
"revis",
"ion",
"\\u",
"orient",
"ed_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"..._",
"._",
"._",
"dependencies_",
"import_",
"solve_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"regex",
"\\u",
"matches_",
"import_",
"Rege",
"x",
"Matches_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"bad",
"words_",
"=_",
"Rege",
"x",
"Matches_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"english",
".",
"bad",
"words",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"r",
"'\\\\",
"w",
"*",
"bad",
"\\\\",
"w",
"*'_",
",_",
"r",
"'",
"butt",
"s",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r",
"\\u",
"text_",
"=_",
"revis",
"ion",
"\\u",
"orient",
"ed_",
"._",
"revision_",
"._",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p",
"\\u",
"text_",
"=_",
"revis",
"ion",
"\\u",
"orient",
"ed_",
"._",
"revision_",
"._",
"parent_",
"._",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"test\\u",
"regexes_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cache_",
"=_",
"{_",
"p",
"\\u",
"text_",
":_",
"\"",
"Thi",
"s",
" ",
"is",
" ",
"good",
".",
" ",
" ",
"There",
"'",
"re",
" ",
"bad",
" ",
"words",
" ",
"butt",
"s",
" ",
"alr",
"ead",
"y",
".\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"\\u",
"text_",
":_",
"\"",
"Thi",
"s",
" ",
"is",
" ",
"bad",
" ",
"super",
"bad",
"word",
".",
" ",
"There",
"'",
"re",
" ",
"bad",
" ",
"words",
" ",
"alr",
"ead",
"y",
".\"_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"eq\\u_",
"(_",
"solve_",
"(_",
"bad",
"words_",
"._",
"revision_",
"._",
"datasources",
"_",
"._",
"matches_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'",
"bad",
"'_",
",_",
"'",
"super",
"bad",
"word",
"'_",
",_",
"'",
"bad",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"solve_",
"(_",
"bad",
"words_",
"._",
"revision_",
"._",
"matches_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"solve_",
"(_",
"bad",
"words_",
"._",
"revision_",
"._",
"parent_",
"._",
"datasources",
"_",
"._",
"matches_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'",
"bad",
"'_",
",_",
"'",
"butt",
"s",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"solve_",
"(_",
"bad",
"words_",
"._",
"revision_",
"._",
"parent_",
"._",
"matches_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"diff_",
"=_",
"bad",
"words_",
"._",
"revision_",
"._",
"diff_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"solve_",
"(_",
"diff_",
"._",
"datasources",
"_",
"._",
"matche",
"s",
"\\u",
"added_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'",
"bad",
"'_",
",_",
"'",
"super",
"bad",
"word",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"solve_",
"(_",
"diff_",
"._",
"matche",
"s",
"\\u",
"added_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"solve_",
"(_",
"diff_",
"._",
"datasources",
"_",
"._",
"matche",
"s",
"\\u",
"removed_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'",
"butt",
"s",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"solve_",
"(_",
"diff_",
"._",
"matche",
"s",
"\\u",
"removed_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"eq\\u_",
"(_",
"solve_",
"(_",
"diff_",
"._",
"datasources",
"_",
"._",
"match",
"\\u",
"delta_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"bad",
"'_",
":_",
"1_",
",_",
"'",
"super",
"bad",
"word",
"'_",
":_",
"1_",
",_",
"'",
"butt",
"s",
"'_",
":_",
"-_",
"1_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pd_",
"=_",
"solve_",
"(_",
"diff_",
"._",
"datasources",
"_",
"._",
"match",
"\\u",
"prop",
"\\u",
"delta_",
",_",
"cache_",
"=_",
"cache_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"pd_",
"._",
"keys_",
"(_",
")_",
",_",
"{_",
"'",
"bad",
"'_",
",_",
"'",
"super",
"bad",
"word",
"'_",
",_",
"'",
"butt",
"s",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"round_",
"(_",
"pd_",
"[_",
"'",
"bad",
"'_",
"]_",
",_",
"2_",
")_",
",_",
"0.50",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"round_",
"(_",
"pd_",
"[_",
"'",
"super",
"bad",
"word",
"'_",
"]_",
",_",
"2_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"round_",
"(_",
"pd_",
"[_",
"'",
"butt",
"s",
"'_",
"]_",
",_",
"2_",
")_",
",_",
"-_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"eq\\u_",
"(_",
"round_",
"(_",
"solve_",
"(_",
"diff_",
"._",
"match",
"\\u",
"delta",
"\\u",
"sum_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"2_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"round_",
"(_",
"solve_",
"(_",
"diff_",
"._",
"match",
"\\u",
"prop",
"\\u",
"delta",
"\\u",
"sum_",
",_",
"cache_",
"=_",
"cache_",
")_",
",_",
"2_",
")_",
",_",
"0.50",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"pick",
"ling_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"eq\\u_",
"(_",
"pickle_",
"._",
"loads_",
"(_",
"pickle_",
"._",
"dumps_",
"(_",
"bad",
"words_",
"._",
"revision_",
"._",
"matches_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"bad",
"words_",
"._",
"revision_",
"._",
"matches_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"pickle_",
"._",
"loads_",
"(_",
"pickle_",
"._",
"dumps_",
"(_",
"bad",
"words_",
"._",
"revision_",
"._",
"parent_",
"._",
"matches_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"bad",
"words_",
"._",
"revision_",
"._",
"parent_",
"._",
"matches_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"eq\\u_",
"(_",
"pickle_",
"._",
"loads_",
"(_",
"pickle_",
"._",
"dumps_",
"(_",
"bad",
"words_",
"._",
"revision_",
"._",
"diff_",
"._",
"matche",
"s",
"\\u",
"added_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"bad",
"words_",
"._",
"revision_",
"._",
"diff_",
"._",
"matche",
"s",
"\\u",
"added_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"pickle_",
"._",
"loads_",
"(_",
"pickle_",
"._",
"dumps_",
"(_",
"bad",
"words_",
"._",
"revision_",
"._",
"diff_",
"._",
"matche",
"s",
"\\u",
"removed_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"bad",
"words_",
"._",
"revision_",
"._",
"diff_",
"._",
"matche",
"s",
"\\u",
"removed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"eq\\u_",
"(_",
"pickle_",
"._",
"loads_",
"(_",
"pickle_",
"._",
"dumps_",
"(_",
"bad",
"words_",
"._",
"revision_",
"._",
"diff_",
"._",
"matche",
"s",
"\\u",
"added_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"bad",
"words_",
"._",
"revision_",
"._",
"diff_",
"._",
"matche",
"s",
"\\u",
"added_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"pickle_",
"._",
"loads_",
"(_",
"pickle_",
"._",
"dumps_",
"(_",
"bad",
"words_",
"._",
"revision_",
"._",
"diff_",
"._",
"matche",
"s",
"\\u",
"removed_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"bad",
"words_",
"._",
"revision_",
"._",
"diff_",
"._",
"matche",
"s",
"\\u",
"removed_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | IndicoDataSolutions/Passage/passage/theano_utils.py | [
{
"content": "import numpy as np\nimport theano\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def intX(X):\n return np.asarray(X, dtype=np.int32)",
"metadata": "root.intX",
"header": "['module', '___EOS___']",
"index": 3
},
{
"content": "def floatX(X):\n return np.asarray(X, dtype=theano.config.floatX)",
"metadata": "root.floatX",
"header": "['module', '___EOS___']",
"index": 6
},
{
"content": "def sharedX(X, dtype=theano.config.floatX, name=None):\n return theano.shared(np.asarray(X, dtype=dtype), name=name)",
"metadata": "root.sharedX",
"header": "['module', '___EOS___']",
"index": 9
},
{
"content": "def shared0s(shape, dtype=theano.config.floatX, name=None):\n return sharedX(np.zeros(shape), dtype=dtype, name=name)",
"metadata": "root.shared0s",
"header": "['module', '___EOS___']",
"index": 12
},
{
"content": "def sharedNs(shape, n, dtype=theano.config.floatX, name=None):\n return sharedX(np.ones(shape)*n, dtype=dtype, name=name)",
"metadata": "root.sharedNs",
"header": "['module', '___EOS___']",
"index": 15
},
{
"content": "def downcast_float(X):\n return np.asarray(X, dtype=np.float32)",
"metadata": "root.downcast_float",
"header": "['module', '___EOS___']",
"index": 18
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"theano_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"int",
"X_",
"(_",
"X_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"np_",
"._",
"asarray_",
"(_",
"X_",
",_",
"dtype_",
"=_",
"np_",
"._",
"int32_",
")_",
"\\u\\u\\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_",
"float",
"X_",
"(_",
"X_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"np_",
"._",
"asarray_",
"(_",
"X_",
",_",
"dtype_",
"=_",
"theano_",
"._",
"config_",
"._",
"float",
"X_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"shared",
"X_",
"(_",
"X_",
",_",
"dtype_",
"=_",
"theano_",
"._",
"config_",
"._",
"float",
"X_",
",_",
"name_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"theano_",
"._",
"shared_",
"(_",
"np_",
"._",
"asarray_",
"(_",
"X_",
",_",
"dtype_",
"=_",
"dtype_",
")_",
",_",
"name_",
"=_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"shared",
"0",
"s_",
"(_",
"shape_",
",_",
"dtype_",
"=_",
"theano_",
"._",
"config_",
"._",
"float",
"X_",
",_",
"name_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"shared",
"X_",
"(_",
"np_",
"._",
"zeros_",
"(_",
"shape_",
")_",
",_",
"dtype_",
"=_",
"dtype_",
",_",
"name_",
"=_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"shared",
"Ns_",
"(_",
"shape_",
",_",
"n_",
",_",
"dtype_",
"=_",
"theano_",
"._",
"config_",
"._",
"float",
"X_",
",_",
"name_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"shared",
"X_",
"(_",
"np_",
"._",
"ones_",
"(_",
"shape_",
")_",
"*_",
"n_",
",_",
"dtype_",
"=_",
"dtype_",
",_",
"name_",
"=_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"down",
"cast",
"\\u",
"float_",
"(_",
"X_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"np_",
"._",
"asarray_",
"(_",
"X_",
",_",
"dtype_",
"=_",
"np_",
"._",
"float32_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unreachable code | avidal/django-pyodbc/sql_server/pyodbc/query.py | [
{
"content": "def query_class(QueryClass):\n \"\"\"\n Returns a custom django.db.models.sql.query.Query subclass that is\n appropriate for MS SQL Server.\n \"\"\"\n global _classes\n try:\n return _classes[QueryClass]\n except KeyError:\n pass\n\n class PyOdbcSSQuery(QueryClass):\n from sql_server.pyodbc import aggregates\n aggregates_module = aggregates\n\n def __init__(self, *args, **kwargs):\n super(PyOdbcSSQuery, self).__init__(*args, **kwargs)\n self.default_reverse_ordering = False\n self._ord = []\n\n # If we are an insert query, monkeypatch the \"as_sql\" method\n from django.db.models.sql.subqueries import InsertQuery\n if isinstance(self, InsertQuery):\n self._orig_as_sql = self.as_sql\n self.as_sql = self._insert_as_sql\n\n def _insert_as_sql(self, *args, **kwargs):\n \"\"\"Helper method for monkeypatching Django InsertQuery's as_sql.\"\"\"\n meta = self.get_meta()\n quoted_table = self.connection.ops.quote_name(meta.db_table)\n # Get (sql, params) from original InsertQuery.as_sql\n sql, params = self._orig_as_sql(*args, **kwargs)\n if meta.has_auto_field and meta.auto_field.column in self.columns:\n if len(self.columns) == 1 and not params:\n sql = \"INSERT INTO %s DEFAULT VALUES\" % quoted_table\n else:\n sql = \"SET IDENTITY_INSERT %s ON;\\n%s;\\nSET IDENTITY_INSERT %s OFF\" % \\\n (quoted_table, sql, quoted_table)\n\n return sql, params\n\n def __reduce__(self):\n \"\"\"\n Enable pickling for this class (normal pickling handling doesn't\n work as Python can only pickle module-level classes by default).\n \"\"\"\n if hasattr(QueryClass, '__getstate__'):\n assert hasattr(QueryClass, '__setstate__')\n data = self.__getstate__()\n else:\n data = self.__dict__\n return (unpickle_query_class, (QueryClass,), data)\n\n def convert_values(self, value, field):\n \"\"\"\n Coerce the value returned by the database backend into a consistent\n type that is compatible with the field type.\n\n In our case, cater for the fact that SQL Server < 2008 has no\n separate Date and Time data types.\n TODO: See how we'll handle this for SQL Server >= 2008\n \"\"\"\n if value is None:\n return None\n if field and field.get_internal_type() == 'DateTimeField':\n return value\n elif field and field.get_internal_type() == 'DateField':\n value = value.date() # extract date\n elif field and field.get_internal_type() == 'TimeField' or (isinstance(value, datetime) and value.year == 1900 and value.month == value.day == 1):\n value = value.time() # extract time\n # Some cases (for example when select_related() is used) aren't\n # caught by the DateField case above and date fields arrive from\n # the DB as datetime instances.\n # Implement a workaround stealing the idea from the Oracle\n # backend. It's not perfect so the same warning applies (i.e. if a\n # query results in valid date+time values with the time part set\n # to midnight, this workaround can surprise us by converting them\n # to the datetime.date Python type).\n elif isinstance(value, datetime) and value.hour == value.minute == value.second == value.microsecond == 0:\n value = value.date()\n # Force floats to the correct type\n elif value is not None and field and field.get_internal_type() == 'FloatField':\n value = float(value)\n return value\n\n def resolve_columns(self, row, fields=()):\n index_start = len(self.extra_select.keys())\n values = [self.convert_values(v, None) for v in row[:index_start]]\n for value, field in map(None, row[index_start:], fields):\n values.append(self.convert_values(value, field))\n return tuple(values)\n\n def modify_query(self, strategy, ordering, out_cols):\n \"\"\"\n Helper method, called from _as_sql()\n\n Sets the value of the self._ord and self.default_reverse_ordering\n attributes.\n Can modify the values of the out_cols list argument and the\n self.ordering_aliases attribute.\n \"\"\"\n self.default_reverse_ordering = False\n self._ord = []\n cnt = 0\n extra_select_aliases = [k.strip('[]') for k in self.extra_select.keys()]\n for ord_spec_item in ordering:\n if ord_spec_item.endswith(' ASC') or ord_spec_item.endswith(' DESC'):\n parts = ord_spec_item.split()\n col, odir = ' '.join(parts[:-1]), parts[-1]\n if col not in self.ordering_aliases and col.strip('[]') not in extra_select_aliases:\n if col.isdigit():\n cnt += 1\n n = int(col)-1\n alias = 'OrdAlias%d' % cnt\n out_cols[n] = '%s AS [%s]' % (out_cols[n], alias)\n self._ord.append((alias, odir))\n elif col in out_cols:\n if strategy == USE_TOP_HMARK:\n cnt += 1\n n = out_cols.index(col)\n alias = 'OrdAlias%d' % cnt\n out_cols[n] = '%s AS %s' % (col, alias)\n self._ord.append((alias, odir))\n else:\n self._ord.append((col, odir))\n elif strategy == USE_TOP_HMARK:\n # Special case: '_order' column created by Django\n # when Meta.order_with_respect_to is used\n if col.split('.')[-1] == '[_order]' and odir == 'DESC':\n self.default_reverse_ordering = True\n cnt += 1\n alias = 'OrdAlias%d' % cnt\n self._ord.append((alias, odir))\n self.ordering_aliases.append('%s AS [%s]' % (col, alias))\n else:\n self._ord.append((col, odir))\n else:\n self._ord.append((col, odir))\n\n if strategy == USE_ROW_NUMBER and not self._ord and 'RAND()' in ordering:\n self._ord.append(('RAND()',''))\n if strategy == USE_TOP_HMARK and not self._ord:\n # XXX:\n #meta = self.get_meta()\n meta = self.model._meta\n qn = self.quote_name_unless_alias\n pk_col = '%s.%s' % (qn(meta.db_table), qn(meta.pk.db_column or meta.pk.column))\n if pk_col not in out_cols:\n out_cols.append(pk_col)\n\n def _as_sql(self, strategy):\n \"\"\"\n Helper method, called from as_sql()\n Similar to django/db/models/sql/query.py:Query.as_sql() but without\n the ordering and limits code.\n\n Returns SQL that hasn't an order-by clause.\n \"\"\"\n # get_columns needs to be called before get_ordering to populate\n # _select_alias.\n out_cols = self.get_columns(True)\n ordering, ordering_group_by = self.get_ordering()\n if strategy == USE_ROW_NUMBER:\n if not ordering:\n meta = self.get_meta()\n qn = self.quote_name_unless_alias\n # Special case: pk not in out_cols, use random ordering. \n #\n if '%s.%s' % (qn(meta.db_table), qn(meta.pk.db_column or meta.pk.column)) not in self.get_columns():\n ordering = ['RAND()']\n # XXX: Maybe use group_by field for ordering?\n #if self.group_by:\n #ordering = ['%s.%s ASC' % (qn(self.group_by[0][0]),qn(self.group_by[0][1]))]\n else:\n ordering = ['%s.%s ASC' % (qn(meta.db_table), qn(meta.pk.db_column or meta.pk.column))]\n\n if strategy in (USE_TOP_HMARK, USE_ROW_NUMBER):\n self.modify_query(strategy, ordering, out_cols)\n\n if strategy == USE_ROW_NUMBER:\n ord = ', '.join(['%s %s' % pair for pair in self._ord])\n self.ordering_aliases.append('(ROW_NUMBER() OVER (ORDER BY %s)) AS [rn]' % ord)\n\n # This must come after 'select' and 'ordering' -- see docstring of\n # get_from_clause() for details.\n from_, f_params = self.get_from_clause()\n\n qn = self.quote_name_unless_alias\n where, w_params = self.where.as_sql(qn=qn)\n having, h_params = self.having.as_sql(qn=qn)\n params = []\n for val in self.extra_select.itervalues():\n params.extend(val[1])\n\n result = ['SELECT']\n if self.distinct:\n result.append('DISTINCT')\n\n if strategy == USE_TOP_LMARK:\n # XXX:\n #meta = self.get_meta()\n meta = self.model._meta\n result.append('TOP %s %s' % (self.low_mark, self.quote_name_unless_alias(meta.pk.db_column or meta.pk.column)))\n else:\n if strategy == USE_TOP_HMARK and self.high_mark is not None:\n result.append('TOP %s' % self.high_mark)\n result.append(', '.join(out_cols + self.ordering_aliases))\n\n result.append('FROM')\n result.extend(from_)\n params.extend(f_params)\n\n if where:\n result.append('WHERE %s' % where)\n params.extend(w_params)\n if self.extra_where:\n if not where:\n result.append('WHERE')\n else:\n result.append('AND')\n result.append(' AND '.join(self.extra_where))\n\n grouping, gb_params = self.get_grouping()\n if grouping:\n if ordering:\n # If the backend can't group by PK (i.e., any database\n # other than MySQL), then any fields mentioned in the\n # ordering clause needs to be in the group by clause.\n if not self.connection.features.allows_group_by_pk:\n for col, col_params in ordering_group_by:\n if col not in grouping:\n grouping.append(str(col))\n gb_params.extend(col_params)\n else:\n ordering = self.connection.ops.force_no_ordering()\n result.append('GROUP BY %s' % ', '.join(grouping))\n params.extend(gb_params)\n\n if having:\n result.append('HAVING %s' % having)\n params.extend(h_params)\n\n params.extend(self.extra_params)\n return ' '.join(result), tuple(params)\n\n def as_sql(self, with_limits=True, with_col_aliases=False):\n \"\"\"\n Creates the SQL for this query. Returns the SQL string and list of\n parameters.\n\n If 'with_limits' is False, any limit/offset information is not included\n in the query.\n \"\"\"\n # The do_offset flag indicates whether we need to construct\n # the SQL needed to use limit/offset w/SQL Server.\n do_offset = with_limits and (self.high_mark is not None or self.low_mark != 0)\n\n # If no offsets, just return the result of the base class\n # `as_sql`.\n if not do_offset:\n return super(PyOdbcSSQuery, self).as_sql(with_limits=False,\n with_col_aliases=with_col_aliases)\n # Shortcut for the corner case when high_mark value is 0:\n if self.high_mark == 0:\n return \"\", ()\n\n self.pre_sql_setup()\n # XXX:\n #meta = self.get_meta()\n meta = self.model._meta\n qn = self.quote_name_unless_alias\n fallback_ordering = '%s.%s' % (qn(meta.db_table), qn(meta.pk.db_column or meta.pk.column))\n\n # SQL Server 2000, offset+limit case\n if self.connection.ops.sql_server_ver < 2005 and self.high_mark is not None:\n orig_sql, params = self._as_sql(USE_TOP_HMARK)\n if self._ord:\n ord = ', '.join(['%s %s' % pair for pair in self._ord])\n rev_ord = ', '.join(['%s %s' % (col, REV_ODIR[odir]) for col, odir in self._ord])\n else:\n if not self.default_reverse_ordering:\n ord = '%s ASC' % fallback_ordering\n rev_ord = '%s DESC' % fallback_ordering\n else:\n ord = '%s DESC' % fallback_ordering\n rev_ord = '%s ASC' % fallback_ordering\n sql = SQL_SERVER_8_LIMIT_QUERY % {\n 'limit': self.high_mark - self.low_mark,\n 'orig_sql': orig_sql,\n 'ord': ord,\n 'rev_ord': rev_ord,\n # XXX:\n 'table': qn(meta.db_table),\n }\n return sql, params\n\n # SQL Server 2005\n if self.connection.ops.sql_server_ver >= 2005:\n sql, params = self._as_sql(USE_ROW_NUMBER)\n\n # Construct the final SQL clause, using the initial select SQL\n # obtained above.\n result = ['SELECT * FROM (%s) AS X' % sql]\n\n # Place WHERE condition on `rn` for the desired range.\n if self.high_mark is None:\n self.high_mark = 9223372036854775807\n result.append('WHERE X.rn BETWEEN %d AND %d' % (self.low_mark+1, self.high_mark))\n\n return ' '.join(result), params\n\n # SQL Server 2000, offset without limit case\n # get_columns needs to be called before get_ordering to populate\n # select_alias.\n self.get_columns(with_col_aliases)\n ordering, ordering_group_by = self.get_ordering()\n if ordering:\n ord = ', '.join(ordering)\n else:\n # We need to define an ordering clause since none was provided\n ord = fallback_ordering\n orig_sql, params = self._as_sql(USE_TOP_LMARK)\n sql = SQL_SERVER_8_NO_LIMIT_QUERY % {\n 'orig_sql': orig_sql,\n 'ord': ord,\n 'table': qn(meta.db_table),\n 'key': qn(meta.pk.db_column or meta.pk.column),\n }\n return sql, params\n\n\n _classes[QueryClass] = PyOdbcSSQuery\n return PyOdbcSSQuery",
"metadata": "root.query_class",
"header": "['module', '___EOS___']",
"index": 43
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"query",
"\\u",
"class_",
"(_",
"Query",
"Class_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
" ",
"a",
" ",
"custom",
" ",
"django",
".",
"db",
".",
"model",
"s",
".",
"sql",
".",
"query",
".",
"Query",
" ",
"subclass",
" ",
"tha",
"t",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"appropr",
"iate",
" ",
"for",
" ",
"MS",
" ",
"SQL",
" ",
"Server",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"global_",
"\\u",
"classes_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u",
"classes_",
"[_",
"Query",
"Class_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Key",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Py",
"Od",
"bc",
"SS",
"Query_",
"(_",
"Query",
"Class_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"sql",
"\\u",
"server_",
"._",
"pyo",
"dbc_",
"import_",
"aggregates",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"aggregates",
"\\u",
"module_",
"=_",
"aggregates",
"_",
"\\u\\u\\uNEWLINE\\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_",
"(_",
"Py",
"Od",
"bc",
"SS",
"Query_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"default",
"\\u",
"reverse",
"\\u",
"ordering_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"ord_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"we",
" ",
"are",
" ",
"an",
" ",
"insert",
" ",
"query",
",",
" ",
"monkey",
"patch",
" ",
"the",
" ",
"\"",
"as",
"\\u",
"sql",
"\"",
" ",
"method_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"._",
"models_",
"._",
"sql_",
"._",
"sub",
"queries_",
"import_",
"Insert",
"Query_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"self_",
",_",
"Insert",
"Query_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"orig",
"\\u",
"as",
"\\u",
"sql_",
"=_",
"self_",
"._",
"as",
"\\u",
"sql_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"as",
"\\u",
"sql_",
"=_",
"self_",
"._",
"\\u",
"insert",
"\\u",
"as",
"\\u",
"sql_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"insert",
"\\u",
"as",
"\\u",
"sql_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Help",
"er",
" ",
"method",
" ",
"for",
" ",
"monkey",
"patch",
"ing",
" ",
"Dj",
"ang",
"o",
" ",
"Insert",
"Query",
"'",
"s",
" ",
"as",
"\\u",
"sql",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"meta_",
"=_",
"self_",
"._",
"get",
"\\u",
"meta_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quoted",
"\\u",
"table_",
"=_",
"self_",
"._",
"connection_",
"._",
"ops_",
"._",
"quote",
"\\u",
"name_",
"(_",
"meta_",
"._",
"db",
"\\u",
"table_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"(",
"sql",
",",
" ",
"params",
")",
" ",
"from",
" ",
"original",
" ",
"Insert",
"Query",
".",
"as",
"\\u",
"sql_",
"\\u\\u\\uNL\\u\\u\\u_",
"sql_",
",_",
"params_",
"=_",
"self_",
"._",
"\\u",
"orig",
"\\u",
"as",
"\\u",
"sql_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"meta_",
"._",
"has",
"\\u",
"auto",
"\\u",
"field_",
"and_",
"meta_",
"._",
"auto",
"\\u",
"field_",
"._",
"column_",
"in_",
"self_",
"._",
"columns_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"len_",
"(_",
"self_",
"._",
"columns_",
")_",
"==_",
"1_",
"and_",
"not_",
"params_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"sql_",
"=_",
"\"",
"INSERT",
" ",
"INT",
"O",
" ",
"%",
"s",
" ",
"DEF",
"AUL",
"T",
" ",
"VALU",
"ES",
"\"_",
"%_",
"quoted",
"\\u",
"table_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"sql_",
"=_",
"\"",
"SET",
" ",
"IDENTITY",
"\\u",
"INSERT",
" ",
"%",
"s",
" ",
"ON",
";\\\\",
"n",
"%",
"s",
";\\\\",
"n",
"SET",
" ",
"IDENTITY",
"\\u",
"INSERT",
" ",
"%",
"s",
" ",
"OFF",
"\"_",
"%_",
"(_",
"quoted",
"\\u",
"table_",
",_",
"sql_",
",_",
"quoted",
"\\u",
"table_",
")_",
"\\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_",
"sql_",
",_",
"params_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"reduce",
"\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Enable",
" ",
"pick",
"ling",
" ",
"for",
" ",
"this",
" ",
"class",
" ",
"(",
"normal",
" ",
"pick",
"ling",
" ",
"handling",
" ",
"doe",
"sn",
"'",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"work",
" ",
"as",
" ",
"Pyth",
"on",
" ",
"can",
" ",
"only",
" ",
"pickle",
" ",
"module",
"-",
"level",
" ",
"classe",
"s",
" ",
"by",
" ",
"default",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"hasattr_",
"(_",
"Query",
"Class_",
",_",
"'\\u",
"\\u",
"getstate",
"\\u\\u'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"hasattr_",
"(_",
"Query",
"Class_",
",_",
"'\\u",
"\\u",
"setstate",
"\\u\\u'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"self_",
"._",
"\\u\\u",
"getstate",
"\\u\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
"=_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"(_",
"unpickle",
"\\u",
"query",
"\\u",
"class_",
",_",
"(_",
"Query",
"Class_",
",_",
")_",
",_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"convert",
"\\u",
"values_",
"(_",
"self_",
",_",
"value_",
",_",
"field_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Coe",
"rce",
" ",
"the",
" ",
"value",
" ",
"return",
"ed",
" ",
"by",
" ",
"the",
" ",
"databa",
"se",
" ",
"back",
"end",
" ",
"int",
"o",
" ",
"a",
" ",
"consistent",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"type",
" ",
"tha",
"t",
" ",
"is",
" ",
"compatible",
" ",
"with",
" ",
"the",
" ",
"field",
" ",
"type",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"In",
" ",
"our",
" ",
"case",
",",
" ",
"cate",
"r",
" ",
"for",
" ",
"the",
" ",
"fact",
" ",
"tha",
"t",
" ",
"SQL",
" ",
"Server",
" ",
"<",
" ",
"2008",
" ",
"has",
" ",
"no",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"separate",
" ",
"Date",
" ",
"and",
" ",
"Time",
" ",
"data",
" ",
"types",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"TOD",
"O",
":",
" ",
"See",
" ",
"how",
" ",
"we",
"'",
"ll",
" ",
"handle",
" ",
"this",
" ",
"for",
" ",
"SQL",
" ",
"Server",
" ",
">=",
" ",
"2008",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"value_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"field_",
"and_",
"field_",
"._",
"get",
"\\u",
"internal",
"\\u",
"type_",
"(_",
")_",
"==_",
"'",
"Date",
"Time",
"Field",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"field_",
"and_",
"field_",
"._",
"get",
"\\u",
"internal",
"\\u",
"type_",
"(_",
")_",
"==_",
"'",
"Date",
"Field",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"value_",
"._",
"date_",
"(_",
")_",
"#",
" ",
"extract",
" ",
"date_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"field_",
"and_",
"field_",
"._",
"get",
"\\u",
"internal",
"\\u",
"type_",
"(_",
")_",
"==_",
"'",
"Time",
"Field",
"'_",
"or_",
"(_",
"isinstance_",
"(_",
"value_",
",_",
"datetime_",
")_",
"and_",
"value_",
"._",
"year_",
"==_",
"1900",
"_",
"and_",
"value_",
"._",
"month_",
"==_",
"value_",
"._",
"day_",
"==_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"value_",
"._",
"time_",
"(_",
")_",
"#",
" ",
"extract",
" ",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Some",
" ",
"case",
"s",
" ",
"(",
"for",
" ",
"example",
" ",
"whe",
"n",
" ",
"select",
"\\u",
"relate",
"d",
"()",
" ",
"is",
" ",
"used",
")",
" ",
"are",
"n",
"'",
"t_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"cau",
"ght",
" ",
"by",
" ",
"the",
" ",
"Date",
"Field",
" ",
"case",
" ",
"above",
" ",
"and",
" ",
"date",
" ",
"fields",
" ",
"arrive",
" ",
"from_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"DB",
" ",
"as",
" ",
"datetime",
" ",
"instance",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Impl",
"ement",
" ",
"a",
" ",
"workar",
"ound",
" ",
"stea",
"ling",
" ",
"the",
" ",
"idea",
" ",
"from",
" ",
"the",
" ",
"Ora",
"cle_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"back",
"end",
".",
" ",
"It",
"'",
"s",
" ",
"not",
" ",
"perfect",
" ",
"so",
" ",
"the",
" ",
"same",
" ",
"warn",
"ing",
" ",
"appli",
"es",
" ",
"(",
"i",
".",
"e",
".",
" ",
"if",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"query",
" ",
"results",
" ",
"in",
" ",
"valid",
" ",
"date",
"+",
"time",
" ",
"values",
" ",
"with",
" ",
"the",
" ",
"time",
" ",
"part",
" ",
"set_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"mid",
"night",
",",
" ",
"this",
" ",
"workar",
"ound",
" ",
"can",
" ",
"sur",
"pris",
"e",
" ",
"us",
" ",
"by",
" ",
"convert",
"ing",
" ",
"them",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"the",
" ",
"datetime",
".",
"date",
" ",
"Pyth",
"on",
" ",
"type",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"value_",
",_",
"datetime_",
")_",
"and_",
"value_",
"._",
"hour_",
"==_",
"value_",
"._",
"minute_",
"==_",
"value_",
"._",
"second_",
"==_",
"value_",
"._",
"microsecond_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"value_",
"._",
"date_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Force",
" ",
"float",
"s",
" ",
"to",
" ",
"the",
" ",
"correct",
" ",
"type_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"value_",
"is_",
"not_",
"None_",
"and_",
"field_",
"and_",
"field_",
"._",
"get",
"\\u",
"internal",
"\\u",
"type_",
"(_",
")_",
"==_",
"'",
"Float",
"Field",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"float_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"resolve",
"\\u",
"columns_",
"(_",
"self_",
",_",
"row_",
",_",
"fields_",
"=_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"index",
"\\u",
"start_",
"=_",
"len_",
"(_",
"self_",
"._",
"extra",
"\\u",
"select_",
"._",
"keys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"values_",
"=_",
"[_",
"self_",
"._",
"convert",
"\\u",
"values_",
"(_",
"v_",
",_",
"None_",
")_",
"for_",
"v_",
"in_",
"row_",
"[_",
":_",
"index",
"\\u",
"start_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"value_",
",_",
"field_",
"in_",
"map_",
"(_",
"None_",
",_",
"row_",
"[_",
"index",
"\\u",
"start_",
":_",
"]_",
",_",
"fields_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"values_",
"._",
"append_",
"(_",
"self_",
"._",
"convert",
"\\u",
"values_",
"(_",
"value_",
",_",
"field_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"tuple_",
"(_",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"modif",
"y",
"\\u",
"query_",
"(_",
"self_",
",_",
"strategy_",
",_",
"ordering_",
",_",
"out",
"\\u",
"cols_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Help",
"er",
" ",
"method",
",",
" ",
"call",
"ed",
" ",
"from",
" ",
"\\u",
"as",
"\\u",
"sql",
"()",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Set",
"s",
" ",
"the",
" ",
"value",
" ",
"of",
" ",
"the",
" ",
"self",
".\\u",
"ord",
" ",
"and",
" ",
"self",
".",
"default",
"\\u",
"reverse",
"\\u",
"orderi",
"ng",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"attribute",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Can",
" ",
"modif",
"y",
" ",
"the",
" ",
"values",
" ",
"of",
" ",
"the",
" ",
"out",
"\\u",
"cols",
" ",
"list",
" ",
"argu",
"ment",
" ",
"and",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"self",
".",
"orderi",
"ng",
"\\u",
"alias",
"es",
" ",
"attribute",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"default",
"\\u",
"reverse",
"\\u",
"ordering_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"ord_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cnt_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"extra",
"\\u",
"select",
"\\u",
"aliases_",
"=_",
"[_",
"k_",
"._",
"strip_",
"(_",
"'[]'_",
")_",
"for_",
"k_",
"in_",
"self_",
"._",
"extra",
"\\u",
"select_",
"._",
"keys_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"ord",
"\\u",
"spec",
"\\u",
"item_",
"in_",
"ordering_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"ord",
"\\u",
"spec",
"\\u",
"item_",
"._",
"endswith_",
"(_",
"'",
" ",
"ASC",
"'_",
")_",
"or_",
"ord",
"\\u",
"spec",
"\\u",
"item_",
"._",
"endswith_",
"(_",
"'",
" ",
"DESC",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"parts_",
"=_",
"ord",
"\\u",
"spec",
"\\u",
"item_",
"._",
"split_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"col_",
",_",
"odi",
"r_",
"=_",
"'",
" ",
"'_",
"._",
"join_",
"(_",
"parts_",
"[_",
":_",
"-_",
"1_",
"]_",
")_",
",_",
"parts_",
"[_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"col_",
"not_",
"in_",
"self_",
"._",
"orderi",
"ng",
"\\u",
"aliases_",
"and_",
"col_",
"._",
"strip_",
"(_",
"'[]'_",
")_",
"not_",
"in_",
"extra",
"\\u",
"select",
"\\u",
"aliases_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"col_",
"._",
"isdigit_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"cnt_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"n_",
"=_",
"int_",
"(_",
"col_",
")_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"alias_",
"=_",
"'",
"Ord",
"Ali",
"as",
"%",
"d",
"'_",
"%_",
"cnt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"out",
"\\u",
"cols_",
"[_",
"n_",
"]_",
"=_",
"'%",
"s",
" ",
"AS",
" ",
"[",
"%",
"s",
"]'_",
"%_",
"(_",
"out",
"\\u",
"cols_",
"[_",
"n_",
"]_",
",_",
"alias_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"ord_",
"._",
"append_",
"(_",
"(_",
"alias_",
",_",
"odi",
"r_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"col_",
"in_",
"out",
"\\u",
"cols_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"strategy_",
"==_",
"USE",
"\\u",
"TOP",
"\\u",
"HM",
"AR",
"K_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"cnt_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"n_",
"=_",
"out",
"\\u",
"cols_",
"._",
"index_",
"(_",
"col_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"alias_",
"=_",
"'",
"Ord",
"Ali",
"as",
"%",
"d",
"'_",
"%_",
"cnt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"out",
"\\u",
"cols_",
"[_",
"n_",
"]_",
"=_",
"'%",
"s",
" ",
"AS",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"col_",
",_",
"alias_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"ord_",
"._",
"append_",
"(_",
"(_",
"alias_",
",_",
"odi",
"r_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"\\u",
"ord_",
"._",
"append_",
"(_",
"(_",
"col_",
",_",
"odi",
"r_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"strategy_",
"==_",
"USE",
"\\u",
"TOP",
"\\u",
"HM",
"AR",
"K_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Special",
" ",
"case",
":",
" ",
"'\\u",
"order",
"'",
" ",
"column",
" ",
"created",
" ",
"by",
" ",
"Dj",
"ang",
"o_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"whe",
"n",
" ",
"Meta",
".",
"order",
"\\u",
"with",
"\\u",
"respec",
"t",
"\\u",
"to",
" ",
"is",
" ",
"used_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"col_",
"._",
"split_",
"(_",
"'.'_",
")_",
"[_",
"-_",
"1_",
"]_",
"==_",
"'[",
"\\u",
"order",
"]'_",
"and_",
"odi",
"r_",
"==_",
"'",
"DESC",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"default",
"\\u",
"reverse",
"\\u",
"ordering_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"cnt_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"alias_",
"=_",
"'",
"Ord",
"Ali",
"as",
"%",
"d",
"'_",
"%_",
"cnt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"ord_",
"._",
"append_",
"(_",
"(_",
"alias_",
",_",
"odi",
"r_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"orderi",
"ng",
"\\u",
"aliases_",
"._",
"append_",
"(_",
"'%",
"s",
" ",
"AS",
" ",
"[",
"%",
"s",
"]'_",
"%_",
"(_",
"col_",
",_",
"alias_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"\\u",
"ord_",
"._",
"append_",
"(_",
"(_",
"col_",
",_",
"odi",
"r_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"\\u",
"ord_",
"._",
"append_",
"(_",
"(_",
"col_",
",_",
"odi",
"r_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"strategy_",
"==_",
"USE",
"\\u",
"ROW",
"\\u",
"NUMBER_",
"and_",
"not_",
"self_",
"._",
"\\u",
"ord_",
"and_",
"'",
"RAN",
"D",
"()'_",
"in_",
"ordering_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"ord_",
"._",
"append_",
"(_",
"(_",
"'",
"RAN",
"D",
"()'_",
",_",
"''_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"strategy_",
"==_",
"USE",
"\\u",
"TOP",
"\\u",
"HM",
"AR",
"K_",
"and_",
"not_",
"self_",
"._",
"\\u",
"ord_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"XX",
"X",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"meta",
" ",
"=",
" ",
"self",
".",
"get",
"\\u",
"meta",
"()",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"meta_",
"=_",
"self_",
"._",
"model_",
"._",
"\\u",
"meta_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"qn_",
"=_",
"self_",
"._",
"quote",
"\\u",
"name",
"\\u",
"unl",
"ess",
"\\u",
"alias_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pk",
"\\u",
"col_",
"=_",
"'%",
"s",
".",
"%",
"s",
"'_",
"%_",
"(_",
"qn_",
"(_",
"meta_",
"._",
"db",
"\\u",
"table_",
")_",
",_",
"qn_",
"(_",
"meta_",
"._",
"pk_",
"._",
"db",
"\\u",
"column_",
"or_",
"meta_",
"._",
"pk_",
"._",
"column_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"pk",
"\\u",
"col_",
"not_",
"in_",
"out",
"\\u",
"cols_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"out",
"\\u",
"cols_",
"._",
"append_",
"(_",
"pk",
"\\u",
"col_",
")_",
"\\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_",
"def_",
"\\u",
"as",
"\\u",
"sql_",
"(_",
"self_",
",_",
"strategy_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Help",
"er",
" ",
"method",
",",
" ",
"call",
"ed",
" ",
"from",
" ",
"as",
"\\u",
"sql",
"()",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Simil",
"ar",
" ",
"to",
" ",
"django",
"/",
"db",
"/",
"model",
"s",
"/",
"sql",
"/",
"query",
".",
"py",
":",
"Query",
".",
"as",
"\\u",
"sql",
"()",
" ",
"but",
" ",
"with",
"out",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"orderi",
"ng",
" ",
"and",
" ",
"limit",
"s",
" ",
"code",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
" ",
"SQL",
" ",
"tha",
"t",
" ",
"hasn",
"'",
"t",
" ",
"an",
" ",
"order",
"-",
"by",
" ",
"clause",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"get",
"\\u",
"column",
"s",
" ",
"need",
"s",
" ",
"to",
" ",
"be",
" ",
"call",
"ed",
" ",
"bef",
"ore",
" ",
"get",
"\\u",
"orderi",
"ng",
" ",
"to",
" ",
"populate_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\\u",
"select",
"\\u",
"alias",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"out",
"\\u",
"cols_",
"=_",
"self_",
"._",
"get",
"\\u",
"columns_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ordering_",
",_",
"orderi",
"ng",
"\\u",
"group",
"\\u",
"by_",
"=_",
"self_",
"._",
"get",
"\\u",
"ordering_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"strategy_",
"==_",
"USE",
"\\u",
"ROW",
"\\u",
"NUMBER_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"ordering_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"meta_",
"=_",
"self_",
"._",
"get",
"\\u",
"meta_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"qn_",
"=_",
"self_",
"._",
"quote",
"\\u",
"name",
"\\u",
"unl",
"ess",
"\\u",
"alias_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Special",
" ",
"case",
":",
" ",
"pk",
" ",
"not",
" ",
"in",
" ",
"out",
"\\u",
"cols",
",",
" ",
"use",
" ",
"random",
" ",
"orderi",
"ng",
".",
" _",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"'%",
"s",
".",
"%",
"s",
"'_",
"%_",
"(_",
"qn_",
"(_",
"meta_",
"._",
"db",
"\\u",
"table_",
")_",
",_",
"qn_",
"(_",
"meta_",
"._",
"pk_",
"._",
"db",
"\\u",
"column_",
"or_",
"meta_",
"._",
"pk_",
"._",
"column_",
")_",
")_",
"not_",
"in_",
"self_",
"._",
"get",
"\\u",
"columns_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"ordering_",
"=_",
"[_",
"'",
"RAN",
"D",
"()'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"XX",
"X",
":",
" ",
"Ma",
"yb",
"e",
" ",
"use",
" ",
"group",
"\\u",
"by",
" ",
"field",
" ",
"for",
" ",
"orderi",
"ng",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"if",
" ",
"self",
".",
"group",
"\\u",
"by",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"orderi",
"ng",
" ",
"=",
" ",
"['",
"%",
"s",
".",
"%",
"s",
" ",
"ASC",
"'",
" ",
"%",
" ",
"(",
"qn",
"(",
"self",
".",
"group",
"\\u",
"by",
"[",
"0",
"][",
"0",
"])",
",",
"qn",
"(",
"self",
".",
"group",
"\\u",
"by",
"[",
"0",
"][",
"1",
"]))",
"]_",
"\\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 ",
" ",
" _",
"ordering_",
"=_",
"[_",
"'%",
"s",
".",
"%",
"s",
" ",
"ASC",
"'_",
"%_",
"(_",
"qn_",
"(_",
"meta_",
"._",
"db",
"\\u",
"table_",
")_",
",_",
"qn_",
"(_",
"meta_",
"._",
"pk_",
"._",
"db",
"\\u",
"column_",
"or_",
"meta_",
"._",
"pk_",
"._",
"column_",
")_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"strategy_",
"in_",
"(_",
"USE",
"\\u",
"TOP",
"\\u",
"HM",
"AR",
"K_",
",_",
"USE",
"\\u",
"ROW",
"\\u",
"NUMBER_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"modif",
"y",
"\\u",
"query_",
"(_",
"strategy_",
",_",
"ordering_",
",_",
"out",
"\\u",
"cols_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"strategy_",
"==_",
"USE",
"\\u",
"ROW",
"\\u",
"NUMBER_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ord_",
"=_",
"',",
" ",
"'_",
"._",
"join_",
"(_",
"[_",
"'%",
"s",
" ",
"%",
"s",
"'_",
"%_",
"pair_",
"for_",
"pair_",
"in_",
"self_",
"._",
"\\u",
"ord_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"orderi",
"ng",
"\\u",
"aliases_",
"._",
"append_",
"(_",
"'(",
"ROW",
"\\u",
"NUMB",
"ER",
"()",
" ",
"OVER",
" ",
"(",
"ORDE",
"R",
" ",
"BY",
" ",
"%",
"s",
"))",
" ",
"AS",
" ",
"[",
"rn",
"]'_",
"%_",
"ord_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"must",
" ",
"come",
" ",
"after",
" ",
"'",
"select",
"'",
" ",
"and",
" ",
"'",
"orderi",
"ng",
"'",
" ",
"--",
" ",
"see",
" ",
"docstr",
"ing",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"get",
"\\u",
"from",
"\\u",
"clause",
"()",
" ",
"for",
" ",
"deta",
"il",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"from\\u_",
",_",
"f",
"\\u",
"params_",
"=_",
"self_",
"._",
"get",
"\\u",
"from",
"\\u",
"clause_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"qn_",
"=_",
"self_",
"._",
"quote",
"\\u",
"name",
"\\u",
"unl",
"ess",
"\\u",
"alias_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"where_",
",_",
"w",
"\\u",
"params_",
"=_",
"self_",
"._",
"where_",
"._",
"as",
"\\u",
"sql_",
"(_",
"qn_",
"=_",
"qn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"hav",
"ing_",
",_",
"h",
"\\u",
"params_",
"=_",
"self_",
"._",
"hav",
"ing_",
"._",
"as",
"\\u",
"sql_",
"(_",
"qn_",
"=_",
"qn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"val_",
"in_",
"self_",
"._",
"extra",
"\\u",
"select_",
"._",
"itervalues_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"params_",
"._",
"extend_",
"(_",
"val_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"=_",
"[_",
"'",
"SELECT",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"distinct_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"._",
"append_",
"(_",
"'",
"DIST",
"INC",
"T",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"strategy_",
"==_",
"USE",
"\\u",
"TOP",
"\\u",
"LM",
"AR",
"K_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"XX",
"X",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"meta",
" ",
"=",
" ",
"self",
".",
"get",
"\\u",
"meta",
"()",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"meta_",
"=_",
"self_",
"._",
"model_",
"._",
"\\u",
"meta_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"'",
"TOP",
" ",
"%",
"s",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"self_",
"._",
"low",
"\\u",
"mark_",
",_",
"self_",
"._",
"quote",
"\\u",
"name",
"\\u",
"unl",
"ess",
"\\u",
"alias_",
"(_",
"meta_",
"._",
"pk_",
"._",
"db",
"\\u",
"column_",
"or_",
"meta_",
"._",
"pk_",
"._",
"column_",
")_",
")_",
")_",
"\\u\\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_",
"strategy_",
"==_",
"USE",
"\\u",
"TOP",
"\\u",
"HM",
"AR",
"K_",
"and_",
"self_",
"._",
"high",
"\\u",
"mark_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"result_",
"._",
"append_",
"(_",
"'",
"TOP",
" ",
"%",
"s",
"'_",
"%_",
"self_",
"._",
"high",
"\\u",
"mark_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"',",
" ",
"'_",
"._",
"join_",
"(_",
"out",
"\\u",
"cols_",
"+_",
"self_",
"._",
"orderi",
"ng",
"\\u",
"aliases_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"'",
"FROM",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"._",
"extend_",
"(_",
"from\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"._",
"extend_",
"(_",
"f",
"\\u",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"where_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"._",
"append_",
"(_",
"'",
"WHE",
"RE",
" ",
"%",
"s",
"'_",
"%_",
"where_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"._",
"extend_",
"(_",
"w",
"\\u",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"extra",
"\\u",
"where_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"where_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"result_",
"._",
"append_",
"(_",
"'",
"WHE",
"RE",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"result_",
"._",
"append_",
"(_",
"'",
"AND",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"'",
" ",
"AND",
" ",
"'_",
"._",
"join_",
"(_",
"self_",
"._",
"extra",
"\\u",
"where_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"grouping_",
",_",
"gb",
"\\u",
"params_",
"=_",
"self_",
"._",
"get",
"\\u",
"grouping_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"grouping_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"ordering_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"the",
" ",
"back",
"end",
" ",
"can",
"'",
"t",
" ",
"group",
" ",
"by",
" ",
"PK",
" ",
"(",
"i",
".",
"e",
".,",
" ",
"any",
" ",
"database_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"other",
" ",
"than",
" ",
"My",
"SQL",
"),",
" ",
"then",
" ",
"any",
" ",
"fields",
" ",
"mentioned",
" ",
"in",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"orderi",
"ng",
" ",
"clause",
" ",
"need",
"s",
" ",
"to",
" ",
"be",
" ",
"in",
" ",
"the",
" ",
"group",
" ",
"by",
" ",
"clause",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"not_",
"self_",
"._",
"connection_",
"._",
"features_",
"._",
"allow",
"s",
"\\u",
"group",
"\\u",
"by",
"\\u",
"pk_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"for_",
"col_",
",_",
"col",
"\\u",
"params_",
"in_",
"orderi",
"ng",
"\\u",
"group",
"\\u",
"by_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"col_",
"not_",
"in_",
"grouping_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"grouping_",
"._",
"append_",
"(_",
"str_",
"(_",
"col_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"gb",
"\\u",
"params_",
"._",
"extend_",
"(_",
"col",
"\\u",
"params_",
")_",
"\\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 ",
" ",
"_",
"ordering_",
"=_",
"self_",
"._",
"connection_",
"._",
"ops_",
"._",
"force",
"\\u",
"no",
"\\u",
"ordering_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"'",
"GROU",
"P",
" ",
"BY",
" ",
"%",
"s",
"'_",
"%_",
"',",
" ",
"'_",
"._",
"join_",
"(_",
"grouping_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"._",
"extend_",
"(_",
"gb",
"\\u",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"hav",
"ing_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"._",
"append_",
"(_",
"'",
"HA",
"VING",
" ",
"%",
"s",
"'_",
"%_",
"hav",
"ing_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"._",
"extend_",
"(_",
"h",
"\\u",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"params_",
"._",
"extend_",
"(_",
"self_",
"._",
"extra",
"\\u",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"'",
" ",
"'_",
"._",
"join_",
"(_",
"result_",
")_",
",_",
"tuple_",
"(_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"as",
"\\u",
"sql_",
"(_",
"self_",
",_",
"with",
"\\u",
"limits_",
"=_",
"True_",
",_",
"with",
"\\u",
"col",
"\\u",
"aliases_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Creat",
"es",
" ",
"the",
" ",
"SQL",
" ",
"for",
" ",
"this",
" ",
"query",
".",
" ",
"Return",
"s",
" ",
"the",
" ",
"SQL",
" ",
"string",
" ",
"and",
" ",
"list",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"parameter",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"'",
"with",
"\\u",
"limit",
"s",
"'",
" ",
"is",
" ",
"Fal",
"se",
",",
" ",
"any",
" ",
"limit",
"/",
"offset",
" ",
"informati",
"on",
" ",
"is",
" ",
"not",
" ",
"include",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"in",
" ",
"the",
" ",
"query",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
" ",
"do",
"\\u",
"offset",
" ",
"flag",
" ",
"indicat",
"es",
" ",
"whe",
"ther",
" ",
"we",
" ",
"need",
" ",
"to",
" ",
"construct_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"SQL",
" ",
"need",
"ed",
" ",
"to",
" ",
"use",
" ",
"limit",
"/",
"offset",
" ",
"w",
"/",
"SQL",
" ",
"Server",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"do",
"\\u",
"offset_",
"=_",
"with",
"\\u",
"limits_",
"and_",
"(_",
"self_",
"._",
"high",
"\\u",
"mark_",
"is_",
"not_",
"None_",
"or_",
"self_",
"._",
"low",
"\\u",
"mark_",
"!=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"no",
" ",
"offset",
"s",
",",
" ",
"just",
" ",
"return",
" ",
"the",
" ",
"result",
" ",
"of",
" ",
"the",
" ",
"base",
" ",
"class_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"`",
"as",
"\\u",
"sql",
"`.",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"do",
"\\u",
"offset_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"super_",
"(_",
"Py",
"Od",
"bc",
"SS",
"Query_",
",_",
"self_",
")_",
"._",
"as",
"\\u",
"sql_",
"(_",
"with",
"\\u",
"limits_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"with",
"\\u",
"col",
"\\u",
"aliases_",
"=_",
"with",
"\\u",
"col",
"\\u",
"aliases_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Short",
"cut",
" ",
"for",
" ",
"the",
" ",
"corn",
"er",
" ",
"case",
" ",
"whe",
"n",
" ",
"high",
"\\u",
"mark",
" ",
"value",
" ",
"is",
" ",
"0",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"high",
"\\u",
"mark_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"\"_",
",_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"pre",
"\\u",
"sql",
"\\u",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"XX",
"X",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"meta",
" ",
"=",
" ",
"self",
".",
"get",
"\\u",
"meta",
"()",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"meta_",
"=_",
"self_",
"._",
"model_",
"._",
"\\u",
"meta_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"qn_",
"=_",
"self_",
"._",
"quote",
"\\u",
"name",
"\\u",
"unl",
"ess",
"\\u",
"alias_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fall",
"back",
"\\u",
"ordering_",
"=_",
"'%",
"s",
".",
"%",
"s",
"'_",
"%_",
"(_",
"qn_",
"(_",
"meta_",
"._",
"db",
"\\u",
"table_",
")_",
",_",
"qn_",
"(_",
"meta_",
"._",
"pk_",
"._",
"db",
"\\u",
"column_",
"or_",
"meta_",
"._",
"pk_",
"._",
"column_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"SQL",
" ",
"Server",
" ",
"2000",
",",
" ",
"offset",
"+",
"limit",
" ",
"case_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"connection_",
"._",
"ops_",
"._",
"sql",
"\\u",
"server",
"\\u",
"ver_",
"<_",
"2005",
"_",
"and_",
"self_",
"._",
"high",
"\\u",
"mark_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"orig",
"\\u",
"sql_",
",_",
"params_",
"=_",
"self_",
"._",
"\\u",
"as",
"\\u",
"sql_",
"(_",
"USE",
"\\u",
"TOP",
"\\u",
"HM",
"AR",
"K_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"ord_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"ord_",
"=_",
"',",
" ",
"'_",
"._",
"join_",
"(_",
"[_",
"'%",
"s",
" ",
"%",
"s",
"'_",
"%_",
"pair_",
"for_",
"pair_",
"in_",
"self_",
"._",
"\\u",
"ord_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rev",
"\\u",
"ord_",
"=_",
"',",
" ",
"'_",
"._",
"join_",
"(_",
"[_",
"'%",
"s",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"col_",
",_",
"REV",
"\\u",
"OD",
"IR_",
"[_",
"odi",
"r_",
"]_",
")_",
"for_",
"col_",
",_",
"odi",
"r_",
"in_",
"self_",
"._",
"\\u",
"ord_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"not_",
"self_",
"._",
"default",
"\\u",
"reverse",
"\\u",
"ordering_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"ord_",
"=_",
"'%",
"s",
" ",
"ASC",
"'_",
"%_",
"fall",
"back",
"\\u",
"ordering_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rev",
"\\u",
"ord_",
"=_",
"'%",
"s",
" ",
"DESC",
"'_",
"%_",
"fall",
"back",
"\\u",
"ordering_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"ord_",
"=_",
"'%",
"s",
" ",
"DESC",
"'_",
"%_",
"fall",
"back",
"\\u",
"ordering_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rev",
"\\u",
"ord_",
"=_",
"'%",
"s",
" ",
"ASC",
"'_",
"%_",
"fall",
"back",
"\\u",
"ordering_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"sql_",
"=_",
"SQL",
"\\u",
"SERVER",
"\\u",
"8",
"\\u",
"LIMIT",
"\\u",
"QUERY_",
"%_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"limit",
"'_",
":_",
"self_",
"._",
"high",
"\\u",
"mark_",
"-_",
"self_",
"._",
"low",
"\\u",
"mark_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"orig",
"\\u",
"sql",
"'_",
":_",
"orig",
"\\u",
"sql_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ord",
"'_",
":_",
"ord_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"rev",
"\\u",
"ord",
"'_",
":_",
"rev",
"\\u",
"ord_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"XX",
"X",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"table",
"'_",
":_",
"qn_",
"(_",
"meta_",
"._",
"db",
"\\u",
"table_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"sql_",
",_",
"params_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"SQL",
" ",
"Server",
" ",
"2005",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"connection_",
"._",
"ops_",
"._",
"sql",
"\\u",
"server",
"\\u",
"ver_",
">=_",
"2005",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sql_",
",_",
"params_",
"=_",
"self_",
"._",
"\\u",
"as",
"\\u",
"sql_",
"(_",
"USE",
"\\u",
"ROW",
"\\u",
"NUMBER_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Construct",
" ",
"the",
" ",
"final",
" ",
"SQL",
" ",
"clause",
",",
" ",
"usi",
"ng",
" ",
"the",
" ",
"initial",
" ",
"select",
" ",
"SQL_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"obtain",
"ed",
" ",
"above",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"[_",
"'",
"SELECT",
" ",
"*",
" ",
"FROM",
" ",
"(%",
"s",
")",
" ",
"AS",
" ",
"X",
"'_",
"%_",
"sql_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Place",
" ",
"WHE",
"RE",
" ",
"condition",
" ",
"on",
" ",
"`",
"rn",
"`",
" ",
"for",
" ",
"the",
" ",
"desi",
"red",
" ",
"range",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"high",
"\\u",
"mark_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"high",
"\\u",
"mark_",
"=_",
"9223",
"372",
"036",
"854",
"775",
"807",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"'",
"WHE",
"RE",
" ",
"X",
".",
"rn",
" ",
"BETWEEN",
" ",
"%",
"d",
" ",
"AND",
" ",
"%",
"d",
"'_",
"%_",
"(_",
"self_",
"._",
"low",
"\\u",
"mark_",
"+_",
"1_",
",_",
"self_",
"._",
"high",
"\\u",
"mark_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"'",
" ",
"'_",
"._",
"join_",
"(_",
"result_",
")_",
",_",
"params_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"SQL",
" ",
"Server",
" ",
"2000",
",",
" ",
"offset",
" ",
"with",
"out",
" ",
"limit",
" ",
"case_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"get",
"\\u",
"column",
"s",
" ",
"need",
"s",
" ",
"to",
" ",
"be",
" ",
"call",
"ed",
" ",
"bef",
"ore",
" ",
"get",
"\\u",
"orderi",
"ng",
" ",
"to",
" ",
"populate_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"select",
"\\u",
"alias",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"get",
"\\u",
"columns_",
"(_",
"with",
"\\u",
"col",
"\\u",
"aliases_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ordering_",
",_",
"orderi",
"ng",
"\\u",
"group",
"\\u",
"by_",
"=_",
"self_",
"._",
"get",
"\\u",
"ordering_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"ordering_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ord_",
"=_",
"',",
" ",
"'_",
"._",
"join_",
"(_",
"ordering_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"We",
" ",
"need",
" ",
"to",
" ",
"defin",
"e",
" ",
"an",
" ",
"orderi",
"ng",
" ",
"clause",
" ",
"sinc",
"e",
" ",
"none",
" ",
"was",
" ",
"provided",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ord_",
"=_",
"fall",
"back",
"\\u",
"ordering_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"orig",
"\\u",
"sql_",
",_",
"params_",
"=_",
"self_",
"._",
"\\u",
"as",
"\\u",
"sql_",
"(_",
"USE",
"\\u",
"TOP",
"\\u",
"LM",
"AR",
"K_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sql_",
"=_",
"SQL",
"\\u",
"SERVER",
"\\u",
"8",
"\\u",
"NO",
"\\u",
"LIMIT",
"\\u",
"QUERY_",
"%_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"orig",
"\\u",
"sql",
"'_",
":_",
"orig",
"\\u",
"sql_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ord",
"'_",
":_",
"ord_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"table",
"'_",
":_",
"qn_",
"(_",
"meta_",
"._",
"db",
"\\u",
"table_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"key",
"'_",
":_",
"qn_",
"(_",
"meta_",
"._",
"pk_",
"._",
"db",
"\\u",
"column_",
"or_",
"meta_",
"._",
"pk_",
"._",
"column_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"sql_",
",_",
"params_",
"\\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",
"classes_",
"[_",
"Query",
"Class_",
"]_",
"=_",
"Py",
"Od",
"bc",
"SS",
"Query_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | morepath/morepath/fixture_packages/base/base/m.py | [
{
"content": "import morepath\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class App(morepath.App):\n pass",
"metadata": "root.App",
"header": "['module', '___EOS___']",
"index": 3
},
{
"content": "class Foo(object):\n pass",
"metadata": "root.Foo",
"header": "['module', '___EOS___']",
"index": 7
},
{
"content": "@App.path(path='foo', model=Foo)\ndef get_foo():\n return Foo()",
"metadata": "root.get_foo",
"header": "['module', '___EOS___']",
"index": 11
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"more",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"App_",
"(_",
"more",
"path_",
"._",
"App_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Foo_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"App_",
"._",
"path_",
"(_",
"path_",
"=_",
"'",
"foo",
"'_",
",_",
"model_",
"=_",
"Foo_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"get",
"\\u",
"foo_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Foo_",
"(_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Module is imported with 'import' and 'import from' | benanne/kaggle-ndsb/icdf.py | [
{
"content": "import numpy as np \nfrom scipy.special import erfinv\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_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"scipy_",
"._",
"special_",
"import_",
"erf",
"inv_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
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
] |
Unused local variable | NORDUnet/opennsa/opennsa/protocols/shared/minisoap.py | [
{
"content": "def parseFault(payload):\n\n envelope = ET.fromstring(payload)\n\n if envelope.tag != SOAP_ENV:\n raise ValueError('Top element in soap payload is not SOAP:Envelope')\n\n # no header parsing for now\n\n body = envelope.find( str(SOAP_BODY) )\n if body is None:\n raise ValueError('Fault payload has no SOAP:Body element in SOAP:Envelope')\n\n fault = body.find( str(SOAP_FAULT) )\n if fault is None:\n raise ValueError('Fault payload has no SOAP:Fault element in SOAP:Body')\n\n # only SOAP 1.1 for now\n fault_code = fault.find('faultcode')\n if fault_code is None:\n raise ValueError('Fault payload has no faultcode element in SOAP:Fault')\n\n fault_string = fault.find('faultstring')\n if fault_string is None:\n raise ValueError('Fault payload has no faultstring element in SOAP:Fault')\n\n detail = None\n\n dt = fault.find('detail')\n if dt is not None:\n dc = dt.getchildren()[0]\n if dc is not None:\n detail = ET.tostring(dc)\n\n return fault_code.text, fault_string.text, detail",
"metadata": "root.parseFault",
"header": "['module', '___EOS___']",
"index": 126
}
] | [] | [] | 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_",
"parse",
"Fault_",
"(_",
"payload_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"envelope_",
"=_",
"ET_",
"._",
"fromstring_",
"(_",
"payload_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"envelope_",
"._",
"tag_",
"!=_",
"SOA",
"P",
"\\u",
"ENV_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"Top",
" ",
"element",
" ",
"in",
" ",
"soap",
" ",
"payload",
" ",
"is",
" ",
"not",
" ",
"SOA",
"P",
":",
"Env",
"elope",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"no",
" ",
"header",
" ",
"pars",
"ing",
" ",
"for",
" ",
"now_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"body_",
"=_",
"envelope_",
"._",
"find_",
"(_",
"str_",
"(_",
"SOA",
"P",
"\\u",
"BODY",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"body_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"Fau",
"lt",
" ",
"payload",
" ",
"has",
" ",
"no",
" ",
"SOA",
"P",
":",
"Bod",
"y",
" ",
"element",
" ",
"in",
" ",
"SOA",
"P",
":",
"Env",
"elope",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fault_",
"=_",
"body_",
"._",
"find_",
"(_",
"str_",
"(_",
"SOA",
"P",
"\\u",
"FA",
"ULT",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"fault_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"Fau",
"lt",
" ",
"payload",
" ",
"has",
" ",
"no",
" ",
"SOA",
"P",
":",
"Fau",
"lt",
" ",
"element",
" ",
"in",
" ",
"SOA",
"P",
":",
"Bod",
"y",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"only",
" ",
"SOA",
"P",
" ",
"1.1",
" ",
"for",
" ",
"now_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fault",
"\\u",
"code_",
"=_",
"fault_",
"._",
"find_",
"(_",
"'",
"fault",
"code",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"fault",
"\\u",
"code_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"Fau",
"lt",
" ",
"payload",
" ",
"has",
" ",
"no",
" ",
"fault",
"code",
" ",
"element",
" ",
"in",
" ",
"SOA",
"P",
":",
"Fau",
"lt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fault",
"\\u",
"string_",
"=_",
"fault_",
"._",
"find_",
"(_",
"'",
"faults",
"tring",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"fault",
"\\u",
"string_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"Fau",
"lt",
" ",
"payload",
" ",
"has",
" ",
"no",
" ",
"faults",
"tring",
" ",
"element",
" ",
"in",
" ",
"SOA",
"P",
":",
"Fau",
"lt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"detail_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dt_",
"=_",
"fault_",
"._",
"find_",
"(_",
"'",
"deta",
"il",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"dt_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dc_",
"=_",
"dt_",
"._",
"getch",
"ildren_",
"(_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"dc_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"detail_",
"=_",
"ET_",
"._",
"tostring_",
"(_",
"dc_",
")_",
"\\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_",
"fault",
"\\u",
"code_",
"._",
"text_",
",_",
"fault",
"\\u",
"string_",
"._",
"text_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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
] |
Except block handles 'BaseException' | openstack/horizon/openstack_dashboard/dashboards/project/networks/views.py | [
{
"content": " def get_ports_data(self):\n try:\n network_id = self.kwargs['network_id']\n ports = api.neutron.port_list(self.request, network_id=network_id)\n except Exception:\n ports = []\n msg = _('Port list can not be retrieved.')\n exceptions.handle(self.request, msg)\n return ports",
"metadata": "root.DetailView.get_ports_data",
"header": "['class', 'DetailView', '(', 'tables', '.', 'MultiTableView', ')', ':', '___EOS___']",
"index": 116
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Det",
"ail",
"View_",
"(_",
"tables_",
"._",
"Multi",
"Table",
"View_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"port",
"s",
"\\u",
"data_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"network",
"\\u",
"id_",
"=_",
"self_",
"._",
"kwargs_",
"[_",
"'",
"network",
"\\u",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ports_",
"=_",
"api_",
"._",
"neutron_",
"._",
"port",
"\\u",
"list_",
"(_",
"self_",
"._",
"request_",
",_",
"network",
"\\u",
"id_",
"=_",
"network",
"\\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 ",
" _",
"ports_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"=_",
"\\u_",
"(_",
"'",
"Port",
" ",
"list",
" ",
"can",
" ",
"not",
" ",
"be",
" ",
"retrieved",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"exceptions_",
"._",
"handle_",
"(_",
"self_",
"._",
"request_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"ports_",
"\\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
] |
Unused import | adblockplus/gyp/test/self-dependency/gyptest-self-dependency.py | [
{
"content": "#!/usr/bin/env python\n\n# Copyright (c) 2013 Google Inc. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\"\"\"\nVerify that pulling in a dependency a second time in a conditional works for\nshared_library targets. Regression test for http://crbug.com/122588\n\"\"\"\n\nimport TestGyp\n\ntest = TestGyp.TestGyp()\n\ntest.run_gyp('self_dependency.gyp')\n\n# If running gyp worked, all is well.\ntest.pass_test()\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",
" ",
"(",
"c",
")",
" ",
"2013",
" ",
"Goo",
"gle",
" ",
"Inc",
".",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Us",
"e",
" ",
"of",
" ",
"this",
" ",
"source",
" ",
"code",
" ",
"is",
" ",
"govern",
"ed",
" ",
"by",
" ",
"a",
" ",
"BS",
"D",
"-",
"style",
" ",
"license",
" ",
"tha",
"t",
" ",
"can",
" ",
"be_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"found",
" ",
"in",
" ",
"the",
" ",
"LICENSE",
" ",
"file",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Verify",
" ",
"tha",
"t",
" ",
"pull",
"ing",
" ",
"in",
" ",
"a",
" ",
"dependen",
"cy",
" ",
"a",
" ",
"second",
" ",
"time",
" ",
"in",
" ",
"a",
" ",
"conditional",
" ",
"works",
" ",
"for",
"\\",
"10",
";",
"shared",
"\\u",
"librar",
"y",
" ",
"target",
"s",
".",
" ",
"Regr",
"ession",
" ",
"test",
" ",
"for",
" ",
"http",
"://",
"cr",
"bug",
".",
"com",
"/",
"122",
"588",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"Test",
"Gy",
"p_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"test_",
"=_",
"Test",
"Gy",
"p_",
"._",
"Test",
"Gy",
"p_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"test_",
"._",
"run",
"\\u",
"gyp",
"_",
"(_",
"'",
"self",
"\\u",
"dependen",
"cy",
".",
"gyp",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"runn",
"ing",
" ",
"gyp",
" ",
"worked",
",",
" ",
"all",
" ",
"is",
" ",
"well",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"test_",
"._",
"pass",
"\\u",
"test_",
"(_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | whtsky/Catsup/catsup/models.py | [
{
"content": "# -*- coding: utf-8 -*-\n\nimport os\nimport re\n\nfrom datetime import datetime\n\nfrom catsup.options import g\nfrom catsup.utils import html_to_raw_text\nfrom .utils import Pagination\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class CatsupPage(object):\n\n\n",
"metadata": "root.CatsupPage",
"header": "['module', '___EOS___']",
"index": 12
},
{
"content": " @property\n def class_name(self):\n return self.__class__.__name__.lower()",
"metadata": "root.CatsupPage.class_name",
"header": "['class', 'CatsupPage', '(', 'object', ')', ':', '___EOS___']",
"index": 13
},
{
"content": " def get_permalink_args(self):\n return {}",
"metadata": "root.CatsupPage.get_permalink_args",
"header": "['class', 'CatsupPage', '(', 'object', ')', ':', '___EOS___']",
"index": 17
},
{
"content": " @property\n def permalink(self):\n kwargs = self.__dict__.copy()\n kwargs.update(self.get_permalink_args())\n return g.permalink[self.class_name].format(**kwargs).replace(\" \", \"-\")",
"metadata": "root.CatsupPage.permalink",
"header": "['class', 'CatsupPage', '(', 'object', ')', ':', '___EOS___']",
"index": 20
},
{
"content": " def render(self, renderer, **kwargs):\n if hasattr(self, \"template_name\"):\n template_name = self.template_name\n else:\n template_name = self.class_name + \".html\"\n kwargs[self.class_name] = self\n kwargs.update(self.__dict__)\n renderer.render_to(template_name, self.permalink, **kwargs)",
"metadata": "root.CatsupPage.render",
"header": "['class', 'CatsupPage', '(', 'object', ')', ':', '___EOS___']",
"index": 26
},
{
"content": "class Tag(CatsupPage):\n\n\n",
"metadata": "root.Tag",
"header": "['module', '___EOS___']",
"index": 36
},
{
"content": " def __init__(self, name):\n self.name = name\n self.posts = []",
"metadata": "root.Tag.__init__",
"header": "['class', 'Tag', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 37
},
{
"content": " def add_post(self, post):\n self.posts.append(post)",
"metadata": "root.Tag.add_post",
"header": "['class', 'Tag', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 41
},
{
"content": " @property\n def count(self):\n return len(self.posts)",
"metadata": "root.Tag.count",
"header": "['class', 'Tag', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 44
},
{
"content": " def __iter__(self):\n for post in self.posts:\n yield post",
"metadata": "root.Tag.__iter__",
"header": "['class', 'Tag', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 48
},
{
"content": "class Tags(CatsupPage):\n\n\n\n",
"metadata": "root.Tags",
"header": "['module', '___EOS___']",
"index": 53
},
{
"content": " def __init__(self, tags=None):\n if tags is None:\n tags = {}\n self.tags_dict = tags",
"metadata": "root.Tags.__init__",
"header": "['class', 'Tags', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 54
},
{
"content": " def get(self, name):\n return self.tags_dict.setdefault(\n name,\n Tag(name)\n )",
"metadata": "root.Tags.get",
"header": "['class', 'Tags', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 59
},
{
"content": " def render(self, renderer, **kwargs):\n for tag in self.tags:\n tag.render(renderer)\n super(Tags, self).render(renderer, **kwargs)",
"metadata": "root.Tags.render",
"header": "['class', 'Tags', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 65
},
{
"content": " @property\n def tags(self):\n if not hasattr(self, \"_tags\"):\n self._tags = list(self.tags_dict.values())\n self._tags.sort(\n key=lambda x: x.count,\n reverse=True\n )\n return self._tags",
"metadata": "root.Tags.tags",
"header": "['class', 'Tags', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 70
},
{
"content": " def __iter__(self):\n for tag in self.tags:\n yield tag",
"metadata": "root.Tags.__iter__",
"header": "['class', 'Tags', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 80
},
{
"content": "class Archive(CatsupPage):\n\n\n",
"metadata": "root.Archive",
"header": "['module', '___EOS___']",
"index": 85
},
{
"content": " def __init__(self, year):\n self.year = int(year)\n self.posts = []",
"metadata": "root.Archive.__init__",
"header": "['class', 'Archive', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 86
},
{
"content": " def add_post(self, post):\n self.posts.append(post)",
"metadata": "root.Archive.add_post",
"header": "['class', 'Archive', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 90
},
{
"content": " @property\n def count(self):\n return len(self.posts)",
"metadata": "root.Archive.count",
"header": "['class', 'Archive', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 93
},
{
"content": " def __iter__(self):\n for post in self.posts:\n yield post",
"metadata": "root.Archive.__iter__",
"header": "['class', 'Archive', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 97
},
{
"content": "class Archives(CatsupPage):\n\n\n\n",
"metadata": "root.Archives",
"header": "['module', '___EOS___']",
"index": 102
},
{
"content": " def __init__(self, archives=None):\n if archives is None:\n archives = {}\n self.archives_dict = archives",
"metadata": "root.Archives.__init__",
"header": "['class', 'Archives', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 103
},
{
"content": " def get(self, year):\n return self.archives_dict.setdefault(\n year,\n Archive(year)\n )",
"metadata": "root.Archives.get",
"header": "['class', 'Archives', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 108
},
{
"content": " def render(self, renderer, **kwargs):\n for tag in self.archives:\n tag.render(renderer)\n super(Archives, self).render(renderer, **kwargs)",
"metadata": "root.Archives.render",
"header": "['class', 'Archives', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 114
},
{
"content": " @property\n def archives(self):\n if not hasattr(self, \"_archives\"):\n self._archives = list(self.archives_dict.values())\n self._archives.sort(\n key=lambda x: x.year,\n reverse=True\n )\n return self._archives",
"metadata": "root.Archives.archives",
"header": "['class', 'Archives', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 119
},
{
"content": " def __iter__(self):\n for archive in self.archives:\n yield archive",
"metadata": "root.Archives.__iter__",
"header": "['class', 'Archives', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 129
},
{
"content": "class Post(CatsupPage):\n DATE_RE = re.compile('\\d{4}\\-\\d{2}\\-\\d{2}')\n\n\n\n\n\n\n\n\n",
"metadata": "root.Post",
"header": "['module', '___EOS___']",
"index": 134
},
{
"content": " def __init__(self, path, meta, content):\n self.path = path\n self.filename, _ = os.path.splitext(os.path.basename(path))\n self.meta = meta\n self.content = content\n self.tags = []\n self.date = self.datetime.strftime(\"%Y-%m-%d\")\n\n filename, _ = os.path.splitext(os.path.basename(path))\n if self.DATE_RE.match(filename[:10]):\n self.meta.setdefault(\"date\", filename[:10])\n self.filename = filename[11:]\n else:\n self.filename = filename\n\n if \"date\" in self.meta:\n self.date = self.meta.date\n else:\n self.date = self.datetime.strftime(\"%Y-%m-%d\")",
"metadata": "root.Post.__init__",
"header": "['class', 'Post', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 137
},
{
"content": " def add_archive_and_tags(self):\n year = self.datetime.strftime(\"%Y\")\n g.archives.get(year).add_post(self)\n\n for tag in self.meta.pop(\"tags\", \"\").split(\",\"):\n tag = tag.strip()\n tag = g.tags.get(tag)\n tag.add_post(self)\n self.tags.append(tag)",
"metadata": "root.Post.add_archive_and_tags",
"header": "['class', 'Post', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 157
},
{
"content": " @property\n def permalink(self):\n if \"permalink\" in self.meta:\n return self.meta.permalink\n return super(Post, self).permalink",
"metadata": "root.Post.permalink",
"header": "['class', 'Post', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 167
},
{
"content": " def get_permalink_args(self):\n args = self.meta.copy()\n args.update(\n title=self.title,\n datetime=self.datetime\n )\n return args",
"metadata": "root.Post.get_permalink_args",
"header": "['class', 'Post', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 173
},
{
"content": " @property\n def datetime(self):\n import os\n if \"time\" in self.meta:\n return datetime.strptime(\n self.meta.time, \"%Y-%m-%d %H:%M\"\n )\n elif \"date\" in self.meta:\n return datetime.strptime(\n self.meta.date, \"%Y-%m-%d\"\n )\n st_ctime = os.stat(self.path).st_ctime\n return datetime.fromtimestamp(st_ctime)",
"metadata": "root.Post.datetime",
"header": "['class', 'Post', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 181
},
{
"content": " @property\n def description(self):\n if \"description\" not in self.meta:\n description = self.meta.get(\n \"description\",\n self.content\n ).replace(\"\\n\", \"\")\n description = html_to_raw_text(description)\n if \"<br\" in description:\n description = description.split(\"<br\")[0]\n elif \"</p\" in description:\n description = description.split(\"</p\")[0]\n if len(description) > 150:\n description = description[:150]\n self.meta.description = description.strip()\n return self.meta.description",
"metadata": "root.Post.description",
"header": "['class', 'Post', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 195
},
{
"content": " @property\n def allow_comment(self):\n if self.meta.get(\"comment\", None) == \"disabled\":\n return False\n else:\n return g.config.comment.allow",
"metadata": "root.Post.allow_comment",
"header": "['class', 'Post', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 212
},
{
"content": " @property\n def title(self):\n return self.meta.get(\"title\", self.filename)",
"metadata": "root.Post.title",
"header": "['class', 'Post', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 219
},
{
"content": " @property\n def type(self):\n return self.meta.type",
"metadata": "root.Post.type",
"header": "['class', 'Post', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 223
},
{
"content": "class Page(CatsupPage):\n\n\n",
"metadata": "root.Page",
"header": "['module', '___EOS___']",
"index": 228
},
{
"content": " def __init__(self, posts):\n self.posts = posts\n self.per_page = g.theme.post_per_page",
"metadata": "root.Page.__init__",
"header": "['class', 'Page', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 229
},
{
"content": " @staticmethod\n def get_permalink(page):\n if page == 1:\n return \"/\"\n return g.permalink[\"page\"].format(page=page)",
"metadata": "root.Page.get_permalink",
"header": "['class', 'Page', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 233
},
{
"content": " @property\n def permalink(self):\n return Page.get_permalink(self.page)",
"metadata": "root.Page.permalink",
"header": "['class', 'Page', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 239
},
{
"content": " def render_all(self, renderer):\n count = int((len(self.posts) - 1) / self.per_page) + 1\n for i in range(count):\n page = i + 1\n if page == 1:\n self._permalink = \"/\"\n self.page = page\n pagination = Pagination(\n page=page,\n posts=self.posts,\n per_page=self.per_page,\n get_permalink=self.get_permalink\n )\n self.render(renderer=renderer, pagination=pagination)",
"metadata": "root.Page.render_all",
"header": "['class', 'Page', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 243
},
{
"content": "class Feed(CatsupPage):",
"metadata": "root.Feed",
"header": "['module', '___EOS___']",
"index": 259
},
{
"content": " def __init__(self, posts):\n self.posts = posts\n self.template_name = \"feed.xml\"",
"metadata": "root.Feed.__init__",
"header": "['class', 'Feed', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 260
},
{
"content": "class NotFound(CatsupPage):\n",
"metadata": "root.NotFound",
"header": "['module', '___EOS___']",
"index": 265
},
{
"content": " def __init__(self):\n self.template_name = \"404.html\"",
"metadata": "root.NotFound.__init__",
"header": "['class', 'NotFound', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 266
},
{
"content": " @property\n def permalink(self):\n return \"/404.html\"",
"metadata": "root.NotFound.permalink",
"header": "['class', 'NotFound', '(', 'CatsupPage', ')', ':', '___EOS___']",
"index": 269
}
] | [] | [] | 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_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"datetime_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"cat",
"sup_",
"._",
"options_",
"import_",
"g_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cat",
"sup_",
"._",
"utils_",
"import_",
"html",
"\\u",
"to",
"\\u",
"raw",
"\\u",
"text_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"utils_",
"import_",
"Pagination",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"Cat",
"sup",
"Page_",
"(_",
"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_",
"[SEP]_",
"class_",
"Cat",
"sup",
"Page_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"class",
"\\u",
"name_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
"._",
"lower_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cat",
"sup",
"Page_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"permalink",
"\\u",
"args_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cat",
"sup",
"Page_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"permalink",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"kwargs_",
"=_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
"._",
"copy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kwargs_",
"._",
"update_",
"(_",
"self_",
"._",
"get",
"\\u",
"permalink",
"\\u",
"args_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"g_",
"._",
"permalink",
"_",
"[_",
"self_",
"._",
"class",
"\\u",
"name_",
"]_",
"._",
"format_",
"(_",
"**_",
"kwargs_",
")_",
"._",
"replace_",
"(_",
"\"",
" ",
"\"_",
",_",
"\"-\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cat",
"sup",
"Page_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render_",
"(_",
"self_",
",_",
"renderer_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"hasattr_",
"(_",
"self_",
",_",
"\"",
"template",
"\\u",
"name",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"template",
"\\u",
"name_",
"=_",
"self_",
"._",
"template",
"\\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 ",
" _",
"template",
"\\u",
"name_",
"=_",
"self_",
"._",
"class",
"\\u",
"name_",
"+_",
"\".",
"html",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"kwargs_",
"[_",
"self_",
"._",
"class",
"\\u",
"name_",
"]_",
"=_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kwargs_",
"._",
"update_",
"(_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"renderer_",
"._",
"render",
"\\u",
"to_",
"(_",
"template",
"\\u",
"name_",
",_",
"self_",
"._",
"permalink",
"_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Tag_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Tag_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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_",
",_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"name_",
"=_",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"posts_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tag_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"add",
"\\u",
"post_",
"(_",
"self_",
",_",
"post_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"posts_",
"._",
"append_",
"(_",
"post_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tag_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"count_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"len_",
"(_",
"self_",
"._",
"posts_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tag_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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 ",
" _",
"for_",
"post_",
"in_",
"self_",
"._",
"posts_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"yield_",
"post_",
"\\u\\u\\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_",
"Tags_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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_",
"Tags_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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_",
",_",
"tags_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"tags_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tags_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"tags",
"\\u",
"dict_",
"=_",
"tags_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tags_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get_",
"(_",
"self_",
",_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"tags",
"\\u",
"dict_",
"._",
"setdefault_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Tag_",
"(_",
"name_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tags_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render_",
"(_",
"self_",
",_",
"renderer_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"tag_",
"in_",
"self_",
"._",
"tags_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tag_",
"._",
"render_",
"(_",
"renderer_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"super_",
"(_",
"Tags_",
",_",
"self_",
")_",
"._",
"render_",
"(_",
"renderer_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tags_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"tags_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"hasattr_",
"(_",
"self_",
",_",
"\"\\u",
"tags",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"tags_",
"=_",
"list_",
"(_",
"self_",
"._",
"tags",
"\\u",
"dict_",
"._",
"values_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"tags_",
"._",
"sort_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"key_",
"=_",
"lambda_",
"x_",
":_",
"x_",
"._",
"count_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"reverse_",
"=_",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"tags_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tags_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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 ",
" _",
"for_",
"tag_",
"in_",
"self_",
"._",
"tags_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"yield_",
"tag_",
"\\u\\u\\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_",
"Archive_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Archive_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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_",
",_",
"year_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"year_",
"=_",
"int_",
"(_",
"year_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"posts_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Archive_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"add",
"\\u",
"post_",
"(_",
"self_",
",_",
"post_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"posts_",
"._",
"append_",
"(_",
"post_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Archive_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"count_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"len_",
"(_",
"self_",
"._",
"posts_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Archive_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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 ",
" _",
"for_",
"post_",
"in_",
"self_",
"._",
"posts_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"yield_",
"post_",
"\\u\\u\\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_",
"Archive",
"s_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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_",
"Archive",
"s_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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_",
",_",
"archives",
"_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"archives",
"_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"archives",
"_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"archives",
"\\u",
"dict_",
"=_",
"archives",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Archive",
"s_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get_",
"(_",
"self_",
",_",
"year_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"archives",
"\\u",
"dict_",
"._",
"setdefault_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"year_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Archive_",
"(_",
"year_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Archive",
"s_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render_",
"(_",
"self_",
",_",
"renderer_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"tag_",
"in_",
"self_",
"._",
"archives",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tag_",
"._",
"render_",
"(_",
"renderer_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"super_",
"(_",
"Archive",
"s_",
",_",
"self_",
")_",
"._",
"render_",
"(_",
"renderer_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Archive",
"s_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"archives",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"hasattr_",
"(_",
"self_",
",_",
"\"\\u",
"archives",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"archives",
"_",
"=_",
"list_",
"(_",
"self_",
"._",
"archives",
"\\u",
"dict_",
"._",
"values_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"archives",
"_",
"._",
"sort_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"key_",
"=_",
"lambda_",
"x_",
":_",
"x_",
"._",
"year_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"reverse_",
"=_",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"archives",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Archive",
"s_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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 ",
" _",
"for_",
"archive_",
"in_",
"self_",
"._",
"archives",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"yield_",
"archive_",
"\\u\\u\\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_",
"Post_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"DAT",
"E",
"\\u",
"RE_",
"=_",
"re_",
"._",
"compile_",
"(_",
"'\\\\",
"d",
"{",
"4",
"}\\\\",
"-\\\\",
"d",
"{",
"2",
"}\\\\",
"-\\\\",
"d",
"{",
"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_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Post_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"path_",
",_",
"meta_",
",_",
"content_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"path_",
"=_",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"filename_",
",_",
"\\u_",
"=_",
"os_",
"._",
"path_",
"._",
"splitext_",
"(_",
"os_",
"._",
"path_",
"._",
"basename_",
"(_",
"path_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"meta_",
"=_",
"meta_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"content_",
"=_",
"content_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"tags_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"date_",
"=_",
"self_",
"._",
"datetime_",
"._",
"strftime_",
"(_",
"\"%",
"Y",
"-%",
"m",
"-%",
"d",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"filename_",
",_",
"\\u_",
"=_",
"os_",
"._",
"path_",
"._",
"splitext_",
"(_",
"os_",
"._",
"path_",
"._",
"basename_",
"(_",
"path_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"DAT",
"E",
"\\u",
"RE_",
"._",
"match_",
"(_",
"filename_",
"[_",
":_",
"10_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"meta_",
"._",
"setdefault_",
"(_",
"\"",
"date",
"\"_",
",_",
"filename_",
"[_",
":_",
"10_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"filename_",
"=_",
"filename_",
"[_",
"11_",
":_",
"]_",
"\\u\\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_",
"._",
"filename_",
"=_",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\"",
"date",
"\"_",
"in_",
"self_",
"._",
"meta_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"date_",
"=_",
"self_",
"._",
"meta_",
"._",
"date_",
"\\u\\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_",
"._",
"date_",
"=_",
"self_",
"._",
"datetime_",
"._",
"strftime_",
"(_",
"\"%",
"Y",
"-%",
"m",
"-%",
"d",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Post_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\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",
"archive",
"\\u",
"and",
"\\u",
"tags_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"year_",
"=_",
"self_",
"._",
"datetime_",
"._",
"strftime_",
"(_",
"\"%",
"Y",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"g_",
"._",
"archives",
"_",
"._",
"get_",
"(_",
"year_",
")_",
"._",
"add",
"\\u",
"post_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"tag_",
"in_",
"self_",
"._",
"meta_",
"._",
"pop_",
"(_",
"\"",
"tags",
"\"_",
",_",
"\"\"_",
")_",
"._",
"split_",
"(_",
"\",\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tag_",
"=_",
"tag_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tag_",
"=_",
"g_",
"._",
"tags_",
"._",
"get_",
"(_",
"tag_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tag_",
"._",
"add",
"\\u",
"post_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"tags_",
"._",
"append_",
"(_",
"tag_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Post_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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_",
"permalink",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"\"",
"permalink",
"\"_",
"in_",
"self_",
"._",
"meta_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"meta_",
"._",
"permalink",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"super_",
"(_",
"Post_",
",_",
"self_",
")_",
"._",
"permalink",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Post_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"permalink",
"\\u",
"args_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"=_",
"self_",
"._",
"meta_",
"._",
"copy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"._",
"update_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"title_",
"=_",
"self_",
"._",
"title_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"datetime_",
"=_",
"self_",
"._",
"datetime_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Post_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"datetime_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"\"",
"time",
"\"_",
"in_",
"self_",
"._",
"meta_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"datetime_",
"._",
"strptime_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"meta_",
"._",
"time_",
",_",
"\"%",
"Y",
"-%",
"m",
"-%",
"d",
" ",
"%",
"H",
":",
"%",
"M",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"\"",
"date",
"\"_",
"in_",
"self_",
"._",
"meta_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"datetime_",
"._",
"strptime_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"meta_",
"._",
"date_",
",_",
"\"%",
"Y",
"-%",
"m",
"-%",
"d",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"st",
"\\u",
"ctime_",
"=_",
"os_",
"._",
"stat_",
"(_",
"self_",
"._",
"path_",
")_",
"._",
"st",
"\\u",
"ctime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"datetime_",
"._",
"fromtimestamp_",
"(_",
"st",
"\\u",
"ctime_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Post_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"description_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"\"",
"description",
"\"_",
"not_",
"in_",
"self_",
"._",
"meta_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"description_",
"=_",
"self_",
"._",
"meta_",
"._",
"get_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"description",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"content_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"._",
"replace_",
"(_",
"\"\\\\",
"n",
"\"_",
",_",
"\"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"description_",
"=_",
"html",
"\\u",
"to",
"\\u",
"raw",
"\\u",
"text_",
"(_",
"description_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"\"<",
"br",
"\"_",
"in_",
"description_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"description_",
"=_",
"description_",
"._",
"split_",
"(_",
"\"<",
"br",
"\"_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"\"<",
"/",
"p",
"\"_",
"in_",
"description_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"description_",
"=_",
"description_",
"._",
"split_",
"(_",
"\"<",
"/",
"p",
"\"_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"len_",
"(_",
"description_",
")_",
">_",
"150_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"description_",
"=_",
"description_",
"[_",
":_",
"150_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"meta_",
"._",
"description_",
"=_",
"description_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"meta_",
"._",
"description_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Post_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"allow",
"\\u",
"comment_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"meta_",
"._",
"get_",
"(_",
"\"",
"comment",
"\"_",
",_",
"None_",
")_",
"==_",
"\"",
"disable",
"d",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"g_",
"._",
"config_",
"._",
"comment_",
"._",
"allow_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Post_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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_",
"title_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"meta_",
"._",
"get_",
"(_",
"\"",
"title",
"\"_",
",_",
"self_",
"._",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Post_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"type_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"meta_",
"._",
"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_",
"Page_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Page_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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_",
",_",
"posts_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"posts_",
"=_",
"posts_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"per",
"\\u",
"page_",
"=_",
"g_",
"._",
"theme_",
"._",
"post",
"\\u",
"per",
"\\u",
"page_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Page_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"staticmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"get",
"\\u",
"permalink",
"_",
"(_",
"page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"page_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"/\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"g_",
"._",
"permalink",
"_",
"[_",
"\"",
"page",
"\"_",
"]_",
"._",
"format_",
"(_",
"page_",
"=_",
"page_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Page_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"permalink",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Page_",
"._",
"get",
"\\u",
"permalink",
"_",
"(_",
"self_",
"._",
"page_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Page_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render",
"\\u",
"all_",
"(_",
"self_",
",_",
"renderer_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"count_",
"=_",
"int_",
"(_",
"(_",
"len_",
"(_",
"self_",
"._",
"posts_",
")_",
"-_",
"1_",
")_",
"/_",
"self_",
"._",
"per",
"\\u",
"page_",
")_",
"+_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"count_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"page_",
"=_",
"i_",
"+_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"page_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"permalink",
"_",
"=_",
"\"/\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"page_",
"=_",
"page_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pagination_",
"=_",
"Pagination",
"_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"page_",
"=_",
"page_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"posts_",
"=_",
"self_",
"._",
"posts_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"per",
"\\u",
"page_",
"=_",
"self_",
"._",
"per",
"\\u",
"page_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"get",
"\\u",
"permalink",
"_",
"=_",
"self_",
"._",
"get",
"\\u",
"permalink",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"render_",
"(_",
"renderer_",
"=_",
"renderer_",
",_",
"pagination_",
"=_",
"pagination_",
")_",
"\\u\\u\\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_",
"Feed_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Feed_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\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_",
",_",
"posts_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"posts_",
"=_",
"posts_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"template",
"\\u",
"name_",
"=_",
"\"",
"feed",
".",
"xml",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Not",
"Found_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Not",
"Found_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"template",
"\\u",
"name_",
"=_",
"\"",
"404",
".",
"html",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Not",
"Found_",
"(_",
"Cat",
"sup",
"Page_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"permalink",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"/",
"404",
".",
"html",
"\"_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
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,
4,
2,
2,
2,
2,
2,
2,
2,
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' | dcramer/django-ratings/djangoratings/tests.py | [
{
"content": " def __unicode__(self):\n return unicode(self.pk)",
"metadata": "root.RatingTestModel.__unicode__",
"header": "['class', 'RatingTestModel', '(', 'models', '.', 'Model', ')', ':', '___EOS___']",
"index": 18
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"Rati",
"ng",
"Test",
"Model_",
"(_",
"models_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"unicode\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"unicode_",
"(_",
"self_",
"._",
"pk_",
")_",
"\\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
] |
Except block handles 'BaseException' | robmadole/jig/src/jig/commands/config.py | [
{
"content": "from os.path import join\nfrom ConfigParser import SafeConfigParser\nfrom collections import namedtuple\nfrom textwrap import TextWrapper\n\nfrom jig.conf import PLUGIN_CONFIG_FILENAME\nfrom jig.exc import CommandError, ConfigKeyInvalid\nfrom jig.commands.base import BaseCommand, plugins_by_bundle\nfrom jig.commands.hints import NO_PLUGINS_INSTALLED, CHANGE_PLUGIN_SETTINGS\nfrom jig.plugins import (\n get_jigconfig, set_jigconfig, PluginManager)\n\ntry:\n import argparse\nexcept ImportError: # pragma: no cover\n from backports import argparse\n\n_parser = argparse.ArgumentParser(\n description='Manage settings for installed Jig plugins',\n usage='jig config [-h] ACTION')\n\n_subparsers = _parser.add_subparsers(\n title='actions',\n description='available commands to manage settings')\n\n_listparser = _subparsers.add_parser(\n 'list', help='list all settings',\n usage='jig config list [-h] [-r GITREPO]')\n_listparser.add_argument(\n '--gitrepo', '-r', default='.', dest='path',\n help='Path to the Git repository, default current directory')\n_listparser.set_defaults(subcommand='list')\n\n_aboutparser = _subparsers.add_parser(\n 'about', help='learn about a plugin\\'s settings',\n usage='jig config about [-h] [-r GITREPO]')\n_aboutparser.add_argument(\n '--gitrepo', '-r', default='.', dest='path',\n help='Path to the Git repository, default current directory')\n_aboutparser.set_defaults(subcommand='about')\n\n_setparser = _subparsers.add_parser(\n 'set', help='set a single setting for an installed plugin',\n usage='jig config set [-h] [-r GITREPO] KEY VALUE')\n_setparser.add_argument(\n '--gitrepo', '-r', default='.', dest='path',\n help='Path to the Git repository, default current directory')\n_setparser.add_argument(\n 'key',\n help='Setting key which is a dot-separated string of the '\n 'bundle name, plugin name, and setting name')\n_setparser.add_argument(\n 'value',\n help='Value for the specified settings')\n_setparser.set_defaults(subcommand='set')\n\n\ntry:\n from collections import OrderedDict\nexcept ImportError: # pragma: no cover\n from ordereddict import OrderedDict\n\n\n\n\nSettingsMeta = namedtuple('SettingsMeta', 'plugin key value default about')\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"os_",
"._",
"path_",
"import_",
"join_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"Config",
"Parser_",
"import_",
"Safe",
"Config",
"Parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"collections_",
"import_",
"namedtuple_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"textwrap_",
"import_",
"Text",
"Wrapper_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ji",
"g_",
"._",
"conf_",
"import_",
"PLUGIN",
"\\u",
"CONFIG",
"\\u",
"FILENAME_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ji",
"g_",
"._",
"exc_",
"import_",
"Command",
"Error_",
",_",
"Config",
"Key",
"Invalid_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ji",
"g_",
"._",
"commands_",
"._",
"base_",
"import_",
"Base",
"Command_",
",_",
"plugin",
"s",
"\\u",
"by",
"\\u",
"bundle_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ji",
"g_",
"._",
"commands_",
"._",
"hints_",
"import_",
"NO",
"\\u",
"PLUGINS",
"\\u",
"INSTALLE",
"D_",
",_",
"CHANGE",
"\\u",
"PLUGIN",
"\\u",
"SETTINGS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ji",
"g_",
"._",
"plugins_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"get",
"\\u",
"ji",
"gconf",
"ig_",
",_",
"set\\u",
"ji",
"gconf",
"ig_",
",_",
"Plug",
"in",
"Manager_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"argparse_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"#",
" ",
"pragma",
":",
" ",
"no",
" ",
"cover_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"backp",
"orts",
"_",
"import_",
"argparse_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u",
"parser_",
"=_",
"argparse_",
"._",
"Arg",
"ument",
"Parser_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"'",
"Manage",
" ",
"settings",
" ",
"for",
" ",
"install",
"ed",
" ",
"Ji",
"g",
" ",
"plugin",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"usage_",
"=_",
"'",
"ji",
"g",
" ",
"config",
" ",
"[-",
"h",
"]",
" ",
"ACTI",
"ON",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"subparsers_",
"=_",
"\\u",
"parser_",
"._",
"add",
"\\u",
"subparsers_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"title_",
"=_",
"'",
"action",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"'",
"avail",
"able",
" ",
"command",
"s",
" ",
"to",
" ",
"manage",
" ",
"settings",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"list",
"parser_",
"=_",
"\\u",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"list",
"'_",
",_",
"help_",
"=_",
"'",
"list",
" ",
"all",
" ",
"settings",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"usage_",
"=_",
"'",
"ji",
"g",
" ",
"config",
" ",
"list",
" ",
"[-",
"h",
"]",
" ",
"[-",
"r",
" ",
"GIT",
"REPO",
"]'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"list",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"git",
"repo",
"'_",
",_",
"'-",
"r",
"'_",
",_",
"default_",
"=_",
"'.'_",
",_",
"dest_",
"=_",
"'",
"path",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Path",
" ",
"to",
" ",
"the",
" ",
"Git",
" ",
"repos",
"itor",
"y",
",",
" ",
"default",
" ",
"current",
" ",
"director",
"y",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"list",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"subcommand_",
"=_",
"'",
"list",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"abo",
"ut",
"parser_",
"=_",
"\\u",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"abo",
"ut",
"'_",
",_",
"help_",
"=_",
"'",
"learn",
" ",
"abo",
"ut",
" ",
"a",
" ",
"plugin",
"\\\\'",
"s",
" ",
"settings",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"usage_",
"=_",
"'",
"ji",
"g",
" ",
"config",
" ",
"abo",
"ut",
" ",
"[-",
"h",
"]",
" ",
"[-",
"r",
" ",
"GIT",
"REPO",
"]'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"abo",
"ut",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"git",
"repo",
"'_",
",_",
"'-",
"r",
"'_",
",_",
"default_",
"=_",
"'.'_",
",_",
"dest_",
"=_",
"'",
"path",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Path",
" ",
"to",
" ",
"the",
" ",
"Git",
" ",
"repos",
"itor",
"y",
",",
" ",
"default",
" ",
"current",
" ",
"director",
"y",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"abo",
"ut",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"subcommand_",
"=_",
"'",
"abo",
"ut",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"setp",
"arser",
"_",
"=_",
"\\u",
"subparsers_",
"._",
"add",
"\\u",
"parser_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"set",
"'_",
",_",
"help_",
"=_",
"'",
"set",
" ",
"a",
" ",
"single",
" ",
"setti",
"ng",
" ",
"for",
" ",
"an",
" ",
"install",
"ed",
" ",
"plugin",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"usage_",
"=_",
"'",
"ji",
"g",
" ",
"config",
" ",
"set",
" ",
"[-",
"h",
"]",
" ",
"[-",
"r",
" ",
"GIT",
"REPO",
"]",
" ",
"KEY",
" ",
"VALU",
"E",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"setp",
"arser",
"_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"git",
"repo",
"'_",
",_",
"'-",
"r",
"'_",
",_",
"default_",
"=_",
"'.'_",
",_",
"dest_",
"=_",
"'",
"path",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Path",
" ",
"to",
" ",
"the",
" ",
"Git",
" ",
"repos",
"itor",
"y",
",",
" ",
"default",
" ",
"current",
" ",
"director",
"y",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"setp",
"arser",
"_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"key",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Sett",
"ing",
" ",
"key",
" ",
"whi",
"ch",
" ",
"is",
" ",
"a",
" ",
"dot",
"-",
"separate",
"d",
" ",
"string",
" ",
"of",
" ",
"the",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bundle",
" ",
"name",
",",
" ",
"plugin",
" ",
"name",
",",
" ",
"and",
" ",
"setti",
"ng",
" ",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"setp",
"arser",
"_",
"._",
"add",
"\\u",
"argument_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"value",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Value",
" ",
"for",
" ",
"the",
" ",
"specified",
" ",
"settings",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"setp",
"arser",
"_",
"._",
"set\\u",
"defaults_",
"(_",
"subcommand_",
"=_",
"'",
"set",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"collections_",
"import_",
"Order",
"ed",
"Dict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"#",
" ",
"pragma",
":",
" ",
"no",
" ",
"cover_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"order",
"eddi",
"ct_",
"import_",
"Order",
"ed",
"Dict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Sett",
"ings",
"Meta_",
"=_",
"namedtuple_",
"(_",
"'",
"Sett",
"ings",
"Meta",
"'_",
",_",
"'",
"plugin",
" ",
"key",
" ",
"value",
" ",
"default",
" ",
"abo",
"ut",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\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
] |
Unused import | kuri65536/python-for-android/python-modules/twisted/twisted/persisted/styles.py | [
{
"content": "# -*- test-case-name: twisted.test.test_persisted -*-\n# Copyright (c) 2001-2004 Twisted Matrix Laboratories.\n# See LICENSE for details.\n\n\n\n\"\"\"\nDifferent styles of persisted objects.\n\"\"\"\n\n# System Imports\nimport types\nimport copy_reg\nimport copy\n\ntry:\n import cStringIO as StringIO\nexcept ImportError:\n import StringIO\n\n# Twisted Imports\nfrom twisted.python import log\n\ntry:\n from new import instancemethod\nexcept:\n from org.python.core import PyMethod\n instancemethod = PyMethod\n\noldModules = {}\n\n## First, let's register support for some stuff that really ought to\n## be registerable...\n\n\n\ncopy_reg.pickle(types.MethodType,\n pickleMethod,\n unpickleMethod)\n\n\n\n\ncopy_reg.pickle(types.ModuleType,\n pickleModule,\n unpickleModule)\n\n\n\nif hasattr(StringIO, 'OutputType'):\n copy_reg.pickle(StringIO.OutputType,\n pickleStringO,\n unpickleStringO)\n\n\n\n\nif hasattr(StringIO, 'InputType'):\n copy_reg.pickle(StringIO.InputType,\n pickleStringI,\n unpickleStringI)\n\n\n\nversionedsToUpgrade = {}\nupgraded = {}\n\n\n\nfrom twisted.python import reflect\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def pickleMethod(method):\n 'support function for copy_reg to pickle method refs'\n return unpickleMethod, (method.im_func.__name__,\n method.im_self,\n method.im_class)",
"metadata": "root.pickleMethod",
"header": "['module', '___EOS___']",
"index": 34
},
{
"content": "def unpickleMethod(im_name,\n im_self,\n im_class):\n 'support function for copy_reg to unpickle method refs'\n try:\n unbound = getattr(im_class,im_name)\n if im_self is None:\n return unbound\n bound=instancemethod(unbound.im_func,\n im_self,\n im_class)\n return bound\n except AttributeError:\n log.msg(\"Method\",im_name,\"not on class\",im_class)\n assert im_self is not None,\"No recourse: no instance to guess from.\"\n # Attempt a common fix before bailing -- if classes have\n # changed around since we pickled this method, we may still be\n # able to get it by looking on the instance's current class.\n unbound = getattr(im_self.__class__,im_name)\n log.msg(\"Attempting fixup with\",unbound)\n if im_self is None:\n return unbound\n bound=instancemethod(unbound.im_func,\n im_self,\n im_self.__class__)\n return bound",
"metadata": "root.unpickleMethod",
"header": "['module', '___EOS___']",
"index": 40
},
{
"content": "def pickleModule(module):\n 'support function for copy_reg to pickle module refs'\n return unpickleModule, (module.__name__,)",
"metadata": "root.pickleModule",
"header": "['module', '___EOS___']",
"index": 71
},
{
"content": "def unpickleModule(name):\n 'support function for copy_reg to unpickle module refs'\n if oldModules.has_key(name):\n log.msg(\"Module has moved: %s\" % name)\n name = oldModules[name]\n log.msg(name)\n return __import__(name,{},{},'x')",
"metadata": "root.unpickleModule",
"header": "['module', '___EOS___']",
"index": 75
},
{
"content": "def pickleStringO(stringo):\n 'support function for copy_reg to pickle StringIO.OutputTypes'\n return unpickleStringO, (stringo.getvalue(), stringo.tell())",
"metadata": "root.pickleStringO",
"header": "['module', '___EOS___']",
"index": 88
},
{
"content": "def unpickleStringO(val, sek):\n x = StringIO.StringIO()\n x.write(val)\n x.seek(sek)\n return x",
"metadata": "root.unpickleStringO",
"header": "['module', '___EOS___']",
"index": 92
},
{
"content": "def pickleStringI(stringi):\n return unpickleStringI, (stringi.getvalue(), stringi.tell())",
"metadata": "root.pickleStringI",
"header": "['module', '___EOS___']",
"index": 103
},
{
"content": "def unpickleStringI(val, sek):\n x = StringIO.StringIO(val)\n x.seek(sek)\n return x",
"metadata": "root.unpickleStringI",
"header": "['module', '___EOS___']",
"index": 106
},
{
"content": "class Ephemeral:\n \"\"\"\n This type of object is never persisted; if possible, even references to it\n are eliminated.\n \"\"\"\n\n",
"metadata": "root.Ephemeral",
"header": "['module', '___EOS___']",
"index": 117
},
{
"content": " def __getstate__(self):\n log.msg( \"WARNING: serializing ephemeral %s\" % self )\n import gc\n if getattr(gc, 'get_referrers', None):\n for r in gc.get_referrers(self):\n log.msg( \" referred to by %s\" % (r,))\n return None",
"metadata": "root.Ephemeral.__getstate__",
"header": "['class', 'Ephemeral', ':', '___EOS___']",
"index": 123
},
{
"content": " def __setstate__(self, state):\n log.msg( \"WARNING: unserializing ephemeral %s\" % self.__class__ )\n self.__class__ = Ephemeral",
"metadata": "root.Ephemeral.__setstate__",
"header": "['class', 'Ephemeral', ':', '___EOS___']",
"index": 131
},
{
"content": "def doUpgrade():\n global versionedsToUpgrade, upgraded\n for versioned in versionedsToUpgrade.values():\n requireUpgrade(versioned)\n versionedsToUpgrade = {}\n upgraded = {}",
"metadata": "root.doUpgrade",
"header": "['module', '___EOS___']",
"index": 139
},
{
"content": "def requireUpgrade(obj):\n \"\"\"Require that a Versioned instance be upgraded completely first.\n \"\"\"\n objID = id(obj)\n if objID in versionedsToUpgrade and objID not in upgraded:\n upgraded[objID] = 1\n obj.versionUpgrade()\n return obj",
"metadata": "root.requireUpgrade",
"header": "['module', '___EOS___']",
"index": 146
},
{
"content": "def _aybabtu(c):\n l = []\n for b in reflect.allYourBase(c, Versioned):\n if b not in l and b is not Versioned:\n l.append(b)\n return l",
"metadata": "root._aybabtu",
"header": "['module', '___EOS___']",
"index": 157
},
{
"content": "class Versioned:\n \"\"\"\n This type of object is persisted with versioning information.\n\n I have a single class attribute, the int persistenceVersion. After I am\n unserialized (and styles.doUpgrade() is called), self.upgradeToVersionX()\n will be called for each version upgrade I must undergo.\n\n For example, if I serialize an instance of a Foo(Versioned) at version 4\n and then unserialize it when the code is at version 9, the calls::\n\n self.upgradeToVersion5()\n self.upgradeToVersion6()\n self.upgradeToVersion7()\n self.upgradeToVersion8()\n self.upgradeToVersion9()\n\n will be made. If any of these methods are undefined, a warning message\n will be printed.\n \"\"\"\n persistenceVersion = 0\n persistenceForgets = ()\n\n\n",
"metadata": "root.Versioned",
"header": "['module', '___EOS___']",
"index": 164
},
{
"content": " def __setstate__(self, state):\n versionedsToUpgrade[id(self)] = self\n self.__dict__ = state",
"metadata": "root.Versioned.__setstate__",
"header": "['class', 'Versioned', ':', '___EOS___']",
"index": 187
},
{
"content": " def __getstate__(self, dict=None):\n \"\"\"Get state, adding a version number to it on its way out.\n \"\"\"\n dct = copy.copy(dict or self.__dict__)\n bases = _aybabtu(self.__class__)\n bases.reverse()\n bases.append(self.__class__) # don't forget me!!\n for base in bases:\n if base.__dict__.has_key('persistenceForgets'):\n for slot in base.persistenceForgets:\n if dct.has_key(slot):\n del dct[slot]\n if base.__dict__.has_key('persistenceVersion'):\n dct['%s.persistenceVersion' % reflect.qual(base)] = base.persistenceVersion\n return dct",
"metadata": "root.Versioned.__getstate__",
"header": "['class', 'Versioned', ':', '___EOS___']",
"index": 191
},
{
"content": " def versionUpgrade(self):\n \"\"\"(internal) Do a version upgrade.\n \"\"\"\n bases = _aybabtu(self.__class__)\n # put the bases in order so superclasses' persistenceVersion methods\n # will be called first.\n bases.reverse()\n bases.append(self.__class__) # don't forget me!!\n # first let's look for old-skool versioned's\n if self.__dict__.has_key(\"persistenceVersion\"):\n \n # Hacky heuristic: if more than one class subclasses Versioned,\n # we'll assume that the higher version number wins for the older\n # class, so we'll consider the attribute the version of the older\n # class. There are obviously possibly times when this will\n # eventually be an incorrect assumption, but hopefully old-school\n # persistenceVersion stuff won't make it that far into multiple\n # classes inheriting from Versioned.\n \n pver = self.__dict__['persistenceVersion']\n del self.__dict__['persistenceVersion']\n highestVersion = 0\n highestBase = None\n for base in bases:\n if not base.__dict__.has_key('persistenceVersion'):\n continue\n if base.persistenceVersion > highestVersion:\n highestBase = base\n highestVersion = base.persistenceVersion\n if highestBase:\n self.__dict__['%s.persistenceVersion' % reflect.qual(highestBase)] = pver\n for base in bases:\n # ugly hack, but it's what the user expects, really\n if (Versioned not in base.__bases__ and\n not base.__dict__.has_key('persistenceVersion')):\n continue\n currentVers = base.persistenceVersion\n pverName = '%s.persistenceVersion' % reflect.qual(base)\n persistVers = (self.__dict__.get(pverName) or 0)\n if persistVers:\n del self.__dict__[pverName]\n assert persistVers <= currentVers, \"Sorry, can't go backwards in time.\"\n while persistVers < currentVers:\n persistVers = persistVers + 1\n method = base.__dict__.get('upgradeToVersion%s' % persistVers, None)\n if method:\n log.msg( \"Upgrading %s (of %s @ %s) to version %s\" % (reflect.qual(base), reflect.qual(self.__class__), id(self), persistVers) )\n method(self)\n else:\n log.msg( 'Warning: cannot upgrade %s to version %s' % (base, persistVers) )",
"metadata": "root.Versioned.versionUpgrade",
"header": "['class', 'Versioned', ':', '___EOS___']",
"index": 207
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"test",
"-",
"case",
"-",
"name",
":",
" ",
"twist",
"ed",
".",
"test",
".",
"test\\u",
"persiste",
"d",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"200",
"1",
"-",
"2004",
" ",
"Twi",
"sted",
" ",
"Matrix",
" ",
"Labo",
"rator",
"ies",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"LICENSE",
" ",
"for",
" ",
"deta",
"il",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Different",
" ",
"style",
"s",
" ",
"of",
" ",
"persiste",
"d",
" ",
"object",
"s",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"System",
" ",
"Imports",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"types_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"copy",
"\\u",
"reg_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"copy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"c",
"String",
"IO_",
"as_",
"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 ",
" _",
"import_",
"String",
"IO_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Twi",
"sted",
" ",
"Imports",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"from_",
"twisted_",
"._",
"python_",
"import_",
"log_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"new_",
"import_",
"instance",
"method_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"org_",
"._",
"python_",
"._",
"core_",
"import_",
"Py",
"Method_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"instance",
"method_",
"=_",
"Py",
"Method_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"old",
"Modules_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Fi",
"rst",
",",
" ",
"let",
"'",
"s",
" ",
"register",
" ",
"support",
" ",
"for",
" ",
"some",
" ",
"stu",
"ff",
" ",
"tha",
"t",
" ",
"reall",
"y",
" ",
"ou",
"ght",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"be",
" ",
"register",
"able",
"..._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"copy",
"\\u",
"reg_",
"._",
"pickle_",
"(_",
"types_",
"._",
"Meth",
"od",
"Type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"pickle",
"Method_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"unpickle",
"Method_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"copy",
"\\u",
"reg_",
"._",
"pickle_",
"(_",
"types_",
"._",
"Modul",
"e",
"Type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"pickle",
"Module_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"unpickle",
"Module_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"hasattr_",
"(_",
"String",
"IO_",
",_",
"'",
"Output",
"Type",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"copy",
"\\u",
"reg_",
"._",
"pickle_",
"(_",
"String",
"IO_",
"._",
"Output",
"Type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"pickle",
"String",
"O_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"unpickle",
"String",
"O_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"hasattr_",
"(_",
"String",
"IO_",
",_",
"'",
"Inp",
"ut",
"Type",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"copy",
"\\u",
"reg_",
"._",
"pickle_",
"(_",
"String",
"IO_",
"._",
"Inp",
"ut",
"Type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"pickle",
"String",
"I_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"unpickle",
"String",
"I_",
")_",
"\\u\\u\\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_",
"versioned",
"s",
"To",
"Upgrade",
"_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"upgrade",
"d_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"from_",
"twisted_",
"._",
"python_",
"import_",
"reflect",
"_",
"\\u\\u\\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_",
"pickle",
"Method_",
"(_",
"method_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'",
"support",
" ",
"function",
" ",
"for",
" ",
"copy",
"\\u",
"reg",
" ",
"to",
" ",
"pickle",
" ",
"method",
" ",
"refs",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"unpickle",
"Method_",
",_",
"(_",
"method_",
"._",
"im",
"\\u",
"func_",
"._",
"\\u\\u",
"name\\u\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"method_",
"._",
"im",
"\\u",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"method_",
"._",
"im",
"\\u",
"class_",
")_",
"\\u\\u\\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_",
"unpickle",
"Method_",
"(_",
"im",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"im",
"\\u",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"im",
"\\u",
"class_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'",
"support",
" ",
"function",
" ",
"for",
" ",
"copy",
"\\u",
"reg",
" ",
"to",
" ",
"unpickle",
" ",
"method",
" ",
"refs",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"unbound",
"_",
"=_",
"getattr_",
"(_",
"im",
"\\u",
"class_",
",_",
"im",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"im",
"\\u",
"self_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"unbound",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"bound_",
"=_",
"instance",
"method_",
"(_",
"unbound",
"_",
"._",
"im",
"\\u",
"func_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"im",
"\\u",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"im",
"\\u",
"class_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"bound_",
"\\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 ",
" _",
"log_",
"._",
"msg_",
"(_",
"\"",
"Meth",
"od",
"\"_",
",_",
"im",
"\\u",
"name_",
",_",
"\"",
"not",
" ",
"on",
" ",
"class",
"\"_",
",_",
"im",
"\\u",
"class_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"im",
"\\u",
"self_",
"is_",
"not_",
"None_",
",_",
"\"",
"No",
" ",
"reco",
"urs",
"e",
":",
" ",
"no",
" ",
"instance",
" ",
"to",
" ",
"guess",
" ",
"from",
".\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Atte",
"mpt",
" ",
"a",
" ",
"common",
" ",
"fix",
" ",
"bef",
"ore",
" ",
"bai",
"ling",
" ",
"--",
" ",
"if",
" ",
"classe",
"s",
" ",
"have_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"change",
"d",
" ",
"aro",
"und",
" ",
"sinc",
"e",
" ",
"we",
" ",
"pickled",
" ",
"this",
" ",
"method",
",",
" ",
"we",
" ",
"may",
" ",
"still",
" ",
"be_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"able",
" ",
"to",
" ",
"get",
" ",
"it",
" ",
"by",
" ",
"look",
"ing",
" ",
"on",
" ",
"the",
" ",
"instance",
"'",
"s",
" ",
"current",
" ",
"class",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"unbound",
"_",
"=_",
"getattr_",
"(_",
"im",
"\\u",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
",_",
"im",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"msg_",
"(_",
"\"",
"Atte",
"mpt",
"ing",
" ",
"fixup",
" ",
"with",
"\"_",
",_",
"unbound",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"im",
"\\u",
"self_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"unbound",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"bound_",
"=_",
"instance",
"method_",
"(_",
"unbound",
"_",
"._",
"im",
"\\u",
"func_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"im",
"\\u",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"im",
"\\u",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"bound_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"pickle",
"Module_",
"(_",
"module_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'",
"support",
" ",
"function",
" ",
"for",
" ",
"copy",
"\\u",
"reg",
" ",
"to",
" ",
"pickle",
" ",
"module",
" ",
"refs",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"unpickle",
"Module_",
",_",
"(_",
"module_",
"._",
"\\u\\u",
"name\\u\\u_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"unpickle",
"Module_",
"(_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'",
"support",
" ",
"function",
" ",
"for",
" ",
"copy",
"\\u",
"reg",
" ",
"to",
" ",
"unpickle",
" ",
"module",
" ",
"refs",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"old",
"Modules_",
"._",
"has",
"\\u",
"key_",
"(_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"msg_",
"(_",
"\"",
"Modul",
"e",
" ",
"has",
" ",
"moved",
":",
" ",
"%",
"s",
"\"_",
"%_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"name_",
"=_",
"old",
"Modules_",
"[_",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"msg_",
"(_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\\u\\u",
"import\\u\\u_",
"(_",
"name_",
",_",
"{_",
"}_",
",_",
"{_",
"}_",
",_",
"'",
"x",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"pickle",
"String",
"O_",
"(_",
"string",
"o_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'",
"support",
" ",
"function",
" ",
"for",
" ",
"copy",
"\\u",
"reg",
" ",
"to",
" ",
"pickle",
" ",
"String",
"IO",
".",
"Output",
"Type",
"s",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"unpickle",
"String",
"O_",
",_",
"(_",
"string",
"o_",
"._",
"getvalue_",
"(_",
")_",
",_",
"string",
"o_",
"._",
"tell_",
"(_",
")_",
")_",
"\\u\\u\\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_",
"unpickle",
"String",
"O_",
"(_",
"val_",
",_",
"se",
"k_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x_",
"=_",
"String",
"IO_",
"._",
"String",
"IO_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x_",
"._",
"write_",
"(_",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x_",
"._",
"seek_",
"(_",
"se",
"k_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"pickle",
"String",
"I_",
"(_",
"string",
"i_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"unpickle",
"String",
"I_",
",_",
"(_",
"string",
"i_",
"._",
"getvalue_",
"(_",
")_",
",_",
"string",
"i_",
"._",
"tell_",
"(_",
")_",
")_",
"\\u\\u\\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_",
"unpickle",
"String",
"I_",
"(_",
"val_",
",_",
"se",
"k_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x_",
"=_",
"String",
"IO_",
"._",
"String",
"IO_",
"(_",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x_",
"._",
"seek_",
"(_",
"se",
"k_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Ep",
"hem",
"eral",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"type",
" ",
"of",
" ",
"object",
" ",
"is",
" ",
"neve",
"r",
" ",
"persiste",
"d",
";",
" ",
"if",
" ",
"possib",
"le",
",",
" ",
"even",
" ",
"reference",
"s",
" ",
"to",
" ",
"it",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"are",
" ",
"eliminat",
"ed",
".",
"\\",
"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_",
"Ep",
"hem",
"eral",
"_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"getstate",
"\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"msg_",
"(_",
"\"",
"WARN",
"ING",
":",
" ",
"serializ",
"ing",
" ",
"ephemeral",
" ",
"%",
"s",
"\"_",
"%_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"gc_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"getattr_",
"(_",
"gc_",
",_",
"'",
"get",
"\\u",
"referrer",
"s",
"'_",
",_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"r_",
"in_",
"gc_",
"._",
"get",
"\\u",
"referrer",
"s_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"msg_",
"(_",
"\"",
" ",
"referred",
" ",
"to",
" ",
"by",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"r_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Ep",
"hem",
"eral",
"_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"setstate",
"\\u\\u_",
"(_",
"self_",
",_",
"state_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"msg_",
"(_",
"\"",
"WARN",
"ING",
":",
" ",
"unse",
"rial",
"izi",
"ng",
" ",
"ephemeral",
" ",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"=_",
"Ep",
"hem",
"eral",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"do",
"Upgrade",
"_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"versioned",
"s",
"To",
"Upgrade",
"_",
",_",
"upgrade",
"d_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"versioned",
"_",
"in_",
"versioned",
"s",
"To",
"Upgrade",
"_",
"._",
"values_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"require",
"Upgrade",
"_",
"(_",
"versioned",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"versioned",
"s",
"To",
"Upgrade",
"_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"upgrade",
"d_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"require",
"Upgrade",
"_",
"(_",
"obj_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Requ",
"ire",
" ",
"tha",
"t",
" ",
"a",
" ",
"Versione",
"d",
" ",
"instance",
" ",
"be",
" ",
"upgrade",
"d",
" ",
"complete",
"ly",
" ",
"first",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"obj",
"ID_",
"=_",
"id_",
"(_",
"obj_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"obj",
"ID_",
"in_",
"versioned",
"s",
"To",
"Upgrade",
"_",
"and_",
"obj",
"ID_",
"not_",
"in_",
"upgrade",
"d_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"upgrade",
"d_",
"[_",
"obj",
"ID_",
"]_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"obj_",
"._",
"version",
"Upgrade",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"obj_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"ay",
"bab",
"tu_",
"(_",
"c_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"l_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"b_",
"in_",
"reflect",
"_",
"._",
"all",
"You",
"r",
"Base_",
"(_",
"c_",
",_",
"Versione",
"d_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"b_",
"not_",
"in_",
"l_",
"and_",
"b_",
"is_",
"not_",
"Versione",
"d_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"l_",
"._",
"append_",
"(_",
"b_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"l_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Versione",
"d_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"type",
" ",
"of",
" ",
"object",
" ",
"is",
" ",
"persiste",
"d",
" ",
"with",
" ",
"versioning",
" ",
"informati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"I",
" ",
"have",
" ",
"a",
" ",
"single",
" ",
"class",
" ",
"attribute",
",",
" ",
"the",
" ",
"int",
" ",
"persiste",
"nce",
"Version",
".",
" ",
" ",
"Af",
"ter",
" ",
"I",
" ",
"am",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"unse",
"rial",
"ize",
"d",
" ",
"(",
"and",
" ",
"style",
"s",
".",
"do",
"Upgrade",
"()",
" ",
"is",
" ",
"call",
"ed",
"),",
" ",
"self",
".",
"upgrade",
"To",
"Version",
"X",
"()",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"will",
" ",
"be",
" ",
"call",
"ed",
" ",
"for",
" ",
"each",
" ",
"version",
" ",
"upgrade",
" ",
"I",
" ",
"must",
" ",
"under",
"go",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"For",
" ",
"example",
",",
" ",
"if",
" ",
"I",
" ",
"serialize",
" ",
"an",
" ",
"instance",
" ",
"of",
" ",
"a",
" ",
"Foo",
"(",
"Versione",
"d",
")",
" ",
"at",
" ",
"version",
" ",
"4",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"then",
" ",
"unse",
"rial",
"ize",
" ",
"it",
" ",
"whe",
"n",
" ",
"the",
" ",
"code",
" ",
"is",
" ",
"at",
" ",
"version",
" ",
"9",
",",
" ",
"the",
" ",
"calls",
"::",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"self",
".",
"upgrade",
"To",
"Version",
"5",
"()",
"\\",
"10",
";",
" ",
" ",
"self",
".",
"upgrade",
"To",
"Version",
"6",
"()",
"\\",
"10",
";",
" ",
" ",
"self",
".",
"upgrade",
"To",
"Version",
"7",
"()",
"\\",
"10",
";",
" ",
" ",
"self",
".",
"upgrade",
"To",
"Version",
"8",
"()",
"\\",
"10",
";",
" ",
" ",
"self",
".",
"upgrade",
"To",
"Version",
"9",
"()",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"will",
" ",
"be",
" ",
"made",
".",
" ",
" ",
"If",
" ",
"any",
" ",
"of",
" ",
"these",
" ",
"method",
"s",
" ",
"are",
" ",
"undefined",
",",
" ",
"a",
" ",
"warn",
"ing",
" ",
"message",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"will",
" ",
"be",
" ",
"printed",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"persiste",
"nce",
"Version_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"persiste",
"nce",
"Forg",
"ets_",
"=_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Versione",
"d_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"setstate",
"\\u\\u_",
"(_",
"self_",
",_",
"state_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"versioned",
"s",
"To",
"Upgrade",
"_",
"[_",
"id_",
"(_",
"self_",
")_",
"]_",
"=_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
"=_",
"state_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Versione",
"d_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"getstate",
"\\u\\u_",
"(_",
"self_",
",_",
"dict_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Get",
" ",
"state",
",",
" ",
"addin",
"g",
" ",
"a",
" ",
"version",
" ",
"number",
" ",
"to",
" ",
"it",
" ",
"on",
" ",
"its",
" ",
"way",
" ",
"out",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dct_",
"=_",
"copy_",
"._",
"copy_",
"(_",
"dict_",
"or_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bases_",
"=_",
"\\u",
"ay",
"bab",
"tu_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bases_",
"._",
"reverse_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bases_",
"._",
"append_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
"#",
" ",
"don",
"'",
"t",
" ",
"forget",
" ",
"me",
"!!",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"base_",
"in_",
"bases_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"base_",
"._",
"\\u\\u",
"dict\\u\\u_",
"._",
"has",
"\\u",
"key_",
"(_",
"'",
"persiste",
"nce",
"Forg",
"ets",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"slot_",
"in_",
"base_",
"._",
"persiste",
"nce",
"Forg",
"ets_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"dct_",
"._",
"has",
"\\u",
"key_",
"(_",
"slot_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"del_",
"dct_",
"[_",
"slot_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"base_",
"._",
"\\u\\u",
"dict\\u\\u_",
"._",
"has",
"\\u",
"key_",
"(_",
"'",
"persiste",
"nce",
"Version",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dct_",
"[_",
"'%",
"s",
".",
"persiste",
"nce",
"Version",
"'_",
"%_",
"reflect",
"_",
"._",
"qual_",
"(_",
"base_",
")_",
"]_",
"=_",
"base_",
"._",
"persiste",
"nce",
"Version_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"dct_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Versione",
"d_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"version",
"Upgrade",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"(",
"internal",
")",
" ",
"Do",
" ",
"a",
" ",
"version",
" ",
"upgrade",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bases_",
"=_",
"\\u",
"ay",
"bab",
"tu_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"put",
" ",
"the",
" ",
"base",
"s",
" ",
"in",
" ",
"order",
" ",
"so",
" ",
"superclass",
"es",
"'",
" ",
"persiste",
"nce",
"Version",
" ",
"methods_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"will",
" ",
"be",
" ",
"call",
"ed",
" ",
"first",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"bases_",
"._",
"reverse_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bases_",
"._",
"append_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
"#",
" ",
"don",
"'",
"t",
" ",
"forget",
" ",
"me",
"!!",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"first",
" ",
"let",
"'",
"s",
" ",
"look",
" ",
"for",
" ",
"old",
"-",
"sko",
"ol",
" ",
"versioned",
"'",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
"._",
"has",
"\\u",
"key_",
"(_",
"\"",
"persiste",
"nce",
"Version",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Hack",
"y",
" ",
"heuristic",
":",
" ",
"if",
" ",
"more",
" ",
"than",
" ",
"one",
" ",
"class",
" ",
"subclasses",
" ",
"Versione",
"d",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"we",
"'",
"ll",
" ",
"assume",
" ",
"tha",
"t",
" ",
"the",
" ",
"higher",
" ",
"version",
" ",
"number",
" ",
"wins",
" ",
"for",
" ",
"the",
" ",
"older_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"class",
",",
" ",
"so",
" ",
"we",
"'",
"ll",
" ",
"consider",
" ",
"the",
" ",
"attribute",
" ",
"the",
" ",
"version",
" ",
"of",
" ",
"the",
" ",
"older_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"class",
".",
" ",
" ",
"There",
" ",
"are",
" ",
"ob",
"vio",
"usl",
"y",
" ",
"possib",
"ly",
" ",
"times",
" ",
"whe",
"n",
" ",
"this",
" ",
"will",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"eventual",
"ly",
" ",
"be",
" ",
"an",
" ",
"incorrect",
" ",
"assumption",
",",
" ",
"but",
" ",
"hop",
"efu",
"ll",
"y",
" ",
"old",
"-",
"school_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"persiste",
"nce",
"Version",
" ",
"stu",
"ff",
" ",
"won",
"'",
"t",
" ",
"make",
" ",
"it",
" ",
"tha",
"t",
" ",
"far",
" ",
"int",
"o",
" ",
"multiple_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"classe",
"s",
" ",
"inherit",
"ing",
" ",
"from",
" ",
"Versione",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pv",
"er_",
"=_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
"[_",
"'",
"persiste",
"nce",
"Version",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
"[_",
"'",
"persiste",
"nce",
"Version",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"high",
"est",
"Version_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"high",
"est",
"Base_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"base_",
"in_",
"bases_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"base_",
"._",
"\\u\\u",
"dict\\u\\u_",
"._",
"has",
"\\u",
"key_",
"(_",
"'",
"persiste",
"nce",
"Version",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"base_",
"._",
"persiste",
"nce",
"Version_",
">_",
"high",
"est",
"Version_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"high",
"est",
"Base_",
"=_",
"base_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"high",
"est",
"Version_",
"=_",
"base_",
"._",
"persiste",
"nce",
"Version_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"high",
"est",
"Base_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
"[_",
"'%",
"s",
".",
"persiste",
"nce",
"Version",
"'_",
"%_",
"reflect",
"_",
"._",
"qual_",
"(_",
"high",
"est",
"Base_",
")_",
"]_",
"=_",
"pv",
"er_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"base_",
"in_",
"bases_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"ug",
"ly",
" ",
"hack",
",",
" ",
"but",
" ",
"it",
"'",
"s",
" ",
"what",
" ",
"the",
" ",
"user",
" ",
"expect",
"s",
",",
" ",
"reall",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"Versione",
"d_",
"not_",
"in_",
"base_",
"._",
"\\u\\u",
"bases\\u",
"\\u_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"not_",
"base_",
"._",
"\\u\\u",
"dict\\u\\u_",
"._",
"has",
"\\u",
"key_",
"(_",
"'",
"persiste",
"nce",
"Version",
"'_",
")_",
")_",
":_",
"\\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_",
"current",
"Vers",
"_",
"=_",
"base_",
"._",
"persiste",
"nce",
"Version_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pv",
"er",
"Name_",
"=_",
"'%",
"s",
".",
"persiste",
"nce",
"Version",
"'_",
"%_",
"reflect",
"_",
"._",
"qual_",
"(_",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"persist",
"Vers",
"_",
"=_",
"(_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
"._",
"get_",
"(_",
"pv",
"er",
"Name_",
")_",
"or_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"persist",
"Vers",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"del_",
"self_",
"._",
"\\u\\u",
"dict\\u\\u_",
"[_",
"pv",
"er",
"Name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert_",
"persist",
"Vers",
"_",
"<=_",
"current",
"Vers",
"_",
",_",
"\"",
"So",
"rr",
"y",
",",
" ",
"can",
"'",
"t",
" ",
"go",
" ",
"back",
"ward",
"s",
" ",
"in",
" ",
"time",
".\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"persist",
"Vers",
"_",
"<_",
"current",
"Vers",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"persist",
"Vers",
"_",
"=_",
"persist",
"Vers",
"_",
"+_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"method_",
"=_",
"base_",
"._",
"\\u\\u",
"dict\\u\\u_",
"._",
"get_",
"(_",
"'",
"upgrade",
"To",
"Version",
"%",
"s",
"'_",
"%_",
"persist",
"Vers",
"_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"method_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"log_",
"._",
"msg_",
"(_",
"\"",
"Up",
"gradi",
"ng",
" ",
"%",
"s",
" ",
"(",
"of",
" ",
"%",
"s",
" ",
"@",
" ",
"%",
"s",
")",
" ",
"to",
" ",
"version",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"reflect",
"_",
"._",
"qual_",
"(_",
"base_",
")_",
",_",
"reflect",
"_",
"._",
"qual_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
")_",
",_",
"id_",
"(_",
"self_",
")_",
",_",
"persist",
"Vers",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"method_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"log_",
"._",
"msg_",
"(_",
"'",
"Warn",
"ing",
":",
" ",
"cann",
"ot",
" ",
"upgrade",
" ",
"%",
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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
] |
Unused import | ContinuumIO/ashiba/enaml/enaml/web/slider.py | [
{
"content": "\nfrom atom.api import Unicode, Int\n\nfrom enaml.core.declarative import d_\n\nfrom html_object import HTMLObject\nfrom lxml.html import builder as E\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Slider(HTMLObject):\n\n tag = E.INPUT\n\n text = d_(Unicode())\n id = d_(Unicode())\n value = d_(Int())\n min = d_(Int())\n max = d_(Int())\n\n",
"metadata": "root.Slider",
"header": "['module', '___EOS___']",
"index": 8
},
{
"content": " def initialize(self):\n super(Slider, self).initialize()",
"metadata": "root.Slider.initialize",
"header": "['class', 'Slider', '(', 'HTMLObject', ')', ':', '___EOS___']",
"index": 18
},
{
"content": " def buildHTML(self, *args):\n self.addTags()\n self.addText(self.text)\n self.addAttributes(id = self.id, type = \"range\", value = str(self.value), min = str(self.min), max = str(self.max))\n return super(Slider, self).buildHTML(*args)",
"metadata": "root.Slider.buildHTML",
"header": "['class', 'Slider', '(', 'HTMLObject', ')', ':', '___EOS___']",
"index": 21
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"atom_",
"._",
"api_",
"import_",
"Unicode_",
",_",
"Int_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ena",
"ml_",
"._",
"core_",
"._",
"declarative",
"_",
"import_",
"d\\u",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"html",
"\\u",
"object_",
"import_",
"HTM",
"LO",
"bject_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"lxml_",
"._",
"html_",
"import_",
"builder_",
"as_",
"E_",
"\\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_",
"Slider_",
"(_",
"HTM",
"LO",
"bject_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tag_",
"=_",
"E_",
"._",
"INPUT_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"text_",
"=_",
"d\\u",
"_",
"(_",
"Unicode_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"id_",
"=_",
"d\\u",
"_",
"(_",
"Unicode_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"value_",
"=_",
"d\\u",
"_",
"(_",
"Int_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"min_",
"=_",
"d\\u",
"_",
"(_",
"Int_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"max_",
"=_",
"d\\u",
"_",
"(_",
"Int_",
"(_",
")_",
")_",
"\\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_",
"Slider_",
"(_",
"HTM",
"LO",
"bject_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"initialize_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Slider_",
",_",
"self_",
")_",
"._",
"initialize_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Slider_",
"(_",
"HTM",
"LO",
"bject_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"build",
"HTML_",
"(_",
"self_",
",_",
"*_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"add",
"Tags_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"add",
"Text_",
"(_",
"self_",
"._",
"text_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"add",
"Attributes_",
"(_",
"id_",
"=_",
"self_",
"._",
"id_",
",_",
"type_",
"=_",
"\"",
"range",
"\"_",
",_",
"value_",
"=_",
"str_",
"(_",
"self_",
"._",
"value_",
")_",
",_",
"min_",
"=_",
"str_",
"(_",
"self_",
"._",
"min_",
")_",
",_",
"max_",
"=_",
"str_",
"(_",
"self_",
"._",
"max_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"super_",
"(_",
"Slider_",
",_",
"self_",
")_",
"._",
"build",
"HTML_",
"(_",
"*_",
"args_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
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
] |
Unused import | letsencrypt/letsencrypt/tests/display.py | [
{
"content": "\"\"\"Manual test of display functions.\"\"\"\nimport sys\n\nfrom certbot.display import util\nfrom certbot.tests.display import util_test\n\n\n\n\nif __name__ == \"__main__\":\n for displayer in util.NcursesDisplay(), util.FileDisplay(sys.stdout):\n test_visual(displayer, util_test.CHOICES)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def test_visual(displayer, choices):\n \"\"\"Visually test all of the display functions.\"\"\"\n displayer.notification(\"Random notification!\")\n displayer.menu(\"Question?\", choices,\n ok_label=\"O\", cancel_label=\"Can\", help_label=\"??\")\n displayer.menu(\"Question?\", [choice[1] for choice in choices],\n ok_label=\"O\", cancel_label=\"Can\", help_label=\"??\")\n displayer.input(\"Input Message\")\n displayer.yesno(\"YesNo Message\", yes_label=\"Yessir\", no_label=\"Nosir\")\n displayer.checklist(\"Checklist Message\", [choice[0] for choice in choices])",
"metadata": "root.test_visual",
"header": "['module', '___EOS___']",
"index": 7
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"Manu",
"al",
" ",
"test",
" ",
"of",
" ",
"display",
" ",
"function",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"cert",
"bot_",
"._",
"display_",
"import_",
"util_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cert",
"bot_",
"._",
"tests_",
"._",
"display_",
"import_",
"util",
"\\u",
"test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"\"\\u\\u",
"main",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"displaye",
"r_",
"in_",
"util_",
"._",
"Nc",
"urs",
"es",
"Display_",
"(_",
")_",
",_",
"util_",
"._",
"File",
"Display_",
"(_",
"sys_",
"._",
"stdout_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"test\\u",
"visual_",
"(_",
"displaye",
"r_",
",_",
"util",
"\\u",
"test_",
"._",
"CHOICES_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"test\\u",
"visual_",
"(_",
"displaye",
"r_",
",_",
"choices_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Vis",
"ual",
"ly",
" ",
"test",
" ",
"all",
" ",
"of",
" ",
"the",
" ",
"display",
" ",
"function",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"displaye",
"r_",
"._",
"notification_",
"(_",
"\"",
"Random",
" ",
"notification",
"!\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"displaye",
"r_",
"._",
"menu_",
"(_",
"\"",
"Quest",
"ion",
"?\"_",
",_",
"choices_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"ok",
"\\u",
"label_",
"=_",
"\"",
"O",
"\"_",
",_",
"cancel",
"\\u",
"label_",
"=_",
"\"",
"Can",
"\"_",
",_",
"help",
"\\u",
"label_",
"=_",
"\"?",
"?\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"displaye",
"r_",
"._",
"menu_",
"(_",
"\"",
"Quest",
"ion",
"?\"_",
",_",
"[_",
"choice_",
"[_",
"1_",
"]_",
"for_",
"choice_",
"in_",
"choices_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"ok",
"\\u",
"label_",
"=_",
"\"",
"O",
"\"_",
",_",
"cancel",
"\\u",
"label_",
"=_",
"\"",
"Can",
"\"_",
",_",
"help",
"\\u",
"label_",
"=_",
"\"?",
"?\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"displaye",
"r_",
"._",
"input_",
"(_",
"\"",
"Inp",
"ut",
" ",
"Messag",
"e",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"displaye",
"r_",
"._",
"yesno",
"_",
"(_",
"\"",
"Ye",
"s",
"No",
" ",
"Messag",
"e",
"\"_",
",_",
"ye",
"s",
"\\u",
"label_",
"=_",
"\"",
"Ye",
"ssi",
"r",
"\"_",
",_",
"no",
"\\u",
"label_",
"=_",
"\"",
"No",
"sir",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | saltstack/salt/salt/pillar/__init__.py | [
{
"content": " def compile_pillar(self):\n '''\n Return the pillar data from the master\n '''\n load = {'id': self.minion_id,\n 'grains': self.grains,\n 'saltenv': self.opts['environment'],\n 'pillarenv': self.opts['pillarenv'],\n 'pillar_override': self.pillar_override,\n 'ver': '2',\n 'cmd': '_pillar'}\n if self.ext:\n load['ext'] = self.ext\n ret_pillar = self.channel.crypted_transfer_decode_dictentry(load,\n dictkey='pillar',\n )\n\n if not isinstance(ret_pillar, dict):\n log.error(\n 'Got a bad pillar from master, type {0}, expecting dict: '\n '{1}'.format(type(ret_pillar).__name__, ret_pillar)\n )\n return {}\n return ret_pillar",
"metadata": "root.RemotePillar.compile_pillar",
"header": "['class', 'RemotePillar', '(', 'object', ')', ':', '___EOS___']",
"index": 141
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Remo",
"te",
"Pil",
"lar",
"_",
"(_",
"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_",
"compile",
"\\u",
"pillar",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"the",
" ",
"pillar",
" ",
"data",
" ",
"from",
" ",
"the",
" ",
"master",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"load_",
"=_",
"{_",
"'",
"id",
"'_",
":_",
"self_",
"._",
"minion",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"grains",
"'_",
":_",
"self_",
"._",
"grains",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"salt",
"env",
"'_",
":_",
"self_",
"._",
"opts_",
"[_",
"'",
"environ",
"ment",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pillar",
"env",
"'_",
":_",
"self_",
"._",
"opts_",
"[_",
"'",
"pillar",
"env",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pillar",
"\\u",
"override",
"'_",
":_",
"self_",
"._",
"pillar",
"\\u",
"override_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ver",
"'_",
":_",
"'",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"cmd",
"'_",
":_",
"'\\u",
"pillar",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"ext_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"load_",
"[_",
"'",
"ext",
"'_",
"]_",
"=_",
"self_",
"._",
"ext_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ret",
"\\u",
"pillar",
"_",
"=_",
"self_",
"._",
"channel_",
"._",
"crypt",
"ed",
"\\u",
"transfer",
"\\u",
"decode",
"\\u",
"dict",
"entry_",
"(_",
"load_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dict",
"key_",
"=_",
"'",
"pillar",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"isinstance_",
"(_",
"ret",
"\\u",
"pillar",
"_",
",_",
"dict_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Got",
" ",
"a",
" ",
"bad",
" ",
"pillar",
" ",
"from",
" ",
"master",
",",
" ",
"type",
" ",
"{",
"0",
"},",
" ",
"expect",
"ing",
" ",
"dict",
":",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'{",
"1",
"}'_",
"._",
"format_",
"(_",
"type_",
"(_",
"ret",
"\\u",
"pillar",
"_",
")_",
"._",
"\\u\\u",
"name\\u\\u_",
",_",
"ret",
"\\u",
"pillar",
"_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"ret",
"\\u",
"pillar",
"_",
"\\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
] |
First parameter of a method is not named 'self' | treeio/treeio/treeio/finance/south_migrations/0002_auto__add_currency__add_tax__add_field_liability_value_currency__add_f.py | [
{
"content": " def forwards(self, orm):\n\n # Adding model 'Currency'\n db.create_table('finance_currency', (\n ('object_ptr', self.gf('django.db.models.fields.related.OneToOneField')(\n to=orm['core.Object'], unique=True, primary_key=True)),\n ('code', self.gf('django.db.models.fields.CharField')\n (max_length=3)),\n ('name', self.gf('django.db.models.fields.CharField')\n (max_length=255)),\n ('symbol', self.gf('django.db.models.fields.CharField')\n (max_length=1, null=True, blank=True)),\n ('factor', self.gf('django.db.models.fields.DecimalField')\n (default=1, max_digits=10, decimal_places=4)),\n ('is_active', self.gf(\n 'django.db.models.fields.BooleanField')(default=True)),\n ('is_default', self.gf(\n 'django.db.models.fields.BooleanField')(default=False)),\n ))\n db.send_create_signal('finance', ['Currency'])\n\n # Adding model 'Tax'\n db.create_table('finance_tax', (\n ('object_ptr', self.gf('django.db.models.fields.related.OneToOneField')(\n to=orm['core.Object'], unique=True, primary_key=True)),\n ('name', self.gf('django.db.models.fields.CharField')\n (max_length=512)),\n ('rate', self.gf('django.db.models.fields.DecimalField')\n (max_digits=4, decimal_places=2)),\n ('compound', self.gf(\n 'django.db.models.fields.BooleanField')(default=False)),\n ))\n db.send_create_signal('finance', ['Tax'])\n\n # Adding field 'Liability.value_currency'\n db.add_column('finance_liability', 'value_currency', self.gf(\n 'django.db.models.fields.related.ForeignKey')(default=1, to=orm['finance.Currency']), keep_default=False)\n\n # Adding field 'Liability.value_display'\n db.add_column('finance_liability', 'value_display', self.gf('django.db.models.fields.DecimalField')(\n default=0, max_digits=20, decimal_places=2), keep_default=False)\n\n # Changing field 'Liability.value'\n db.alter_column('finance_liability', 'value', self.gf(\n 'django.db.models.fields.DecimalField')(max_digits=20, decimal_places=2))\n\n # Changing field 'Asset.initial_value'\n db.alter_column('finance_asset', 'initial_value', self.gf(\n 'django.db.models.fields.DecimalField')(max_digits=20, decimal_places=2))\n\n # Changing field 'Asset.current_value'\n db.alter_column('finance_asset', 'current_value', self.gf(\n 'django.db.models.fields.DecimalField')(max_digits=20, decimal_places=2))\n\n # Changing field 'Asset.endlife_value'\n db.alter_column('finance_asset', 'endlife_value', self.gf(\n 'django.db.models.fields.DecimalField')(null=True, max_digits=20, decimal_places=2))\n\n # Changing field 'Asset.lifetime'\n db.alter_column('finance_asset', 'lifetime', self.gf(\n 'django.db.models.fields.DecimalField')(null=True, max_digits=20, decimal_places=0))\n\n # Changing field 'Asset.depreciation_rate'\n db.alter_column('finance_asset', 'depreciation_rate', self.gf(\n 'django.db.models.fields.DecimalField')(null=True, max_digits=4, decimal_places=2))\n\n # Adding field 'Account.balance_currency'\n db.add_column('finance_account', 'balance_currency', self.gf(\n 'django.db.models.fields.related.ForeignKey')(default=1, to=orm['finance.Currency']), keep_default=False)\n\n # Adding field 'Account.balance_display'\n db.add_column('finance_account', 'balance_display', self.gf('django.db.models.fields.DecimalField')(\n default=0, max_digits=20, decimal_places=2), keep_default=False)\n\n # Changing field 'Account.balance'\n db.alter_column('finance_account', 'balance', self.gf(\n 'django.db.models.fields.DecimalField')(max_digits=20, decimal_places=2))\n\n # Adding field 'Transaction.value_currency'\n db.add_column('finance_transaction', 'value_currency', self.gf(\n 'django.db.models.fields.related.ForeignKey')(default=1, to=orm['finance.Currency']), keep_default=False)\n\n # Adding field 'Transaction.value_display'\n db.add_column('finance_transaction', 'value_display', self.gf('django.db.models.fields.DecimalField')(\n default=0, max_digits=20, decimal_places=2), keep_default=False)\n\n # Changing field 'Transaction.value'\n db.alter_column('finance_transaction', 'value', self.gf(\n 'django.db.models.fields.DecimalField')(max_digits=20, decimal_places=2))\n\n # Changing field 'Equity.issue_price'\n db.alter_column('finance_equity', 'issue_price', self.gf(\n 'django.db.models.fields.DecimalField')(max_digits=20, decimal_places=2))\n\n # Changing field 'Equity.sell_price'\n db.alter_column('finance_equity', 'sell_price', self.gf(\n 'django.db.models.fields.DecimalField')(max_digits=20, decimal_places=2))",
"metadata": "root.Migration.forwards",
"header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']",
"index": 14
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"Migration_",
"(_",
"Schema",
"Migration_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"forwards_",
"(_",
"self_",
",_",
"orm_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"model",
" ",
"'",
"Currenc",
"y",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"db_",
"._",
"create",
"\\u",
"table_",
"(_",
"'",
"finance",
"\\u",
"curr",
"ency",
"'_",
",_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"object\\u",
"ptr",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"relate",
"d",
".",
"One",
"To",
"One",
"Field",
"'_",
")_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"to_",
"=_",
"orm_",
"[_",
"'",
"core",
".",
"Object",
"'_",
"]_",
",_",
"unique_",
"=_",
"True_",
",_",
"primary",
"\\u",
"key_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"code",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"max",
"\\u",
"length_",
"=_",
"3_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"name",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"max",
"\\u",
"length_",
"=_",
"255_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"symbol",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"max",
"\\u",
"length_",
"=_",
"1_",
",_",
"null_",
"=_",
"True_",
",_",
"blank_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"factor",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"default_",
"=_",
"1_",
",_",
"max",
"\\u",
"digits_",
"=_",
"10_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"4_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"is",
"\\u",
"active",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Boo",
"lean",
"Field",
"'_",
")_",
"(_",
"default_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"is",
"\\u",
"default",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Boo",
"lean",
"Field",
"'_",
")_",
"(_",
"default_",
"=_",
"False_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"db_",
"._",
"send",
"\\u",
"create",
"\\u",
"signal_",
"(_",
"'",
"finance",
"'_",
",_",
"[_",
"'",
"Currenc",
"y",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"model",
" ",
"'",
"Tax",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"create",
"\\u",
"table_",
"(_",
"'",
"finance",
"\\u",
"tax",
"'_",
",_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"object\\u",
"ptr",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"relate",
"d",
".",
"One",
"To",
"One",
"Field",
"'_",
")_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"to_",
"=_",
"orm_",
"[_",
"'",
"core",
".",
"Object",
"'_",
"]_",
",_",
"unique_",
"=_",
"True_",
",_",
"primary",
"\\u",
"key_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"name",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"max",
"\\u",
"length_",
"=_",
"512_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"rate",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"max",
"\\u",
"digits_",
"=_",
"4_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"compo",
"und",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Boo",
"lean",
"Field",
"'_",
")_",
"(_",
"default_",
"=_",
"False_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"db_",
"._",
"send",
"\\u",
"create",
"\\u",
"signal_",
"(_",
"'",
"finance",
"'_",
",_",
"[_",
"'",
"Tax",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"field",
" ",
"'",
"Lia",
"bilit",
"y",
".",
"value",
"\\u",
"curr",
"ency",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"add",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"lia",
"bilit",
"y",
"'_",
",_",
"'",
"value",
"\\u",
"curr",
"ency",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"relate",
"d",
".",
"Fore",
"ign",
"Key",
"'_",
")_",
"(_",
"default_",
"=_",
"1_",
",_",
"to_",
"=_",
"orm_",
"[_",
"'",
"finance",
".",
"Currenc",
"y",
"'_",
"]_",
")_",
",_",
"keep",
"\\u",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"field",
" ",
"'",
"Lia",
"bilit",
"y",
".",
"value",
"\\u",
"display",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"add",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"lia",
"bilit",
"y",
"'_",
",_",
"'",
"value",
"\\u",
"display",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"0_",
",_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
",_",
"keep",
"\\u",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Chang",
"ing",
" ",
"field",
" ",
"'",
"Lia",
"bilit",
"y",
".",
"value",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"alter",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"lia",
"bilit",
"y",
"'_",
",_",
"'",
"value",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Chang",
"ing",
" ",
"field",
" ",
"'",
"Asset",
".",
"initial",
"\\u",
"value",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"alter",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"asset",
"'_",
",_",
"'",
"initial",
"\\u",
"value",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Chang",
"ing",
" ",
"field",
" ",
"'",
"Asset",
".",
"current",
"\\u",
"value",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"alter",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"asset",
"'_",
",_",
"'",
"current",
"\\u",
"value",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Chang",
"ing",
" ",
"field",
" ",
"'",
"Asset",
".",
"endl",
"ife",
"\\u",
"value",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"alter",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"asset",
"'_",
",_",
"'",
"endl",
"ife",
"\\u",
"value",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
",_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Chang",
"ing",
" ",
"field",
" ",
"'",
"Asset",
".",
"life",
"time",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"alter",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"asset",
"'_",
",_",
"'",
"life",
"time",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
",_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"0_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Chang",
"ing",
" ",
"field",
" ",
"'",
"Asset",
".",
"depre",
"ciat",
"ion",
"\\u",
"rate",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"alter",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"asset",
"'_",
",_",
"'",
"depre",
"ciat",
"ion",
"\\u",
"rate",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
",_",
"max",
"\\u",
"digits_",
"=_",
"4_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"field",
" ",
"'",
"Account",
".",
"balance",
"\\u",
"curr",
"ency",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"add",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"account",
"'_",
",_",
"'",
"balance",
"\\u",
"curr",
"ency",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"relate",
"d",
".",
"Fore",
"ign",
"Key",
"'_",
")_",
"(_",
"default_",
"=_",
"1_",
",_",
"to_",
"=_",
"orm_",
"[_",
"'",
"finance",
".",
"Currenc",
"y",
"'_",
"]_",
")_",
",_",
"keep",
"\\u",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"field",
" ",
"'",
"Account",
".",
"balance",
"\\u",
"display",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"add",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"account",
"'_",
",_",
"'",
"balance",
"\\u",
"display",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"0_",
",_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
",_",
"keep",
"\\u",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Chang",
"ing",
" ",
"field",
" ",
"'",
"Account",
".",
"balance",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"alter",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"account",
"'_",
",_",
"'",
"balance",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"field",
" ",
"'",
"Transa",
"ction",
".",
"value",
"\\u",
"curr",
"ency",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"add",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"transaction",
"'_",
",_",
"'",
"value",
"\\u",
"curr",
"ency",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"relate",
"d",
".",
"Fore",
"ign",
"Key",
"'_",
")_",
"(_",
"default_",
"=_",
"1_",
",_",
"to_",
"=_",
"orm_",
"[_",
"'",
"finance",
".",
"Currenc",
"y",
"'_",
"]_",
")_",
",_",
"keep",
"\\u",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"field",
" ",
"'",
"Transa",
"ction",
".",
"value",
"\\u",
"display",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"add",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"transaction",
"'_",
",_",
"'",
"value",
"\\u",
"display",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"0_",
",_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
",_",
"keep",
"\\u",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Chang",
"ing",
" ",
"field",
" ",
"'",
"Transa",
"ction",
".",
"value",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"alter",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"transaction",
"'_",
",_",
"'",
"value",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Chang",
"ing",
" ",
"field",
" ",
"'",
"Equi",
"ty",
".",
"issue",
"\\u",
"price",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"alter",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"equit",
"y",
"'_",
",_",
"'",
"issue",
"\\u",
"price",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Chang",
"ing",
" ",
"field",
" ",
"'",
"Equi",
"ty",
".",
"sell",
"\\u",
"price",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"alter",
"\\u",
"column_",
"(_",
"'",
"finance",
"\\u",
"equit",
"y",
"'_",
",_",
"'",
"sell",
"\\u",
"price",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Deci",
"mal",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"digits_",
"=_",
"20_",
",_",
"decima",
"l\\u",
"places_",
"=_",
"2_",
")_",
")_",
"\\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,
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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
] |
Unused import | mixcloud/django-speedbar/speedbar/modules/sql.py | [
{
"content": "from __future__ import absolute_import\n\ntry:\n from django.db.backends.base.base import BaseDatabaseWrapper\nexcept ImportError:\n # Backwards compatibility for Django <1.8\n from django.db.backends import BaseDatabaseWrapper\n\ntry:\n from django.db.backends.utils import CursorWrapper\nexcept ImportError:\n # Backwards compatibility for Django <1.9\n from django.db.backends.util import CursorWrapper\n\nfrom .base import BaseModule, RequestTrace\nfrom .monkey_patching import monkeypatch_method\n\n\n\n\n\n\n# The linter thinks the methods we monkeypatch are not used\n# pylint: disable=W0612\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class SqlModule(BaseModule):\n key = 'sql'\n\n\n",
"metadata": "root.SqlModule",
"header": "['module', '___EOS___']",
"index": 18
},
{
"content": " def __init__(self):\n super(SqlModule, self).__init__()\n self.queries = []",
"metadata": "root.SqlModule.__init__",
"header": "['class', 'SqlModule', '(', 'BaseModule', ')', ':', '___EOS___']",
"index": 21
},
{
"content": " def get_metrics(self):\n return RequestTrace.instance().stacktracer.get_node_metrics('SQL')",
"metadata": "root.SqlModule.get_metrics",
"header": "['class', 'SqlModule', '(', 'BaseModule', ')', ':', '___EOS___']",
"index": 25
},
{
"content": " def get_details(self):\n sql_nodes = RequestTrace.instance().stacktracer.get_nodes('SQL')\n return [{'sql': node.label, 'time': int(node.duration*1000)} for node in sql_nodes]",
"metadata": "root.SqlModule.get_details",
"header": "['class', 'SqlModule', '(', 'BaseModule', ')', ':', '___EOS___']",
"index": 28
},
{
"content": "class _DetailedTracingCursorWrapper(CursorWrapper):\n",
"metadata": "root._DetailedTracingCursorWrapper",
"header": "['module', '___EOS___']",
"index": 33
},
{
"content": " def execute(self, sql, params=()):\n request_trace = RequestTrace.instance()\n if request_trace:\n stack_entry = request_trace.stacktracer.push_stack('SQL', sql)\n try:\n return self.cursor.execute(sql, params)\n finally:\n if request_trace:\n request_trace.stacktracer.pop_stack()\n sql = self.db.ops.last_executed_query(self.cursor, sql, params)\n stack_entry.label = sql",
"metadata": "root._DetailedTracingCursorWrapper.execute",
"header": "['class', '_DetailedTracingCursorWrapper', '(', 'CursorWrapper', ')', ':', '___EOS___']",
"index": 34
},
{
"content": " def executemany(self, sql, param_list):\n request_trace = RequestTrace.instance()\n if request_trace:\n request_trace.stacktracer.push_stack('SQL', sql)\n try:\n return self.cursor.executemany(sql, param_list)\n finally:\n if request_trace:\n request_trace.stacktracer.pop_stack()",
"metadata": "root._DetailedTracingCursorWrapper.executemany",
"header": "['class', '_DetailedTracingCursorWrapper', '(', 'CursorWrapper', ')', ':', '___EOS___']",
"index": 46
},
{
"content": "def init():\n @monkeypatch_method(BaseDatabaseWrapper)\n def cursor(original, self, *args, **kwargs):\n result = original(*args, **kwargs)\n return _DetailedTracingCursorWrapper(result, self)\n\n return SqlModule",
"metadata": "root.init",
"header": "['module', '___EOS___']",
"index": 59
}
] | [] | [] | 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_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"django_",
"._",
"db_",
"._",
"backends_",
"._",
"base_",
"._",
"base_",
"import_",
"Base",
"Databa",
"se",
"Wrapper_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Backward",
"s",
" ",
"compatibility",
" ",
"for",
" ",
"Dj",
"ang",
"o",
" ",
"<",
"1.8_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"django_",
"._",
"db_",
"._",
"backends_",
"import_",
"Base",
"Databa",
"se",
"Wrapper_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"django_",
"._",
"db_",
"._",
"backends_",
"._",
"utils_",
"import_",
"Curs",
"or",
"Wrapper_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Backward",
"s",
" ",
"compatibility",
" ",
"for",
" ",
"Dj",
"ang",
"o",
" ",
"<",
"1.9",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"django_",
"._",
"db_",
"._",
"backends_",
"._",
"util_",
"import_",
"Curs",
"or",
"Wrapper_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"from_",
"._",
"base_",
"import_",
"Base",
"Module_",
",_",
"Request",
"Trace_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"monkey",
"\\u",
"patch",
"ing_",
"import_",
"monkey",
"patch",
"\\u",
"method_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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",
" ",
"linter",
" ",
"think",
"s",
" ",
"the",
" ",
"method",
"s",
" ",
"we",
" ",
"monkey",
"patch",
" ",
"are",
" ",
"not",
" ",
"used_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"pylint",
":",
" ",
"disable",
"=",
"W",
"061",
"2_",
"\\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_",
"Sq",
"l",
"Module_",
"(_",
"Base",
"Module_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key_",
"=_",
"'",
"sql",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Sq",
"l",
"Module_",
"(_",
"Base",
"Module_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Sq",
"l",
"Module_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"queries_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Sq",
"l",
"Module_",
"(_",
"Base",
"Module_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"metrics_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Request",
"Trace_",
"._",
"instance_",
"(_",
")_",
"._",
"stack",
"tracer_",
"._",
"get",
"\\u",
"node",
"\\u",
"metrics_",
"(_",
"'",
"SQL",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Sq",
"l",
"Module_",
"(_",
"Base",
"Module_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"details_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sql",
"\\u",
"nodes_",
"=_",
"Request",
"Trace_",
"._",
"instance_",
"(_",
")_",
"._",
"stack",
"tracer_",
"._",
"get",
"\\u",
"nodes_",
"(_",
"'",
"SQL",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"[_",
"{_",
"'",
"sql",
"'_",
":_",
"node_",
"._",
"label_",
",_",
"'",
"time",
"'_",
":_",
"int_",
"(_",
"node_",
"._",
"duration_",
"*_",
"1000_",
")_",
"}_",
"for_",
"node_",
"in_",
"sql",
"\\u",
"nodes_",
"]_",
"\\u\\u\\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",
"Det",
"ail",
"ed",
"Trac",
"ing",
"Curs",
"or",
"Wrapper_",
"(_",
"Curs",
"or",
"Wrapper_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Det",
"ail",
"ed",
"Trac",
"ing",
"Curs",
"or",
"Wrapper_",
"(_",
"Curs",
"or",
"Wrapper_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"execute_",
"(_",
"self_",
",_",
"sql_",
",_",
"params_",
"=_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"request",
"\\u",
"trace_",
"=_",
"Request",
"Trace_",
"._",
"instance_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"request",
"\\u",
"trace_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"stack",
"\\u",
"entry_",
"=_",
"request",
"\\u",
"trace_",
"._",
"stack",
"tracer_",
"._",
"push",
"\\u",
"stack_",
"(_",
"'",
"SQL",
"'_",
",_",
"sql_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"cursor_",
"._",
"execute_",
"(_",
"sql_",
",_",
"params_",
")_",
"\\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 ",
" _",
"if_",
"request",
"\\u",
"trace_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"request",
"\\u",
"trace_",
"._",
"stack",
"tracer_",
"._",
"pop",
"\\u",
"stack_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sql_",
"=_",
"self_",
"._",
"db_",
"._",
"ops_",
"._",
"last",
"\\u",
"executed",
"\\u",
"query_",
"(_",
"self_",
"._",
"cursor_",
",_",
"sql_",
",_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stack",
"\\u",
"entry_",
"._",
"label_",
"=_",
"sql_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Det",
"ail",
"ed",
"Trac",
"ing",
"Curs",
"or",
"Wrapper_",
"(_",
"Curs",
"or",
"Wrapper_",
")_",
":_",
"\\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_",
"executemany",
"_",
"(_",
"self_",
",_",
"sql_",
",_",
"param",
"\\u",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"request",
"\\u",
"trace_",
"=_",
"Request",
"Trace_",
"._",
"instance_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"request",
"\\u",
"trace_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"request",
"\\u",
"trace_",
"._",
"stack",
"tracer_",
"._",
"push",
"\\u",
"stack_",
"(_",
"'",
"SQL",
"'_",
",_",
"sql_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"cursor_",
"._",
"executemany",
"_",
"(_",
"sql_",
",_",
"param",
"\\u",
"list_",
")_",
"\\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 ",
" _",
"if_",
"request",
"\\u",
"trace_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"request",
"\\u",
"trace_",
"._",
"stack",
"tracer_",
"._",
"pop",
"\\u",
"stack_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"init_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"@_",
"monkey",
"patch",
"\\u",
"method_",
"(_",
"Base",
"Databa",
"se",
"Wrapper_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"cursor_",
"(_",
"original_",
",_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"original_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u",
"Det",
"ail",
"ed",
"Trac",
"ing",
"Curs",
"or",
"Wrapper_",
"(_",
"result_",
",_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"Sq",
"l",
"Module_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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{
"content": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2010 United States Government as represented by the\n# Administrator of the National Aeronautics and Space Administration.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"Based a bit on the carrot.backeds.queue backend... but a lot better.\"\"\"\n\nimport Queue as queue\n\nfrom carrot.backends import base\nfrom eventlet import greenthread\n\nfrom nova import log as logging\n\n\nLOG = logging.getLogger(\"nova.fakerabbit\")\n\n\nEXCHANGES = {}\nQUEUES = {}\nCONSUMERS = {}\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Message(base.BaseMessage):\n pass",
"metadata": "root.Message",
"header": "['module', '___EOS___']",
"index": 36
},
{
"content": "class Exchange(object):\n\n",
"metadata": "root.Exchange",
"header": "['module', '___EOS___']",
"index": 40
},
{
"content": " def __init__(self, name, exchange_type):\n self.name = name\n self.exchange_type = exchange_type\n self._queue = queue.Queue()\n self._routes = {}",
"metadata": "root.Exchange.__init__",
"header": "['class', 'Exchange', '(', 'object', ')', ':', '___EOS___']",
"index": 41
},
{
"content": " def publish(self, message, routing_key=None):\n nm = self.name\n LOG.debug(_('(%(nm)s) publish (key: %(routing_key)s)'\n ' %(message)s') % locals())\n if routing_key in self._routes:\n for f in self._routes[routing_key]:\n LOG.debug(_('Publishing to route %s'), f)\n f(message, routing_key=routing_key)",
"metadata": "root.Exchange.publish",
"header": "['class', 'Exchange', '(', 'object', ')', ':', '___EOS___']",
"index": 47
},
{
"content": " def bind(self, callback, routing_key):\n self._routes.setdefault(routing_key, [])\n self._routes[routing_key].append(callback)",
"metadata": "root.Exchange.bind",
"header": "['class', 'Exchange', '(', 'object', ')', ':', '___EOS___']",
"index": 56
},
{
"content": "class Queue(object):\n\n\n\n",
"metadata": "root.Queue",
"header": "['module', '___EOS___']",
"index": 61
},
{
"content": " def __init__(self, name):\n self.name = name\n self._queue = queue.Queue()",
"metadata": "root.Queue.__init__",
"header": "['class', 'Queue', '(', 'object', ')', ':', '___EOS___']",
"index": 62
},
{
"content": " def __repr__(self):\n return '<Queue: %s>' % self.name",
"metadata": "root.Queue.__repr__",
"header": "['class', 'Queue', '(', 'object', ')', ':', '___EOS___']",
"index": 66
},
{
"content": " def push(self, message, routing_key=None):\n self._queue.put(message)",
"metadata": "root.Queue.push",
"header": "['class', 'Queue', '(', 'object', ')', ':', '___EOS___']",
"index": 69
},
{
"content": " def size(self):\n return self._queue.qsize()",
"metadata": "root.Queue.size",
"header": "['class', 'Queue', '(', 'object', ')', ':', '___EOS___']",
"index": 72
},
{
"content": " def pop(self):\n return self._queue.get()",
"metadata": "root.Queue.pop",
"header": "['class', 'Queue', '(', 'object', ')', ':', '___EOS___']",
"index": 75
},
{
"content": "class Backend(base.BaseBackend):\n\n\n\n\n\n\n\n",
"metadata": "root.Backend",
"header": "['module', '___EOS___']",
"index": 79
},
{
"content": " def queue_declare(self, queue, **kwargs):\n global QUEUES\n if queue not in QUEUES:\n LOG.debug(_('Declaring queue %s'), queue)\n QUEUES[queue] = Queue(queue)",
"metadata": "root.Backend.queue_declare",
"header": "['class', 'Backend', '(', 'base', '.', 'BaseBackend', ')', ':', '___EOS___']",
"index": 80
},
{
"content": " def exchange_declare(self, exchange, type, *args, **kwargs):\n global EXCHANGES\n if exchange not in EXCHANGES:\n LOG.debug(_('Declaring exchange %s'), exchange)\n EXCHANGES[exchange] = Exchange(exchange, type)",
"metadata": "root.Backend.exchange_declare",
"header": "['class', 'Backend', '(', 'base', '.', 'BaseBackend', ')', ':', '___EOS___']",
"index": 86
},
{
"content": " def queue_bind(self, queue, exchange, routing_key, **kwargs):\n global EXCHANGES\n global QUEUES\n LOG.debug(_('Binding %(queue)s to %(exchange)s with'\n ' key %(routing_key)s') % locals())\n EXCHANGES[exchange].bind(QUEUES[queue].push, routing_key)",
"metadata": "root.Backend.queue_bind",
"header": "['class', 'Backend', '(', 'base', '.', 'BaseBackend', ')', ':', '___EOS___']",
"index": 92
},
{
"content": " def declare_consumer(self, queue, callback, consumer_tag, *args, **kwargs):\n global CONSUMERS\n LOG.debug(\"Adding consumer %s\", consumer_tag)\n CONSUMERS[consumer_tag] = (queue, callback)",
"metadata": "root.Backend.declare_consumer",
"header": "['class', 'Backend', '(', 'base', '.', 'BaseBackend', ')', ':', '___EOS___']",
"index": 99
},
{
"content": " def cancel(self, consumer_tag):\n global CONSUMERS\n LOG.debug(\"Removing consumer %s\", consumer_tag)\n del CONSUMERS[consumer_tag]",
"metadata": "root.Backend.cancel",
"header": "['class', 'Backend', '(', 'base', '.', 'BaseBackend', ')', ':', '___EOS___']",
"index": 104
},
{
"content": " def consume(self, limit=None):\n global CONSUMERS\n num = 0\n while True:\n for (queue, callback) in CONSUMERS.itervalues():\n item = self.get(queue)\n if item:\n callback(item)\n num += 1\n yield\n if limit and num == limit:\n raise StopIteration()\n greenthread.sleep(0.1)",
"metadata": "root.Backend.consume",
"header": "['class', 'Backend', '(', 'base', '.', 'BaseBackend', ')', ':', '___EOS___']",
"index": 109
},
{
"content": " def get(self, queue, no_ack=False):\n global QUEUES\n if not queue in QUEUES or not QUEUES[queue].size():\n return None\n (message_data, content_type, content_encoding) = QUEUES[queue].pop()\n message = Message(backend=self, body=message_data,\n content_type=content_type,\n content_encoding=content_encoding)\n message.result = True\n LOG.debug(_('Getting from %(queue)s: %(message)s') % locals())\n return message",
"metadata": "root.Backend.get",
"header": "['class', 'Backend', '(', 'base', '.', 'BaseBackend', ')', ':', '___EOS___']",
"index": 123
},
{
"content": " def prepare_message(self, message_data, delivery_mode,\n content_type, content_encoding, **kwargs):\n \"\"\"Prepare message for sending.\"\"\"\n return (message_data, content_type, content_encoding)",
"metadata": "root.Backend.prepare_message",
"header": "['class', 'Backend', '(', 'base', '.', 'BaseBackend', ')', ':', '___EOS___']",
"index": 135
},
{
"content": " def publish(self, message, exchange, routing_key, **kwargs):\n global EXCHANGES\n if exchange in EXCHANGES:\n EXCHANGES[exchange].publish(message, routing_key=routing_key)",
"metadata": "root.Backend.publish",
"header": "['class', 'Backend', '(', 'base', '.', 'BaseBackend', ')', ':', '___EOS___']",
"index": 140
},
{
"content": "def reset_all():\n global EXCHANGES\n global QUEUES\n global CONSUMERS\n EXCHANGES = {}\n QUEUES = {}\n CONSUMERS = {}",
"metadata": "root.reset_all",
"header": "['module', '___EOS___']",
"index": 146
}
] | [] | [] | 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",
" ",
"2010",
" ",
"Unit",
"ed",
" ",
"State",
"s",
" ",
"Gov",
"ern",
"ment",
" ",
"as",
" ",
"represent",
"ed",
" ",
"by",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Administra",
"tor",
" ",
"of",
" ",
"the",
" ",
"Nat",
"ional",
" ",
"Aer",
"ona",
"uti",
"cs",
" ",
"and",
" ",
"Spac",
"e",
" ",
"Administrati",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"Rig",
"hts",
" ",
"Reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"Base",
"d",
" ",
"a",
" ",
"bit",
" ",
"on",
" ",
"the",
" ",
"carr",
"ot",
".",
"backed",
"s",
".",
"queue",
" ",
"back",
"end",
"...",
" ",
"but",
" ",
"a",
" ",
"lot",
" ",
"bett",
"er",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"Queue_",
"as_",
"queue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"carr",
"ot_",
"._",
"backends_",
"import_",
"base_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"eventlet_",
"import_",
"green",
"thread_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"nova_",
"import_",
"log_",
"as_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"LOG_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\"",
"nova",
".",
"faker",
"abb",
"it",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"EXCH",
"ANGE",
"S_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"QUEUE",
"S_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"CONSU",
"MER",
"S_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Message_",
"(_",
"base_",
"._",
"Base",
"Message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Exchange_",
"(_",
"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_",
"[SEP]_",
"class_",
"Exchange_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"name_",
",_",
"exchange",
"\\u",
"type_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"name_",
"=_",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"exchange",
"\\u",
"type_",
"=_",
"exchange",
"\\u",
"type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"queue_",
"=_",
"queue_",
"._",
"Queue_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"routes_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Exchange_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"publish_",
"(_",
"self_",
",_",
"message_",
",_",
"routin",
"g",
"\\u",
"key_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"nm_",
"=_",
"self_",
"._",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"LOG_",
"._",
"debug_",
"(_",
"\\u_",
"(_",
"'(",
"%",
"(",
"nm",
")",
"s",
")",
" ",
"publi",
"sh",
" ",
"(",
"key",
":",
" ",
"%",
"(",
"routin",
"g",
"\\u",
"key",
")",
"s",
")'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"%",
"(",
"message",
")",
"s",
"'_",
")_",
"%_",
"locals_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"routin",
"g",
"\\u",
"key_",
"in_",
"self_",
"._",
"\\u",
"routes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"f_",
"in_",
"self_",
"._",
"\\u",
"routes_",
"[_",
"routin",
"g",
"\\u",
"key_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"LOG_",
"._",
"debug_",
"(_",
"\\u_",
"(_",
"'",
"Publish",
"ing",
" ",
"to",
" ",
"route",
" ",
"%",
"s",
"'_",
")_",
",_",
"f_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"(_",
"message_",
",_",
"routin",
"g",
"\\u",
"key_",
"=_",
"routin",
"g",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Exchange_",
"(_",
"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_",
"bind_",
"(_",
"self_",
",_",
"callback_",
",_",
"routin",
"g",
"\\u",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"routes_",
"._",
"setdefault_",
"(_",
"routin",
"g",
"\\u",
"key_",
",_",
"[_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"routes_",
"[_",
"routin",
"g",
"\\u",
"key_",
"]_",
"._",
"append_",
"(_",
"callback_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Queue_",
"(_",
"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_",
"[SEP]_",
"class_",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"name_",
"=_",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"queue_",
"=_",
"queue_",
"._",
"Queue_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"repr\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'<",
"Queue",
":",
" ",
"%",
"s",
">'_",
"%_",
"self_",
"._",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"push_",
"(_",
"self_",
",_",
"message_",
",_",
"routin",
"g",
"\\u",
"key_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"queue_",
"._",
"put_",
"(_",
"message_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"size_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"queue_",
"._",
"qsize_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"pop_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"queue_",
"._",
"get_",
"(_",
")_",
"\\u\\u\\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_",
"Backend_",
"(_",
"base_",
"._",
"Base",
"Backend_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Backend_",
"(_",
"base_",
"._",
"Base",
"Backend_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"queue",
"\\u",
"declare_",
"(_",
"self_",
",_",
"queue_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"QUEUE",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"queue_",
"not_",
"in_",
"QUEUE",
"S_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"LOG_",
"._",
"debug_",
"(_",
"\\u_",
"(_",
"'",
"Declar",
"ing",
" ",
"queue",
" ",
"%",
"s",
"'_",
")_",
",_",
"queue_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"QUEUE",
"S_",
"[_",
"queue_",
"]_",
"=_",
"Queue_",
"(_",
"queue_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Backend_",
"(_",
"base_",
"._",
"Base",
"Backend_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"exchange",
"\\u",
"declare_",
"(_",
"self_",
",_",
"exchange_",
",_",
"type_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"EXCH",
"ANGE",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"exchange_",
"not_",
"in_",
"EXCH",
"ANGE",
"S_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"LOG_",
"._",
"debug_",
"(_",
"\\u_",
"(_",
"'",
"Declar",
"ing",
" ",
"exchange",
" ",
"%",
"s",
"'_",
")_",
",_",
"exchange_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"EXCH",
"ANGE",
"S_",
"[_",
"exchange_",
"]_",
"=_",
"Exchange_",
"(_",
"exchange_",
",_",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Backend_",
"(_",
"base_",
"._",
"Base",
"Backend_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"queue",
"\\u",
"bind_",
"(_",
"self_",
",_",
"queue_",
",_",
"exchange_",
",_",
"routin",
"g",
"\\u",
"key_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"EXCH",
"ANGE",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"global_",
"QUEUE",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"LOG_",
"._",
"debug_",
"(_",
"\\u_",
"(_",
"'",
"Bind",
"ing",
" ",
"%",
"(",
"queue",
")",
"s",
" ",
"to",
" ",
"%",
"(",
"exchange",
")",
"s",
" ",
"with",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"key",
" ",
"%",
"(",
"routin",
"g",
"\\u",
"key",
")",
"s",
"'_",
")_",
"%_",
"locals_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"EXCH",
"ANGE",
"S_",
"[_",
"exchange_",
"]_",
"._",
"bind_",
"(_",
"QUEUE",
"S_",
"[_",
"queue_",
"]_",
"._",
"push_",
",_",
"routin",
"g",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Backend_",
"(_",
"base_",
"._",
"Base",
"Backend_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"declar",
"e\\u",
"consumer_",
"(_",
"self_",
",_",
"queue_",
",_",
"callback_",
",_",
"consume",
"r",
"\\u",
"tag_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"CONSU",
"MER",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"LOG_",
"._",
"debug_",
"(_",
"\"",
"Add",
"ing",
" ",
"consume",
"r",
" ",
"%",
"s",
"\"_",
",_",
"consume",
"r",
"\\u",
"tag_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"CONSU",
"MER",
"S_",
"[_",
"consume",
"r",
"\\u",
"tag_",
"]_",
"=_",
"(_",
"queue_",
",_",
"callback_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Backend_",
"(_",
"base_",
"._",
"Base",
"Backend_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"cancel_",
"(_",
"self_",
",_",
"consume",
"r",
"\\u",
"tag_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"CONSU",
"MER",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"LOG_",
"._",
"debug_",
"(_",
"\"",
"Remo",
"ving",
" ",
"consume",
"r",
" ",
"%",
"s",
"\"_",
",_",
"consume",
"r",
"\\u",
"tag_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"CONSU",
"MER",
"S_",
"[_",
"consume",
"r",
"\\u",
"tag_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Backend_",
"(_",
"base_",
"._",
"Base",
"Backend_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"consume_",
"(_",
"self_",
",_",
"limit_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"CONSU",
"MER",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"(_",
"queue_",
",_",
"callback_",
")_",
"in_",
"CONSU",
"MER",
"S_",
"._",
"itervalues_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"item_",
"=_",
"self_",
"._",
"get_",
"(_",
"queue_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"item_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"callback_",
"(_",
"item_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yield_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"limit_",
"and_",
"num_",
"==_",
"limit_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"raise_",
"Sto",
"p",
"Iteration_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"green",
"thread_",
"._",
"sleep_",
"(_",
"0.1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Backend_",
"(_",
"base_",
"._",
"Base",
"Backend_",
")_",
":_",
"\\u\\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_",
"(_",
"self_",
",_",
"queue_",
",_",
"no",
"\\u",
"ack_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"QUEUE",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"queue_",
"in_",
"QUEUE",
"S_",
"or_",
"not_",
"QUEUE",
"S_",
"[_",
"queue_",
"]_",
"._",
"size_",
"(_",
")_",
":_",
"\\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_",
"(_",
"message",
"\\u",
"data_",
",_",
"content",
"\\u",
"type_",
",_",
"content",
"\\u",
"encoding_",
")_",
"=_",
"QUEUE",
"S_",
"[_",
"queue_",
"]_",
"._",
"pop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message_",
"=_",
"Message_",
"(_",
"backend_",
"=_",
"self_",
",_",
"body_",
"=_",
"message",
"\\u",
"data_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"content",
"\\u",
"type_",
"=_",
"content",
"\\u",
"type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"content",
"\\u",
"encoding_",
"=_",
"content",
"\\u",
"encoding_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message_",
"._",
"result_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"LOG_",
"._",
"debug_",
"(_",
"\\u_",
"(_",
"'",
"Get",
"ting",
" ",
"from",
" ",
"%",
"(",
"queue",
")",
"s",
":",
" ",
"%",
"(",
"message",
")",
"s",
"'_",
")_",
"%_",
"locals_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Backend_",
"(_",
"base_",
"._",
"Base",
"Backend_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"prepar",
"e\\u",
"message_",
"(_",
"self_",
",_",
"message",
"\\u",
"data_",
",_",
"delivery",
"\\u",
"mode_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"content",
"\\u",
"type_",
",_",
"content",
"\\u",
"encoding_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Prepare",
" ",
"message",
" ",
"for",
" ",
"sendin",
"g",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"message",
"\\u",
"data_",
",_",
"content",
"\\u",
"type_",
",_",
"content",
"\\u",
"encoding_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Backend_",
"(_",
"base_",
"._",
"Base",
"Backend_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"publish_",
"(_",
"self_",
",_",
"message_",
",_",
"exchange_",
",_",
"routin",
"g",
"\\u",
"key_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"EXCH",
"ANGE",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"exchange_",
"in_",
"EXCH",
"ANGE",
"S_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"EXCH",
"ANGE",
"S_",
"[_",
"exchange_",
"]_",
"._",
"publish_",
"(_",
"message_",
",_",
"routin",
"g",
"\\u",
"key_",
"=_",
"routin",
"g",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"reset",
"\\u",
"all_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uIND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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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Constant in conditional expression or statement | cloudera/hue/desktop/core/ext-py/django-extensions-1.5.0/django_extensions/management/commands/admin_generator.py | [
{
"content": " @signalcommand\n def handle(self, *args, **kwargs):\n self.style = color_style()\n\n installed_apps = dict((a.__name__.rsplit('.', 1)[0], a) for a in models.get_apps())\n\n # Make sure we always have args\n if not args:\n args = [False]\n\n app = installed_apps.get(args[0])\n if not app:\n print(self.style.WARN('This command requires an existing app name as argument'))\n print(self.style.WARN('Available apps:'))\n for app in sorted(installed_apps):\n print(self.style.WARN(' %s' % app))\n sys.exit(1)\n\n model_res = []\n for arg in args[1:]:\n model_res.append(re.compile(arg, re.IGNORECASE))\n\n self.handle_app(app, model_res, **kwargs)",
"metadata": "root.Command.handle",
"header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']",
"index": 306
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Constant_",
"in_",
"conditional",
"_",
"expression_",
"or_",
"statement_",
"[SEP]_",
"class_",
"Command_",
"(_",
"Base",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"signal",
"command_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"handle_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"style_",
"=_",
"color",
"\\u",
"style_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"install",
"ed",
"\\u",
"apps_",
"=_",
"dict_",
"(_",
"(_",
"a_",
"._",
"\\u\\u",
"name\\u\\u_",
"._",
"rsplit_",
"(_",
"'.'_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
",_",
"a_",
")_",
"for_",
"a_",
"in_",
"models_",
"._",
"get",
"\\u",
"apps_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"sure",
" ",
"we",
" ",
"alw",
"ay",
"s",
" ",
"have",
" ",
"args_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"args_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"=_",
"[_",
"False_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"app_",
"=_",
"install",
"ed",
"\\u",
"apps_",
"._",
"get_",
"(_",
"args_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"app_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"self_",
"._",
"style_",
"._",
"WARN_",
"(_",
"'",
"Thi",
"s",
" ",
"command",
" ",
"require",
"s",
" ",
"an",
" ",
"exist",
"ing",
" ",
"app",
" ",
"name",
" ",
"as",
" ",
"argu",
"ment",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"self_",
"._",
"style_",
"._",
"WARN_",
"(_",
"'",
"Avail",
"able",
" ",
"apps",
":'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"app_",
"in_",
"sorted_",
"(_",
"install",
"ed",
"\\u",
"apps_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"self_",
"._",
"style_",
"._",
"WARN_",
"(_",
"'",
" ",
" ",
" ",
" ",
"%",
"s",
"'_",
"%_",
"app_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"model",
"\\u",
"res_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"arg_",
"in_",
"args_",
"[_",
"1_",
":_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"model",
"\\u",
"res_",
"._",
"append_",
"(_",
"re_",
"._",
"compile_",
"(_",
"arg_",
",_",
"re_",
"._",
"IGNORECASE_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"handle",
"\\u",
"app_",
"(_",
"app_",
",_",
"model",
"\\u",
"res_",
",_",
"**_",
"kwargs_",
")_",
"\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | AppScale/appscale/AppServer/google/appengine/tools/gen_protorpc.py | [
{
"content": "def open_input_file(filename):\n \"\"\"Open file for reading.\n\n Args:\n filename: Name of input file to open or None to open stdin.\n\n Returns:\n Opened file if string provided, stdin if filename is None.\n \"\"\"\n # TODO(rafek): Detect missing or invalid files, generating user friendly\n # error messages.\n if filename is None:\n return sys.stdin\n else:\n try:\n return open(filename, 'rb')\n except IOError, err:\n fatal_error(str(err))",
"metadata": "root.open_input_file",
"header": "['module', '___EOS___']",
"index": 57
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"open",
"\\u",
"input",
"\\u",
"file_",
"(_",
"filename_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Open",
" ",
"file",
" ",
"for",
" ",
"readi",
"ng",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"filename",
":",
" ",
"Name",
" ",
"of",
" ",
"input",
" ",
"file",
" ",
"to",
" ",
"open",
" ",
"or",
" ",
"Non",
"e",
" ",
"to",
" ",
"open",
" ",
"std",
"in",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Opened",
" ",
"file",
" ",
"if",
" ",
"string",
" ",
"provided",
",",
" ",
"std",
"in",
" ",
"if",
" ",
"filename",
" ",
"is",
" ",
"Non",
"e",
".",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
"(",
"raf",
"ek",
"):",
" ",
"Detect",
" ",
"missi",
"ng",
" ",
"or",
" ",
"invalid",
" ",
"files",
",",
" ",
"generat",
"ing",
" ",
"user",
" ",
"frie",
"ndl",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"error",
" ",
"message",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"filename_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"sys_",
"._",
"stdin_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"open_",
"(_",
"filename_",
",_",
"'",
"rb",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"IO",
"Error_",
",_",
"err_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fat",
"al",
"\\u",
"error_",
"(_",
"str_",
"(_",
"err_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | google/grr/grr/server/data_server/rebalance.py | [
{
"content": "def _CreateDirectory(database_dir, rebalance_id):\n tempdir = _GetTransactionDirectory(database_dir, rebalance_id)\n try:\n os.makedirs(tempdir)\n except os.error:\n pass\n return tempdir",
"metadata": "root._CreateDirectory",
"header": "['module', '___EOS___']",
"index": 169
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Creat",
"e",
"Directory_",
"(_",
"databa",
"se",
"\\u",
"dir_",
",_",
"rebalance",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tempdir_",
"=_",
"\\u",
"Get",
"Transa",
"ction",
"Directory_",
"(_",
"databa",
"se",
"\\u",
"dir_",
",_",
"rebalance",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"makedirs_",
"(_",
"tempdir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"os_",
"._",
"error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"tempdir_",
"\\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
] |
Imprecise assert | openstack-infra/elastic-recheck/elastic_recheck/tests/unit/test_graph.py | [
{
"content": " def test_get_open_reviews(self):\n with mock.patch('requests.get') as mock_get:\n with open('elastic_recheck/tests/unit/samples/'\n 'gerrit-bug-query.json') as f:\n mock_get.return_value = FakeResponse(f.read())\n self.assertEqual(graph.get_open_reviews('1288393'), [113009])",
"metadata": "root.TestGraphCmd.test_get_open_reviews",
"header": "['class', 'TestGraphCmd', '(', 'unit', '.', 'UnitTestCase', ')', ':', '___EOS___']",
"index": 31
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Test",
"Graph",
"Cmd_",
"(_",
"unit_",
"._",
"Unit",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"open",
"\\u",
"reviews_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"mock_",
"._",
"patch_",
"(_",
"'",
"request",
"s",
".",
"get",
"'_",
")_",
"as_",
"mock",
"\\u",
"get_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"open_",
"(_",
"'",
"elastic",
"\\u",
"rech",
"eck",
"/",
"tests",
"/",
"unit",
"/",
"samples",
"/'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"gerrit",
"-",
"bug",
"-",
"query",
".",
"json",
"'_",
")_",
"as_",
"f_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mock",
"\\u",
"get_",
"._",
"return",
"\\u",
"value_",
"=_",
"Fake",
"Response_",
"(_",
"f_",
"._",
"read_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"graph_",
"._",
"get",
"\\u",
"open",
"\\u",
"reviews_",
"(_",
"'",
"128",
"839",
"3",
"'_",
")_",
",_",
"[_",
"113",
"009",
"_",
"]_",
")_"
] | [
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
] |
Unused import | benoitc/gunicorn/tests/requests/invalid/013.py | [
{
"content": "from gunicorn.config import Config\nfrom gunicorn.http.errors import LimitRequestHeaders\n\nrequest = LimitRequestHeaders\ncfg = Config()\ncfg.set('limit_request_field_size', 14)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"gun",
"icor",
"n_",
"._",
"config_",
"import_",
"Config_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"gun",
"icor",
"n_",
"._",
"http_",
"._",
"errors_",
"import_",
"Limit",
"Request",
"Headers_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"request_",
"=_",
"Limit",
"Request",
"Headers_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cfg_",
"=_",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cfg_",
"._",
"set_",
"(_",
"'",
"limit",
"\\u",
"request",
"\\u",
"field",
"\\u",
"size",
"'_",
",_",
"14_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Redundant comparison | CollabQ/CollabQ/vendor/django/db/models/options.py | [
{
"content": " def _fill_related_objects_cache(self):\n cache = SortedDict()\n parent_list = self.get_parent_list()\n for parent in self.parents:\n for obj, model in parent._meta.get_all_related_objects_with_model():\n if (obj.field.creation_counter < 0 or obj.field.rel.parent_link) and obj.model not in parent_list:\n continue\n if not model:\n cache[obj] = parent\n else:\n cache[obj] = model\n for klass in get_models():\n for f in klass._meta.local_fields:\n if f.rel and not isinstance(f.rel.to, str) and self == f.rel.to._meta:\n cache[RelatedObject(f.rel.to, klass, f)] = None\n self._related_objects_cache = cache",
"metadata": "root.Options._fill_related_objects_cache",
"header": "['class', 'Options', '(', 'object', ')', ':', '___EOS___']",
"index": 366
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Redu",
"ndan",
"t_",
"comparison_",
"[SEP]_",
"class_",
"Options_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"fill",
"\\u",
"relate",
"d\\u",
"object",
"s",
"\\u",
"cache_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cache_",
"=_",
"Sorte",
"d",
"Dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parent",
"\\u",
"list_",
"=_",
"self_",
"._",
"get",
"\\u",
"parent",
"\\u",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"parent_",
"in_",
"self_",
"._",
"parents_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"obj_",
",_",
"model_",
"in_",
"parent_",
"._",
"\\u",
"meta_",
"._",
"get",
"\\u",
"all",
"\\u",
"relate",
"d\\u",
"object",
"s",
"\\u",
"with",
"\\u",
"model_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"obj_",
"._",
"field_",
"._",
"creati",
"on",
"\\u",
"counter_",
"<_",
"0_",
"or_",
"obj_",
"._",
"field_",
"._",
"rel_",
"._",
"parent",
"\\u",
"link_",
")_",
"and_",
"obj_",
"._",
"model_",
"not_",
"in_",
"parent",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"model_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"cache_",
"[_",
"obj_",
"]_",
"=_",
"parent_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"cache_",
"[_",
"obj_",
"]_",
"=_",
"model_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"klass_",
"in_",
"get",
"\\u",
"models_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"f_",
"in_",
"klass_",
"._",
"\\u",
"meta_",
"._",
"local",
"\\u",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"f_",
"._",
"rel_",
"and_",
"not_",
"isinstance_",
"(_",
"f_",
"._",
"rel_",
"._",
"to_",
",_",
"str_",
")_",
"and_",
"self_",
"==_",
"f_",
"._",
"rel_",
"._",
"to_",
"._",
"\\u",
"meta_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"cache_",
"[_",
"Rela",
"ted",
"Object_",
"(_",
"f_",
"._",
"rel_",
"._",
"to_",
",_",
"klass_",
",_",
"f_",
")_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"relate",
"d\\u",
"object",
"s",
"\\u",
"cache_",
"=_",
"cache_",
"\\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
] |
First parameter of a method is not named 'self' | dimagi/commcare-hq/corehq/apps/users/models.py | [
{
"content": " def get_language_code(self):\n return self.language",
"metadata": "root.WebUser.get_language_code",
"header": "['class', 'WebUser', '(', 'CouchUser', ',', 'MultiMembershipMixin', ',', 'CommCareMobileContactMixin', ')', ':', '___NEWLINE___', '#do sync and create still work?', '___NL___', '___EOS___']",
"index": 1946
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"Web",
"User_",
"(_",
"Cou",
"ch",
"User_",
",_",
"Multi",
"Membership",
"Mixin_",
",_",
"Comm",
"Care",
"Mob",
"ile",
"Conta",
"ct",
"Mixin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"do",
" ",
"sync",
" ",
"and",
" ",
"create",
" ",
"still",
" ",
"work",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"language",
"\\u",
"code_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"language_",
"\\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
] |
Unreachable code | zzzeek/sqlalchemy/test/sql/test_resultset.py | [
{
"content": " def test_row_case_sensitive_unoptimized(self):\n ins_db = engines.testing_engine(options={\"case_sensitive\": True})\n row = ins_db.execute(\n select([\n literal_column(\"1\").label(\"case_insensitive\"),\n literal_column(\"2\").label(\"CaseSensitive\"),\n text(\"3 AS screw_up_the_cols\")\n ])\n ).first()\n\n eq_(\n list(row.keys()),\n [\"case_insensitive\", \"CaseSensitive\", \"screw_up_the_cols\"])\n\n in_(\"case_insensitive\", row._keymap)\n in_(\"CaseSensitive\", row._keymap)\n not_in_(\"casesensitive\", row._keymap)\n\n eq_(row[\"case_insensitive\"], 1)\n eq_(row[\"CaseSensitive\"], 2)\n eq_(row[\"screw_up_the_cols\"], 3)\n\n assert_raises(KeyError, lambda: row[\"Case_insensitive\"])\n assert_raises(KeyError, lambda: row[\"casesensitive\"])\n assert_raises(KeyError, lambda: row[\"screw_UP_the_cols\"])",
"metadata": "root.ResultProxyTest.test_row_case_sensitive_unoptimized",
"header": "['class', 'ResultProxyTest', '(', 'fixtures', '.', 'TablesTest', ')', ':', '___EOS___']",
"index": 517
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Result",
"Pro",
"xy",
"Test_",
"(_",
"fixtures_",
"._",
"Table",
"s",
"Test_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"row",
"\\u",
"case",
"\\u",
"sensi",
"tiv",
"e\\u",
"uno",
"pti",
"mi",
"zed_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ins",
"\\u",
"db_",
"=_",
"engines_",
"._",
"testi",
"ng",
"\\u",
"engine_",
"(_",
"options_",
"=_",
"{_",
"\"",
"case",
"\\u",
"sensi",
"tiv",
"e",
"\"_",
":_",
"True_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"row_",
"=_",
"ins",
"\\u",
"db_",
"._",
"execute_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"select_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"literal",
"\\u",
"column_",
"(_",
"\"",
"1",
"\"_",
")_",
"._",
"label_",
"(_",
"\"",
"case",
"\\u",
"inse",
"nsitive",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"literal",
"\\u",
"column_",
"(_",
"\"",
"2",
"\"_",
")_",
"._",
"label_",
"(_",
"\"",
"Case",
"Sensitiv",
"e",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"text_",
"(_",
"\"",
"3",
" ",
"AS",
" ",
"scre",
"w",
"\\u",
"up",
"\\u",
"the",
"\\u",
"cols",
"\"_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"._",
"first_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"eq\\u_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"list_",
"(_",
"row_",
"._",
"keys_",
"(_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\"",
"case",
"\\u",
"inse",
"nsitive",
"\"_",
",_",
"\"",
"Case",
"Sensitiv",
"e",
"\"_",
",_",
"\"",
"scre",
"w",
"\\u",
"up",
"\\u",
"the",
"\\u",
"cols",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"in\\u_",
"(_",
"\"",
"case",
"\\u",
"inse",
"nsitive",
"\"_",
",_",
"row_",
"._",
"\\u",
"keymap_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"in\\u_",
"(_",
"\"",
"Case",
"Sensitiv",
"e",
"\"_",
",_",
"row_",
"._",
"\\u",
"keymap_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"not",
"\\u",
"in\\u_",
"(_",
"\"",
"case",
"sensi",
"tiv",
"e",
"\"_",
",_",
"row_",
"._",
"\\u",
"keymap_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"eq\\u_",
"(_",
"row_",
"[_",
"\"",
"case",
"\\u",
"inse",
"nsitive",
"\"_",
"]_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"row_",
"[_",
"\"",
"Case",
"Sensitiv",
"e",
"\"_",
"]_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eq\\u_",
"(_",
"row_",
"[_",
"\"",
"scre",
"w",
"\\u",
"up",
"\\u",
"the",
"\\u",
"cols",
"\"_",
"]_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"raises_",
"(_",
"Key",
"Error_",
",_",
"lambda_",
":_",
"row_",
"[_",
"\"",
"Case",
"\\u",
"inse",
"nsitive",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"raises_",
"(_",
"Key",
"Error_",
",_",
"lambda_",
":_",
"row_",
"[_",
"\"",
"case",
"sensi",
"tiv",
"e",
"\"_",
"]_",
")_",
"\\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
] |
Except block handles 'BaseException' | weblabdeusto/weblabdeusto/server/src/voodoo/override.py | [
{
"content": "def Override(classes):\n \"\"\" Override(classes) -> decorator\n\n Decorator which emulates the same behaviour as the\n Overrides annotation in Java >= 1.5\n \"\"\"\n def wrapped(func):\n try:\n real_classes = tuple(( i for i in classes ))\n except TypeError:\n real_classes = ( classes, )\n\n found = False\n for i in real_classes:\n if hasattr(i, func.__name__):\n found = True\n break\n if not found:\n raise TypeError(\"Method %s is not present in classes: %s\" % (func.__name__, real_classes))\n else:\n return func\n return wrapped",
"metadata": "root.Override",
"header": "['module', '___EOS___']",
"index": 16
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"Override",
"_",
"(_",
"classes_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Override",
"(",
"classe",
"s",
")",
" ",
"->",
" ",
"decorat",
"or",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Decorat",
"or",
" ",
"whi",
"ch",
" ",
"emulate",
"s",
" ",
"the",
" ",
"same",
" ",
"behaviour",
" ",
"as",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Override",
"s",
" ",
"annot",
"ation",
" ",
"in",
" ",
"Ja",
"va",
" ",
">=",
" ",
"1.5",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"wrapped_",
"(_",
"func_",
")_",
":_",
"\\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 ",
" _",
"real",
"\\u",
"classes_",
"=_",
"tuple_",
"(_",
"(_",
"i_",
"for_",
"i_",
"in_",
"classes_",
")_",
")_",
"\\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 ",
" _",
"real",
"\\u",
"classes_",
"=_",
"(_",
"classes_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"found_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"real",
"\\u",
"classes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"hasattr_",
"(_",
"i_",
",_",
"func_",
"._",
"\\u\\u",
"name\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"found_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"found_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Type",
"Error_",
"(_",
"\"",
"Meth",
"od",
" ",
"%",
"s",
" ",
"is",
" ",
"not",
" ",
"presen",
"t",
" ",
"in",
" ",
"classe",
"s",
":",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"func_",
"._",
"\\u\\u",
"name\\u\\u_",
",_",
"real",
"\\u",
"classes_",
")_",
")_",
"\\u\\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_",
"func_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"wrapped_"
] | [
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
] |
Comparison using is when operands support `__eq__` | kdart/pycopia/QA/pycopia/QA/core.py | [
{
"content": "#!/usr/bin/python2.7\n# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab\n\n# LICENSE: LGPL\n\n# Copied from Pycopia test automation framework, and modified for Google Gtest.\n# Copied from Gtest, and modified for powerdroid test automation framework.\n# Copied from powerdroid back into Pycopia test automation framework.\n\n\nfrom __future__ import print_function\n\n\"\"\"Provides base classes for test cases and suites.\n\nThis module defines a Test class, which is the base class for all test case\nimplementations. This class is not substantiated itself, but a subclass is\ndefined that overrides the `execute` method.\n\nYour `execute` should return the value that the `passed` or\n`failed` methods return, as appropriate.\n\nAll test related errors are based on the `TestError` exception. You may\nalso use the built-in `assert` statement. There are also various assertion\nmethods you may use. If a test cannot be completed for some reason you may\nalso raise a 'TestIncompleteError' exception.\n\nUsually, a set of test cases is collected in a TestSuite object, and run\nsequentially by calling the suite instance.\n\n\"\"\"\n\n__author__ = '[email protected] (Keith Dart)'\n\n\nimport sys\nimport os\n\nfrom pycopia import scheduler\nfrom pycopia import timelib\nfrom pycopia import debugger\nfrom pycopia import UserFile\nfrom pycopia import dictlib\nfrom pycopia import module\nfrom pycopia import methods\nfrom pycopia.QA import constants\nfrom pycopia.db.config import ConfigError\n\n\n# exception classes that may be raised by test methods.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# --------------------\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": " @classmethod\n def set_test_options(cls):\n insert_options(cls)\n opts = cls.OPTIONS\n pl = []\n for prereq in cls.PREREQUISITES:\n if isinstance(prereq, basestring):\n pl.append(PreReq(prereq))\n elif type(prereq) is tuple:\n pl.append(PreReq(*prereq))\n else:\n raise ValueError(\"Bad prerequisite value.\")\n opts.prerequisites = pl\n opts.bugid = None",
"metadata": "root.Test.set_test_options",
"header": "['class', 'Test', '(', 'object', ')', ':', '___EOS___']",
"index": 158
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Compari",
"son_",
"using_",
"is_",
"when_",
"operands_",
"support_",
" _",
"`_",
"\\u\\u",
"eq\\u\\u_",
"`_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"python",
"2.7",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"vim",
":",
"ts",
"=",
"4",
":",
"sw",
"=",
"4",
":",
"soft",
"tabs",
"top",
"=",
"4",
":",
"smart",
"tab",
":",
"expand",
"tab_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"LICENSE",
":",
" ",
"LGP",
"L_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copie",
"d",
" ",
"from",
" ",
"Py",
"cop",
"ia",
" ",
"test",
" ",
"automati",
"on",
" ",
"frame",
"work",
",",
" ",
"and",
" ",
"modifi",
"ed",
" ",
"for",
" ",
"Goo",
"gle",
" ",
"Gt",
"est",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copie",
"d",
" ",
"from",
" ",
"Gt",
"est",
",",
" ",
"and",
" ",
"modifi",
"ed",
" ",
"for",
" ",
"power",
"droid",
" ",
"test",
" ",
"automati",
"on",
" ",
"frame",
"work",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copie",
"d",
" ",
"from",
" ",
"power",
"droid",
" ",
"back",
" ",
"int",
"o",
" ",
"Py",
"cop",
"ia",
" ",
"test",
" ",
"automati",
"on",
" ",
"frame",
"work",
"._",
"\\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_",
"print",
"\\u",
"function_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"Prov",
"ides",
" ",
"base",
" ",
"classe",
"s",
" ",
"for",
" ",
"test",
" ",
"case",
"s",
" ",
"and",
" ",
"suites",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Thi",
"s",
" ",
"module",
" ",
"defin",
"es",
" ",
"a",
" ",
"Test",
" ",
"class",
",",
" ",
"whi",
"ch",
" ",
"is",
" ",
"the",
" ",
"base",
" ",
"class",
" ",
"for",
" ",
"all",
" ",
"test",
" ",
"case",
"\\",
"10",
";",
"implementation",
"s",
".",
" ",
"Thi",
"s",
" ",
"class",
" ",
"is",
" ",
"not",
" ",
"substa",
"nti",
"ated",
" ",
"its",
"elf",
",",
" ",
"but",
" ",
"a",
" ",
"subclass",
" ",
"is",
"\\",
"10",
";",
"defin",
"ed",
" ",
"tha",
"t",
" ",
"override",
"s",
" ",
"the",
" ",
"`",
"execute",
"`",
" ",
"method",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"You",
"r",
" ",
"`",
"execute",
"`",
" ",
"shou",
"ld",
" ",
"return",
" ",
"the",
" ",
"value",
" ",
"tha",
"t",
" ",
"the",
" ",
"`",
"pass",
"ed",
"`",
" ",
"or",
"\\",
"10",
";",
"`",
"fail",
"ed",
"`",
" ",
"method",
"s",
" ",
"return",
",",
" ",
"as",
" ",
"appropr",
"iate",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"All",
" ",
"test",
" ",
"relate",
"d",
" ",
"error",
"s",
" ",
"are",
" ",
"based",
" ",
"on",
" ",
"the",
" ",
"`",
"Test",
"Error",
"`",
" ",
"exception",
".",
" ",
"You",
" ",
"may",
"\\",
"10",
";",
"als",
"o",
" ",
"use",
" ",
"the",
" ",
"bui",
"lt",
"-",
"in",
" ",
"`",
"assert",
"`",
" ",
"statem",
"ent",
".",
" ",
"There",
" ",
"are",
" ",
"als",
"o",
" ",
"vari",
"ous",
" ",
"assertion",
"\\",
"10",
";",
"method",
"s",
" ",
"you",
" ",
"may",
" ",
"use",
".",
" ",
"If",
" ",
"a",
" ",
"test",
" ",
"cann",
"ot",
" ",
"be",
" ",
"complete",
"d",
" ",
"for",
" ",
"some",
" ",
"reason",
" ",
"you",
" ",
"may",
"\\",
"10",
";",
"als",
"o",
" ",
"raise",
" ",
"a",
" ",
"'",
"Test",
"Incomp",
"lete",
"Error",
"'",
" ",
"exception",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Us",
"ual",
"ly",
",",
" ",
"a",
" ",
"set",
" ",
"of",
" ",
"test",
" ",
"case",
"s",
" ",
"is",
" ",
"collected",
" ",
"in",
" ",
"a",
" ",
"Test",
"Suit",
"e",
" ",
"object",
",",
" ",
"and",
" ",
"run",
"\\",
"10",
";",
"sequential",
"ly",
" ",
"by",
" ",
"calling",
" ",
"the",
" ",
"suit",
"e",
" ",
"instance",
".",
"\\",
"10",
";",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"author\\u\\u_",
"=_",
"'",
"kei",
"th",
"@",
"kd",
"art",
".",
"com",
" ",
"(",
"Ke",
"ith",
" ",
"Dar",
"t",
")'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"pycopia_",
"import_",
"scheduler_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pycopia_",
"import_",
"timeli",
"b_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pycopia_",
"import_",
"debugger_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pycopia_",
"import_",
"User",
"File_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pycopia_",
"import_",
"dict",
"lib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pycopia_",
"import_",
"module_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pycopia_",
"import_",
"methods_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pycopia_",
"._",
"QA",
"_",
"import_",
"constants_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pycopia_",
"._",
"db_",
"._",
"config_",
"import_",
"Config",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"exception",
" ",
"classe",
"s",
" ",
"tha",
"t",
" ",
"may",
" ",
"be",
" ",
"raise",
"d",
" ",
"by",
" ",
"test",
" ",
"method",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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\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uDEDENT\\u\\u\\u_",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"set\\u",
"test\\u",
"options_",
"(_",
"cls_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"insert",
"\\u",
"options_",
"(_",
"cls_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"opts_",
"=_",
"cls_",
"._",
"OPTIONS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pl_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"prere",
"q_",
"in_",
"cls_",
"._",
"PRE",
"REQ",
"UI",
"SITE",
"S_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"prere",
"q_",
",_",
"basestring_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pl_",
"._",
"append_",
"(_",
"Pre",
"Req_",
"(_",
"prere",
"q_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"type_",
"(_",
"prere",
"q_",
")_",
"is_",
"tuple_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pl_",
"._",
"append_",
"(_",
"Pre",
"Req_",
"(_",
"*_",
"prere",
"q_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"",
"Ba",
"d",
" ",
"prerequisite",
" ",
"value",
".\"_",
")_",
"\\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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | saullocastro/mapy/mapy/model/elements/__init__.py | [
{
"content": " def rebuild(self):\n if getattr(self, 'pid', False) <> False:\n prop = self.model.propdict[int(self.pid)]\n self.pobj = prop",
"metadata": "root.Elements.rebuild",
"header": "['class', 'Elements', '(', 'object', ')', ':', '___EOS___']",
"index": 11
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Elements_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"rebuild_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"getattr_",
"(_",
"self_",
",_",
"'",
"pid",
"'_",
",_",
"False_",
")_",
"<_",
">_",
"False_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"prop_",
"=_",
"self_",
"._",
"model_",
"._",
"prop",
"dict_",
"[_",
"int_",
"(_",
"self_",
"._",
"pid_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"pob",
"j_",
"=_",
"prop_",
"\\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
] |
Variable defined multiple times | djangonauts/django-hstore/tests/django_hstore_tests/models.py | [
{
"content": "class Ref(models.Model):\n name = models.CharField(max_length=32)",
"metadata": "root.Ref",
"header": "['module', '___EOS___']",
"index": 24
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Ref_",
"(_",
"models_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"models_",
"._",
"Char",
"Field_",
"(_",
"max",
"\\u",
"length_",
"=_",
"32_",
")_",
"\\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
] |
Unused local variable | severb/flowy/tests/examples.py | [
{
"content": "def main():\n # logging, the basicConfig is for futures, setup_default_logger is for flowy\n logging.basicConfig()\n setup_default_logger()\n\n def workflow(workflow_class):\n try:\n return globals()[workflow_class]\n except KeyError:\n raise ValueError('Workflow \"%s\" not found.' % workflow_class)\n\n parser = argparse.ArgumentParser(description='Example workflow runner.')\n parser.add_argument('workflow', action='store', type=workflow)\n parser.add_argument('--pure', action='store_true', default=False)\n parser.add_argument('--workflow-workers',\n action='store',\n type=int,\n default=2)\n parser.add_argument('--activity-workers',\n action='store',\n type=int,\n default=8)\n parser.add_argument('--timeit', action='store_true', default=False)\n parser.add_argument('--trace', action='store_true', default=False)\n parser.add_argument('--wait-children', action='store_true', default=False)\n args = parser.parse_args()\n\n start = time.time()\n if args.pure:\n wf = args.workflow(activity)\n result = wf()\n else:\n lw = LocalWorkflow(args.workflow,\n activity_workers=args.activity_workers,\n workflow_workers=args.workflow_workers)\n lw.conf_activity('a', activity)\n result = lw.run(_wait=args.wait_children, _trace=args.trace)\n if args.timeit:\n print('Timed at:', time.time() - start)\n print('Result:', result)",
"metadata": "root.main",
"header": "['module', '___EOS___']",
"index": 269
}
] | [] | [] | 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_",
"def_",
"main_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"logg",
"ing",
",",
" ",
"the",
" ",
"basic",
"Config",
" ",
"is",
" ",
"for",
" ",
"future",
"s",
",",
" ",
"setup",
"\\u",
"default",
"\\u",
"logg",
"er",
" ",
"is",
" ",
"for",
" ",
"flow",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"basic",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"setup",
"\\u",
"default",
"\\u",
"logger_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"workflow_",
"(_",
"workf",
"low",
"\\u",
"class_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"globals_",
"(_",
")_",
"[_",
"workf",
"low",
"\\u",
"class_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Key",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"'",
"Work",
"flow",
" ",
"\"%",
"s",
"\"",
" ",
"not",
" ",
"found",
".'_",
"%_",
"workf",
"low",
"\\u",
"class_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"parser_",
"=_",
"argparse_",
"._",
"Arg",
"ument",
"Parser_",
"(_",
"description_",
"=_",
"'",
"Exam",
"ple",
" ",
"workf",
"low",
" ",
"runn",
"er",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'",
"workf",
"low",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"type_",
"=_",
"workflow_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"pure",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"workf",
"low",
"-",
"worker",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"type_",
"=_",
"int_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"activit",
"y",
"-",
"worker",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"action_",
"=_",
"'",
"store",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"type_",
"=_",
"int_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"time",
"it",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"trace",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"wait",
"-",
"child",
"ren",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"=_",
"parser_",
"._",
"parse",
"\\u",
"args_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"start_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"args_",
"._",
"pure",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"wf_",
"=_",
"args_",
"._",
"workflow_",
"(_",
"activity_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"wf_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"lw_",
"=_",
"Local",
"Workflow_",
"(_",
"args_",
"._",
"workflow_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"activit",
"y",
"\\u",
"workers_",
"=_",
"args_",
"._",
"activit",
"y",
"\\u",
"workers_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"workf",
"low",
"\\u",
"workers_",
"=_",
"args_",
"._",
"workf",
"low",
"\\u",
"workers_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lw_",
"._",
"conf",
"\\u",
"activity_",
"(_",
"'",
"a",
"'_",
",_",
"activity_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"lw_",
"._",
"run_",
"(_",
"\\u",
"wait_",
"=_",
"args_",
"._",
"wait",
"\\u",
"children_",
",_",
"\\u",
"trace_",
"=_",
"args_",
"._",
"trace_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"args_",
"._",
"timeit_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"'",
"Time",
"d",
" ",
"at",
":'_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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | wcong/ants/ants/contrib/loader/processor.py | [
{
"content": "\"\"\"\nThis module provides some commonly used processors for Item Loaders.\n\nSee documentation in docs/topics/loaders.rst\n\"\"\"\n\nfrom ants.utils.misc import arg_to_iter\nfrom ants.utils.datatypes import MergeDict\nfrom .common import wrap_loader_context\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class MapCompose(object):\n\n",
"metadata": "root.MapCompose",
"header": "['module', '___EOS___']",
"index": 10
},
{
"content": " def __init__(self, *functions, **default_loader_context):\n self.functions = functions\n self.default_loader_context = default_loader_context",
"metadata": "root.MapCompose.__init__",
"header": "['class', 'MapCompose', '(', 'object', ')', ':', '___EOS___']",
"index": 12
},
{
"content": " def __call__(self, value, loader_context=None):\n values = arg_to_iter(value)\n if loader_context:\n context = MergeDict(loader_context, self.default_loader_context)\n else:\n context = self.default_loader_context\n wrapped_funcs = [wrap_loader_context(f, context) for f in self.functions]\n for func in wrapped_funcs:\n next_values = []\n for v in values:\n next_values += arg_to_iter(func(v))\n values = next_values\n return values",
"metadata": "root.MapCompose.__call__",
"header": "['class', 'MapCompose', '(', 'object', ')', ':', '___EOS___']",
"index": 16
},
{
"content": "class Compose(object):\n\n",
"metadata": "root.Compose",
"header": "['module', '___EOS___']",
"index": 31
},
{
"content": " def __init__(self, *functions, **default_loader_context):\n self.functions = functions\n self.stop_on_none = default_loader_context.get('stop_on_none', True)\n self.default_loader_context = default_loader_context",
"metadata": "root.Compose.__init__",
"header": "['class', 'Compose', '(', 'object', ')', ':', '___EOS___']",
"index": 33
},
{
"content": " def __call__(self, value, loader_context=None):\n if loader_context:\n context = MergeDict(loader_context, self.default_loader_context)\n else:\n context = self.default_loader_context\n wrapped_funcs = [wrap_loader_context(f, context) for f in self.functions]\n for func in wrapped_funcs:\n if value is None and self.stop_on_none:\n break\n value = func(value)\n return value",
"metadata": "root.Compose.__call__",
"header": "['class', 'Compose', '(', 'object', ')', ':', '___EOS___']",
"index": 38
},
{
"content": "class TakeFirst(object):\n",
"metadata": "root.TakeFirst",
"header": "['module', '___EOS___']",
"index": 51
},
{
"content": " def __call__(self, values):\n for value in values:\n if value is not None and value != '':\n return value",
"metadata": "root.TakeFirst.__call__",
"header": "['class', 'TakeFirst', '(', 'object', ')', ':', '___EOS___']",
"index": 53
},
{
"content": "class Identity(object):\n",
"metadata": "root.Identity",
"header": "['module', '___EOS___']",
"index": 59
},
{
"content": " def __call__(self, values):\n return values",
"metadata": "root.Identity.__call__",
"header": "['class', 'Identity', '(', 'object', ')', ':', '___EOS___']",
"index": 61
},
{
"content": "class Join(object):\n\n",
"metadata": "root.Join",
"header": "['module', '___EOS___']",
"index": 65
},
{
"content": " def __init__(self, separator=u' '):\n self.separator = separator",
"metadata": "root.Join.__init__",
"header": "['class', 'Join', '(', 'object', ')', ':', '___EOS___']",
"index": 67
},
{
"content": " def __call__(self, values):\n return self.separator.join(values)",
"metadata": "root.Join.__call__",
"header": "['class', 'Join', '(', 'object', ')', ':', '___EOS___']",
"index": 70
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Thi",
"s",
" ",
"module",
" ",
"provide",
"s",
" ",
"some",
" ",
"common",
"ly",
" ",
"used",
" ",
"process",
"ors",
" ",
"for",
" ",
"Item",
" ",
"Load",
"ers",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"See",
" ",
"documentation",
" ",
"in",
" ",
"docs",
"/",
"topic",
"s",
"/",
"load",
"ers",
".",
"rst",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ants_",
"._",
"utils_",
"._",
"misc_",
"import_",
"arg",
"\\u",
"to",
"\\u",
"iter_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ants_",
"._",
"utils_",
"._",
"datatypes_",
"import_",
"Merge",
"Dict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"common_",
"import_",
"wrap",
"\\u",
"load",
"er",
"\\u",
"context_",
"\\u\\u\\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_",
"class_",
"Map",
"Compose",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Map",
"Compose",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"*_",
"functions_",
",_",
"**_",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"functions_",
"=_",
"functions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
"=_",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Map",
"Compose",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"call\\u\\u_",
"(_",
"self_",
",_",
"value_",
",_",
"load",
"er",
"\\u",
"context_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"values_",
"=_",
"arg",
"\\u",
"to",
"\\u",
"iter_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"load",
"er",
"\\u",
"context_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"=_",
"Merge",
"Dict_",
"(_",
"load",
"er",
"\\u",
"context_",
",_",
"self_",
"._",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"=_",
"self_",
"._",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"wrapp",
"ed",
"\\u",
"funcs_",
"=_",
"[_",
"wrap",
"\\u",
"load",
"er",
"\\u",
"context_",
"(_",
"f_",
",_",
"context_",
")_",
"for_",
"f_",
"in_",
"self_",
"._",
"functions_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"func_",
"in_",
"wrapp",
"ed",
"\\u",
"funcs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"next",
"\\u",
"values_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"v_",
"in_",
"values_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"next",
"\\u",
"values_",
"+=_",
"arg",
"\\u",
"to",
"\\u",
"iter_",
"(_",
"func_",
"(_",
"v_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"values_",
"=_",
"next",
"\\u",
"values_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"values_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Compose",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Compose",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"*_",
"functions_",
",_",
"**_",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"functions_",
"=_",
"functions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"stop",
"\\u",
"on",
"\\u",
"none_",
"=_",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
"._",
"get_",
"(_",
"'",
"stop",
"\\u",
"on",
"\\u",
"none",
"'_",
",_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
"=_",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Compose",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"call\\u\\u_",
"(_",
"self_",
",_",
"value_",
",_",
"load",
"er",
"\\u",
"context_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"load",
"er",
"\\u",
"context_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"=_",
"Merge",
"Dict_",
"(_",
"load",
"er",
"\\u",
"context_",
",_",
"self_",
"._",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"=_",
"self_",
"._",
"default",
"\\u",
"load",
"er",
"\\u",
"context_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"wrapp",
"ed",
"\\u",
"funcs_",
"=_",
"[_",
"wrap",
"\\u",
"load",
"er",
"\\u",
"context_",
"(_",
"f_",
",_",
"context_",
")_",
"for_",
"f_",
"in_",
"self_",
"._",
"functions_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"func_",
"in_",
"wrapp",
"ed",
"\\u",
"funcs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"value_",
"is_",
"None_",
"and_",
"self_",
"._",
"stop",
"\\u",
"on",
"\\u",
"none_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"value_",
"=_",
"func_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Tak",
"e",
"First_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Tak",
"e",
"First_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"call\\u\\u_",
"(_",
"self_",
",_",
"values_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"value_",
"in_",
"values_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"value_",
"is_",
"not_",
"None_",
"and_",
"value_",
"!=_",
"''_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Identity_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Identity_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"call\\u\\u_",
"(_",
"self_",
",_",
"values_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"values_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Join_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Join_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"separator_",
"=_",
"u",
"'",
" ",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"separator_",
"=_",
"separator_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Join_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"call\\u\\u_",
"(_",
"self_",
",_",
"values_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
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 | randy3k/Project-Manager/pm.py | [
{
"content": " def rename_project(self, project):\n def rename_callback(new_project):\n if project == new_project:\n return\n pfile = self.project_file_name(project)\n wsfile = self.project_workspace(project)\n pdir = self.which_project_dir(pfile)\n if not pdir:\n pdir = os.path.dirname(pfile)\n new_pfile = os.path.join(pdir, \"%s.sublime-project\" % new_project)\n new_wsfile = new_pfile.replace(\".sublime-project\", \".sublime-workspace\")\n\n reopen = self.close_project_by_name(project)\n os.rename(pfile, new_pfile)\n os.rename(wsfile, new_wsfile)\n\n j = JsonFile(new_wsfile)\n data = j.load({})\n if \"project\" in data:\n data[\"project\"] = \"%s.sublime-project\" % os.path.basename(new_project)\n j.save(data)\n\n if not self.which_project_dir(pfile):\n for pdir in self.projects_path:\n library = os.path.join(pdir, \"library.json\")\n if os.path.exists(library):\n j = JsonFile(library)\n data = j.load([])\n if pfile in data:\n data.remove(pfile)\n data.append(new_pfile)\n j.save(data)\n\n if reopen:\n # reload projects info\n self.__init__(self.window)\n self.open_in_new_window(new_project)\n\n def show_input_panel():\n v = self.window.show_input_panel(\"New project name:\",\n project, rename_callback, None, None)\n v.run_command(\"select_all\")\n\n sublime.set_timeout(show_input_panel, 100)",
"metadata": "root.Manager.rename_project",
"header": "['class', 'Manager', ':', '___EOS___']",
"index": 354
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Manager_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"rename",
"\\u",
"project_",
"(_",
"self_",
",_",
"project_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"rename",
"\\u",
"callback_",
"(_",
"new",
"\\u",
"project_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"project_",
"==_",
"new",
"\\u",
"project_",
":_",
"\\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_",
"pfile",
"_",
"=_",
"self_",
"._",
"project",
"\\u",
"file",
"\\u",
"name_",
"(_",
"project_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ws",
"file_",
"=_",
"self_",
"._",
"project",
"\\u",
"workspace_",
"(_",
"project_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pdi",
"r_",
"=_",
"self_",
"._",
"whi",
"ch",
"\\u",
"project",
"\\u",
"dir_",
"(_",
"pfile",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"pdi",
"r_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pdi",
"r_",
"=_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"pfile",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"new",
"\\u",
"pfile",
"_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"pdi",
"r_",
",_",
"\"%",
"s",
".",
"sublim",
"e-",
"project",
"\"_",
"%_",
"new",
"\\u",
"project_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"ws",
"file_",
"=_",
"new",
"\\u",
"pfile",
"_",
"._",
"replace_",
"(_",
"\".",
"sublim",
"e-",
"project",
"\"_",
",_",
"\".",
"sublim",
"e-",
"works",
"pace",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"reo",
"pen_",
"=_",
"self_",
"._",
"close",
"\\u",
"project",
"\\u",
"by",
"\\u",
"name_",
"(_",
"project_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"os_",
"._",
"rename_",
"(_",
"pfile",
"_",
",_",
"new",
"\\u",
"pfile",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"os_",
"._",
"rename_",
"(_",
"ws",
"file_",
",_",
"new",
"\\u",
"ws",
"file_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"j_",
"=_",
"Js",
"on",
"File_",
"(_",
"new",
"\\u",
"ws",
"file_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"j_",
"._",
"load_",
"(_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"\"",
"project",
"\"_",
"in_",
"data_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
"[_",
"\"",
"project",
"\"_",
"]_",
"=_",
"\"%",
"s",
".",
"sublim",
"e-",
"project",
"\"_",
"%_",
"os_",
"._",
"path_",
"._",
"basename_",
"(_",
"new",
"\\u",
"project_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"j_",
"._",
"save_",
"(_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"whi",
"ch",
"\\u",
"project",
"\\u",
"dir_",
"(_",
"pfile",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"pdi",
"r_",
"in_",
"self_",
"._",
"project",
"s",
"\\u",
"path_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"library_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"pdi",
"r_",
",_",
"\"",
"librar",
"y",
".",
"json",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"library_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"j_",
"=_",
"Js",
"on",
"File_",
"(_",
"library_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"j_",
"._",
"load_",
"(_",
"[_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"pfile",
"_",
"in_",
"data_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"data_",
"._",
"remove_",
"(_",
"pfile",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"._",
"append_",
"(_",
"new",
"\\u",
"pfile",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"j_",
"._",
"save_",
"(_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"reo",
"pen_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"relo",
"ad",
" ",
"project",
"s",
" ",
"info_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
"._",
"window_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"open",
"\\u",
"in",
"\\u",
"new",
"\\u",
"window_",
"(_",
"new",
"\\u",
"project_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"show",
"\\u",
"input",
"\\u",
"panel_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"v_",
"=_",
"self_",
"._",
"window_",
"._",
"show",
"\\u",
"input",
"\\u",
"panel_",
"(_",
"\"",
"New",
" ",
"project",
" ",
"name",
":\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"project_",
",_",
"rename",
"\\u",
"callback_",
",_",
"None_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v_",
"._",
"run",
"\\u",
"command_",
"(_",
"\"",
"select",
"\\u",
"all",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"sublime_",
"._",
"set\\u",
"timeout_",
"(_",
"show",
"\\u",
"input",
"\\u",
"panel_",
",_",
"100_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | Nikola-K/django_reddit/users/tests/test_login.py | [
{
"content": "from django.core.urlresolvers import reverse\nfrom django.test import TestCase, Client\nfrom django.contrib.auth.models import User\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TestloginPOST(TestCase):\n\n\n\n\n\n",
"metadata": "root.TestloginPOST",
"header": "['module', '___EOS___']",
"index": 5
},
{
"content": " def setUp(self):\n self.c = Client()\n self.valid_data = {\"username\": \"user\",\n \"password\": \"password\"}\n self.invalid_data = {\"username\": \"none\",\n \"password\": \"none\"}\n User.objects.create_user(**self.valid_data)",
"metadata": "root.TestloginPOST.setUp",
"header": "['class', 'TestloginPOST', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 6
},
{
"content": " def test_valid_login(self):\n r = self.c.post(reverse('login'), data=self.valid_data, follow=True)\n self.assertRedirects(r, reverse('frontpage'))\n self.assertTrue(self.c.login(**self.valid_data))",
"metadata": "root.TestloginPOST.test_valid_login",
"header": "['class', 'TestloginPOST', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 14
},
{
"content": " def test_invalid_login(self):\n r = self.c.post(reverse('login'), data=self.invalid_data)\n self.assertEqual(r.status_code, 200)\n self.assertContains(r, \"Wrong username or password.\")\n self.assertFalse(self.c.login(**self.invalid_data))",
"metadata": "root.TestloginPOST.test_invalid_login",
"header": "['class', 'TestloginPOST', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 19
},
{
"content": " def test_disabled_account(self):\n u = User.objects.get(username=self.valid_data['username'])\n u.is_active = False\n u.save()\n r = self.c.post(reverse('login'), data=self.valid_data)\n self.assertContains(r, \"Account disabled\", status_code=200)",
"metadata": "root.TestloginPOST.test_disabled_account",
"header": "['class', 'TestloginPOST', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 25
},
{
"content": " def test_already_logged_in(self):\n self.c.post(reverse('login'), data=self.valid_data)\n r = self.c.post(reverse('login'), data=self.valid_data)\n self.assertContains(r, 'You are already logged in.')",
"metadata": "root.TestloginPOST.test_already_logged_in",
"header": "['class', 'TestloginPOST', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 32
},
{
"content": " def test_login_redirect(self):\n redirect_data = {'username': self.valid_data['username'],\n 'password': self.valid_data['password'],\n 'next': reverse('submit')}\n r = self.c.post(reverse('login'), data=redirect_data)\n self.assertRedirects(r, reverse('submit'))",
"metadata": "root.TestloginPOST.test_login_redirect",
"header": "['class', 'TestloginPOST', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 37
},
{
"content": " def test_malformed_request(self):\n r = self.c.post(reverse('login'), data={\"a\": \"a\", 1: \"b\"})\n self.assertEqual(r.status_code, 400)",
"metadata": "root.TestloginPOST.test_malformed_request",
"header": "['class', 'TestloginPOST', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 44
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"._",
"urlresolvers_",
"import_",
"reverse_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"test_",
"import_",
"Test",
"Case_",
",_",
"Client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"contrib_",
"._",
"auth_",
"._",
"models_",
"import_",
"User_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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",
"login",
"POST_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"login",
"POST_",
"(_",
"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 ",
" _",
"self_",
"._",
"c_",
"=_",
"Client_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"valid",
"\\u",
"data_",
"=_",
"{_",
"\"",
"user",
"name",
"\"_",
":_",
"\"",
"user",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"password",
"\"_",
":_",
"\"",
"password",
"\"_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"invalid",
"\\u",
"data_",
"=_",
"{_",
"\"",
"user",
"name",
"\"_",
":_",
"\"",
"none",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"password",
"\"_",
":_",
"\"",
"none",
"\"_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"User_",
"._",
"objects_",
"._",
"create",
"\\u",
"user_",
"(_",
"**_",
"self_",
"._",
"valid",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"login",
"POST_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"valid",
"\\u",
"login_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r_",
"=_",
"self_",
"._",
"c_",
"._",
"post_",
"(_",
"reverse_",
"(_",
"'",
"login",
"'_",
")_",
",_",
"data_",
"=_",
"self_",
"._",
"valid",
"\\u",
"data_",
",_",
"follow_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Redirects_",
"(_",
"r_",
",_",
"reverse_",
"(_",
"'",
"front",
"page",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"self_",
"._",
"c_",
"._",
"login_",
"(_",
"**_",
"self_",
"._",
"valid",
"\\u",
"data_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"login",
"POST_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"invalid",
"\\u",
"login_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r_",
"=_",
"self_",
"._",
"c_",
"._",
"post_",
"(_",
"reverse_",
"(_",
"'",
"login",
"'_",
")_",
",_",
"data_",
"=_",
"self_",
"._",
"invalid",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"r_",
"._",
"status",
"\\u",
"code_",
",_",
"200_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Contains_",
"(_",
"r_",
",_",
"\"",
"Wro",
"ng",
" ",
"user",
"name",
" ",
"or",
" ",
"password",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"self_",
"._",
"c_",
"._",
"login_",
"(_",
"**_",
"self_",
"._",
"invalid",
"\\u",
"data_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"login",
"POST_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"disable",
"d\\u",
"account_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"u_",
"=_",
"User_",
"._",
"objects_",
"._",
"get_",
"(_",
"username_",
"=_",
"self_",
"._",
"valid",
"\\u",
"data_",
"[_",
"'",
"user",
"name",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"._",
"is",
"\\u",
"active_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"=_",
"self_",
"._",
"c_",
"._",
"post_",
"(_",
"reverse_",
"(_",
"'",
"login",
"'_",
")_",
",_",
"data_",
"=_",
"self_",
"._",
"valid",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Contains_",
"(_",
"r_",
",_",
"\"",
"Account",
" ",
"disable",
"d",
"\"_",
",_",
"status",
"\\u",
"code_",
"=_",
"200_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"login",
"POST_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"alr",
"ead",
"y",
"\\u",
"logged",
"\\u",
"in_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"c_",
"._",
"post_",
"(_",
"reverse_",
"(_",
"'",
"login",
"'_",
")_",
",_",
"data_",
"=_",
"self_",
"._",
"valid",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"=_",
"self_",
"._",
"c_",
"._",
"post_",
"(_",
"reverse_",
"(_",
"'",
"login",
"'_",
")_",
",_",
"data_",
"=_",
"self_",
"._",
"valid",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Contains_",
"(_",
"r_",
",_",
"'",
"You",
" ",
"are",
" ",
"alr",
"ead",
"y",
" ",
"logged",
" ",
"in",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"login",
"POST_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"login",
"\\u",
"redirect_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"redirec",
"t",
"\\u",
"data_",
"=_",
"{_",
"'",
"user",
"name",
"'_",
":_",
"self_",
"._",
"valid",
"\\u",
"data_",
"[_",
"'",
"user",
"name",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"password",
"'_",
":_",
"self_",
"._",
"valid",
"\\u",
"data_",
"[_",
"'",
"password",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"next",
"'_",
":_",
"reverse_",
"(_",
"'",
"submit",
"'_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"=_",
"self_",
"._",
"c_",
"._",
"post_",
"(_",
"reverse_",
"(_",
"'",
"login",
"'_",
")_",
",_",
"data_",
"=_",
"redirec",
"t",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Redirects_",
"(_",
"r_",
",_",
"reverse_",
"(_",
"'",
"submit",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"login",
"POST_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"mal",
"formed",
"\\u",
"request_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r_",
"=_",
"self_",
"._",
"c_",
"._",
"post_",
"(_",
"reverse_",
"(_",
"'",
"login",
"'_",
")_",
",_",
"data_",
"=_",
"{_",
"\"",
"a",
"\"_",
":_",
"\"",
"a",
"\"_",
",_",
"1_",
":_",
"\"",
"b",
"\"_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"r_",
"._",
"status",
"\\u",
"code_",
",_",
"400_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | fp7-ofelia/ocf/vt_manager/src/python/vt_manager/common/rpc4django/views.py | [
{
"content": "def _check_request_permission(request, request_format='xml', url_name=\"root\"):\n '''\n Checks whether this user has permission to perform the specified action\n This method does not check method call validity. That is done later\n \n PARAMETERS\n \n - ``request`` - a django HttpRequest object\n - ``request_format`` - the request type: 'json' or 'xml' \n \n RETURNS \n \n True if the request is valid and False if permission is denied\n '''\n \n user = getattr(request, 'user', None)\n dispatcher = get_dispatcher(request.path, url_name)\n methods = dispatcher.list_methods()\n method_name = dispatcher.get_method_name(request.raw_post_data, \\\n request_format)\n response = True\n \n for method in methods:\n if method.name == method_name:\n # this is the method the user is calling\n # time to check the permissions\n if method.permission is not None:\n logger.debug('Method \"%s\" is protected by permission \"%s\"' \\\n %(method.name, method.permission))\n if user is None:\n # user is only none if not using AuthenticationMiddleware\n logger.warn('AuthenticationMiddleware is not enabled')\n response = False\n elif not user.has_perm(method.permission):\n # check the permission against the permission database\n logger.info('User \"%s\" is NOT authorized' %(str(user)))\n response = False\n else:\n logger.debug('User \"%s\" is authorized' %(str(user)))\n else:\n logger.debug('Method \"%s\" is unprotected' %(method.name))\n \n break\n \n return response",
"metadata": "root._check_request_permission",
"header": "['module', '___EOS___']",
"index": 63
}
] | [] | [] | 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",
"check",
"\\u",
"request",
"\\u",
"permission_",
"(_",
"request_",
",_",
"request",
"\\u",
"format_",
"=_",
"'",
"xml",
"'_",
",_",
"url",
"\\u",
"name_",
"=_",
"\"",
"root",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Check",
"s",
" ",
"whe",
"ther",
" ",
"this",
" ",
"user",
" ",
"has",
" ",
"permissi",
"on",
" ",
"to",
" ",
"perform",
" ",
"the",
" ",
"specified",
" ",
"action",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"method",
" ",
"doe",
"s",
" ",
"not",
" ",
"check",
" ",
"method",
" ",
"call",
" ",
"valid",
"it",
"y",
".",
" ",
"Tha",
"t",
" ",
"is",
" ",
"don",
"e",
" ",
"late",
"r",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"PARAMETERS",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"``",
"request",
"``",
" ",
"-",
" ",
"a",
" ",
"django",
" ",
"Http",
"Request",
" ",
"object",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"``",
"request",
"\\u",
"format",
"``",
" ",
"-",
" ",
"the",
" ",
"request",
" ",
"type",
":",
" ",
"'",
"json",
"'",
" ",
"or",
" ",
"'",
"xml",
"'",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"RETURN",
"S",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Tru",
"e",
" ",
"if",
" ",
"the",
" ",
"request",
" ",
"is",
" ",
"valid",
" ",
"and",
" ",
"Fal",
"se",
" ",
"if",
" ",
"permissi",
"on",
" ",
"is",
" ",
"deni",
"ed",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"user_",
"=_",
"getattr_",
"(_",
"request_",
",_",
"'",
"user",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dispatcher_",
"=_",
"get",
"\\u",
"dispatcher_",
"(_",
"request_",
"._",
"path_",
",_",
"url",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"methods_",
"=_",
"dispatcher_",
"._",
"list",
"\\u",
"methods_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"method",
"\\u",
"name_",
"=_",
"dispatcher_",
"._",
"get",
"\\u",
"method",
"\\u",
"name_",
"(_",
"request_",
"._",
"raw",
"\\u",
"post",
"\\u",
"data_",
",_",
"request",
"\\u",
"format_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"method_",
"in_",
"methods_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"method_",
"._",
"name_",
"==_",
"method",
"\\u",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"this",
" ",
"is",
" ",
"the",
" ",
"method",
" ",
"the",
" ",
"user",
" ",
"is",
" ",
"calling",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"time",
" ",
"to",
" ",
"check",
" ",
"the",
" ",
"permissions_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"method_",
"._",
"permission_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"debug_",
"(_",
"'",
"Meth",
"od",
" ",
"\"%",
"s",
"\"",
" ",
"is",
" ",
"protect",
"ed",
" ",
"by",
" ",
"permissi",
"on",
" ",
"\"%",
"s",
"\"'_",
"%_",
"(_",
"method_",
"._",
"name_",
",_",
"method_",
"._",
"permission_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"user_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"user",
" ",
"is",
" ",
"only",
" ",
"none",
" ",
"if",
" ",
"not",
" ",
"usi",
"ng",
" ",
"Auth",
"entica",
"tion",
"Middleware_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"logger_",
"._",
"warn_",
"(_",
"'",
"Auth",
"entica",
"tion",
"Mid",
"dle",
"ware",
" ",
"is",
" ",
"not",
" ",
"enable",
"d",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"not_",
"user_",
"._",
"has",
"\\u",
"perm_",
"(_",
"method_",
"._",
"permission_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"check",
" ",
"the",
" ",
"permissi",
"on",
" ",
"against",
" ",
"the",
" ",
"permissi",
"on",
" ",
"database_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"logger_",
"._",
"info_",
"(_",
"'",
"User",
" ",
"\"%",
"s",
"\"",
" ",
"is",
" ",
"NOT",
" ",
"authoriz",
"ed",
"'_",
"%_",
"(_",
"str_",
"(_",
"user_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"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 ",
" ",
"_",
"logger_",
"._",
"debug_",
"(_",
"'",
"User",
" ",
"\"%",
"s",
"\"",
" ",
"is",
" ",
"authoriz",
"ed",
"'_",
"%_",
"(_",
"str_",
"(_",
"user_",
")_",
")_",
")_",
"\\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 ",
" _",
"logger_",
"._",
"debug_",
"(_",
"'",
"Meth",
"od",
" ",
"\"%",
"s",
"\"",
" ",
"is",
" ",
"unpr",
"ote",
"cte",
"d",
"'_",
"%_",
"(_",
"method_",
"._",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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' | IDSIA/sacred/sacred/observers/mongo.py | [
{
"content": "def force_bson_encodeable(obj):\n if isinstance(obj, dict):\n try:\n bson.BSON.encode(obj, check_keys=True)\n return obj\n except bson.InvalidDocument:\n return {force_valid_bson_key(k): force_bson_encodeable(v)\n for k, v in obj.items()}\n\n elif opt.has_numpy and isinstance(obj, opt.np.ndarray):\n return obj\n else:\n try:\n bson.BSON.encode({'dict_just_for_testing': obj})\n return obj\n except bson.InvalidDocument:\n return str(obj)",
"metadata": "root.force_bson_encodeable",
"header": "['module', '___EOS___']",
"index": 67
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"force",
"\\u",
"bso",
"n",
"\\u",
"encode",
"able_",
"(_",
"obj_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"obj_",
",_",
"dict_",
")_",
":_",
"\\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 ",
" _",
"bson_",
"._",
"BS",
"ON_",
"._",
"encode_",
"(_",
"obj_",
",_",
"check",
"\\u",
"keys_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"obj_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"bson_",
"._",
"Inva",
"lid",
"Document_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"{_",
"force",
"\\u",
"valid",
"\\u",
"bso",
"n",
"\\u",
"key_",
"(_",
"k_",
")_",
":_",
"force",
"\\u",
"bso",
"n",
"\\u",
"encode",
"able_",
"(_",
"v_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"k_",
",_",
"v_",
"in_",
"obj_",
"._",
"items_",
"(_",
")_",
"}_",
"\\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_",
"opt_",
"._",
"has",
"\\u",
"numpy_",
"and_",
"isinstance_",
"(_",
"obj_",
",_",
"opt_",
"._",
"np_",
"._",
"ndarray_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"obj_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"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 ",
" _",
"bson_",
"._",
"BS",
"ON_",
"._",
"encode_",
"(_",
"{_",
"'",
"dict",
"\\u",
"just",
"\\u",
"for",
"\\u",
"testi",
"ng",
"'_",
":_",
"obj_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"obj_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"bson_",
"._",
"Inva",
"lid",
"Document_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"str_",
"(_",
"obj_",
")_",
"\\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
] |
Variable defined multiple times | bfontaine/term2048/tests/test_ui.py | [
{
"content": " def test_parse_args_rules_short(self):\n sys.argv = ['term2048', '-r']\n args = ui.parse_cli_args()\n self.assertTrue(args['rules'])",
"metadata": "root.TestUI.test_parse_args_rules_short",
"header": "['class', 'TestUI', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 103
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Test",
"UI_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"parse",
"\\u",
"args",
"\\u",
"rule",
"s",
"\\u",
"short_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"argv_",
"=_",
"[_",
"'",
"term",
"204",
"8",
"'_",
",_",
"'-",
"r",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"=_",
"ui_",
"._",
"parse",
"\\u",
"cli",
"\\u",
"args_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"args_",
"[_",
"'",
"rule",
"s",
"'_",
"]_",
")_",
"\\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
] |
Constant in conditional expression or statement | adblockplus/gyp/test/lib/TestCmd.py | [
{
"content": " def banner(self, s, width=None):\n if width is None:\n width = self.banner_width\n return s + self.banner_char * (width - len(s))",
"metadata": "root.TestCmd.banner",
"header": "['class', 'TestCmd', '(', 'object', ')', ':', '___EOS___']",
"index": 917
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Constant_",
"in_",
"conditional",
"_",
"expression_",
"or_",
"statement_",
"[SEP]_",
"class_",
"Test",
"Cmd_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"banner_",
"(_",
"self_",
",_",
"s_",
",_",
"width_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"width_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"width_",
"=_",
"self_",
"._",
"banner",
"\\u",
"width_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"s_",
"+_",
"self_",
"._",
"banner",
"\\u",
"char_",
"*_",
"(_",
"width_",
"-_",
"len_",
"(_",
"s_",
")_",
")_",
"\\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
] |
Unused import | ganeti/ganeti/qa/qa_performance.py | [
{
"content": "#\n#\n\n# Copyright (C) 2014 Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# 1. Redistributions of source code must retain the above copyright notice,\n# this list of conditions and the following disclaimer.\n#\n# 2. Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\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\n# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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\"\"\"Performance testing QA tests.\n\n\"\"\"\n\nimport datetime\nimport functools\nimport itertools\nimport threading\nimport time\n\nfrom ganeti import constants\n\nimport qa_config\nimport qa_error\nfrom qa_instance_utils import GetGenericAddParameters\nimport qa_job_utils\nimport qa_logging\nimport qa_utils\n\n\nMAX_JOB_SUBMISSION_DURATION = 15.0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class _JobQueueDriver(object):\n \"\"\"This class handles polling of jobs and reacting on status changes.\n\n Jobs are added via the L{AddJob} method, and can have callback functions\n assigned to them. Those are called as soon as the job enters the appropriate\n state. Callback functions can add new jobs to the driver as needed.\n\n A call to L{WaitForCompletion} finally polls Ganeti until all jobs have\n succeeded.\n\n \"\"\"\n\n _UNKNOWN_STATUS = \"unknown\"\n\n class _JobEntry(object):\n \"\"\"Internal class representing a job entry.\n\n \"\"\"\n def __init__(self, job_id, running_fn, success_fn):\n self.job_id = job_id\n self.running_fn = running_fn\n self.success_fn = success_fn\n\n def __str__(self):\n return str(self.job_id)\n\n\n\n\n\n\n\n",
"metadata": "root._JobQueueDriver",
"header": "['module', '___EOS___']",
"index": 53
},
{
"content": " def __init__(self):\n self._jobs = {}\n self._running_notified = set()\n self._jobs_per_status = {}\n self._lock = threading.RLock()",
"metadata": "root._JobQueueDriver.__init__",
"header": "['class', '_JobQueueDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 79
},
{
"content": " def AddJob(self, job_id, running_fn=None, success_fn=None):\n \"\"\"Add a job to the driver.\n\n @type job_id: of ints\n @param job_id: job id to add to the driver\n @type running_fn: function taking a L{_JobQueueDriver} and an int\n @param running_fn: function called once when a job changes to running state\n (or success state, if the running state was too short)\n @type success_fn: function taking a L{_JobQueueDriver} and an int\n @param success_fn: function called for each successful job id\n\n \"\"\"\n with self._lock:\n self._jobs[job_id] = _JobQueueDriver._JobEntry(job_id,\n running_fn,\n success_fn)\n # the status will be updated on the next call to _FetchJobStatuses\n self._jobs_per_status.setdefault(self._UNKNOWN_STATUS, []).append(job_id)",
"metadata": "root._JobQueueDriver.AddJob",
"header": "['class', '_JobQueueDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 85
},
{
"content": " def _FetchJobStatuses(self):\n \"\"\"Retrieves status information of the given jobs.\n\n \"\"\"\n job_statuses = qa_job_utils.GetJobStatuses(self._GetJobIds())\n\n new_statuses = {}\n for job_id, status in job_statuses.items():\n new_statuses.setdefault(status, []).append(self._jobs[int(job_id)])\n self._jobs_per_status = new_statuses",
"metadata": "root._JobQueueDriver._FetchJobStatuses",
"header": "['class', '_JobQueueDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 104
},
{
"content": " def _GetJobIds(self):\n return list(self._jobs.keys())",
"metadata": "root._JobQueueDriver._GetJobIds",
"header": "['class', '_JobQueueDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 115
},
{
"content": " def _GetJobsInStatuses(self, statuses):\n \"\"\"Returns a list of L{_JobEntry} of all jobs in the given statuses.\n\n @type statuses: iterable of strings\n @param statuses: jobs in those statuses are returned\n @rtype: list of L{_JobEntry}\n @return: list of job entries in the requested statuses\n\n \"\"\"\n ret = []\n for state in statuses:\n ret.extend(self._jobs_per_status.get(state, []))\n return ret",
"metadata": "root._JobQueueDriver._GetJobsInStatuses",
"header": "['class', '_JobQueueDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 118
},
{
"content": " def _UpdateJobStatuses(self):\n \"\"\"Retrieves job statuses from the cluster and updates internal state.\n\n \"\"\"\n self._FetchJobStatuses()\n error_jobs = self._GetJobsInStatuses([constants.JOB_STATUS_ERROR])\n if error_jobs:\n raise qa_error.Error(\n \"Jobs %s are in error state!\" % [job.job_id for job in error_jobs])\n\n for job in self._GetJobsInStatuses([constants.JOB_STATUS_RUNNING,\n constants.JOB_STATUS_SUCCESS]):\n if job.job_id not in self._running_notified:\n if job.running_fn is not None:\n job.running_fn(self, job.job_id)\n self._running_notified.add(job.job_id)\n\n for job in self._GetJobsInStatuses([constants.JOB_STATUS_SUCCESS]):\n if job.success_fn is not None:\n job.success_fn(self, job.job_id)\n\n # we're done with this job\n del self._jobs[job.job_id]",
"metadata": "root._JobQueueDriver._UpdateJobStatuses",
"header": "['class', '_JobQueueDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 132
},
{
"content": " def _HasPendingJobs(self):\n \"\"\"Checks if there are still jobs pending.\n\n @rtype: bool\n @return: C{True} if there are still jobs which have not succeeded\n\n \"\"\"\n with self._lock:\n self._UpdateJobStatuses()\n uncompleted_jobs = self._GetJobsInStatuses(\n constants.JOB_STATUS_ALL - constants.JOBS_FINALIZED)\n unknown_jobs = self._GetJobsInStatuses([self._UNKNOWN_STATUS])\n return len(uncompleted_jobs) > 0 or len(unknown_jobs) > 0",
"metadata": "root._JobQueueDriver._HasPendingJobs",
"header": "['class', '_JobQueueDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 156
},
{
"content": " def WaitForCompletion(self):\n \"\"\"Wait for the completion of all registered jobs.\n\n \"\"\"\n while self._HasPendingJobs():\n time.sleep(2)\n\n with self._lock:\n if self._jobs:\n raise qa_error.Error(\n \"Jobs %s didn't finish in success state!\" % self._GetJobIds())",
"metadata": "root._JobQueueDriver.WaitForCompletion",
"header": "['class', '_JobQueueDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 170
},
{
"content": "def _AcquireAllInstances():\n \"\"\"Generator for acquiring all instances in the QA config.\n\n \"\"\"\n try:\n while True:\n instance = qa_config.AcquireInstance()\n yield instance\n except qa_error.OutOfInstancesError:\n pass",
"metadata": "root._AcquireAllInstances",
"header": "['module', '___EOS___']",
"index": 183
},
{
"content": "def _AcquireAllNodes():\n \"\"\"Generator for acquiring all nodes in the QA config.\n\n \"\"\"\n exclude = []\n try:\n while True:\n node = qa_config.AcquireNode(exclude=exclude)\n exclude.append(node)\n yield node\n except qa_error.OutOfNodesError:\n pass",
"metadata": "root._AcquireAllNodes",
"header": "['module', '___EOS___']",
"index": 195
},
{
"content": "def _ExecuteJobSubmittingCmd(cmd):\n \"\"\"Executes a job submitting command and returns the resulting job ID.\n\n This will fail if submitting the job takes longer than\n L{MAX_JOB_SUBMISSION_DURATION}.\n\n @type cmd: list of string or string\n @param cmd: the job producing command to execute on the cluster\n @rtype: int\n @return: job-id\n\n \"\"\"\n start = datetime.datetime.now()\n result = qa_job_utils.ExecuteJobProducingCommand(cmd)\n duration = qa_utils.TimedeltaToTotalSeconds(datetime.datetime.now() - start)\n if duration > MAX_JOB_SUBMISSION_DURATION:\n print(qa_logging.FormatWarning(\n \"Executing '%s' took %f seconds, a maximum of %f was expected\" %\n (cmd, duration, MAX_JOB_SUBMISSION_DURATION)))\n return result",
"metadata": "root._ExecuteJobSubmittingCmd",
"header": "['module', '___EOS___']",
"index": 209
},
{
"content": "def _SubmitInstanceCreationJob(instance, disk_template=None):\n \"\"\"Submit an instance creation job.\n\n @type instance: L{qa_config._QaInstance}\n @param instance: instance to submit a create command for\n @type disk_template: string\n @param disk_template: disk template for the new instance or C{None} which\n causes the default disk template to be used\n @rtype: int\n @return: job id of the submitted creation job\n\n \"\"\"\n if disk_template is None:\n disk_template = qa_config.GetDefaultDiskTemplate()\n try:\n cmd = ([\"gnt-instance\", \"add\", \"--submit\", \"--opportunistic-locking\",\n \"--os-type=%s\" % qa_config.get(\"os\"),\n \"--disk-template=%s\" % disk_template] +\n GetGenericAddParameters(instance, disk_template))\n cmd.append(instance.name)\n\n instance.SetDiskTemplate(disk_template)\n\n return _ExecuteJobSubmittingCmd(cmd)\n except:\n instance.Release()\n raise",
"metadata": "root._SubmitInstanceCreationJob",
"header": "['module', '___EOS___']",
"index": 231
},
{
"content": "def _SubmitInstanceRemoveJob(instance):\n \"\"\"Submit an instance remove job.\n\n @type instance: L{qa_config._QaInstance}\n @param instance: the instance to remove\n @rtype: int\n @return: job id of the submitted remove job\n\n \"\"\"\n try:\n cmd = ([\"gnt-instance\", \"remove\", \"--submit\", \"-f\"])\n cmd.append(instance.name)\n\n return _ExecuteJobSubmittingCmd(cmd)\n finally:\n instance.Release()",
"metadata": "root._SubmitInstanceRemoveJob",
"header": "['module', '___EOS___']",
"index": 260
},
{
"content": "def _TestParallelInstanceCreationAndRemoval(max_instances=None,\n disk_template=None,\n custom_job_driver=None):\n \"\"\"Tests parallel creation and immediate removal of instances.\n\n @type max_instances: int\n @param max_instances: maximum number of instances to create\n @type disk_template: string\n @param disk_template: disk template for the new instances or C{None} which\n causes the default disk template to be used\n @type custom_job_driver: _JobQueueDriver\n @param custom_job_driver: a custom L{_JobQueueDriver} to use if not L{None}.\n If one is specified, C{WaitForCompletion} is _not_\n called on it.\n\n \"\"\"\n job_driver = custom_job_driver or _JobQueueDriver()\n\n def _CreateSuccessFn(instance, job_driver, _):\n job_id = _SubmitInstanceRemoveJob(instance)\n job_driver.AddJob(job_id)\n\n instance_generator = _AcquireAllInstances()\n if max_instances is not None:\n instance_generator = itertools.islice(instance_generator, max_instances)\n\n for instance in instance_generator:\n job_id = _SubmitInstanceCreationJob(instance, disk_template=disk_template)\n job_driver.AddJob(\n job_id, success_fn=functools.partial(_CreateSuccessFn, instance))\n\n if custom_job_driver is None:\n job_driver.WaitForCompletion()",
"metadata": "root._TestParallelInstanceCreationAndRemoval",
"header": "['module', '___EOS___']",
"index": 278
},
{
"content": "def TestParallelMaxInstanceCreationPerformance():\n \"\"\"PERFORMANCE: Parallel instance creation (instance count = max).\n\n \"\"\"\n _TestParallelInstanceCreationAndRemoval()",
"metadata": "root.TestParallelMaxInstanceCreationPerformance",
"header": "['module', '___EOS___']",
"index": 313
},
{
"content": "def TestParallelNodeCountInstanceCreationPerformance():\n \"\"\"PERFORMANCE: Parallel instance creation (instance count = node count).\n\n \"\"\"\n nodes = list(_AcquireAllNodes())\n _TestParallelInstanceCreationAndRemoval(max_instances=len(nodes))\n qa_config.ReleaseManyNodes(nodes)",
"metadata": "root.TestParallelNodeCountInstanceCreationPerformance",
"header": "['module', '___EOS___']",
"index": 320
},
{
"content": "def CreateAllInstances():\n \"\"\"Create all instances configured in QA config in the cluster.\n\n @rtype: list of L{qa_config._QaInstance}\n @return: list of instances created in the cluster\n\n \"\"\"\n job_driver = _JobQueueDriver()\n instances = list(_AcquireAllInstances())\n for instance in instances:\n job_id = _SubmitInstanceCreationJob(instance)\n job_driver.AddJob(job_id)\n\n job_driver.WaitForCompletion()\n return instances",
"metadata": "root.CreateAllInstances",
"header": "['module', '___EOS___']",
"index": 329
},
{
"content": "def RemoveAllInstances(instances):\n \"\"\"Removes all given instances from the cluster.\n\n @type instances: list of L{qa_config._QaInstance}\n @param instances:\n\n \"\"\"\n job_driver = _JobQueueDriver()\n for instance in instances:\n job_id = _SubmitInstanceRemoveJob(instance)\n job_driver.AddJob(job_id)\n\n job_driver.WaitForCompletion()",
"metadata": "root.RemoveAllInstances",
"header": "['module', '___EOS___']",
"index": 346
},
{
"content": "def TestParallelModify(instances):\n \"\"\"PERFORMANCE: Parallel instance modify.\n\n @type instances: list of L{qa_config._QaInstance}\n @param instances: list of instances to issue modify commands against\n\n \"\"\"\n job_driver = _JobQueueDriver()\n # set min mem to same value as max mem\n new_min_mem = qa_config.get(constants.BE_MAXMEM)\n for instance in instances:\n cmd = ([\"gnt-instance\", \"modify\", \"--submit\",\n \"-B\", \"%s=%s\" % (constants.BE_MINMEM, new_min_mem)])\n cmd.append(instance.name)\n job_driver.AddJob(_ExecuteJobSubmittingCmd(cmd))\n\n cmd = ([\"gnt-instance\", \"modify\", \"--submit\",\n \"-O\", \"fake_os_param=fake_value\"])\n cmd.append(instance.name)\n job_driver.AddJob(_ExecuteJobSubmittingCmd(cmd))\n\n cmd = ([\"gnt-instance\", \"modify\", \"--submit\",\n \"-O\", \"fake_os_param=fake_value\",\n \"-B\", \"%s=%s\" % (constants.BE_MINMEM, new_min_mem)])\n cmd.append(instance.name)\n job_driver.AddJob(_ExecuteJobSubmittingCmd(cmd))\n\n job_driver.WaitForCompletion()",
"metadata": "root.TestParallelModify",
"header": "['module', '___EOS___']",
"index": 361
},
{
"content": "def TestParallelInstanceOSOperations(instances):\n \"\"\"PERFORMANCE: Parallel instance OS operations.\n\n Note: This test leaves the instances either running or stopped, there's no\n guarantee on the actual status.\n\n @type instances: list of L{qa_config._QaInstance}\n @param instances: list of instances to issue lifecycle commands against\n\n \"\"\"\n OPS = [\"start\", \"shutdown\", \"reboot\", \"reinstall\"]\n job_driver = _JobQueueDriver()\n\n def _SubmitNextOperation(instance, start, idx, job_driver, _):\n if idx == len(OPS):\n return\n op_idx = (start + idx) % len(OPS)\n\n next_fn = functools.partial(_SubmitNextOperation, instance, start, idx + 1)\n\n if OPS[op_idx] == \"reinstall\" and \\\n instance.disk_template == constants.DT_DISKLESS:\n # no reinstall possible with diskless instances\n next_fn(job_driver, None)\n return\n elif OPS[op_idx] == \"reinstall\":\n # the instance has to be shut down for reinstall to work\n shutdown_cmd = [\"gnt-instance\", \"shutdown\", \"--submit\", instance.name]\n cmd = [\"gnt-instance\", \"reinstall\", \"--submit\", \"-f\", instance.name]\n\n job_driver.AddJob(_ExecuteJobSubmittingCmd(shutdown_cmd),\n running_fn=lambda _, __: job_driver.AddJob(\n _ExecuteJobSubmittingCmd(cmd),\n running_fn=next_fn))\n else:\n cmd = [\"gnt-instance\", OPS[op_idx], \"--submit\"]\n if OPS[op_idx] == \"reinstall\":\n cmd.append(\"-f\")\n cmd.append(instance.name)\n\n job_id = _ExecuteJobSubmittingCmd(cmd)\n job_driver.AddJob(job_id, running_fn=next_fn)\n\n for start, instance in enumerate(instances):\n _SubmitNextOperation(instance, start % len(OPS), 0, job_driver, None)\n\n job_driver.WaitForCompletion()",
"metadata": "root.TestParallelInstanceOSOperations",
"header": "['module', '___EOS___']",
"index": 391
},
{
"content": "def TestParallelInstanceQueries(instances):\n \"\"\"PERFORMANCE: Parallel instance queries.\n\n @type instances: list of L{qa_config._QaInstance}\n @param instances: list of instances to issue queries against\n\n \"\"\"\n threads = qa_job_utils.QAThreadGroup()\n for instance in instances:\n cmd = [\"gnt-instance\", \"info\", instance.name]\n info_thread = qa_job_utils.QAThread(qa_utils.AssertCommand, [cmd], {})\n threads.Start(info_thread)\n\n cmd = [\"gnt-instance\", \"list\"]\n list_thread = qa_job_utils.QAThread(qa_utils.AssertCommand, [cmd], {})\n threads.Start(list_thread)\n\n threads.JoinAndReraise()",
"metadata": "root.TestParallelInstanceQueries",
"header": "['module', '___EOS___']",
"index": 440
},
{
"content": "def TestJobQueueSubmissionPerformance():\n \"\"\"PERFORMANCE: Job queue submission performance.\n\n This test exercises the job queue and verifies that the job submission time\n does not increase as more jobs are added.\n\n \"\"\"\n MAX_CLUSTER_INFO_SECONDS = 15.0\n job_driver = _JobQueueDriver()\n submission_durations = []\n\n def _VerifySubmissionDuration(duration_seconds):\n # only start to verify the submission duration once we got data from the\n # first 10 job submissions\n if len(submission_durations) >= 10:\n avg_duration = sum(submission_durations) / len(submission_durations)\n max_duration = avg_duration * 1.5\n if duration_seconds > max_duration:\n print(qa_logging.FormatWarning(\n \"Submitting a delay job took %f seconds, max %f expected\" %\n (duration_seconds, max_duration)))\n else:\n submission_durations.append(duration_seconds)\n\n def _SubmitDelayJob(count):\n for _ in range(count):\n cmd = [\"gnt-debug\", \"delay\", \"--submit\", \"0.1\"]\n\n start = datetime.datetime.now()\n job_id = _ExecuteJobSubmittingCmd(cmd)\n duration_seconds = \\\n qa_utils.TimedeltaToTotalSeconds(datetime.datetime.now() - start)\n _VerifySubmissionDuration(duration_seconds)\n\n job_driver.AddJob(job_id)\n\n threads = qa_job_utils.QAThreadGroup()\n for _ in range(10):\n thread = qa_job_utils.QAThread(_SubmitDelayJob, [20], {})\n threads.Start(thread)\n\n threads.JoinAndReraise()\n\n qa_utils.AssertCommand([\"gnt-cluster\", \"info\"],\n max_seconds=MAX_CLUSTER_INFO_SECONDS)\n\n job_driver.WaitForCompletion()",
"metadata": "root.TestJobQueueSubmissionPerformance",
"header": "['module', '___EOS___']",
"index": 460
},
{
"content": "def TestParallelDRBDInstanceCreationPerformance():\n \"\"\"PERFORMANCE: Parallel DRBD backed instance creation.\n\n \"\"\"\n assert qa_config.IsTemplateSupported(constants.DT_DRBD8)\n\n nodes = list(_AcquireAllNodes())\n _TestParallelInstanceCreationAndRemoval(max_instances=len(nodes) * 2,\n disk_template=constants.DT_DRBD8)\n qa_config.ReleaseManyNodes(nodes)",
"metadata": "root.TestParallelDRBDInstanceCreationPerformance",
"header": "['module', '___EOS___']",
"index": 509
},
{
"content": "def TestParallelPlainInstanceCreationPerformance():\n \"\"\"PERFORMANCE: Parallel plain backed instance creation.\n\n \"\"\"\n assert qa_config.IsTemplateSupported(constants.DT_PLAIN)\n\n nodes = list(_AcquireAllNodes())\n _TestParallelInstanceCreationAndRemoval(max_instances=len(nodes) * 2,\n disk_template=constants.DT_PLAIN)\n qa_config.ReleaseManyNodes(nodes)",
"metadata": "root.TestParallelPlainInstanceCreationPerformance",
"header": "['module', '___EOS___']",
"index": 521
},
{
"content": "def _TestInstanceOperationInParallelToInstanceCreation(*cmds):\n \"\"\"Run the given test command in parallel to an instance creation.\n\n @type cmds: list of list of strings\n @param cmds: commands to execute in parallel to an instance creation. Each\n command in the list is executed once the previous job starts\n to run.\n\n \"\"\"\n def _SubmitNextCommand(cmd_idx, job_driver, _):\n if cmd_idx >= len(cmds):\n return\n job_id = _ExecuteJobSubmittingCmd(cmds[cmd_idx])\n job_driver.AddJob(\n job_id, success_fn=functools.partial(_SubmitNextCommand, cmd_idx + 1))\n\n assert qa_config.IsTemplateSupported(constants.DT_DRBD8)\n assert len(cmds) > 0\n\n job_driver = _JobQueueDriver()\n _SubmitNextCommand(0, job_driver, None)\n\n _TestParallelInstanceCreationAndRemoval(max_instances=1,\n disk_template=constants.DT_DRBD8,\n custom_job_driver=job_driver)\n\n job_driver.WaitForCompletion()",
"metadata": "root._TestInstanceOperationInParallelToInstanceCreation",
"header": "['module', '___EOS___']",
"index": 533
},
{
"content": "def TestParallelInstanceFailover(instance):\n \"\"\"PERFORMANCE: Instance failover with parallel instance creation.\n\n \"\"\"\n _TestInstanceOperationInParallelToInstanceCreation(\n [\"gnt-instance\", \"failover\", \"--submit\", \"-f\", \"--shutdown-timeout=0\",\n instance.name])",
"metadata": "root.TestParallelInstanceFailover",
"header": "['module', '___EOS___']",
"index": 562
},
{
"content": "def TestParallelInstanceMigration(instance):\n \"\"\"PERFORMANCE: Instance migration with parallel instance creation.\n\n \"\"\"\n _TestInstanceOperationInParallelToInstanceCreation(\n [\"gnt-instance\", \"migrate\", \"--submit\", \"-f\", instance.name])",
"metadata": "root.TestParallelInstanceMigration",
"header": "['module', '___EOS___']",
"index": 571
},
{
"content": "def TestParallelInstanceReplaceDisks(instance):\n \"\"\"PERFORMANCE: Instance replace-disks with parallel instance creation.\n\n \"\"\"\n _TestInstanceOperationInParallelToInstanceCreation(\n [\"gnt-instance\", \"replace-disks\", \"--submit\", \"--early-release\", \"-p\",\n instance.name])",
"metadata": "root.TestParallelInstanceReplaceDisks",
"header": "['module', '___EOS___']",
"index": 579
},
{
"content": "def TestParallelInstanceReboot(instance):\n \"\"\"PERFORMANCE: Instance reboot with parallel instance creation.\n\n \"\"\"\n _TestInstanceOperationInParallelToInstanceCreation(\n [\"gnt-instance\", \"reboot\", \"--submit\", instance.name])",
"metadata": "root.TestParallelInstanceReboot",
"header": "['module', '___EOS___']",
"index": 588
},
{
"content": "def TestParallelInstanceReinstall(instance):\n \"\"\"PERFORMANCE: Instance reinstall with parallel instance creation.\n\n \"\"\"\n # instance reinstall requires the instance to be down\n qa_utils.AssertCommand([\"gnt-instance\", \"stop\", instance.name])\n\n _TestInstanceOperationInParallelToInstanceCreation(\n [\"gnt-instance\", \"reinstall\", \"--submit\", \"-f\", instance.name])\n\n qa_utils.AssertCommand([\"gnt-instance\", \"start\", instance.name])",
"metadata": "root.TestParallelInstanceReinstall",
"header": "['module', '___EOS___']",
"index": 596
},
{
"content": "def TestParallelInstanceRename(instance):\n \"\"\"PERFORMANCE: Instance rename with parallel instance creation.\n\n \"\"\"\n # instance rename requires the instance to be down\n qa_utils.AssertCommand([\"gnt-instance\", \"stop\", instance.name])\n\n new_instance = qa_config.AcquireInstance()\n try:\n _TestInstanceOperationInParallelToInstanceCreation(\n [\"gnt-instance\", \"rename\", \"--submit\", instance.name, new_instance.name],\n [\"gnt-instance\", \"rename\", \"--submit\", new_instance.name, instance.name])\n finally:\n new_instance.Release()\n\n qa_utils.AssertCommand([\"gnt-instance\", \"start\", instance.name])",
"metadata": "root.TestParallelInstanceRename",
"header": "['module', '___EOS___']",
"index": 609
}
] | [] | [] | 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_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"2014",
" ",
"Goo",
"gle",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Redistributi",
"on",
" ",
"and",
" ",
"use",
" ",
"in",
" ",
"source",
" ",
"and",
" ",
"binar",
"y",
" ",
"forms",
",",
" ",
"with",
" ",
"or",
" ",
"with",
"out_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"modification",
",",
" ",
"are",
" ",
"permit",
"ted",
" ",
"provided",
" ",
"tha",
"t",
" ",
"the",
" ",
"follow",
"ing",
" ",
"condition",
"s",
" ",
"are",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"met",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"1",
".",
" ",
"Redistributi",
"ons",
" ",
"of",
" ",
"source",
" ",
"code",
" ",
"must",
" ",
"retain",
" ",
"the",
" ",
"above",
" ",
"copyr",
"ight",
" ",
"notice",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"follow",
"ing",
" ",
"discl",
"aime",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"2",
".",
" ",
"Redistributi",
"ons",
" ",
"in",
" ",
"binar",
"y",
" ",
"form",
" ",
"must",
" ",
"reproduce",
" ",
"the",
" ",
"above",
" ",
"copyright_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"follow",
"ing",
" ",
"discl",
"aime",
"r",
" ",
"in",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"documentation",
" ",
"and",
"/",
"or",
" ",
"other",
" ",
"material",
"s",
" ",
"provided",
" ",
"with",
" ",
"the",
" ",
"distribu",
"tion",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\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_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TO",
",",
" ",
"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",
" ",
"HOLD",
"ER",
" ",
"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_",
"\"\"\"",
"Perform",
"anc",
"e",
" ",
"testi",
"ng",
" ",
"QA",
" ",
"tests",
".",
"\\",
"10",
";",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"functools_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"itertools_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"threading_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"gane",
"ti_",
"import_",
"constants_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"qa",
"\\u",
"config_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"qa",
"\\u",
"error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"qa",
"\\u",
"instance",
"\\u",
"utils_",
"import_",
"Get",
"Gene",
"ric",
"Add",
"Parameters_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"qa",
"\\u",
"job",
"\\u",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"qa",
"\\u",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"qa",
"\\u",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"MAX",
"\\u",
"JOB",
"\\u",
"SUB",
"MISSI",
"ON",
"\\u",
"DURATION",
"_",
"=_",
"15.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\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u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Thi",
"s",
" ",
"class",
" ",
"handle",
"s",
" ",
"polling",
" ",
"of",
" ",
"jobs",
" ",
"and",
" ",
"reacti",
"ng",
" ",
"on",
" ",
"status",
" ",
"change",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Jo",
"bs",
" ",
"are",
" ",
"adde",
"d",
" ",
"via",
" ",
"the",
" ",
"L",
"{",
"Add",
"Jo",
"b",
"}",
" ",
"method",
",",
" ",
"and",
" ",
"can",
" ",
"have",
" ",
"callback",
" ",
"function",
"s",
"\\",
"10",
";",
" ",
" ",
"assign",
"ed",
" ",
"to",
" ",
"them",
".",
" ",
"Tho",
"se",
" ",
"are",
" ",
"call",
"ed",
" ",
"as",
" ",
"soo",
"n",
" ",
"as",
" ",
"the",
" ",
"job",
" ",
"enter",
"s",
" ",
"the",
" ",
"appropr",
"iate",
"\\",
"10",
";",
" ",
" ",
"state",
".",
" ",
"Call",
"back",
" ",
"function",
"s",
" ",
"can",
" ",
"add",
" ",
"new",
" ",
"jobs",
" ",
"to",
" ",
"the",
" ",
"driver",
" ",
"as",
" ",
"need",
"ed",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"A",
" ",
"call",
" ",
"to",
" ",
"L",
"{",
"Wait",
"For",
"Completi",
"on",
"}",
" ",
"final",
"ly",
" ",
"polls",
" ",
"Gan",
"eti",
" ",
"unti",
"l",
" ",
"all",
" ",
"jobs",
" ",
"have",
"\\",
"10",
";",
" ",
" ",
"succe",
"eded",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"UNK",
"NOW",
"N",
"\\u",
"STATUS_",
"=_",
"\"",
"unknown",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"\\u",
"Jo",
"b",
"Entry_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Intern",
"al",
" ",
"class",
" ",
"represent",
"ing",
" ",
"a",
" ",
"job",
" ",
"entry",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"job",
"\\u",
"id_",
",_",
"runn",
"ing",
"\\u",
"fn_",
",_",
"success",
"\\u",
"fn_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"job",
"\\u",
"id_",
"=_",
"job",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"runn",
"ing",
"\\u",
"fn_",
"=_",
"runn",
"ing",
"\\u",
"fn_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"success",
"\\u",
"fn_",
"=_",
"success",
"\\u",
"fn_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"str\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"str_",
"(_",
"self_",
"._",
"job",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"jobs_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"runn",
"ing",
"\\u",
"notified",
"_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"jobs",
"\\u",
"per",
"\\u",
"status_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"lock_",
"=_",
"threading_",
"._",
"RL",
"ock_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Add",
"Job_",
"(_",
"self_",
",_",
"job",
"\\u",
"id_",
",_",
"runn",
"ing",
"\\u",
"fn_",
"=_",
"None_",
",_",
"success",
"\\u",
"fn_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Add",
" ",
"a",
" ",
"job",
" ",
"to",
" ",
"the",
" ",
"driver",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"type",
" ",
"job",
"\\u",
"id",
":",
" ",
"of",
" ",
"ints",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"job",
"\\u",
"id",
":",
" ",
"job",
" ",
"id",
" ",
"to",
" ",
"add",
" ",
"to",
" ",
"the",
" ",
"driver",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"type",
" ",
"runn",
"ing",
"\\u",
"fn",
":",
" ",
"function",
" ",
"tak",
"ing",
" ",
"a",
" ",
"L",
"{\\u",
"Jo",
"b",
"Queue",
"Drive",
"r",
"}",
" ",
"and",
" ",
"an",
" ",
"int",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"runn",
"ing",
"\\u",
"fn",
":",
" ",
"function",
" ",
"call",
"ed",
" ",
"onc",
"e",
" ",
"whe",
"n",
" ",
"a",
" ",
"job",
" ",
"change",
"s",
" ",
"to",
" ",
"runn",
"ing",
" ",
"state",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"(",
"or",
" ",
"success",
" ",
"state",
",",
" ",
"if",
" ",
"the",
" ",
"runn",
"ing",
" ",
"state",
" ",
"was",
" ",
"too",
" ",
"short",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"type",
" ",
"success",
"\\u",
"fn",
":",
" ",
"function",
" ",
"tak",
"ing",
" ",
"a",
" ",
"L",
"{\\u",
"Jo",
"b",
"Queue",
"Drive",
"r",
"}",
" ",
"and",
" ",
"an",
" ",
"int",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"success",
"\\u",
"fn",
":",
" ",
"function",
" ",
"call",
"ed",
" ",
"for",
" ",
"each",
" ",
"success",
"ful",
" ",
"job",
" ",
"id",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"self_",
"._",
"\\u",
"lock_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"jobs_",
"[_",
"job",
"\\u",
"id_",
"]_",
"=_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"._",
"\\u",
"Jo",
"b",
"Entry_",
"(_",
"job",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"runn",
"ing",
"\\u",
"fn_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"success",
"\\u",
"fn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"the",
" ",
"status",
" ",
"will",
" ",
"be",
" ",
"update",
"d",
" ",
"on",
" ",
"the",
" ",
"next",
" ",
"call",
" ",
"to",
" ",
"\\u",
"Fe",
"tch",
"Jo",
"b",
"Status",
"es_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"jobs",
"\\u",
"per",
"\\u",
"status_",
"._",
"setdefault_",
"(_",
"self_",
"._",
"\\u",
"UNK",
"NOW",
"N",
"\\u",
"STATUS_",
",_",
"[_",
"]_",
")_",
"._",
"append_",
"(_",
"job",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Fe",
"tch",
"Jo",
"b",
"Status",
"es_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Retrieve",
"s",
" ",
"status",
" ",
"informati",
"on",
" ",
"of",
" ",
"the",
" ",
"give",
"n",
" ",
"jobs",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"statuses_",
"=_",
"qa",
"\\u",
"job",
"\\u",
"utils_",
"._",
"Get",
"Jo",
"b",
"Status",
"es_",
"(_",
"self_",
"._",
"\\u",
"Get",
"Jo",
"b",
"Ids_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"new",
"\\u",
"statuses_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"job",
"\\u",
"id_",
",_",
"status_",
"in_",
"job",
"\\u",
"statuses_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"new",
"\\u",
"statuses_",
"._",
"setdefault_",
"(_",
"status_",
",_",
"[_",
"]_",
")_",
"._",
"append_",
"(_",
"self_",
"._",
"\\u",
"jobs_",
"[_",
"int_",
"(_",
"job",
"\\u",
"id_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"jobs",
"\\u",
"per",
"\\u",
"status_",
"=_",
"new",
"\\u",
"statuses_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Get",
"Jo",
"b",
"Ids_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"list_",
"(_",
"self_",
"._",
"\\u",
"jobs_",
"._",
"keys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Get",
"Jo",
"bs",
"In",
"Status",
"es_",
"(_",
"self_",
",_",
"statuses_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"L",
"{\\u",
"Jo",
"b",
"Entr",
"y",
"}",
" ",
"of",
" ",
"all",
" ",
"jobs",
" ",
"in",
" ",
"the",
" ",
"give",
"n",
" ",
"status",
"es",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"type",
" ",
"status",
"es",
":",
" ",
"iterable",
" ",
"of",
" ",
"string",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"status",
"es",
":",
" ",
"jobs",
" ",
"in",
" ",
"tho",
"se",
" ",
"status",
"es",
" ",
"are",
" ",
"return",
"ed",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"rty",
"pe",
":",
" ",
"list",
" ",
"of",
" ",
"L",
"{\\u",
"Jo",
"b",
"Entr",
"y",
"}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"return",
":",
" ",
"list",
" ",
"of",
" ",
"job",
" ",
"entri",
"es",
" ",
"in",
" ",
"the",
" ",
"request",
"ed",
" ",
"status",
"es",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"state_",
"in_",
"statuses_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ret_",
"._",
"extend_",
"(_",
"self_",
"._",
"\\u",
"jobs",
"\\u",
"per",
"\\u",
"status_",
"._",
"get_",
"(_",
"state_",
",_",
"[_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"ret_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Update",
"Jo",
"b",
"Status",
"es_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Retrieve",
"s",
" ",
"job",
" ",
"status",
"es",
" ",
"from",
" ",
"the",
" ",
"cluster",
" ",
"and",
" ",
"update",
"s",
" ",
"internal",
" ",
"state",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"Fe",
"tch",
"Jo",
"b",
"Status",
"es_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"error",
"\\u",
"jobs_",
"=_",
"self_",
"._",
"\\u",
"Get",
"Jo",
"bs",
"In",
"Status",
"es_",
"(_",
"[_",
"constants_",
"._",
"JOB",
"\\u",
"STATUS",
"\\u",
"ERROR_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"error",
"\\u",
"jobs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"qa",
"\\u",
"error_",
"._",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Jo",
"bs",
" ",
"%",
"s",
" ",
"are",
" ",
"in",
" ",
"error",
" ",
"state",
"!\"_",
"%_",
"[_",
"job_",
"._",
"job",
"\\u",
"id_",
"for_",
"job_",
"in_",
"error",
"\\u",
"jobs_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"job_",
"in_",
"self_",
"._",
"\\u",
"Get",
"Jo",
"bs",
"In",
"Status",
"es_",
"(_",
"[_",
"constants_",
"._",
"JOB",
"\\u",
"STATUS",
"\\u",
"RUNNING_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"constants_",
"._",
"JOB",
"\\u",
"STATUS",
"\\u",
"SUCCESS_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"job_",
"._",
"job",
"\\u",
"id_",
"not_",
"in_",
"self_",
"._",
"\\u",
"runn",
"ing",
"\\u",
"notified",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"job_",
"._",
"runn",
"ing",
"\\u",
"fn_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"job_",
"._",
"runn",
"ing",
"\\u",
"fn_",
"(_",
"self_",
",_",
"job_",
"._",
"job",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"runn",
"ing",
"\\u",
"notified",
"_",
"._",
"add_",
"(_",
"job_",
"._",
"job",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"job_",
"in_",
"self_",
"._",
"\\u",
"Get",
"Jo",
"bs",
"In",
"Status",
"es_",
"(_",
"[_",
"constants_",
"._",
"JOB",
"\\u",
"STATUS",
"\\u",
"SUCCESS_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"job_",
"._",
"success",
"\\u",
"fn_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"job_",
"._",
"success",
"\\u",
"fn_",
"(_",
"self_",
",_",
"job_",
"._",
"job",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"we",
"'",
"re",
" ",
"don",
"e",
" ",
"with",
" ",
"this",
" ",
"job_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"del_",
"self_",
"._",
"\\u",
"jobs_",
"[_",
"job_",
"._",
"job",
"\\u",
"id_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Has",
"Pend",
"ing",
"Jobs_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Check",
"s",
" ",
"if",
" ",
"there",
" ",
"are",
" ",
"still",
" ",
"jobs",
" ",
"pend",
"ing",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"rty",
"pe",
":",
" ",
"bool",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"return",
":",
" ",
"C",
"{",
"Tru",
"e",
"}",
" ",
"if",
" ",
"there",
" ",
"are",
" ",
"still",
" ",
"jobs",
" ",
"whi",
"ch",
" ",
"have",
" ",
"not",
" ",
"succe",
"eded",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"self_",
"._",
"\\u",
"lock_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"Update",
"Jo",
"b",
"Status",
"es_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"uncom",
"ple",
"ted",
"\\u",
"jobs_",
"=_",
"self_",
"._",
"\\u",
"Get",
"Jo",
"bs",
"In",
"Status",
"es_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"constants_",
"._",
"JOB",
"\\u",
"STATUS",
"\\u",
"ALL_",
"-_",
"constants_",
"._",
"JOB",
"S",
"\\u",
"FINAL",
"IZED",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"unknown",
"\\u",
"jobs_",
"=_",
"self_",
"._",
"\\u",
"Get",
"Jo",
"bs",
"In",
"Status",
"es_",
"(_",
"[_",
"self_",
"._",
"\\u",
"UNK",
"NOW",
"N",
"\\u",
"STATUS_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"len_",
"(_",
"uncom",
"ple",
"ted",
"\\u",
"jobs_",
")_",
">_",
"0_",
"or_",
"len_",
"(_",
"unknown",
"\\u",
"jobs_",
")_",
">_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
"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",
"For",
"Completi",
"on_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Wait",
" ",
"for",
" ",
"the",
" ",
"completion",
" ",
"of",
" ",
"all",
" ",
"register",
"ed",
" ",
"jobs",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"self_",
"._",
"\\u",
"Has",
"Pend",
"ing",
"Jobs_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"time_",
"._",
"sleep_",
"(_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"with_",
"self_",
"._",
"\\u",
"lock_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"\\u",
"jobs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"qa",
"\\u",
"error_",
"._",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Jo",
"bs",
" ",
"%",
"s",
" ",
"did",
"n",
"'",
"t",
" ",
"finish",
" ",
"in",
" ",
"success",
" ",
"state",
"!\"_",
"%_",
"self_",
"._",
"\\u",
"Get",
"Jo",
"b",
"Ids_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Acquire",
"All",
"Instances_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Generat",
"or",
" ",
"for",
" ",
"acquir",
"ing",
" ",
"all",
" ",
"instance",
"s",
" ",
"in",
" ",
"the",
" ",
"QA",
" ",
"config",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"instance_",
"=_",
"qa",
"\\u",
"config_",
"._",
"Acquire",
"Instance_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yield_",
"instance_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"qa",
"\\u",
"error_",
"._",
"Out",
"Of",
"Insta",
"nce",
"s",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Acquire",
"All",
"Nodes_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Generat",
"or",
" ",
"for",
" ",
"acquir",
"ing",
" ",
"all",
" ",
"nodes",
" ",
"in",
" ",
"the",
" ",
"QA",
" ",
"config",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"exclude_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"node_",
"=_",
"qa",
"\\u",
"config_",
"._",
"Acquire",
"Node_",
"(_",
"exclude_",
"=_",
"exclude_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"exclude_",
"._",
"append_",
"(_",
"node_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yield_",
"node_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"qa",
"\\u",
"error_",
"._",
"Out",
"Of",
"Node",
"s",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"cmd_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Execut",
"es",
" ",
"a",
" ",
"job",
" ",
"submit",
"ting",
" ",
"command",
" ",
"and",
" ",
"return",
"s",
" ",
"the",
" ",
"result",
"ing",
" ",
"job",
" ",
"ID",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Thi",
"s",
" ",
"will",
" ",
"fail",
" ",
"if",
" ",
"submit",
"ting",
" ",
"the",
" ",
"job",
" ",
"take",
"s",
" ",
"long",
"er",
" ",
"than",
"\\",
"10",
";",
" ",
" ",
"L",
"{",
"MAX",
"\\u",
"JOB",
"\\u",
"SUB",
"MISSI",
"ON",
"\\u",
"DURATION",
"}.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"cmd",
":",
" ",
"list",
" ",
"of",
" ",
"string",
" ",
"or",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"cmd",
":",
" ",
"the",
" ",
"job",
" ",
"produc",
"ing",
" ",
"command",
" ",
"to",
" ",
"execute",
" ",
"on",
" ",
"the",
" ",
"cluster",
"\\",
"10",
";",
" ",
" ",
"@",
"rty",
"pe",
":",
" ",
"int",
"\\",
"10",
";",
" ",
" ",
"@",
"return",
":",
" ",
"job",
"-",
"id",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"start_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"now_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"qa",
"\\u",
"job",
"\\u",
"utils_",
"._",
"Execut",
"e",
"Jo",
"b",
"Produ",
"cing",
"Command_",
"(_",
"cmd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"duration_",
"=_",
"qa",
"\\u",
"utils_",
"._",
"Time",
"delta",
"To",
"Total",
"Seconds_",
"(_",
"datetime_",
"._",
"datetime_",
"._",
"now_",
"(_",
")_",
"-_",
"start_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"duration_",
">_",
"MAX",
"\\u",
"JOB",
"\\u",
"SUB",
"MISSI",
"ON",
"\\u",
"DURATION",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"qa",
"\\u",
"logging_",
"._",
"Format",
"Warning_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Execut",
"ing",
" ",
"'%",
"s",
"'",
" ",
"too",
"k",
" ",
"%",
"f",
" ",
"second",
"s",
",",
" ",
"a",
" ",
"maxim",
"um",
" ",
"of",
" ",
"%",
"f",
" ",
"was",
" ",
"expected",
"\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"cmd_",
",_",
"duration_",
",_",
"MAX",
"\\u",
"JOB",
"\\u",
"SUB",
"MISSI",
"ON",
"\\u",
"DURATION",
"_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Submit",
"Insta",
"nce",
"Creat",
"ion",
"Job_",
"(_",
"instance_",
",_",
"disk",
"\\u",
"template_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Submit",
" ",
"an",
" ",
"instance",
" ",
"creati",
"on",
" ",
"job",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"instance",
":",
" ",
"L",
"{",
"qa",
"\\u",
"config",
".\\u",
"Qa",
"Insta",
"nce",
"}",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"instance",
":",
" ",
"instance",
" ",
"to",
" ",
"submit",
" ",
"a",
" ",
"create",
" ",
"command",
" ",
"for",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"disk",
"\\u",
"template",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"disk",
"\\u",
"template",
":",
" ",
"disk",
" ",
"template",
" ",
"for",
" ",
"the",
" ",
"new",
" ",
"instance",
" ",
"or",
" ",
"C",
"{",
"Non",
"e",
"}",
" ",
"whi",
"ch",
"\\",
"10",
";",
" ",
" ",
"caus",
"es",
" ",
"the",
" ",
"default",
" ",
"disk",
" ",
"template",
" ",
"to",
" ",
"be",
" ",
"used",
"\\",
"10",
";",
" ",
" ",
"@",
"rty",
"pe",
":",
" ",
"int",
"\\",
"10",
";",
" ",
" ",
"@",
"return",
":",
" ",
"job",
" ",
"id",
" ",
"of",
" ",
"the",
" ",
"submitted",
" ",
"creati",
"on",
" ",
"job",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"disk",
"\\u",
"template_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"disk",
"\\u",
"template_",
"=_",
"qa",
"\\u",
"config_",
"._",
"Get",
"Default",
"Disk",
"Template_",
"(_",
")_",
"\\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 ",
" _",
"cmd_",
"=_",
"(_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"add",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\"--",
"oppo",
"rtu",
"nist",
"ic",
"-",
"locking",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"--",
"os",
"-",
"type",
"=",
"%",
"s",
"\"_",
"%_",
"qa",
"\\u",
"config_",
"._",
"get_",
"(_",
"\"",
"os",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"--",
"disk",
"-",
"template",
"=",
"%",
"s",
"\"_",
"%_",
"disk",
"\\u",
"template_",
"]_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"Get",
"Gene",
"ric",
"Add",
"Parameters_",
"(_",
"instance_",
",_",
"disk",
"\\u",
"template_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cmd_",
"._",
"append_",
"(_",
"instance_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"instance_",
"._",
"Set",
"Disk",
"Template_",
"(_",
"disk",
"\\u",
"template_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"cmd_",
")_",
"\\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 ",
" _",
"instance_",
"._",
"Release_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Submit",
"Insta",
"nce",
"Remove",
"Job_",
"(_",
"instance_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Submit",
" ",
"an",
" ",
"instance",
" ",
"remove",
" ",
"job",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"instance",
":",
" ",
"L",
"{",
"qa",
"\\u",
"config",
".\\u",
"Qa",
"Insta",
"nce",
"}",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"instance",
":",
" ",
"the",
" ",
"instance",
" ",
"to",
" ",
"remove",
"\\",
"10",
";",
" ",
" ",
"@",
"rty",
"pe",
":",
" ",
"int",
"\\",
"10",
";",
" ",
" ",
"@",
"return",
":",
" ",
"job",
" ",
"id",
" ",
"of",
" ",
"the",
" ",
"submitted",
" ",
"remove",
" ",
"job",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"=_",
"(_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"remove",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\"-",
"f",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cmd_",
"._",
"append_",
"(_",
"instance_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"cmd_",
")_",
"\\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 ",
" _",
"instance_",
"._",
"Release_",
"(_",
")_",
"\\u\\u\\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",
"Test",
"Parallel",
"Insta",
"nce",
"Creat",
"ion",
"And",
"Remo",
"val_",
"(_",
"max",
"\\u",
"instances_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"disk",
"\\u",
"template_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"custom",
"\\u",
"job",
"\\u",
"driver_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Test",
"s",
" ",
"parall",
"el",
" ",
"creati",
"on",
" ",
"and",
" ",
"immediate",
" ",
"removal",
" ",
"of",
" ",
"instance",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"max",
"\\u",
"instance",
"s",
":",
" ",
"int",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"max",
"\\u",
"instance",
"s",
":",
" ",
"maxim",
"um",
" ",
"number",
" ",
"of",
" ",
"instance",
"s",
" ",
"to",
" ",
"create",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"disk",
"\\u",
"template",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"disk",
"\\u",
"template",
":",
" ",
"disk",
" ",
"template",
" ",
"for",
" ",
"the",
" ",
"new",
" ",
"instance",
"s",
" ",
"or",
" ",
"C",
"{",
"Non",
"e",
"}",
" ",
"whi",
"ch",
"\\",
"10",
";",
" ",
" ",
"caus",
"es",
" ",
"the",
" ",
"default",
" ",
"disk",
" ",
"template",
" ",
"to",
" ",
"be",
" ",
"used",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"custom",
"\\u",
"job",
"\\u",
"driver",
":",
" ",
"\\u",
"Jo",
"b",
"Queue",
"Drive",
"r",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"custom",
"\\u",
"job",
"\\u",
"driver",
":",
" ",
"a",
" ",
"custom",
" ",
"L",
"{\\u",
"Jo",
"b",
"Queue",
"Drive",
"r",
"}",
" ",
"to",
" ",
"use",
" ",
"if",
" ",
"not",
" ",
"L",
"{",
"Non",
"e",
"}.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"If",
" ",
"one",
" ",
"is",
" ",
"specified",
",",
" ",
"C",
"{",
"Wait",
"For",
"Completi",
"on",
"}",
" ",
"is",
" ",
"\\u",
"not",
"\\u",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"call",
"ed",
" ",
"on",
" ",
"it",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"=_",
"custom",
"\\u",
"job",
"\\u",
"driver_",
"or_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"Creat",
"e",
"Success",
"Fn_",
"(_",
"instance_",
",_",
"job",
"\\u",
"driver_",
",_",
"\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"job",
"\\u",
"id_",
"=_",
"\\u",
"Submit",
"Insta",
"nce",
"Remove",
"Job_",
"(_",
"instance_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"job",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"instance",
"\\u",
"generator_",
"=_",
"\\u",
"Acquire",
"All",
"Instances_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"max",
"\\u",
"instances_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"instance",
"\\u",
"generator_",
"=_",
"itertools_",
"._",
"islice_",
"(_",
"instance",
"\\u",
"generator_",
",_",
"max",
"\\u",
"instances_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"instance_",
"in_",
"instance",
"\\u",
"generator_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"job",
"\\u",
"id_",
"=_",
"\\u",
"Submit",
"Insta",
"nce",
"Creat",
"ion",
"Job_",
"(_",
"instance_",
",_",
"disk",
"\\u",
"template_",
"=_",
"disk",
"\\u",
"template_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"job",
"\\u",
"id_",
",_",
"success",
"\\u",
"fn_",
"=_",
"functools_",
"._",
"partial_",
"(_",
"\\u",
"Creat",
"e",
"Success",
"Fn_",
",_",
"instance_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"custom",
"\\u",
"job",
"\\u",
"driver_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"job",
"\\u",
"driver_",
"._",
"Wait",
"For",
"Completi",
"on_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Max",
"Insta",
"nce",
"Creat",
"ion",
"Perform",
"ance_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Parallel",
" ",
"instance",
" ",
"creati",
"on",
" ",
"(",
"instance",
" ",
"count",
" ",
"=",
" ",
"max",
").",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"Test",
"Parallel",
"Insta",
"nce",
"Creat",
"ion",
"And",
"Remo",
"val_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Node",
"Count",
"Insta",
"nce",
"Creat",
"ion",
"Perform",
"ance_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Parallel",
" ",
"instance",
" ",
"creati",
"on",
" ",
"(",
"instance",
" ",
"count",
" ",
"=",
" ",
"node",
" ",
"count",
").",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"nodes_",
"=_",
"list_",
"(_",
"\\u",
"Acquire",
"All",
"Nodes_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"Test",
"Parallel",
"Insta",
"nce",
"Creat",
"ion",
"And",
"Remo",
"val_",
"(_",
"max",
"\\u",
"instances_",
"=_",
"len_",
"(_",
"nodes_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"qa",
"\\u",
"config_",
"._",
"Release",
"Many",
"Nodes_",
"(_",
"nodes_",
")_",
"\\u\\u\\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_",
"Creat",
"e",
"All",
"Instances_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Creat",
"e",
" ",
"all",
" ",
"instance",
"s",
" ",
"configur",
"ed",
" ",
"in",
" ",
"QA",
" ",
"config",
" ",
"in",
" ",
"the",
" ",
"cluster",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"@",
"rty",
"pe",
":",
" ",
"list",
" ",
"of",
" ",
"L",
"{",
"qa",
"\\u",
"config",
".\\u",
"Qa",
"Insta",
"nce",
"}",
"\\",
"10",
";",
" ",
" ",
"@",
"return",
":",
" ",
"list",
" ",
"of",
" ",
"instance",
"s",
" ",
"created",
" ",
"in",
" ",
"the",
" ",
"cluster",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"=_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"instances_",
"=_",
"list_",
"(_",
"\\u",
"Acquire",
"All",
"Instances_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"instance_",
"in_",
"instances_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"job",
"\\u",
"id_",
"=_",
"\\u",
"Submit",
"Insta",
"nce",
"Creat",
"ion",
"Job_",
"(_",
"instance_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"job",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Wait",
"For",
"Completi",
"on_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"instances_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Remove",
"All",
"Instances_",
"(_",
"instances_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Remove",
"s",
" ",
"all",
" ",
"give",
"n",
" ",
"instance",
"s",
" ",
"from",
" ",
"the",
" ",
"cluster",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"instance",
"s",
":",
" ",
"list",
" ",
"of",
" ",
"L",
"{",
"qa",
"\\u",
"config",
".\\u",
"Qa",
"Insta",
"nce",
"}",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"instance",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"=_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"instance_",
"in_",
"instances_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"job",
"\\u",
"id_",
"=_",
"\\u",
"Submit",
"Insta",
"nce",
"Remove",
"Job_",
"(_",
"instance_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"job",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Wait",
"For",
"Completi",
"on_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Modif",
"y_",
"(_",
"instances_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Parallel",
" ",
"instance",
" ",
"modif",
"y",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"instance",
"s",
":",
" ",
"list",
" ",
"of",
" ",
"L",
"{",
"qa",
"\\u",
"config",
".\\u",
"Qa",
"Insta",
"nce",
"}",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"instance",
"s",
":",
" ",
"list",
" ",
"of",
" ",
"instance",
"s",
" ",
"to",
" ",
"issue",
" ",
"modif",
"y",
" ",
"command",
"s",
" ",
"against",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"=_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"set",
" ",
"min",
" ",
"mem",
" ",
"to",
" ",
"same",
" ",
"value",
" ",
"as",
" ",
"max",
" ",
"mem_",
"\\u\\u\\uNL\\u\\u\\u_",
"new",
"\\u",
"min",
"\\u",
"mem_",
"=_",
"qa",
"\\u",
"config_",
"._",
"get_",
"(_",
"constants_",
"._",
"BE",
"\\u",
"MAX",
"MEM",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"instance_",
"in_",
"instances_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"=_",
"(_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"modif",
"y",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"-",
"B",
"\"_",
",_",
"\"%",
"s",
"=",
"%",
"s",
"\"_",
"%_",
"(_",
"constants_",
"._",
"BE",
"\\u",
"MIN",
"MEM",
"_",
",_",
"new",
"\\u",
"min",
"\\u",
"mem_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cmd_",
"._",
"append_",
"(_",
"instance_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"cmd_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"cmd_",
"=_",
"(_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"modif",
"y",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"-",
"O",
"\"_",
",_",
"\"",
"fake",
"\\u",
"os",
"\\u",
"param",
"=",
"fake",
"\\u",
"value",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cmd_",
"._",
"append_",
"(_",
"instance_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"cmd_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"cmd_",
"=_",
"(_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"modif",
"y",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"-",
"O",
"\"_",
",_",
"\"",
"fake",
"\\u",
"os",
"\\u",
"param",
"=",
"fake",
"\\u",
"value",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"-",
"B",
"\"_",
",_",
"\"%",
"s",
"=",
"%",
"s",
"\"_",
"%_",
"(_",
"constants_",
"._",
"BE",
"\\u",
"MIN",
"MEM",
"_",
",_",
"new",
"\\u",
"min",
"\\u",
"mem_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cmd_",
"._",
"append_",
"(_",
"instance_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"cmd_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Wait",
"For",
"Completi",
"on_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Insta",
"nce",
"OS",
"Operations_",
"(_",
"instances_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Parallel",
" ",
"instance",
" ",
"OS",
" ",
"operati",
"ons",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Not",
"e",
":",
" ",
"Thi",
"s",
" ",
"test",
" ",
"lea",
"ves",
" ",
"the",
" ",
"instance",
"s",
" ",
"eit",
"her",
" ",
"runn",
"ing",
" ",
"or",
" ",
"stopp",
"ed",
",",
" ",
"there",
"'",
"s",
" ",
"no",
"\\",
"10",
";",
" ",
" ",
"guaran",
"tee",
" ",
"on",
" ",
"the",
" ",
"actual",
" ",
"status",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"instance",
"s",
":",
" ",
"list",
" ",
"of",
" ",
"L",
"{",
"qa",
"\\u",
"config",
".\\u",
"Qa",
"Insta",
"nce",
"}",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"instance",
"s",
":",
" ",
"list",
" ",
"of",
" ",
"instance",
"s",
" ",
"to",
" ",
"issue",
" ",
"lifecycle",
" ",
"command",
"s",
" ",
"against",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"OPS",
"_",
"=_",
"[_",
"\"",
"start",
"\"_",
",_",
"\"",
"shut",
"down",
"\"_",
",_",
"\"",
"rebo",
"ot",
"\"_",
",_",
"\"",
"rein",
"stall",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"=_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"Submit",
"Ne",
"xt",
"Operation_",
"(_",
"instance_",
",_",
"start_",
",_",
"idx_",
",_",
"job",
"\\u",
"driver_",
",_",
"\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"idx_",
"==_",
"len_",
"(_",
"OPS",
"_",
")_",
":_",
"\\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_",
"op",
"\\u",
"idx_",
"=_",
"(_",
"start_",
"+_",
"idx_",
")_",
"%_",
"len_",
"(_",
"OPS",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"next",
"\\u",
"fn_",
"=_",
"functools_",
"._",
"partial_",
"(_",
"\\u",
"Submit",
"Ne",
"xt",
"Operation_",
",_",
"instance_",
",_",
"start_",
",_",
"idx_",
"+_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"OPS",
"_",
"[_",
"op",
"\\u",
"idx_",
"]_",
"==_",
"\"",
"rein",
"stall",
"\"_",
"and_",
"instance_",
"._",
"disk",
"\\u",
"template_",
"==_",
"constants_",
"._",
"DT",
"\\u",
"DISK",
"LESS",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"no",
" ",
"rein",
"stall",
" ",
"possib",
"le",
" ",
"with",
" ",
"disk",
"less",
" ",
"instances_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"next",
"\\u",
"fn_",
"(_",
"job",
"\\u",
"driver_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"OPS",
"_",
"[_",
"op",
"\\u",
"idx_",
"]_",
"==_",
"\"",
"rein",
"stall",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"the",
" ",
"instance",
" ",
"has",
" ",
"to",
" ",
"be",
" ",
"shut",
" ",
"down",
" ",
"for",
" ",
"rein",
"stall",
" ",
"to",
" ",
"work_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"shut",
"down",
"\\u",
"cmd_",
"=_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"shut",
"down",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"instance_",
"._",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cmd_",
"=_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"rein",
"stall",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\"-",
"f",
"\"_",
",_",
"instance_",
"._",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"shut",
"down",
"\\u",
"cmd_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"runn",
"ing",
"\\u",
"fn_",
"=_",
"lambda_",
"\\u_",
",_",
"\\u\\u_",
":_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"cmd_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"runn",
"ing",
"\\u",
"fn_",
"=_",
"next",
"\\u",
"fn_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"=_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"OPS",
"_",
"[_",
"op",
"\\u",
"idx_",
"]_",
",_",
"\"--",
"submit",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"OPS",
"_",
"[_",
"op",
"\\u",
"idx_",
"]_",
"==_",
"\"",
"rein",
"stall",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"._",
"append_",
"(_",
"\"-",
"f",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"cmd_",
"._",
"append_",
"(_",
"instance_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"job",
"\\u",
"id_",
"=_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"cmd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"job",
"\\u",
"id_",
",_",
"runn",
"ing",
"\\u",
"fn_",
"=_",
"next",
"\\u",
"fn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"start_",
",_",
"instance_",
"in_",
"enumerate_",
"(_",
"instances_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"Submit",
"Ne",
"xt",
"Operation_",
"(_",
"instance_",
",_",
"start_",
"%_",
"len_",
"(_",
"OPS",
"_",
")_",
",_",
"0_",
",_",
"job",
"\\u",
"driver_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Wait",
"For",
"Completi",
"on_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Insta",
"nce",
"Querie",
"s_",
"(_",
"instances_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Parallel",
" ",
"instance",
" ",
"querie",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"instance",
"s",
":",
" ",
"list",
" ",
"of",
" ",
"L",
"{",
"qa",
"\\u",
"config",
".\\u",
"Qa",
"Insta",
"nce",
"}",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"instance",
"s",
":",
" ",
"list",
" ",
"of",
" ",
"instance",
"s",
" ",
"to",
" ",
"issue",
" ",
"querie",
"s",
" ",
"against",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"threads_",
"=_",
"qa",
"\\u",
"job",
"\\u",
"utils_",
"._",
"QA",
"Thread",
"Group_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"instance_",
"in_",
"instances_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"=_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"info",
"\"_",
",_",
"instance_",
"._",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"info",
"\\u",
"thread_",
"=_",
"qa",
"\\u",
"job",
"\\u",
"utils_",
"._",
"QA",
"Thread_",
"(_",
"qa",
"\\u",
"utils_",
"._",
"Assert",
"Command_",
",_",
"[_",
"cmd_",
"]_",
",_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"threads_",
"._",
"Start_",
"(_",
"info",
"\\u",
"thread_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"cmd_",
"=_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"list",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"list",
"\\u",
"thread_",
"=_",
"qa",
"\\u",
"job",
"\\u",
"utils_",
"._",
"QA",
"Thread_",
"(_",
"qa",
"\\u",
"utils_",
"._",
"Assert",
"Command_",
",_",
"[_",
"cmd_",
"]_",
",_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"threads_",
"._",
"Start_",
"(_",
"list",
"\\u",
"thread_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"threads_",
"._",
"Join",
"And",
"Re",
"raise_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Jo",
"b",
"Queue",
"Subm",
"ission",
"Perform",
"ance_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Jo",
"b",
" ",
"queue",
" ",
"subm",
"ission",
" ",
"perform",
"anc",
"e",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Thi",
"s",
" ",
"test",
" ",
"exercise",
"s",
" ",
"the",
" ",
"job",
" ",
"queue",
" ",
"and",
" ",
"verifie",
"s",
" ",
"tha",
"t",
" ",
"the",
" ",
"job",
" ",
"subm",
"ission",
" ",
"time",
"\\",
"10",
";",
" ",
" ",
"doe",
"s",
" ",
"not",
" ",
"increase",
" ",
"as",
" ",
"more",
" ",
"jobs",
" ",
"are",
" ",
"adde",
"d",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"MAX",
"\\u",
"CLUSTER",
"\\u",
"INFO",
"\\u",
"SECONDS_",
"=_",
"15.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"=_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"subm",
"ission",
"\\u",
"durations_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"Verify",
"Subm",
"ission",
"Duration_",
"(_",
"duration",
"\\u",
"seconds_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"only",
" ",
"start",
" ",
"to",
" ",
"verify",
" ",
"the",
" ",
"subm",
"ission",
" ",
"duration",
" ",
"onc",
"e",
" ",
"we",
" ",
"got",
" ",
"data",
" ",
"from",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"first",
" ",
"10",
" ",
"job",
" ",
"submissions_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"len_",
"(_",
"subm",
"ission",
"\\u",
"durations_",
")_",
">=_",
"10_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"avg",
"\\u",
"duration_",
"=_",
"sum_",
"(_",
"subm",
"ission",
"\\u",
"durations_",
")_",
"/_",
"len_",
"(_",
"subm",
"ission",
"\\u",
"durations_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"max",
"\\u",
"duration_",
"=_",
"avg",
"\\u",
"duration_",
"*_",
"1.5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"duration",
"\\u",
"seconds_",
">_",
"max",
"\\u",
"duration_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"qa",
"\\u",
"logging_",
"._",
"Format",
"Warning_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Submit",
"ting",
" ",
"a",
" ",
"dela",
"y",
" ",
"job",
" ",
"too",
"k",
" ",
"%",
"f",
" ",
"second",
"s",
",",
" ",
"max",
" ",
"%",
"f",
" ",
"expected",
"\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"duration",
"\\u",
"seconds_",
",_",
"max",
"\\u",
"duration_",
")_",
")_",
")_",
"\\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 ",
" _",
"subm",
"ission",
"\\u",
"durations_",
"._",
"append_",
"(_",
"duration",
"\\u",
"seconds_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"Submit",
"Delay",
"Job_",
"(_",
"count_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"\\u_",
"in_",
"range_",
"(_",
"count_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"=_",
"[_",
"\"",
"gn",
"t",
"-",
"debug",
"\"_",
",_",
"\"",
"dela",
"y",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\"",
"0.",
"1",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"start_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"now_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"id_",
"=_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"cmd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"duration",
"\\u",
"seconds_",
"=_",
"qa",
"\\u",
"utils_",
"._",
"Time",
"delta",
"To",
"Total",
"Seconds_",
"(_",
"datetime_",
"._",
"datetime_",
"._",
"now_",
"(_",
")_",
"-_",
"start_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"Verify",
"Subm",
"ission",
"Duration_",
"(_",
"duration",
"\\u",
"seconds_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"job",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"threads_",
"=_",
"qa",
"\\u",
"job",
"\\u",
"utils_",
"._",
"QA",
"Thread",
"Group_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"\\u_",
"in_",
"range_",
"(_",
"10_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"thread_",
"=_",
"qa",
"\\u",
"job",
"\\u",
"utils_",
"._",
"QA",
"Thread_",
"(_",
"\\u",
"Submit",
"Delay",
"Job_",
",_",
"[_",
"20_",
"]_",
",_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"threads_",
"._",
"Start_",
"(_",
"thread_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"threads_",
"._",
"Join",
"And",
"Re",
"raise_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"qa",
"\\u",
"utils_",
"._",
"Assert",
"Command_",
"(_",
"[_",
"\"",
"gn",
"t",
"-",
"cluster",
"\"_",
",_",
"\"",
"info",
"\"_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"max",
"\\u",
"seconds_",
"=_",
"MAX",
"\\u",
"CLUSTER",
"\\u",
"INFO",
"\\u",
"SECONDS_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Wait",
"For",
"Completi",
"on_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"DR",
"BD",
"Insta",
"nce",
"Creat",
"ion",
"Perform",
"ance_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Parallel",
" ",
"DR",
"BD",
" ",
"backed",
" ",
"instance",
" ",
"creati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"qa",
"\\u",
"config_",
"._",
"Is",
"Templa",
"te",
"Supported_",
"(_",
"constants_",
"._",
"DT",
"\\u",
"DR",
"BD",
"8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"nodes_",
"=_",
"list_",
"(_",
"\\u",
"Acquire",
"All",
"Nodes_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"Test",
"Parallel",
"Insta",
"nce",
"Creat",
"ion",
"And",
"Remo",
"val_",
"(_",
"max",
"\\u",
"instances_",
"=_",
"len_",
"(_",
"nodes_",
")_",
"*_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"disk",
"\\u",
"template_",
"=_",
"constants_",
"._",
"DT",
"\\u",
"DR",
"BD",
"8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"qa",
"\\u",
"config_",
"._",
"Release",
"Many",
"Nodes_",
"(_",
"nodes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Plai",
"n",
"Insta",
"nce",
"Creat",
"ion",
"Perform",
"ance_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Parallel",
" ",
"plain",
" ",
"backed",
" ",
"instance",
" ",
"creati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"qa",
"\\u",
"config_",
"._",
"Is",
"Templa",
"te",
"Supported_",
"(_",
"constants_",
"._",
"DT",
"\\u",
"PLAIN",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"nodes_",
"=_",
"list_",
"(_",
"\\u",
"Acquire",
"All",
"Nodes_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"Test",
"Parallel",
"Insta",
"nce",
"Creat",
"ion",
"And",
"Remo",
"val_",
"(_",
"max",
"\\u",
"instances_",
"=_",
"len_",
"(_",
"nodes_",
")_",
"*_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"disk",
"\\u",
"template_",
"=_",
"constants_",
"._",
"DT",
"\\u",
"PLAIN",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"qa",
"\\u",
"config_",
"._",
"Release",
"Many",
"Nodes_",
"(_",
"nodes_",
")_",
"\\u\\u\\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",
"Test",
"Insta",
"nce",
"Opera",
"tion",
"In",
"Parallel",
"To",
"Insta",
"nce",
"Creat",
"ion_",
"(_",
"*_",
"cmds_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Run",
" ",
"the",
" ",
"give",
"n",
" ",
"test",
" ",
"command",
" ",
"in",
" ",
"parall",
"el",
" ",
"to",
" ",
"an",
" ",
"instance",
" ",
"creati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"@",
"type",
" ",
"cmds",
":",
" ",
"list",
" ",
"of",
" ",
"list",
" ",
"of",
" ",
"string",
"s",
"\\",
"10",
";",
" ",
" ",
"@",
"param",
" ",
"cmds",
":",
" ",
"command",
"s",
" ",
"to",
" ",
"execute",
" ",
"in",
" ",
"parall",
"el",
" ",
"to",
" ",
"an",
" ",
"instance",
" ",
"creati",
"on",
".",
" ",
"Ea",
"ch",
"\\",
"10",
";",
" ",
" ",
" ",
"command",
" ",
"in",
" ",
"the",
" ",
"list",
" ",
"is",
" ",
"executed",
" ",
"onc",
"e",
" ",
"the",
" ",
"previ",
"ous",
" ",
"job",
" ",
"starts",
"\\",
"10",
";",
" ",
" ",
" ",
"to",
" ",
"run",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u",
"Submit",
"Ne",
"xt",
"Command_",
"(_",
"cmd",
"\\u",
"idx_",
",_",
"job",
"\\u",
"driver_",
",_",
"\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"cmd",
"\\u",
"idx_",
">=_",
"len_",
"(_",
"cmds_",
")_",
":_",
"\\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_",
"job",
"\\u",
"id_",
"=_",
"\\u",
"Execut",
"e",
"Jo",
"b",
"Submit",
"ting",
"Cmd_",
"(_",
"cmds_",
"[_",
"cmd",
"\\u",
"idx_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Add",
"Job_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"job",
"\\u",
"id_",
",_",
"success",
"\\u",
"fn_",
"=_",
"functools_",
"._",
"partial_",
"(_",
"\\u",
"Submit",
"Ne",
"xt",
"Command_",
",_",
"cmd",
"\\u",
"idx_",
"+_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert_",
"qa",
"\\u",
"config_",
"._",
"Is",
"Templa",
"te",
"Supported_",
"(_",
"constants_",
"._",
"DT",
"\\u",
"DR",
"BD",
"8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"len_",
"(_",
"cmds_",
")_",
">_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"job",
"\\u",
"driver_",
"=_",
"\\u",
"Jo",
"b",
"Queue",
"Driver_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"Submit",
"Ne",
"xt",
"Command_",
"(_",
"0_",
",_",
"job",
"\\u",
"driver_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"Test",
"Parallel",
"Insta",
"nce",
"Creat",
"ion",
"And",
"Remo",
"val_",
"(_",
"max",
"\\u",
"instances_",
"=_",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"disk",
"\\u",
"template_",
"=_",
"constants_",
"._",
"DT",
"\\u",
"DR",
"BD",
"8_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"custom",
"\\u",
"job",
"\\u",
"driver_",
"=_",
"job",
"\\u",
"driver_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"job",
"\\u",
"driver_",
"._",
"Wait",
"For",
"Completi",
"on_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Insta",
"nce",
"Fail",
"over_",
"(_",
"instance_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Insta",
"nce",
" ",
"failover",
" ",
"with",
" ",
"parall",
"el",
" ",
"instance",
" ",
"creati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"Test",
"Insta",
"nce",
"Opera",
"tion",
"In",
"Parallel",
"To",
"Insta",
"nce",
"Creat",
"ion_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"failover",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\"-",
"f",
"\"_",
",_",
"\"--",
"shut",
"down",
"-",
"timeo",
"ut",
"=",
"0",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"instance_",
"._",
"name_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Insta",
"nce",
"Migration_",
"(_",
"instance_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Insta",
"nce",
" ",
"migrati",
"on",
" ",
"with",
" ",
"parall",
"el",
" ",
"instance",
" ",
"creati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"Test",
"Insta",
"nce",
"Opera",
"tion",
"In",
"Parallel",
"To",
"Insta",
"nce",
"Creat",
"ion_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"migr",
"ate",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\"-",
"f",
"\"_",
",_",
"instance_",
"._",
"name_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Insta",
"nce",
"Replace",
"Disk",
"s_",
"(_",
"instance_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Insta",
"nce",
" ",
"replace",
"-",
"disks",
" ",
"with",
" ",
"parall",
"el",
" ",
"instance",
" ",
"creati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"Test",
"Insta",
"nce",
"Opera",
"tion",
"In",
"Parallel",
"To",
"Insta",
"nce",
"Creat",
"ion_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"replace",
"-",
"disks",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\"--",
"ear",
"ly",
"-",
"release",
"\"_",
",_",
"\"-",
"p",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"instance_",
"._",
"name_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Insta",
"nce",
"Reboot",
"_",
"(_",
"instance_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Insta",
"nce",
" ",
"rebo",
"ot",
" ",
"with",
" ",
"parall",
"el",
" ",
"instance",
" ",
"creati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"Test",
"Insta",
"nce",
"Opera",
"tion",
"In",
"Parallel",
"To",
"Insta",
"nce",
"Creat",
"ion_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"rebo",
"ot",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"instance_",
"._",
"name_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Insta",
"nce",
"Rein",
"stall",
"_",
"(_",
"instance_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Insta",
"nce",
" ",
"rein",
"stall",
" ",
"with",
" ",
"parall",
"el",
" ",
"instance",
" ",
"creati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"instance",
" ",
"rein",
"stall",
" ",
"require",
"s",
" ",
"the",
" ",
"instance",
" ",
"to",
" ",
"be",
" ",
"down_",
"\\u\\u\\uNL\\u\\u\\u_",
"qa",
"\\u",
"utils_",
"._",
"Assert",
"Command_",
"(_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"stop",
"\"_",
",_",
"instance_",
"._",
"name_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"Test",
"Insta",
"nce",
"Opera",
"tion",
"In",
"Parallel",
"To",
"Insta",
"nce",
"Creat",
"ion_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"rein",
"stall",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"\"-",
"f",
"\"_",
",_",
"instance_",
"._",
"name_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"qa",
"\\u",
"utils_",
"._",
"Assert",
"Command_",
"(_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"start",
"\"_",
",_",
"instance_",
"._",
"name_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Test",
"Parallel",
"Insta",
"nce",
"Rename",
"_",
"(_",
"instance_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"PERF",
"ORM",
"ANCE",
":",
" ",
"Insta",
"nce",
" ",
"rename",
" ",
"with",
" ",
"parall",
"el",
" ",
"instance",
" ",
"creati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"instance",
" ",
"rename",
" ",
"require",
"s",
" ",
"the",
" ",
"instance",
" ",
"to",
" ",
"be",
" ",
"down_",
"\\u\\u\\uNL\\u\\u\\u_",
"qa",
"\\u",
"utils_",
"._",
"Assert",
"Command_",
"(_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"stop",
"\"_",
",_",
"instance_",
"._",
"name_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"new",
"\\u",
"instance_",
"=_",
"qa",
"\\u",
"config_",
"._",
"Acquire",
"Instance_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"Test",
"Insta",
"nce",
"Opera",
"tion",
"In",
"Parallel",
"To",
"Insta",
"nce",
"Creat",
"ion_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"rename",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"instance_",
"._",
"name_",
",_",
"new",
"\\u",
"instance_",
"._",
"name_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"rename",
"\"_",
",_",
"\"--",
"submit",
"\"_",
",_",
"new",
"\\u",
"instance_",
"._",
"name_",
",_",
"instance_",
"._",
"name_",
"]_",
")_",
"\\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 ",
" _",
"new",
"\\u",
"instance_",
"._",
"Release_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"qa",
"\\u",
"utils_",
"._",
"Assert",
"Command_",
"(_",
"[_",
"\"",
"gn",
"t",
"-",
"instance",
"\"_",
",_",
"\"",
"start",
"\"_",
",_",
"instance_",
"._",
"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,
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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
] |
Implicit string concatenation in a list | enthought/mayavi/mayavi/core/common.py | [
{
"content": "def get_object_path(object, parent, path='engine'):\n \"\"\"Given a mayavi object on the tree view, this should find its\n \"path\" with respect to the parent object that contains it.\n \"\"\"\n def _get_child_trait(obj):\n if hasattr(obj, 'scenes'):\n return 'scenes'\n elif hasattr(obj, 'children'):\n return 'children'\n return ''\n\n def _finder(obj, to_find, path):\n if obj is to_find:\n return path\n else:\n child_t = _get_child_trait(obj)\n if child_t == '':\n return ''\n for i, o in enumerate(getattr(obj, child_t)):\n pth = _finder(o, to_find, '%s.%s[%d]'%(path, child_t, i))\n if len(pth) > 0:\n return pth\n return ''\n\n return _finder(parent, object, path)",
"metadata": "root.get_object_path",
"header": "['module', '___EOS___']",
"index": 106
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Implicit",
"_",
"string_",
"concate",
"nation_",
"in_",
"a_",
"list_",
"[SEP]_",
"module_",
"\\u\\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",
"object\\u",
"path_",
"(_",
"object_",
",_",
"parent_",
",_",
"path_",
"=_",
"'",
"eng",
"ine",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Give",
"n",
" ",
"a",
" ",
"maya",
"vi",
" ",
"object",
" ",
"on",
" ",
"the",
" ",
"tree",
" ",
"view",
",",
" ",
"this",
" ",
"shou",
"ld",
" ",
"find",
" ",
"its",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"path",
"\"",
" ",
"with",
" ",
"respec",
"t",
" ",
"to",
" ",
"the",
" ",
"parent",
" ",
"object",
" ",
"tha",
"t",
" ",
"contain",
"s",
" ",
"it",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u",
"get",
"\\u",
"child",
"\\u",
"trait_",
"(_",
"obj_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"hasattr_",
"(_",
"obj_",
",_",
"'",
"scenes",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'",
"scenes",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"hasattr_",
"(_",
"obj_",
",_",
"'",
"child",
"ren",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'",
"child",
"ren",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"finder_",
"(_",
"obj_",
",_",
"to",
"\\u",
"find_",
",_",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"obj_",
"is_",
"to",
"\\u",
"find_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"child",
"\\u",
"t_",
"=_",
"\\u",
"get",
"\\u",
"child",
"\\u",
"trait_",
"(_",
"obj_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"child",
"\\u",
"t_",
"==_",
"''_",
":_",
"\\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_",
"for_",
"i_",
",_",
"o_",
"in_",
"enumerate_",
"(_",
"getattr_",
"(_",
"obj_",
",_",
"child",
"\\u",
"t_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pth_",
"=_",
"\\u",
"finder_",
"(_",
"o_",
",_",
"to",
"\\u",
"find_",
",_",
"'%",
"s",
".",
"%",
"s",
"[",
"%",
"d",
"]'_",
"%_",
"(_",
"path_",
",_",
"child",
"\\u",
"t_",
",_",
"i_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"pth_",
")_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\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
] |
Unused import | StackStorm/st2/st2actions/tests/unit/test_windows_runners.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 os\nfrom unittest2 import TestCase\n\nimport mock\n\nfrom st2actions.runners.windows_runner import BaseWindowsRunner\nfrom st2actions.runners.windows_script_runner import WindowsScriptRunner\n\nBASE_DIR = os.path.dirname(os.path.abspath(__file__))\nFIXTURES_DIR = os.path.abspath(os.path.join(BASE_DIR, '../fixtures/windows'))\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class WindowsRunnerTestCase(TestCase):\n\n\n\n\n\n\n",
"metadata": "root.WindowsRunnerTestCase",
"header": "['module', '___EOS___']",
"index": 27
},
{
"content": " def test_get_winexe_command_args(self):\n arguments = [\n {\n 'host': 'localhost',\n 'username': 'Administrator1',\n 'password': 'bar1',\n 'command': 'powershell.exe \"C:\\\\\\\\myscript.ps1\"'\n },\n {\n 'host': '127.0.0.1',\n 'username': 'Administrator2',\n 'password': 'bar2',\n 'command': 'dir'\n },\n {\n 'host': 'localhost',\n 'username': 'Administrator3',\n 'password': 'bar3',\n 'command': 'dir',\n 'domain': 'MyDomain'\n }\n ]\n expected_values = [\n [\n 'winexe',\n '--interactive', '0',\n '-U', 'Administrator1%bar1',\n '//localhost',\n 'powershell.exe \"C:\\\\\\\\myscript.ps1\"'\n ],\n [\n 'winexe',\n '--interactive', '0',\n '-U', 'Administrator2%bar2',\n '//127.0.0.1',\n 'dir'\n ],\n [\n 'winexe',\n '--interactive', '0',\n '-U', 'MyDomain\\Administrator3%bar3',\n '//localhost',\n 'dir'\n ]\n ]\n\n runner = self._get_base_runner()\n for arguments, expected_value in zip(arguments, expected_values):\n actual_value = runner._get_winexe_command_args(**arguments)\n self.assertEqual(actual_value, expected_value)",
"metadata": "root.WindowsRunnerTestCase.test_get_winexe_command_args",
"header": "['class', 'WindowsRunnerTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 28
},
{
"content": " def test_get_smbclient_command_args(self):\n arguments = [\n {\n 'host': 'localhost',\n 'username': 'Administrator1',\n 'password': 'bar1',\n 'command': 'put /home/1.txt 1.txt',\n 'share': 'C$'\n },\n {\n 'host': 'localhost',\n 'username': 'Administrator2',\n 'password': 'bar2',\n 'command': 'put /home/2.txt 2.txt',\n 'share': 'D$'\n },\n {\n 'host': 'localhost',\n 'username': 'Administrator3',\n 'password': 'bar3',\n 'command': 'dir',\n 'share': 'E$',\n 'domain': 'MyDomain'\n }\n ]\n expected_values = [\n [\n 'smbclient',\n '-U', 'Administrator1%bar1',\n '//localhost/C$',\n '-c', 'put /home/1.txt 1.txt'\n ],\n [\n 'smbclient',\n '-U', 'Administrator2%bar2',\n '//localhost/D$',\n '-c', 'put /home/2.txt 2.txt'\n ],\n [\n 'smbclient',\n '-U', 'MyDomain\\Administrator3%bar3',\n '//localhost/E$',\n '-c', 'dir'\n ],\n ]\n\n runner = self._get_base_runner()\n for arguments, expected_value in zip(arguments, expected_values):\n actual_value = runner._get_smbclient_command_args(**arguments)\n self.assertEqual(actual_value, expected_value)",
"metadata": "root.WindowsRunnerTestCase.test_get_smbclient_command_args",
"header": "['class', 'WindowsRunnerTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 79
},
{
"content": " def test_get_script_args(self):\n arguments = [\n {\n 'positional_args': 'a b c',\n 'named_args': {\n 'arg1': 'value1',\n 'arg2': 'value2'\n }\n },\n {\n 'positional_args': 'a b c',\n 'named_args': {\n 'arg1': 'value1',\n 'arg2': True,\n 'arg3': False,\n 'arg4': ['foo', 'bar', 'baz']\n }\n }\n ]\n expected_values = [\n 'a b c -arg1 value1 -arg2 value2',\n 'a b c -arg1 value1 -arg2 -arg3:$false -arg4 foo,bar,baz'\n ]\n\n runner = self._get_script_runner()\n for arguments, expected_value in zip(arguments, expected_values):\n actual_value = runner._get_script_arguments(**arguments)\n self.assertEqual(actual_value, expected_value)",
"metadata": "root.WindowsRunnerTestCase.test_get_script_args",
"header": "['class', 'WindowsRunnerTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 130
},
{
"content": " def test_parse_share_information(self):\n runner = self._get_script_runner()\n\n fixture_path = os.path.join(FIXTURES_DIR, 'net_share_C_stdout.txt')\n with open(fixture_path, 'r') as fp:\n stdout = fp.read()\n\n result = runner._parse_share_information(stdout=stdout)\n\n expected_keys = ['share_name', 'path', 'remark', 'maximum_users', 'users', 'caching',\n 'permission']\n for key in expected_keys:\n self.assertTrue(key in result)\n\n self.assertEqual(result['share_name'], 'C$')\n self.assertEqual(result['path'], 'C:\\\\')\n self.assertEqual(result['users'], None)",
"metadata": "root.WindowsRunnerTestCase.test_parse_share_information",
"header": "['class', 'WindowsRunnerTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 159
},
{
"content": " @mock.patch('st2actions.runners.windows_script_runner.run_command')\n def test_get_share_absolute_path(self, mock_run_command):\n runner = self._get_script_runner()\n\n fixture_path = os.path.join(FIXTURES_DIR, 'net_share_C_stdout.txt')\n with open(fixture_path, 'r') as fp:\n stdout = fp.read()\n\n # Failure, non-zero status code\n mock_run_command.return_value = (2, '', '', False)\n self.assertRaises(Exception, runner._get_share_absolute_path, share='C$')\n\n # Failure, missing / corrupted data\n mock_run_command.return_value = (0, '', '', False)\n self.assertRaises(Exception, runner._get_share_absolute_path, share='C$')\n\n # Success, everything OK\n mock_run_command.return_value = (0, stdout, '', False)\n share_path = runner._get_share_absolute_path(share='C$')\n self.assertEqual(share_path, 'C:\\\\')",
"metadata": "root.WindowsRunnerTestCase.test_get_share_absolute_path",
"header": "['class', 'WindowsRunnerTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 177
},
{
"content": " def test_shell_command_parameter_escaping(self):\n pass",
"metadata": "root.WindowsRunnerTestCase.test_shell_command_parameter_escaping",
"header": "['class', 'WindowsRunnerTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 198
},
{
"content": " def _get_base_runner(self):\n class Runner(BaseWindowsRunner):\n def pre_run(self):\n pass\n\n def run(self):\n pass\n\n runner = Runner('id')\n return runner",
"metadata": "root.WindowsRunnerTestCase._get_base_runner",
"header": "['class', 'WindowsRunnerTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 201
},
{
"content": " def _get_script_runner(self):\n runner = WindowsScriptRunner('id')\n runner._host = None\n runner._username = None\n runner._password = None\n runner._timeout = None\n\n return runner",
"metadata": "root.WindowsRunnerTestCase._get_script_runner",
"header": "['class', 'WindowsRunnerTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 212
}
] | [] | [] | 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_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"unittest2_",
"import_",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"mock_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"st2",
"actions_",
"._",
"runners",
"_",
"._",
"windows",
"\\u",
"runner_",
"import_",
"Base",
"Window",
"s",
"Runner_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"st2",
"actions_",
"._",
"runners",
"_",
"._",
"windows",
"\\u",
"script",
"\\u",
"runner_",
"import_",
"Window",
"s",
"Script",
"Runner_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"BASE",
"\\u",
"DIR_",
"=_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"os_",
"._",
"path_",
"._",
"abspath_",
"(_",
"\\u\\u",
"file\\u\\u_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FIXTURE",
"S",
"\\u",
"DIR_",
"=_",
"os_",
"._",
"path_",
"._",
"abspath_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"BASE",
"\\u",
"DIR_",
",_",
"'../",
"fixture",
"s",
"/",
"windows",
"'_",
")_",
")_",
"\\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_",
"Window",
"s",
"Run",
"ner",
"Test",
"Case_",
"(_",
"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_",
"[SEP]_",
"class_",
"Window",
"s",
"Run",
"ner",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"get",
"\\u",
"wine",
"xe",
"\\u",
"command",
"\\u",
"args_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"arguments_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"host",
"'_",
":_",
"'",
"local",
"host",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
":_",
"'",
"Administra",
"tor",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"password",
"'_",
":_",
"'",
"bar",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"command",
"'_",
":_",
"'",
"powers",
"hell",
".",
"exe",
" ",
"\"",
"C",
":\\\\",
"\\\\\\\\\\\\",
"mys",
"cript",
".",
"ps",
"1",
"\"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"host",
"'_",
":_",
"'",
"127",
".0",
".0",
".1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
":_",
"'",
"Administra",
"tor",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"password",
"'_",
":_",
"'",
"bar",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"command",
"'_",
":_",
"'",
"dir",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"host",
"'_",
":_",
"'",
"local",
"host",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
":_",
"'",
"Administra",
"tor",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"password",
"'_",
":_",
"'",
"bar",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"command",
"'_",
":_",
"'",
"dir",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"domain",
"'_",
":_",
"'",
"My",
"Doma",
"in",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"values_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"wine",
"xe",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"interactive",
"'_",
",_",
"'",
"0",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"U",
"'_",
",_",
"'",
"Administra",
"tor",
"1",
"%",
"bar",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'//",
"local",
"host",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"powers",
"hell",
".",
"exe",
" ",
"\"",
"C",
":\\\\",
"\\\\\\\\\\\\",
"mys",
"cript",
".",
"ps",
"1",
"\"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"wine",
"xe",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"interactive",
"'_",
",_",
"'",
"0",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"U",
"'_",
",_",
"'",
"Administra",
"tor",
"2",
"%",
"bar",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'//",
"127",
".0",
".0",
".1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"dir",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"wine",
"xe",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"interactive",
"'_",
",_",
"'",
"0",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"U",
"'_",
",_",
"'",
"My",
"Doma",
"in",
"\\\\",
"Administra",
"tor",
"3",
"%",
"bar",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'//",
"local",
"host",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"dir",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"runner_",
"=_",
"self_",
"._",
"\\u",
"get",
"\\u",
"base",
"\\u",
"runner_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"arguments_",
",_",
"expected",
"\\u",
"value_",
"in_",
"zip_",
"(_",
"arguments_",
",_",
"expected",
"\\u",
"values_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"actual",
"\\u",
"value_",
"=_",
"runner_",
"._",
"\\u",
"get",
"\\u",
"wine",
"xe",
"\\u",
"command",
"\\u",
"args_",
"(_",
"**_",
"arguments_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"actual",
"\\u",
"value_",
",_",
"expected",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window",
"s",
"Run",
"ner",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"smb",
"client",
"\\u",
"command",
"\\u",
"args_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"arguments_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"host",
"'_",
":_",
"'",
"local",
"host",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
":_",
"'",
"Administra",
"tor",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"password",
"'_",
":_",
"'",
"bar",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"command",
"'_",
":_",
"'",
"put",
" ",
"/",
"home",
"/",
"1",
".",
"txt",
" ",
"1",
".",
"txt",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"share",
"'_",
":_",
"'",
"C",
"$'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"host",
"'_",
":_",
"'",
"local",
"host",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
":_",
"'",
"Administra",
"tor",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"password",
"'_",
":_",
"'",
"bar",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"command",
"'_",
":_",
"'",
"put",
" ",
"/",
"home",
"/",
"2",
".",
"txt",
" ",
"2",
".",
"txt",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"share",
"'_",
":_",
"'",
"D",
"$'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"host",
"'_",
":_",
"'",
"local",
"host",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
":_",
"'",
"Administra",
"tor",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"password",
"'_",
":_",
"'",
"bar",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"command",
"'_",
":_",
"'",
"dir",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"share",
"'_",
":_",
"'",
"E",
"$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"domain",
"'_",
":_",
"'",
"My",
"Doma",
"in",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"values_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"smb",
"client",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"U",
"'_",
",_",
"'",
"Administra",
"tor",
"1",
"%",
"bar",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'//",
"local",
"host",
"/",
"C",
"$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"c",
"'_",
",_",
"'",
"put",
" ",
"/",
"home",
"/",
"1",
".",
"txt",
" ",
"1",
".",
"txt",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"smb",
"client",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"U",
"'_",
",_",
"'",
"Administra",
"tor",
"2",
"%",
"bar",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'//",
"local",
"host",
"/",
"D",
"$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"c",
"'_",
",_",
"'",
"put",
" ",
"/",
"home",
"/",
"2",
".",
"txt",
" ",
"2",
".",
"txt",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"smb",
"client",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"U",
"'_",
",_",
"'",
"My",
"Doma",
"in",
"\\\\",
"Administra",
"tor",
"3",
"%",
"bar",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'//",
"local",
"host",
"/",
"E",
"$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"c",
"'_",
",_",
"'",
"dir",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"runner_",
"=_",
"self_",
"._",
"\\u",
"get",
"\\u",
"base",
"\\u",
"runner_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"arguments_",
",_",
"expected",
"\\u",
"value_",
"in_",
"zip_",
"(_",
"arguments_",
",_",
"expected",
"\\u",
"values_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"actual",
"\\u",
"value_",
"=_",
"runner_",
"._",
"\\u",
"get",
"\\u",
"smb",
"client",
"\\u",
"command",
"\\u",
"args_",
"(_",
"**_",
"arguments_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"actual",
"\\u",
"value_",
",_",
"expected",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window",
"s",
"Run",
"ner",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"script",
"\\u",
"args_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"arguments_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"positional",
"\\u",
"args",
"'_",
":_",
"'",
"a",
" ",
"b",
" ",
"c",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"named",
"\\u",
"args",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"arg",
"1",
"'_",
":_",
"'",
"value",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"arg",
"2",
"'_",
":_",
"'",
"value",
"2",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"positional",
"\\u",
"args",
"'_",
":_",
"'",
"a",
" ",
"b",
" ",
"c",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"named",
"\\u",
"args",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"arg",
"1",
"'_",
":_",
"'",
"value",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"arg",
"2",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"arg",
"3",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"arg",
"4",
"'_",
":_",
"[_",
"'",
"foo",
"'_",
",_",
"'",
"bar",
"'_",
",_",
"'",
"ba",
"z",
"'_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"values_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"a",
" ",
"b",
" ",
"c",
" ",
"-",
"arg",
"1",
" ",
"value",
"1",
" ",
"-",
"arg",
"2",
" ",
"value",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"a",
" ",
"b",
" ",
"c",
" ",
"-",
"arg",
"1",
" ",
"value",
"1",
" ",
"-",
"arg",
"2",
" ",
"-",
"arg",
"3",
":$",
"fal",
"se",
" ",
"-",
"arg",
"4",
" ",
"foo",
",",
"bar",
",",
"ba",
"z",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"runner_",
"=_",
"self_",
"._",
"\\u",
"get",
"\\u",
"script",
"\\u",
"runner_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"arguments_",
",_",
"expected",
"\\u",
"value_",
"in_",
"zip_",
"(_",
"arguments_",
",_",
"expected",
"\\u",
"values_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"actual",
"\\u",
"value_",
"=_",
"runner_",
"._",
"\\u",
"get",
"\\u",
"script",
"\\u",
"arguments_",
"(_",
"**_",
"arguments_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"actual",
"\\u",
"value_",
",_",
"expected",
"\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window",
"s",
"Run",
"ner",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"parse",
"\\u",
"share",
"\\u",
"information_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"runner_",
"=_",
"self_",
"._",
"\\u",
"get",
"\\u",
"script",
"\\u",
"runner_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"fixture",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"FIXTURE",
"S",
"\\u",
"DIR_",
",_",
"'",
"net",
"\\u",
"share",
"\\u",
"C",
"\\u",
"stdout",
".",
"txt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"open_",
"(_",
"fixture",
"\\u",
"path_",
",_",
"'",
"r",
"'_",
")_",
"as_",
"fp_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"stdout_",
"=_",
"fp_",
"._",
"read_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"=_",
"runner_",
"._",
"\\u",
"parse",
"\\u",
"share",
"\\u",
"information_",
"(_",
"stdout_",
"=_",
"stdout_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected",
"\\u",
"keys_",
"=_",
"[_",
"'",
"share",
"\\u",
"name",
"'_",
",_",
"'",
"path",
"'_",
",_",
"'",
"remark",
"'_",
",_",
"'",
"maxim",
"um",
"\\u",
"users",
"'_",
",_",
"'",
"users",
"'_",
",_",
"'",
"caching",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"permissi",
"on",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"key_",
"in_",
"expected",
"\\u",
"keys_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"True_",
"(_",
"key_",
"in_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"result_",
"[_",
"'",
"share",
"\\u",
"name",
"'_",
"]_",
",_",
"'",
"C",
"$'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"result_",
"[_",
"'",
"path",
"'_",
"]_",
",_",
"'",
"C",
":\\\\",
"\\\\'",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"result_",
"[_",
"'",
"users",
"'_",
"]_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window",
"s",
"Run",
"ner",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"'",
"st2",
"action",
"s",
".",
"runners",
".",
"windows",
"\\u",
"script",
"\\u",
"runn",
"er",
".",
"run",
"\\u",
"command",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"share",
"\\u",
"abs",
"olute",
"\\u",
"path_",
"(_",
"self_",
",_",
"mock",
"\\u",
"run",
"\\u",
"command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"runner_",
"=_",
"self_",
"._",
"\\u",
"get",
"\\u",
"script",
"\\u",
"runner_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"fixture",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"FIXTURE",
"S",
"\\u",
"DIR_",
",_",
"'",
"net",
"\\u",
"share",
"\\u",
"C",
"\\u",
"stdout",
".",
"txt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"open_",
"(_",
"fixture",
"\\u",
"path_",
",_",
"'",
"r",
"'_",
")_",
"as_",
"fp_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"stdout_",
"=_",
"fp_",
"._",
"read_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fail",
"ure",
",",
" ",
"non",
"-",
"zero",
" ",
"status",
" ",
"code_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"mock",
"\\u",
"run",
"\\u",
"command_",
"._",
"return",
"\\u",
"value_",
"=_",
"(_",
"2_",
",_",
"''_",
",_",
"''_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Exception_",
",_",
"runner_",
"._",
"\\u",
"get",
"\\u",
"share",
"\\u",
"abs",
"olute",
"\\u",
"path_",
",_",
"share_",
"=_",
"'",
"C",
"$'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fail",
"ure",
",",
" ",
"missi",
"ng",
" ",
"/",
" ",
"corrupted",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"run",
"\\u",
"command_",
"._",
"return",
"\\u",
"value_",
"=_",
"(_",
"0_",
",_",
"''_",
",_",
"''_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Exception_",
",_",
"runner_",
"._",
"\\u",
"get",
"\\u",
"share",
"\\u",
"abs",
"olute",
"\\u",
"path_",
",_",
"share_",
"=_",
"'",
"C",
"$'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Success",
",",
" ",
"every",
"thing",
" ",
"OK_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"run",
"\\u",
"command_",
"._",
"return",
"\\u",
"value_",
"=_",
"(_",
"0_",
",_",
"stdout_",
",_",
"''_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"share",
"\\u",
"path_",
"=_",
"runner_",
"._",
"\\u",
"get",
"\\u",
"share",
"\\u",
"abs",
"olute",
"\\u",
"path_",
"(_",
"share_",
"=_",
"'",
"C",
"$'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"share",
"\\u",
"path_",
",_",
"'",
"C",
":\\\\",
"\\\\'",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window",
"s",
"Run",
"ner",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"shell",
"\\u",
"command",
"\\u",
"parameter",
"\\u",
"esca",
"ping_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window",
"s",
"Run",
"ner",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"get",
"\\u",
"base",
"\\u",
"runner_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"class_",
"Runner_",
"(_",
"Base",
"Window",
"s",
"Runner_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"pre",
"\\u",
"run_",
"(_",
"self_",
")_",
":_",
"\\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_",
"def_",
"run_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"runner_",
"=_",
"Runner_",
"(_",
"'",
"id",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"runner_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Window",
"s",
"Run",
"ner",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"get",
"\\u",
"script",
"\\u",
"runner_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"runner_",
"=_",
"Window",
"s",
"Script",
"Runner_",
"(_",
"'",
"id",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"runner_",
"._",
"\\u",
"host_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"runner_",
"._",
"\\u",
"username_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"runner_",
"._",
"\\u",
"password_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"runner_",
"._",
"\\u",
"timeout_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"runner_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused import | dimagi/commcare-hq/corehq/ex-submodules/couchexport/schema.py | [
{
"content": "from couchdbkit.client import Database\nfrom django.conf import settings\nfrom couchexport.exceptions import SchemaInferenceError\nfrom couchexport.models import ExportSchema\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def build_latest_schema(schema_index):\n \"\"\"\n Build a schema, directly from the index. Also creates a saved checkpoint.\n \"\"\"\n from couchexport.export import ExportConfiguration\n db = Database(settings.COUCH_DATABASE)\n previous_export = ExportSchema.last(schema_index)\n config = ExportConfiguration(db, schema_index,\n previous_export=previous_export)\n schema = config.get_latest_schema()\n if not schema:\n return None\n updated_checkpoint = config.create_new_checkpoint()\n return updated_checkpoint",
"metadata": "root.build_latest_schema",
"header": "['module', '___EOS___']",
"index": 6
},
{
"content": "def get_kind(doc):\n if doc == \"\" or doc is None:\n return \"null\"\n elif isinstance(doc, dict):\n return \"dict\"\n elif isinstance(doc, list):\n return \"list\"\n else:\n return \"string\"",
"metadata": "root.get_kind",
"header": "['module', '___EOS___']",
"index": 22
},
{
"content": "def make_schema(doc):\n doc_kind = get_kind(doc)\n if doc_kind == \"null\":\n return None\n elif doc_kind == \"dict\":\n schema = {}\n for key in doc:\n schema[key] = make_schema(doc[key])\n return schema\n elif doc_kind == \"list\":\n schema = None\n for doc_ in doc:\n schema = extend_schema(schema, doc_)\n return [schema]\n elif doc_kind == \"string\":\n return \"string\"",
"metadata": "root.make_schema",
"header": "['module', '___EOS___']",
"index": 33
},
{
"content": "def extend_schema(schema, doc):\n schema_kind = get_kind(schema)\n doc_kind = get_kind(doc)\n\n # 1. anything + null => anything\n if doc_kind == \"null\":\n return schema\n if schema_kind == \"null\":\n return make_schema(doc)\n\n # 2. not-list => [not-list] when compared to a list\n if schema_kind != \"list\" and doc_kind == \"list\":\n schema_kind = \"list\"\n schema = [schema]\n if doc_kind != \"list\" and schema_kind == \"list\":\n doc_kind = \"list\"\n doc = [doc]\n\n # 3. not-dict => {'': not-dict} when compared to a dict\n if schema_kind != 'dict' and doc_kind == 'dict':\n if not schema_kind == 'string':\n raise SchemaInferenceError(\"%r is type %r but should be type 'string'!!\" % (schema, schema_kind))\n schema_kind = 'dict'\n schema = {'': schema_kind}\n if doc_kind != 'dict' and schema_kind == 'dict':\n if not doc_kind == 'string':\n raise SchemaInferenceError(\"%r is type %r but should be type 'string'!!\" % (doc, doc_kind))\n doc_kind = 'dict'\n doc = {'': doc_kind}\n\n # 4. Now that schema and doc are of the same kind\n if schema_kind == doc_kind == \"dict\":\n for key in doc:\n schema[key] = extend_schema(schema.get(key, None), doc[key])\n return schema\n if schema_kind == doc_kind == \"list\":\n for doc_ in doc:\n schema[0] = extend_schema(schema[0], doc_)\n return schema\n if schema_kind == doc_kind == \"string\":\n return \"string\"\n\n # 5. We should have covered every case above, but if not, fail hard\n raise SchemaInferenceError(\"Mismatched schema (%r) and doc (%r)\" % (schema, doc))",
"metadata": "root.extend_schema",
"header": "['module', '___EOS___']",
"index": 51
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"couchdb",
"kit_",
"._",
"client_",
"import_",
"Database_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"couch",
"export_",
"._",
"exceptions_",
"import_",
"Schema",
"Infer",
"ence",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"couch",
"export_",
"._",
"models_",
"import_",
"Export",
"Schema_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"build",
"\\u",
"late",
"st",
"\\u",
"schema_",
"(_",
"schema",
"\\u",
"index_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Build",
" ",
"a",
" ",
"schema",
",",
" ",
"direct",
"ly",
" ",
"from",
" ",
"the",
" ",
"index",
".",
" ",
"Al",
"so",
" ",
"create",
"s",
" ",
"a",
" ",
"saved",
" ",
"checkp",
"oint",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"couch",
"export_",
"._",
"export_",
"import_",
"Export",
"Configuration_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"db_",
"=_",
"Database_",
"(_",
"settings_",
"._",
"COU",
"CH",
"\\u",
"DATABASE_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"previ",
"ous",
"\\u",
"export_",
"=_",
"Export",
"Schema_",
"._",
"last_",
"(_",
"schema",
"\\u",
"index_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"config_",
"=_",
"Export",
"Configuration_",
"(_",
"db_",
",_",
"schema",
"\\u",
"index_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"previ",
"ous",
"\\u",
"export_",
"=_",
"previ",
"ous",
"\\u",
"export_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"schema_",
"=_",
"config_",
"._",
"get",
"\\u",
"late",
"st",
"\\u",
"schema_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"schema_",
":_",
"\\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_",
"update",
"d\\u",
"checkpoint_",
"=_",
"config_",
"._",
"create",
"\\u",
"new",
"\\u",
"checkpoint_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"update",
"d\\u",
"checkpoint_",
"\\u\\u\\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",
"kind_",
"(_",
"doc_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"doc_",
"==_",
"\"\"_",
"or_",
"doc_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"null",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"doc_",
",_",
"dict_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"dict",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"doc_",
",_",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"list",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"string",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"make",
"\\u",
"schema_",
"(_",
"doc_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"doc",
"\\u",
"kind_",
"=_",
"get",
"\\u",
"kind_",
"(_",
"doc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"doc",
"\\u",
"kind_",
"==_",
"\"",
"null",
"\"_",
":_",
"\\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_",
"elif_",
"doc",
"\\u",
"kind_",
"==_",
"\"",
"dict",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"schema_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"key_",
"in_",
"doc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"schema_",
"[_",
"key_",
"]_",
"=_",
"make",
"\\u",
"schema_",
"(_",
"doc_",
"[_",
"key_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"schema_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"doc",
"\\u",
"kind_",
"==_",
"\"",
"list",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"schema_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"doc",
"\\u_",
"in_",
"doc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"schema_",
"=_",
"extend",
"\\u",
"schema_",
"(_",
"schema_",
",_",
"doc",
"\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"[_",
"schema_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"doc",
"\\u",
"kind_",
"==_",
"\"",
"string",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"string",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"extend",
"\\u",
"schema_",
"(_",
"schema_",
",_",
"doc_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"schema",
"\\u",
"kind_",
"=_",
"get",
"\\u",
"kind_",
"(_",
"schema_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"doc",
"\\u",
"kind_",
"=_",
"get",
"\\u",
"kind_",
"(_",
"doc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"1",
".",
" ",
"anyt",
"hing",
" ",
"+",
" ",
"null",
" ",
"=>",
" ",
"anyt",
"hing_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"doc",
"\\u",
"kind_",
"==_",
"\"",
"null",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"schema_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"schema",
"\\u",
"kind_",
"==_",
"\"",
"null",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"make",
"\\u",
"schema_",
"(_",
"doc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"2",
".",
" ",
"not",
"-",
"list",
" ",
"=>",
" ",
"[",
"not",
"-",
"list",
"]",
" ",
"whe",
"n",
" ",
"compare",
"d",
" ",
"to",
" ",
"a",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"schema",
"\\u",
"kind_",
"!=_",
"\"",
"list",
"\"_",
"and_",
"doc",
"\\u",
"kind_",
"==_",
"\"",
"list",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"schema",
"\\u",
"kind_",
"=_",
"\"",
"list",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"schema_",
"=_",
"[_",
"schema_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"doc",
"\\u",
"kind_",
"!=_",
"\"",
"list",
"\"_",
"and_",
"schema",
"\\u",
"kind_",
"==_",
"\"",
"list",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"doc",
"\\u",
"kind_",
"=_",
"\"",
"list",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"doc_",
"=_",
"[_",
"doc_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"3",
".",
" ",
"not",
"-",
"dict",
" ",
"=>",
" ",
"{",
"''",
":",
" ",
"not",
"-",
"dict",
"}",
" ",
"whe",
"n",
" ",
"compare",
"d",
" ",
"to",
" ",
"a",
" ",
"dict_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"schema",
"\\u",
"kind_",
"!=_",
"'",
"dict",
"'_",
"and_",
"doc",
"\\u",
"kind_",
"==_",
"'",
"dict",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"schema",
"\\u",
"kind_",
"==_",
"'",
"string",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Schema",
"Infer",
"ence",
"Error_",
"(_",
"\"%",
"r",
" ",
"is",
" ",
"type",
" ",
"%",
"r",
" ",
"but",
" ",
"shou",
"ld",
" ",
"be",
" ",
"type",
" ",
"'",
"string",
"'!",
"!\"_",
"%_",
"(_",
"schema_",
",_",
"schema",
"\\u",
"kind_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"schema",
"\\u",
"kind_",
"=_",
"'",
"dict",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"schema_",
"=_",
"{_",
"''_",
":_",
"schema",
"\\u",
"kind_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"doc",
"\\u",
"kind_",
"!=_",
"'",
"dict",
"'_",
"and_",
"schema",
"\\u",
"kind_",
"==_",
"'",
"dict",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"doc",
"\\u",
"kind_",
"==_",
"'",
"string",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Schema",
"Infer",
"ence",
"Error_",
"(_",
"\"%",
"r",
" ",
"is",
" ",
"type",
" ",
"%",
"r",
" ",
"but",
" ",
"shou",
"ld",
" ",
"be",
" ",
"type",
" ",
"'",
"string",
"'!",
"!\"_",
"%_",
"(_",
"doc_",
",_",
"doc",
"\\u",
"kind_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"doc",
"\\u",
"kind_",
"=_",
"'",
"dict",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"doc_",
"=_",
"{_",
"''_",
":_",
"doc",
"\\u",
"kind_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"4",
".",
" ",
"No",
"w",
" ",
"tha",
"t",
" ",
"schema",
" ",
"and",
" ",
"doc",
" ",
"are",
" ",
"of",
" ",
"the",
" ",
"same",
" ",
"kind_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"schema",
"\\u",
"kind_",
"==_",
"doc",
"\\u",
"kind_",
"==_",
"\"",
"dict",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"key_",
"in_",
"doc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"schema_",
"[_",
"key_",
"]_",
"=_",
"extend",
"\\u",
"schema_",
"(_",
"schema_",
"._",
"get_",
"(_",
"key_",
",_",
"None_",
")_",
",_",
"doc_",
"[_",
"key_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"schema_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"schema",
"\\u",
"kind_",
"==_",
"doc",
"\\u",
"kind_",
"==_",
"\"",
"list",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"doc",
"\\u_",
"in_",
"doc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"schema_",
"[_",
"0_",
"]_",
"=_",
"extend",
"\\u",
"schema_",
"(_",
"schema_",
"[_",
"0_",
"]_",
",_",
"doc",
"\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"schema_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"schema",
"\\u",
"kind_",
"==_",
"doc",
"\\u",
"kind_",
"==_",
"\"",
"string",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"string",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"5",
".",
" ",
"We",
" ",
"shou",
"ld",
" ",
"have",
" ",
"covered",
" ",
"every",
" ",
"case",
" ",
"above",
",",
" ",
"but",
" ",
"if",
" ",
"not",
",",
" ",
"fail",
" ",
"hard",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"raise_",
"Schema",
"Infer",
"ence",
"Error_",
"(_",
"\"",
"Mismatch",
"ed",
" ",
"schema",
" ",
"(%",
"r",
")",
" ",
"and",
" ",
"doc",
" ",
"(%",
"r",
")\"_",
"%_",
"(_",
"schema_",
",_",
"doc_",
")_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
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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
] |
Unused import | allegro/ralph/vagrant/provisioning_scripts/createsuperuser.py | [
{
"content": "#!/usr/bin/python\nimport os\nimport django\nfrom django.contrib.auth import get_user_model\n\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"ralph.settings\")\ndjango.setup()\n\nprint('Updating superuser info')\nu = get_user_model().objects.get(username='ralph')\nu.set_password('ralph')\nu.is_superuser = True\nu.is_staff = True\nu.save()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"django_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"contrib_",
"._",
"auth_",
"import_",
"get",
"\\u",
"user",
"\\u",
"model_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"os_",
"._",
"environ_",
"._",
"setdefault_",
"(_",
"\"",
"DJANGO",
"\\u",
"SETTING",
"S",
"\\u",
"MODUL",
"E",
"\"_",
",_",
"\"",
"ral",
"ph",
".",
"settings",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"django_",
"._",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"(_",
"'",
"Up",
"dati",
"ng",
" ",
"super",
"user",
" ",
"info",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"=_",
"get",
"\\u",
"user",
"\\u",
"model_",
"(_",
")_",
"._",
"objects_",
"._",
"get_",
"(_",
"username_",
"=_",
"'",
"ral",
"ph",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"._",
"set\\u",
"password_",
"(_",
"'",
"ral",
"ph",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"._",
"is",
"\\u",
"superuser_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"._",
"is",
"\\u",
"staff_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"._",
"save_",
"(_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | CenterForOpenScience/osf.io/website/project/views/drafts.py | [
{
"content": "@must_have_permission(ADMIN)\n@must_be_valid_project\ndef new_draft_registration(auth, node, *args, **kwargs):\n \"\"\"Create a new draft registration for the node\n\n :return: Redirect to the new draft's edit page\n :rtype: flask.redirect\n :raises: HTTPError\n \"\"\"\n if node.is_registration:\n raise HTTPError(http.FORBIDDEN, data={\n 'message_short': \"Can't create draft\",\n 'message_long': \"Creating draft registrations on registered projects is not allowed.\"\n })\n data = request.values\n\n schema_name = data.get('schema_name')\n if not schema_name:\n raise HTTPError(\n http.BAD_REQUEST,\n data={\n 'message_short': 'Must specify a schema_name',\n 'message_long': 'Please specify a schema_name'\n }\n )\n\n schema_version = data.get('schema_version', 2)\n\n meta_schema = get_schema_or_fail(\n Q('name', 'eq', schema_name) &\n Q('schema_version', 'eq', int(schema_version))\n )\n draft = DraftRegistration.create_from_node(\n node,\n user=auth.user,\n schema=meta_schema,\n data={}\n )\n return redirect(node.web_url_for('edit_draft_registration_page', draft_id=draft._id))",
"metadata": "root.new_draft_registration",
"header": "['module', '___EOS___']",
"index": 232
}
] | [] | [] | 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_",
"@_",
"must",
"\\u",
"have",
"\\u",
"permission_",
"(_",
"ADMIN_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"must",
"\\u",
"be",
"\\u",
"valid",
"\\u",
"project_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"new",
"\\u",
"draft",
"\\u",
"registration_",
"(_",
"auth_",
",_",
"node_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Creat",
"e",
" ",
"a",
" ",
"new",
" ",
"draft",
" ",
"registration",
" ",
"for",
" ",
"the",
" ",
"node",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"Redirect",
" ",
"to",
" ",
"the",
" ",
"new",
" ",
"draft",
"'",
"s",
" ",
"edit",
" ",
"page",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"rty",
"pe",
":",
" ",
"fla",
"sk",
".",
"redirec",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"raise",
"s",
":",
" ",
"HTTP",
"Error",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"node_",
"._",
"is",
"\\u",
"registration_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"HTTP",
"Error_",
"(_",
"http_",
"._",
"FORB",
"IDD",
"EN_",
",_",
"data_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"message",
"\\u",
"short",
"'_",
":_",
"\"",
"Can",
"'",
"t",
" ",
"create",
" ",
"draft",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"message",
"\\u",
"long",
"'_",
":_",
"\"",
"Creat",
"ing",
" ",
"draft",
" ",
"registration",
"s",
" ",
"on",
" ",
"register",
"ed",
" ",
"project",
"s",
" ",
"is",
" ",
"not",
" ",
"allow",
"ed",
".\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data_",
"=_",
"request_",
"._",
"values_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"schema",
"\\u",
"name_",
"=_",
"data_",
"._",
"get_",
"(_",
"'",
"schema",
"\\u",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"schema",
"\\u",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"HTTP",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"http_",
"._",
"BAD",
"\\u",
"REQUEST_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"message",
"\\u",
"short",
"'_",
":_",
"'",
"Mus",
"t",
" ",
"speci",
"fy",
" ",
"a",
" ",
"schema",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"message",
"\\u",
"long",
"'_",
":_",
"'",
"Ple",
"ase",
" ",
"speci",
"fy",
" ",
"a",
" ",
"schema",
"\\u",
"name",
"'_",
"\\u\\u\\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_",
"schema",
"\\u",
"version_",
"=_",
"data_",
"._",
"get_",
"(_",
"'",
"schema",
"\\u",
"version",
"'_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"meta",
"\\u",
"schema_",
"=_",
"get",
"\\u",
"schema",
"\\u",
"or",
"\\u",
"fail_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Q_",
"(_",
"'",
"name",
"'_",
",_",
"'",
"eq",
"'_",
",_",
"schema",
"\\u",
"name_",
")_",
"&_",
"\\u\\u\\uNL\\u\\u\\u_",
"Q_",
"(_",
"'",
"schema",
"\\u",
"version",
"'_",
",_",
"'",
"eq",
"'_",
",_",
"int_",
"(_",
"schema",
"\\u",
"version_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"draft_",
"=_",
"Dra",
"ft",
"Registration",
"_",
"._",
"create",
"\\u",
"from",
"\\u",
"node_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"node_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"user_",
"=_",
"auth_",
"._",
"user_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"schema_",
"=_",
"meta",
"\\u",
"schema_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"{_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"redirect_",
"(_",
"node_",
"._",
"web",
"\\u",
"url",
"\\u",
"for_",
"(_",
"'",
"edit",
"\\u",
"draft",
"\\u",
"registration",
"\\u",
"page",
"'_",
",_",
"draft",
"\\u",
"id_",
"=_",
"draft_",
"._",
"\\u",
"id_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | Yelp/paasta/paasta_itests/steps/cleanup_chronos_job_steps.py | [
{
"content": "# Copyright 2015 Yelp Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nimport json\n\nfrom behave import then\nfrom behave import when\n\nfrom paasta_tools.chronos_tools import compose_job_id\nfrom paasta_tools.utils import _run\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "@when(('I launch {num_jobs} {state} jobs for the service \"{service}\"'\n ' with scheduled chronos instance \"{job}\"'))\ndef launch_jobs(context, num_jobs, state, service, job):\n client = context.chronos_client\n jobs = [{\n 'async': False,\n 'command': 'echo 1',\n 'epsilon': 'PT15M',\n 'name': compose_job_id(service, job),\n 'owner': 'paasta',\n 'disabled': True,\n 'schedule': 'R/2014-01-01T00:00:00Z/PT60M',\n } for x in range(0, int(num_jobs))]\n for job in jobs:\n try:\n print 'attempting to create job %s' % job['name']\n client.add(job)\n except Exception:\n print 'Error creating test job: %s' % json.dumps(job)\n raise\n\n # a 'configured' job is one which has had the appropriate\n # yelp-soa configs into place.\n # an 'unconfigured' job represents a job which may at one stage\n # been a configured chronos job, but no longer has the\n # corresponding configuration in place the target for.\n # 'unconfigured' jobs are the target for cleanup_chronos_jobs\n if state == \"configured\":\n context.configured_job_names = [job['name'] for job in jobs]\n elif state == \"unconfigured\":\n context.unconfigured_job_names = [job['name'] for job in jobs]",
"metadata": "root.launch_jobs",
"header": "['module', '___EOS___']",
"index": 22
},
{
"content": "@when('I launch {num_jobs} non-paasta jobs')\ndef launch_non_paasta_jobs(context, num_jobs):\n client = context.chronos_client\n jobs = [{\n 'async': False,\n 'command': 'echo 1',\n 'epsilon': 'PT15M',\n 'name': 'foobar%d' % job,\n 'owner': 'rogue',\n 'disabled': True,\n 'schedule': 'R/2014-01-01T00:00:00Z/PT60M',\n } for job in range(0, int(num_jobs))]\n context.non_paasta_jobs = [job['name'] for job in jobs]\n for job in jobs:\n try:\n print 'attempting to create job %s' % job['name']\n client.add(job)\n except Exception:\n print 'Error creating test job: %s' % json.dumps(job)\n raise",
"metadata": "root.launch_non_paasta_jobs",
"header": "['module', '___EOS___']",
"index": 55
},
{
"content": "@then(u'cleanup_chronos_jobs exits with return code \"{expected_return_code}\" and the correct output')\ndef check_cleanup_chronos_jobs_output(context, expected_return_code):\n cmd = '../paasta_tools/cleanup_chronos_jobs.py --soa-dir %s' % context.soa_dir\n exit_code, output = _run(cmd)\n print context.unconfigured_job_names\n print 'Got exitcode %s with output:\\n%s' % (exit_code, output)\n\n assert exit_code == int(expected_return_code)\n assert \"Successfully Removed Tasks (if any were running) for:\" in output\n assert \"Successfully Removed Jobs:\" in output\n for job in context.unconfigured_job_names:\n assert ' %s' % job in output",
"metadata": "root.check_cleanup_chronos_jobs_output",
"header": "['module', '___EOS___']",
"index": 77
},
{
"content": "@when(u'we run cleanup_chronos_jobs')\ndef run_cleanup_chronos_jobs(context):\n cmd = '../paasta_tools/cleanup_chronos_jobs.py --soa-dir %s' % context.soa_dir\n context.exit_code, context.output = _run(cmd)\n print context.output",
"metadata": "root.run_cleanup_chronos_jobs",
"header": "['module', '___EOS___']",
"index": 91
},
{
"content": "@then('the non-paasta jobs are not in the job list')\ndef check_non_paasta_jobs(context):\n jobs = context.chronos_client.list()\n running_job_names = [job['name'] for job in jobs]\n assert not any([job_name in running_job_names for job_name in context.non_paasta_jobs])",
"metadata": "root.check_non_paasta_jobs",
"header": "['module', '___EOS___']",
"index": 98
},
{
"content": "@then('the {state} chronos jobs are not in the job list')\ndef assert_jobs_not_in_job_list(context, state):\n jobs = context.chronos_client.list()\n if state == \"configured\":\n state_list = context.configured_job_names\n elif state == \"unconfigured\":\n state_list = context.unconfigured_job_names\n assert_no_job_names_in_list(state_list, jobs)",
"metadata": "root.assert_jobs_not_in_job_list",
"header": "['module', '___EOS___']",
"index": 105
},
{
"content": "@then('the {state} chronos jobs are in the job list')\ndef assert_jobs_all_in_job_list(context, state):\n jobs = context.chronos_client.list()\n if state == \"configured\":\n state_list = context.configured_job_names\n elif state == \"unconfigured\":\n state_list = context.unconfigured_job_names\n assert_all_job_names_in_list(state_list, jobs)",
"metadata": "root.assert_jobs_all_in_job_list",
"header": "['module', '___EOS___']",
"index": 115
},
{
"content": "def assert_no_job_names_in_list(names, jobs):\n running_job_names = [job['name'] for job in jobs]\n assert all([job_name not in running_job_names for job_name in names])",
"metadata": "root.assert_no_job_names_in_list",
"header": "['module', '___EOS___']",
"index": 125
},
{
"content": "def assert_all_job_names_in_list(names, jobs):\n running_job_names = [job['name'] for job in jobs]\n assert all([job_name in running_job_names for job_name in names])",
"metadata": "root.assert_all_job_names_in_list",
"header": "['module', '___EOS___']",
"index": 130
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"201",
"5",
" ",
"Ye",
"lp",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"json_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"behave",
"_",
"import_",
"then_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"behave",
"_",
"import_",
"when_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"paasta",
"\\u",
"tools_",
"._",
"chrono",
"s",
"\\u",
"tools_",
"import_",
"compose",
"\\u",
"job",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"paasta",
"\\u",
"tools_",
"._",
"utils_",
"import_",
"\\u",
"run_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"@_",
"when_",
"(_",
"(_",
"'",
"I",
" ",
"launch",
" ",
"{",
"num",
"\\u",
"jobs",
"}",
" ",
"{",
"state",
"}",
" ",
"jobs",
" ",
"for",
" ",
"the",
" ",
"service",
" ",
"\"{",
"service",
"}\"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"with",
" ",
"schedule",
"d",
" ",
"chrono",
"s",
" ",
"instance",
" ",
"\"{",
"job",
"}\"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"launch",
"\\u",
"jobs_",
"(_",
"context_",
",_",
"num",
"\\u",
"jobs_",
",_",
"state_",
",_",
"service_",
",_",
"job_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"=_",
"context_",
"._",
"chrono",
"s",
"\\u",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"jobs_",
"=_",
"[_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"async",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"command",
"'_",
":_",
"'",
"echo",
" ",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"eps",
"ilon",
"'_",
":_",
"'",
"PT",
"15",
"M",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"compose",
"\\u",
"job",
"\\u",
"id_",
"(_",
"service_",
",_",
"job_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"owner",
"'_",
":_",
"'",
"paasta",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"disable",
"d",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"schedule",
"'_",
":_",
"'",
"R",
"/",
"2014",
"-0",
"1",
"-0",
"1",
"T",
"00",
":",
"00",
":",
"00",
"Z",
"/",
"PT",
"60",
"M",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"for_",
"x_",
"in_",
"range_",
"(_",
"0_",
",_",
"int_",
"(_",
"num",
"\\u",
"jobs_",
")_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"job_",
"in_",
"jobs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
"atte",
"mpt",
"ing",
" ",
"to",
" ",
"create",
" ",
"job",
" ",
"%",
"s",
"'_",
"%_",
"job_",
"[_",
"'",
"name",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"._",
"add_",
"(_",
"job_",
")_",
"\\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 ",
" _",
"print_",
"'",
"Error",
" ",
"creati",
"ng",
" ",
"test",
" ",
"job",
":",
" ",
"%",
"s",
"'_",
"%_",
"json_",
"._",
"dumps_",
"(_",
"job_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"a",
" ",
"'",
"configur",
"ed",
"'",
" ",
"job",
" ",
"is",
" ",
"one",
" ",
"whi",
"ch",
" ",
"has",
" ",
"had",
" ",
"the",
" ",
"appropr",
"iate",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"yel",
"p",
"-",
"soa",
" ",
"configs",
" ",
"int",
"o",
" ",
"place",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"an",
" ",
"'",
"unconfi",
"gur",
"ed",
"'",
" ",
"job",
" ",
"represent",
"s",
" ",
"a",
" ",
"job",
" ",
"whi",
"ch",
" ",
"may",
" ",
"at",
" ",
"one",
" ",
"stage_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"bee",
"n",
" ",
"a",
" ",
"configur",
"ed",
" ",
"chrono",
"s",
" ",
"job",
",",
" ",
"but",
" ",
"no",
" ",
"long",
"er",
" ",
"has",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"correspond",
"ing",
" ",
"configura",
"tion",
" ",
"in",
" ",
"place",
" ",
"the",
" ",
"target",
" ",
"for",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"'",
"unconfi",
"gur",
"ed",
"'",
" ",
"jobs",
" ",
"are",
" ",
"the",
" ",
"target",
" ",
"for",
" ",
"clean",
"up",
"\\u",
"chrono",
"s",
"\\u",
"jobs_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"state_",
"==_",
"\"",
"configur",
"ed",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"._",
"configur",
"ed",
"\\u",
"job",
"\\u",
"names_",
"=_",
"[_",
"job_",
"[_",
"'",
"name",
"'_",
"]_",
"for_",
"job_",
"in_",
"jobs_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"state_",
"==_",
"\"",
"unconfi",
"gur",
"ed",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"._",
"unconfi",
"gur",
"ed",
"\\u",
"job",
"\\u",
"names_",
"=_",
"[_",
"job_",
"[_",
"'",
"name",
"'_",
"]_",
"for_",
"job_",
"in_",
"jobs_",
"]_",
"\\u\\u\\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_",
"@_",
"when_",
"(_",
"'",
"I",
" ",
"launch",
" ",
"{",
"num",
"\\u",
"jobs",
"}",
" ",
"non",
"-",
"paasta",
" ",
"jobs",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"launch",
"\\u",
"non",
"\\u",
"paasta",
"\\u",
"jobs_",
"(_",
"context_",
",_",
"num",
"\\u",
"jobs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"=_",
"context_",
"._",
"chrono",
"s",
"\\u",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"jobs_",
"=_",
"[_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"async",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"command",
"'_",
":_",
"'",
"echo",
" ",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"eps",
"ilon",
"'_",
":_",
"'",
"PT",
"15",
"M",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'",
"fooba",
"r",
"%",
"d",
"'_",
"%_",
"job_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"owner",
"'_",
":_",
"'",
"rog",
"ue",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"disable",
"d",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"schedule",
"'_",
":_",
"'",
"R",
"/",
"2014",
"-0",
"1",
"-0",
"1",
"T",
"00",
":",
"00",
":",
"00",
"Z",
"/",
"PT",
"60",
"M",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"for_",
"job_",
"in_",
"range_",
"(_",
"0_",
",_",
"int_",
"(_",
"num",
"\\u",
"jobs_",
")_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"non",
"\\u",
"paasta",
"\\u",
"jobs_",
"=_",
"[_",
"job_",
"[_",
"'",
"name",
"'_",
"]_",
"for_",
"job_",
"in_",
"jobs_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"job_",
"in_",
"jobs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
"atte",
"mpt",
"ing",
" ",
"to",
" ",
"create",
" ",
"job",
" ",
"%",
"s",
"'_",
"%_",
"job_",
"[_",
"'",
"name",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"._",
"add_",
"(_",
"job_",
")_",
"\\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 ",
" _",
"print_",
"'",
"Error",
" ",
"creati",
"ng",
" ",
"test",
" ",
"job",
":",
" ",
"%",
"s",
"'_",
"%_",
"json_",
"._",
"dumps_",
"(_",
"job_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"then_",
"(_",
"u",
"'",
"clean",
"up",
"\\u",
"chrono",
"s",
"\\u",
"jobs",
" ",
"exits",
" ",
"with",
" ",
"return",
" ",
"code",
" ",
"\"{",
"expected",
"\\u",
"return",
"\\u",
"code",
"}\"",
" ",
"and",
" ",
"the",
" ",
"correct",
" ",
"output",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"check",
"\\u",
"clean",
"up",
"\\u",
"chrono",
"s",
"\\u",
"jobs",
"\\u",
"output_",
"(_",
"context_",
",_",
"expected",
"\\u",
"return",
"\\u",
"code_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"=_",
"'../",
"paasta",
"\\u",
"tool",
"s",
"/",
"clean",
"up",
"\\u",
"chrono",
"s",
"\\u",
"jobs",
".",
"py",
" ",
"--",
"soa",
"-",
"dir",
" ",
"%",
"s",
"'_",
"%_",
"context_",
"._",
"soa",
"\\u",
"dir_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"exit",
"\\u",
"code_",
",_",
"output_",
"=_",
"\\u",
"run_",
"(_",
"cmd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"context_",
"._",
"unconfi",
"gur",
"ed",
"\\u",
"job",
"\\u",
"names_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"'",
"Got",
" ",
"exit",
"code",
" ",
"%",
"s",
" ",
"with",
" ",
"output",
":\\\\",
"n",
"%",
"s",
"'_",
"%_",
"(_",
"exit",
"\\u",
"code_",
",_",
"output_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert_",
"exit",
"\\u",
"code_",
"==_",
"int_",
"(_",
"expected",
"\\u",
"return",
"\\u",
"code_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"\"",
"Success",
"full",
"y",
" ",
"Remove",
"d",
" ",
"Task",
"s",
" ",
"(",
"if",
" ",
"any",
" ",
"wer",
"e",
" ",
"runn",
"ing",
")",
" ",
"for",
":\"_",
"in_",
"output_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"\"",
"Success",
"full",
"y",
" ",
"Remove",
"d",
" ",
"Jo",
"bs",
":\"_",
"in_",
"output_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"job_",
"in_",
"context_",
"._",
"unconfi",
"gur",
"ed",
"\\u",
"job",
"\\u",
"names_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"'",
" ",
" ",
"%",
"s",
"'_",
"%_",
"job_",
"in_",
"output_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"when_",
"(_",
"u",
"'",
"we",
" ",
"run",
" ",
"clean",
"up",
"\\u",
"chrono",
"s",
"\\u",
"jobs",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"run",
"\\u",
"clean",
"up",
"\\u",
"chrono",
"s",
"\\u",
"jobs_",
"(_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"=_",
"'../",
"paasta",
"\\u",
"tool",
"s",
"/",
"clean",
"up",
"\\u",
"chrono",
"s",
"\\u",
"jobs",
".",
"py",
" ",
"--",
"soa",
"-",
"dir",
" ",
"%",
"s",
"'_",
"%_",
"context_",
"._",
"soa",
"\\u",
"dir_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"exit",
"\\u",
"code_",
",_",
"context_",
"._",
"output_",
"=_",
"\\u",
"run_",
"(_",
"cmd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"context_",
"._",
"output_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"then_",
"(_",
"'",
"the",
" ",
"non",
"-",
"paasta",
" ",
"jobs",
" ",
"are",
" ",
"not",
" ",
"in",
" ",
"the",
" ",
"job",
" ",
"list",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"check",
"\\u",
"non",
"\\u",
"paasta",
"\\u",
"jobs_",
"(_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"jobs_",
"=_",
"context_",
"._",
"chrono",
"s",
"\\u",
"client_",
"._",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"runn",
"ing",
"\\u",
"job",
"\\u",
"names_",
"=_",
"[_",
"job_",
"[_",
"'",
"name",
"'_",
"]_",
"for_",
"job_",
"in_",
"jobs_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"not_",
"any_",
"(_",
"[_",
"job",
"\\u",
"name_",
"in_",
"runn",
"ing",
"\\u",
"job",
"\\u",
"names_",
"for_",
"job",
"\\u",
"name_",
"in_",
"context_",
"._",
"non",
"\\u",
"paasta",
"\\u",
"jobs_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"then_",
"(_",
"'",
"the",
" ",
"{",
"state",
"}",
" ",
"chrono",
"s",
" ",
"jobs",
" ",
"are",
" ",
"not",
" ",
"in",
" ",
"the",
" ",
"job",
" ",
"list",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"assert",
"\\u",
"jobs",
"\\u",
"not",
"\\u",
"in",
"\\u",
"job",
"\\u",
"list_",
"(_",
"context_",
",_",
"state_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"jobs_",
"=_",
"context_",
"._",
"chrono",
"s",
"\\u",
"client_",
"._",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"state_",
"==_",
"\"",
"configur",
"ed",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"state",
"\\u",
"list_",
"=_",
"context_",
"._",
"configur",
"ed",
"\\u",
"job",
"\\u",
"names_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"state_",
"==_",
"\"",
"unconfi",
"gur",
"ed",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"state",
"\\u",
"list_",
"=_",
"context_",
"._",
"unconfi",
"gur",
"ed",
"\\u",
"job",
"\\u",
"names_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert",
"\\u",
"no",
"\\u",
"job",
"\\u",
"names",
"\\u",
"in",
"\\u",
"list_",
"(_",
"state",
"\\u",
"list_",
",_",
"jobs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"then_",
"(_",
"'",
"the",
" ",
"{",
"state",
"}",
" ",
"chrono",
"s",
" ",
"jobs",
" ",
"are",
" ",
"in",
" ",
"the",
" ",
"job",
" ",
"list",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"assert",
"\\u",
"jobs",
"\\u",
"all",
"\\u",
"in",
"\\u",
"job",
"\\u",
"list_",
"(_",
"context_",
",_",
"state_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"jobs_",
"=_",
"context_",
"._",
"chrono",
"s",
"\\u",
"client_",
"._",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"state_",
"==_",
"\"",
"configur",
"ed",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"state",
"\\u",
"list_",
"=_",
"context_",
"._",
"configur",
"ed",
"\\u",
"job",
"\\u",
"names_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"state_",
"==_",
"\"",
"unconfi",
"gur",
"ed",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"state",
"\\u",
"list_",
"=_",
"context_",
"._",
"unconfi",
"gur",
"ed",
"\\u",
"job",
"\\u",
"names_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert",
"\\u",
"all",
"\\u",
"job",
"\\u",
"names",
"\\u",
"in",
"\\u",
"list_",
"(_",
"state",
"\\u",
"list_",
",_",
"jobs_",
")_",
"\\u\\u\\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_",
"assert",
"\\u",
"no",
"\\u",
"job",
"\\u",
"names",
"\\u",
"in",
"\\u",
"list_",
"(_",
"names_",
",_",
"jobs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"runn",
"ing",
"\\u",
"job",
"\\u",
"names_",
"=_",
"[_",
"job_",
"[_",
"'",
"name",
"'_",
"]_",
"for_",
"job_",
"in_",
"jobs_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"all_",
"(_",
"[_",
"job",
"\\u",
"name_",
"not_",
"in_",
"runn",
"ing",
"\\u",
"job",
"\\u",
"names_",
"for_",
"job",
"\\u",
"name_",
"in_",
"names_",
"]_",
")_",
"\\u\\u\\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_",
"assert",
"\\u",
"all",
"\\u",
"job",
"\\u",
"names",
"\\u",
"in",
"\\u",
"list_",
"(_",
"names_",
",_",
"jobs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"runn",
"ing",
"\\u",
"job",
"\\u",
"names_",
"=_",
"[_",
"job_",
"[_",
"'",
"name",
"'_",
"]_",
"for_",
"job_",
"in_",
"jobs_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"all_",
"(_",
"[_",
"job",
"\\u",
"name_",
"in_",
"runn",
"ing",
"\\u",
"job",
"\\u",
"names_",
"for_",
"job",
"\\u",
"name_",
"in_",
"names_",
"]_",
")_"
] | [
4,
4,
4,
4,
4,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | pantsbuild/pants/tests/python/pants_test/util/xml_test_base.py | [
{
"content": "# coding=utf-8\n# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import (absolute_import, division, generators, nested_scopes, print_function,\n unicode_literals, with_statement)\n\nimport textwrap\nimport unittest\nfrom contextlib import contextmanager\n\nfrom pants.util.contextutil import temporary_file\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class XmlTestBase(unittest.TestCase):\n \"\"\"Base class for tests that parse xml.\"\"\"\n",
"metadata": "root.XmlTestBase",
"header": "['module', '___EOS___']",
"index": 14
},
{
"content": " @contextmanager\n def xml_file(self,\n manifest_element='manifest',\n package_attribute='package',\n package_value='org.pantsbuild.example.hello',\n uses_sdk_element='uses-sdk',\n android_attribute='android:targetSdkVersion',\n activity_element='activity',\n android_name_attribute='android:name',\n application_name_value='org.pantsbuild.example.hello.HelloWorld'):\n \"\"\"Represent an .xml file (Here an AndroidManifest.xml is used).\"\"\"\n with temporary_file() as fp:\n fp.write(textwrap.dedent(\n \"\"\"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <{manifest} xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:unrelated=\"http://schemas.android.com/apk/res/android\"\n {package}=\"{package_name}\" >\n <{uses_sdk}\n {android}=\"19\" />\n <application >\n <{activity}\n {android_name}=\"{application_name}\" >\n </{activity}>\n </application>\n </{manifest}>\"\"\".format(manifest=manifest_element,\n package=package_attribute,\n package_name=package_value,\n uses_sdk=uses_sdk_element,\n android=android_attribute,\n activity=activity_element,\n android_name=android_name_attribute,\n application_name=application_name_value)))\n fp.close()\n path = fp.name\n yield path",
"metadata": "root.XmlTestBase.xml_file",
"header": "['class', 'XmlTestBase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 17
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"codi",
"ng",
"=",
"utf",
"-",
"8_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2016",
" ",
"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_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"(_",
"abs",
"olute",
"\\u",
"import_",
",_",
"division_",
",_",
"generators_",
",_",
"nest",
"ed",
"\\u",
"scopes_",
",_",
"print",
"\\u",
"function_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"unicode",
"\\u",
"literals_",
",_",
"with",
"\\u",
"statement_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"textwrap_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"contextlib_",
"import_",
"contextmanager_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"pants_",
"._",
"util_",
"._",
"context",
"util_",
"import_",
"temporar",
"y",
"\\u",
"file_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Xm",
"l",
"Test",
"Base_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Base",
" ",
"class",
" ",
"for",
" ",
"tests",
" ",
"tha",
"t",
" ",
"parse",
" ",
"xml",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Xm",
"l",
"Test",
"Base_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"contextmanager_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"xml",
"\\u",
"file_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"manifest",
"\\u",
"element_",
"=_",
"'",
"manifest",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"package",
"\\u",
"attribute_",
"=_",
"'",
"package",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"package",
"\\u",
"value_",
"=_",
"'",
"org",
".",
"pant",
"sbu",
"ild",
".",
"example",
".",
"hell",
"o",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"use",
"s",
"\\u",
"sd",
"k",
"\\u",
"element_",
"=_",
"'",
"use",
"s",
"-",
"sd",
"k",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"android",
"\\u",
"attribute_",
"=_",
"'",
"android",
":",
"target",
"Sd",
"k",
"Version",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"activit",
"y",
"\\u",
"element_",
"=_",
"'",
"activit",
"y",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"android",
"\\u",
"name",
"\\u",
"attribute_",
"=_",
"'",
"android",
":",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"applica",
"tion",
"\\u",
"name",
"\\u",
"value_",
"=_",
"'",
"org",
".",
"pant",
"sbu",
"ild",
".",
"example",
".",
"hell",
"o",
".",
"Hell",
"o",
"Wor",
"ld",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Represent",
" ",
"an",
" ",
".",
"xml",
" ",
"file",
" ",
"(",
"Her",
"e",
" ",
"an",
" ",
"And",
"roid",
"Manifest",
".",
"xml",
" ",
"is",
" ",
"used",
").\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"temporar",
"y",
"\\u",
"file_",
"(_",
")_",
"as_",
"fp_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fp_",
"._",
"write_",
"(_",
"textwrap_",
"._",
"dedent_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"<",
"?",
"xml",
" ",
"version",
"=\"",
"1.0",
"\"",
" ",
"encoding",
"=\"",
"utf",
"-",
"8",
"\"?",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"{",
"manifest",
"}",
" ",
"xml",
"ns",
":",
"android",
"=\"",
"http",
"://",
"schema",
"s",
".",
"android",
".",
"com",
"/",
"apk",
"/",
"res",
"/",
"android",
"\"",
"\\",
"10",
";",
" ",
" ",
"xml",
"ns",
":",
"unre",
"late",
"d",
"=\"",
"http",
"://",
"schema",
"s",
".",
"android",
".",
"com",
"/",
"apk",
"/",
"res",
"/",
"android",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"{",
"package",
"}=",
"\"{",
"package",
"\\u",
"name",
"}\"",
" ",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"{",
"use",
"s",
"\\u",
"sd",
"k",
"}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"{",
"android",
"}=",
"\"",
"1",
"9",
"\"",
" ",
"/>",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"applica",
"tion",
" ",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"{",
"activit",
"y",
"}",
"\\",
"10",
";",
" ",
" ",
"{",
"android",
"\\u",
"name",
"}=",
"\"{",
"applica",
"tion",
"\\u",
"name",
"}\"",
" ",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"{",
"activit",
"y",
"}>",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"applica",
"tion",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"{",
"manifest",
"}>",
"\"\"\"_",
"._",
"format_",
"(_",
"manifest_",
"=_",
"manifest",
"\\u",
"element_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"package_",
"=_",
"package",
"\\u",
"attribute_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"package",
"\\u",
"name_",
"=_",
"package",
"\\u",
"value_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"use",
"s",
"\\u",
"sdk_",
"=_",
"use",
"s",
"\\u",
"sd",
"k",
"\\u",
"element_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"android",
"_",
"=_",
"android",
"\\u",
"attribute_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"activity_",
"=_",
"activit",
"y",
"\\u",
"element_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"android",
"\\u",
"name_",
"=_",
"android",
"\\u",
"name",
"\\u",
"attribute_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"applica",
"tion",
"\\u",
"name_",
"=_",
"applica",
"tion",
"\\u",
"name",
"\\u",
"value_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fp_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"path_",
"=_",
"fp_",
"._",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yield_",
"path_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Except block handles 'BaseException' | googlei18n/nototools/nototools/unittests/layout.py | [
{
"content": "def _run_harfbuzz(text, font, language, extra_parameters=None):\n \"\"\"Run harfbuzz on some text and return the shaped list.\"\"\"\n try:\n # if extra_parameters is a string, split it into a list\n extra_parameters = extra_parameters.split(' ')\n except AttributeError:\n pass\n hb_output = render.run_harfbuzz_on_text(\n text, font, language, extra_parameters)\n return json.loads(hb_output)",
"metadata": "root._run_harfbuzz",
"header": "['module', '___EOS___']",
"index": 20
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"run",
"\\u",
"har",
"fb",
"uz",
"z_",
"(_",
"text_",
",_",
"font_",
",_",
"language_",
",_",
"extra",
"\\u",
"parameters_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Run",
" ",
"har",
"fb",
"uz",
"z",
" ",
"on",
" ",
"some",
" ",
"text",
" ",
"and",
" ",
"return",
" ",
"the",
" ",
"shaped",
" ",
"list",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"if",
" ",
"extra",
"\\u",
"parameter",
"s",
" ",
"is",
" ",
"a",
" ",
"string",
",",
" ",
"split",
" ",
"it",
" ",
"int",
"o",
" ",
"a",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"extra",
"\\u",
"parameters_",
"=_",
"extra",
"\\u",
"parameters_",
"._",
"split_",
"(_",
"'",
" ",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Attribute",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"hb",
"\\u",
"output_",
"=_",
"render_",
"._",
"run",
"\\u",
"har",
"fb",
"uz",
"z",
"\\u",
"on",
"\\u",
"text_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"text_",
",_",
"font_",
",_",
"language_",
",_",
"extra",
"\\u",
"parameters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"json_",
"._",
"loads_",
"(_",
"hb",
"\\u",
"output_",
")_",
"\\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
] |
Unused import | deliveryhero/lymph/lymph/services/node.py | [
{
"content": "import json\nimport logging\nimport gevent\nimport os\nimport psutil\nimport six\nfrom gevent import subprocess\nfrom six.moves import range\n\nfrom lymph.core.interfaces import Interface\nfrom lymph.core.monitoring.metrics import Generator\nfrom lymph.utils.sockets import create_socket\n\n\nlogger = logging.getLogger(__name__)\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Process(object):\n\n\n\n\n",
"metadata": "root.Process",
"header": "['module', '___EOS___']",
"index": 17
},
{
"content": " def __init__(self, cmd, env=None, service_type='n/a'):\n self.cmd = cmd\n self.env = env\n self.service_type = service_type\n self._process = None\n self._popen = None",
"metadata": "root.Process.__init__",
"header": "['class', 'Process', '(', 'object', ')', ':', '___EOS___']",
"index": 18
},
{
"content": " def is_running(self):\n return self._process and self._process.is_running()",
"metadata": "root.Process.is_running",
"header": "['class', 'Process', '(', 'object', ')', ':', '___EOS___']",
"index": 25
},
{
"content": " def start(self):\n self._popen = subprocess.Popen(\n self.cmd, env=self.env, close_fds=False)\n self._process = psutil.Process(self._popen.pid)\n self._process.cpu_percent()",
"metadata": "root.Process.start",
"header": "['class', 'Process', '(', 'object', ')', ':', '___EOS___']",
"index": 28
},
{
"content": " def stop(self, **kwargs):\n signalnum = kwargs.get('signalnum')\n try:\n if signalnum:\n self._process.send_signal(signalnum)\n else:\n self._process.terminate()\n self._process.wait()\n except psutil.NoSuchProcess:\n pass",
"metadata": "root.Process.stop",
"header": "['class', 'Process', '(', 'object', ')', ':', '___EOS___']",
"index": 34
},
{
"content": " def restart(self):\n print(\"restarting %s\" % self)\n self.stop()\n self.start()",
"metadata": "root.Process.restart",
"header": "['class', 'Process', '(', 'object', ')', ':', '___EOS___']",
"index": 45
},
{
"content": " def get_metrics(self):\n if not self.is_running():\n return\n tags = {'service_type': self.service_type}\n try:\n memory = self._process.memory_info()\n yield 'node.process.memory.rss', memory.rss, tags\n yield 'node.process.memory.vms', memory.vms, tags\n yield 'node.process.cpu', self._process.cpu_percent(), tags\n except psutil.NoSuchProcess:\n pass",
"metadata": "root.Process.get_metrics",
"header": "['class', 'Process', '(', 'object', ')', ':', '___EOS___']",
"index": 50
},
{
"content": "class Node(Interface):\n\n\n\n\n",
"metadata": "root.Node",
"header": "['module', '___EOS___']",
"index": 63
},
{
"content": " def __init__(self, *args, **kwargs):\n super(Node, self).__init__(*args, **kwargs)\n self.sockets = {}\n self.processes = []\n self.running = False\n self._sockets = []\n self._services = []",
"metadata": "root.Node.__init__",
"header": "['class', 'Node', '(', 'Interface', ')', ':', '___EOS___']",
"index": 64
},
{
"content": " def apply_config(self, config):\n for name, c in six.iteritems(config.get('instances', {})):\n self._services.append((name, c.get('command'), c.get('numprocesses', 1)))\n\n socket_config = config.get_raw('sockets', ())\n if isinstance(socket_config, dict):\n socket_config = socket_config.values()\n for c in socket_config:\n self._sockets.append((c.get('host'), c.get('port')))",
"metadata": "root.Node.apply_config",
"header": "['class', 'Node', '(', 'Interface', ')', ':', '___EOS___']",
"index": 72
},
{
"content": " def on_start(self):\n self.create_shared_sockets()\n self.running = True\n shared_fds = json.dumps({port: s.fileno() for port, s in six.iteritems(self.sockets)})\n for service_type, cmd, num in self._services:\n env = os.environ.copy()\n env.update({\n 'LYMPH_NODE': self.container.endpoint,\n 'LYMPH_MONITOR': self.container.monitor.endpoint,\n 'LYMPH_NODE_IP': self.container.server.ip,\n 'LYMPH_SHARED_SOCKET_FDS': shared_fds,\n 'LYMPH_SERVICE_NAME': service_type,\n })\n for i in range(num):\n p = Process(cmd.split(' '), env=env, service_type=service_type)\n self.processes.append(p)\n self.metrics.add(Generator(p.get_metrics))\n logger.info('starting %s', cmd)\n p.start()\n self.container.spawn(self.watch_processes)",
"metadata": "root.Node.on_start",
"header": "['class', 'Node', '(', 'Interface', ')', ':', '___EOS___']",
"index": 82
},
{
"content": " def on_stop(self, **kwargs):\n logger.info(\"waiting for all service processes to die ...\")\n self.running = False\n for p in self.processes:\n p.stop(**kwargs)\n super(Node, self).on_stop(**kwargs)",
"metadata": "root.Node.on_stop",
"header": "['class', 'Node', '(', 'Interface', ')', ':', '___EOS___']",
"index": 103
},
{
"content": " def create_shared_sockets(self):\n for host, port in self._sockets:\n sock = create_socket(\n '%s:%s' % (host or self.container.server.ip, port), inheritable=True)\n self.sockets[port] = sock",
"metadata": "root.Node.create_shared_sockets",
"header": "['class', 'Node', '(', 'Interface', ')', ':', '___EOS___']",
"index": 110
},
{
"content": " def watch_processes(self):\n while True:\n for process in self.processes:\n try:\n status = process._process.status()\n except psutil.NoSuchProcess:\n if self.running:\n process.start()\n continue\n if status in (psutil.STATUS_ZOMBIE, psutil.STATUS_DEAD):\n if self.running:\n process.restart()\n gevent.sleep(1)",
"metadata": "root.Node.watch_processes",
"header": "['class', 'Node', '(', 'Interface', ')', ':', '___EOS___']",
"index": 116
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"json_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"gevent_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"psutil_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"six_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"gevent_",
"import_",
"subprocess_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"six_",
"._",
"moves_",
"import_",
"range_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ly",
"mph",
"_",
"._",
"core_",
"._",
"interfaces_",
"import_",
"Interface_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ly",
"mph",
"_",
"._",
"core_",
"._",
"monitorin",
"g_",
"._",
"metrics_",
"import_",
"Generator_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ly",
"mph",
"_",
"._",
"utils_",
"._",
"sockets_",
"import_",
"create",
"\\u",
"socket_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Process_",
"(_",
"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_",
"[SEP]_",
"class_",
"Process_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"cmd_",
",_",
"env_",
"=_",
"None_",
",_",
"service",
"\\u",
"type_",
"=_",
"'",
"n",
"/",
"a",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"cmd_",
"=_",
"cmd_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"env_",
"=_",
"env_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"service",
"\\u",
"type_",
"=_",
"service",
"\\u",
"type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"process_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"popen_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Process_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"is",
"\\u",
"running_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"process_",
"and_",
"self_",
"._",
"\\u",
"process_",
"._",
"is",
"\\u",
"running_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Process_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"start_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"popen_",
"=_",
"subprocess_",
"._",
"Popen_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"cmd_",
",_",
"env_",
"=_",
"self_",
"._",
"env_",
",_",
"close",
"\\u",
"fds_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"process_",
"=_",
"psutil_",
"._",
"Process_",
"(_",
"self_",
"._",
"\\u",
"popen_",
"._",
"pid_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"process_",
"._",
"cpu",
"\\u",
"percent_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Process_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"stop_",
"(_",
"self_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"signal",
"num_",
"=_",
"kwargs_",
"._",
"get_",
"(_",
"'",
"signal",
"num",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"signal",
"num_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"process_",
"._",
"send",
"\\u",
"signal_",
"(_",
"signal",
"num_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"process_",
"._",
"terminate_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"process_",
"._",
"wait_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"psutil_",
"._",
"No",
"Suc",
"h",
"Process_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Process_",
"(_",
"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_",
"restart_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"\"",
"restart",
"ing",
" ",
"%",
"s",
"\"_",
"%_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"stop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"start_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Process_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"metrics_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"is",
"\\u",
"running_",
"(_",
")_",
":_",
"\\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_",
"tags_",
"=_",
"{_",
"'",
"service",
"\\u",
"type",
"'_",
":_",
"self_",
"._",
"service",
"\\u",
"type_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"memory_",
"=_",
"self_",
"._",
"\\u",
"process_",
"._",
"memory",
"\\u",
"info_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yield_",
"'",
"node",
".",
"process",
".",
"memory",
".",
"rs",
"s",
"'_",
",_",
"memory_",
"._",
"rss_",
",_",
"tags_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yield_",
"'",
"node",
".",
"process",
".",
"memory",
".",
"vms",
"'_",
",_",
"memory_",
"._",
"vms_",
",_",
"tags_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yield_",
"'",
"node",
".",
"process",
".",
"cpu",
"'_",
",_",
"self_",
"._",
"\\u",
"process_",
"._",
"cpu",
"\\u",
"percent_",
"(_",
")_",
",_",
"tags_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"psutil_",
"._",
"No",
"Suc",
"h",
"Process_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Node_",
"(_",
"Interface_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Node_",
"(_",
"Interface_",
")_",
":_",
"\\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_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Node_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"sockets_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"processes_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"running_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"sockets_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"services_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Node_",
"(_",
"Interface_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"appl",
"y",
"\\u",
"config_",
"(_",
"self_",
",_",
"config_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"name_",
",_",
"c_",
"in_",
"six_",
"._",
"iteritems_",
"(_",
"config_",
"._",
"get_",
"(_",
"'",
"instance",
"s",
"'_",
",_",
"{_",
"}_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"services_",
"._",
"append_",
"(_",
"(_",
"name_",
",_",
"c_",
"._",
"get_",
"(_",
"'",
"command",
"'_",
")_",
",_",
"c_",
"._",
"get_",
"(_",
"'",
"nump",
"rocess",
"es",
"'_",
",_",
"1_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"socket",
"\\u",
"config_",
"=_",
"config_",
"._",
"get",
"\\u",
"raw_",
"(_",
"'",
"socket",
"s",
"'_",
",_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"socket",
"\\u",
"config_",
",_",
"dict_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"socket",
"\\u",
"config_",
"=_",
"socket",
"\\u",
"config_",
"._",
"values_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"c_",
"in_",
"socket",
"\\u",
"config_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"sockets_",
"._",
"append_",
"(_",
"(_",
"c_",
"._",
"get_",
"(_",
"'",
"host",
"'_",
")_",
",_",
"c_",
"._",
"get_",
"(_",
"'",
"port",
"'_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Node_",
"(_",
"Interface_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"on",
"\\u",
"start_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"create",
"\\u",
"shared",
"\\u",
"sockets_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"running_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"shared",
"\\u",
"fds_",
"=_",
"json_",
"._",
"dumps_",
"(_",
"{_",
"port_",
":_",
"s_",
"._",
"fileno_",
"(_",
")_",
"for_",
"port_",
",_",
"s_",
"in_",
"six_",
"._",
"iteritems_",
"(_",
"self_",
"._",
"sockets_",
")_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"service",
"\\u",
"type_",
",_",
"cmd_",
",_",
"num_",
"in_",
"self_",
"._",
"\\u",
"services_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"env_",
"=_",
"os_",
"._",
"environ_",
"._",
"copy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"env_",
"._",
"update_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"LY",
"MP",
"H",
"\\u",
"NODE",
"'_",
":_",
"self_",
"._",
"container_",
"._",
"endpoint_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"LY",
"MP",
"H",
"\\u",
"MONITOR",
"'_",
":_",
"self_",
"._",
"container_",
"._",
"monitor_",
"._",
"endpoint_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"LY",
"MP",
"H",
"\\u",
"NODE",
"\\u",
"IP",
"'_",
":_",
"self_",
"._",
"container_",
"._",
"server_",
"._",
"ip_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"LY",
"MP",
"H",
"\\u",
"SHARED",
"\\u",
"SOCKET",
"\\u",
"FD",
"S",
"'_",
":_",
"shared",
"\\u",
"fds_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"LY",
"MP",
"H",
"\\u",
"SERV",
"ICE",
"\\u",
"NAME",
"'_",
":_",
"service",
"\\u",
"type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"num_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"p_",
"=_",
"Process_",
"(_",
"cmd_",
"._",
"split_",
"(_",
"'",
" ",
"'_",
")_",
",_",
"env_",
"=_",
"env_",
",_",
"service",
"\\u",
"type_",
"=_",
"service",
"\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"processes_",
"._",
"append_",
"(_",
"p_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"metrics_",
"._",
"add_",
"(_",
"Generator_",
"(_",
"p_",
"._",
"get",
"\\u",
"metrics_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logger_",
"._",
"info_",
"(_",
"'",
"startin",
"g",
" ",
"%",
"s",
"'_",
",_",
"cmd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p_",
"._",
"start_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"container_",
"._",
"spawn_",
"(_",
"self_",
"._",
"watch",
"\\u",
"processes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Node_",
"(_",
"Interface_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"on",
"\\u",
"stop_",
"(_",
"self_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"info_",
"(_",
"\"",
"wait",
"ing",
" ",
"for",
" ",
"all",
" ",
"service",
" ",
"process",
"es",
" ",
"to",
" ",
"die",
" ",
"...\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"running_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"p_",
"in_",
"self_",
"._",
"processes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"p_",
"._",
"stop_",
"(_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"super_",
"(_",
"Node_",
",_",
"self_",
")_",
"._",
"on",
"\\u",
"stop_",
"(_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Node_",
"(_",
"Interface_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"create",
"\\u",
"shared",
"\\u",
"sockets_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"host_",
",_",
"port_",
"in_",
"self_",
"._",
"\\u",
"sockets_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sock_",
"=_",
"create",
"\\u",
"socket_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'%",
"s",
":",
"%",
"s",
"'_",
"%_",
"(_",
"host_",
"or_",
"self_",
"._",
"container_",
"._",
"server_",
"._",
"ip_",
",_",
"port_",
")_",
",_",
"inherita",
"ble_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"sockets_",
"[_",
"port_",
"]_",
"=_",
"sock_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Node_",
"(_",
"Interface_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"watch",
"\\u",
"processes_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"process_",
"in_",
"self_",
"._",
"processes_",
":_",
"\\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 ",
" ",
"_",
"status_",
"=_",
"process_",
"._",
"\\u",
"process_",
"._",
"status_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"psutil_",
"._",
"No",
"Suc",
"h",
"Process_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"self_",
"._",
"running_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"process_",
"._",
"start_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"status_",
"in_",
"(_",
"psutil_",
"._",
"STATUS",
"\\u",
"ZO",
"MB",
"IE_",
",_",
"psutil_",
"._",
"STATUS",
"\\u",
"DEAD",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"self_",
"._",
"running_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"process_",
"._",
"restart_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
First parameter of a method is not named 'self' | dimagi/commcare-hq/corehq/apps/app_manager/xml_utils.py | [
{
"content": " def structure(self):\n return self",
"metadata": "root.XMLObject.structure",
"header": "['class', 'XMLObject', '(', 'object', ')', ':', '___EOS___']",
"index": 27
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"XML",
"Object_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"structure_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"\\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
] |
Unreachable code | mne-tools/mne-python/mne/externals/tempita/__init__.py | [
{
"content": "def parse_default(tokens, name, context):\n first, pos = tokens[0]\n assert first.startswith('default ')\n first = first.split(None, 1)[1]\n parts = first.split('=', 1)\n if len(parts) == 1:\n raise TemplateError(\n \"Expression must be {{default var=value}}; no = found in %r\" %\n first, position=pos, name=name)\n var = parts[0].strip()\n if ',' in var:\n raise TemplateError(\n \"{{default x, y = ...}} is not supported\",\n position=pos, name=name)\n if not var_re.search(var):\n raise TemplateError(\n \"Not a valid variable name for {{default}}: %r\"\n % var, position=pos, name=name)\n expr = parts[1].strip()\n return ('default', pos, var, expr), tokens[1:]",
"metadata": "root.parse_default",
"header": "['module', '___EOS___']",
"index": 1068
}
] | [] | [] | 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_",
"def_",
"parse",
"\\u",
"default_",
"(_",
"tokens_",
",_",
"name_",
",_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"first_",
",_",
"pos_",
"=_",
"tokens_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"first_",
"._",
"startswith_",
"(_",
"'",
"default",
" ",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"first_",
"=_",
"first_",
"._",
"split_",
"(_",
"None_",
",_",
"1_",
")_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parts_",
"=_",
"first_",
"._",
"split_",
"(_",
"'='_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"parts_",
")_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Templa",
"te",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Expression",
" ",
"must",
" ",
"be",
" ",
"{{",
"default",
" ",
"var",
"=",
"value",
"}}",
";",
" ",
"no",
" ",
"=",
" ",
"found",
" ",
"in",
" ",
"%",
"r",
"\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"first_",
",_",
"position_",
"=_",
"pos_",
",_",
"name_",
"=_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"var_",
"=_",
"parts_",
"[_",
"0_",
"]_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"','_",
"in_",
"var_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Templa",
"te",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"{",
"{",
"default",
" ",
"x",
",",
" ",
"y",
" ",
"=",
" ",
"...",
"}}",
" ",
"is",
" ",
"not",
" ",
"support",
"ed",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"position_",
"=_",
"pos_",
",_",
"name_",
"=_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"var",
"\\u",
"re_",
"._",
"search_",
"(_",
"var_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Templa",
"te",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Not",
" ",
"a",
" ",
"valid",
" ",
"variab",
"le",
" ",
"name",
" ",
"for",
" ",
"{{",
"default",
"}}",
":",
" ",
"%",
"r",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"%_",
"var_",
",_",
"position_",
"=_",
"pos_",
",_",
"name_",
"=_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"expr_",
"=_",
"parts_",
"[_",
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[
{
"content": "# This file is part of PyOP2\n#\n# PyOP2 is Copyright (c) 2012, Imperial College London and\n# others. Please see the AUTHORS file in the main source directory for\n# a full list of copyright holders. 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\n# are met:\n#\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n# * The name of Imperial College London or that of other\n# contributors may not be used to endorse or promote products\n# derived from this software without specific prior written\n# permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTERS\n# ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n# OF THE POSSIBILITY OF SUCH DAMAGE.\n\nimport pytest\nimport numpy\nfrom random import randrange\n\nfrom pyop2 import plan as _plan\nfrom pyop2 import op2\n\nbackends = ['opencl', 'openmp']\n\n# Data type\nvaluetype = numpy.float64\n\n# Constants\nNUM_ELE = 12\nNUM_NODES = 36\nNUM_ENTRIES = 4\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TestColoring:\n\n \"\"\"\n Coloring tests\n\n \"\"\"\n\n\n\n\n\n\n\n",
"metadata": "root.TestColoring",
"header": "['module', '___EOS___']",
"index": 51
},
{
"content": " @pytest.fixture\n def nodes(cls):\n return op2.Set(NUM_NODES, \"nodes\")",
"metadata": "root.TestColoring.nodes",
"header": "['class', 'TestColoring', ':', '___EOS___']",
"index": 58
},
{
"content": " @pytest.fixture\n def elements(cls):\n return op2.Set(NUM_ELE, \"elements\")",
"metadata": "root.TestColoring.elements",
"header": "['class', 'TestColoring', ':', '___EOS___']",
"index": 62
},
{
"content": " @pytest.fixture\n def dnodes(cls, nodes):\n return op2.DataSet(nodes, 1, \"dnodes\")",
"metadata": "root.TestColoring.dnodes",
"header": "['class', 'TestColoring', ':', '___EOS___']",
"index": 66
},
{
"content": " @pytest.fixture\n def elem_node_map(cls):\n v = [randrange(NUM_ENTRIES) for i in range(NUM_ELE * 3)]\n return numpy.asarray(v, dtype=numpy.uint32)",
"metadata": "root.TestColoring.elem_node_map",
"header": "['class', 'TestColoring', ':', '___EOS___']",
"index": 70
},
{
"content": " @pytest.fixture\n def elem_node(cls, elements, nodes, elem_node_map):\n return op2.Map(elements, nodes, 3, elem_node_map, \"elem_node\")",
"metadata": "root.TestColoring.elem_node",
"header": "['class', 'TestColoring', ':', '___EOS___']",
"index": 75
},
{
"content": " @pytest.fixture\n def mat(cls, elem_node, dnodes):\n sparsity = op2.Sparsity((dnodes, dnodes), (elem_node, elem_node), \"sparsity\")\n return op2.Mat(sparsity, valuetype, \"mat\")",
"metadata": "root.TestColoring.mat",
"header": "['class', 'TestColoring', ':', '___EOS___']",
"index": 79
},
{
"content": " @pytest.fixture\n def x(cls, dnodes):\n return op2.Dat(dnodes, numpy.zeros(NUM_NODES, dtype=numpy.uint32), numpy.uint32, \"x\")",
"metadata": "root.TestColoring.x",
"header": "['class', 'TestColoring', ':', '___EOS___']",
"index": 84
},
{
"content": " def test_thread_coloring(self, backend, skip_opencl, elements, elem_node_map, elem_node, mat, x):\n assert NUM_ELE % 2 == 0, \"NUM_ELE must be even.\"\n\n plan = _plan.Plan(elements.all_part,\n mat(op2.INC, (elem_node[op2.i[0]],\n elem_node[op2.i[1]])),\n x(op2.WRITE, elem_node[0]),\n partition_size=NUM_ELE / 2,\n matrix_coloring=True)\n\n assert plan.nblocks == 2\n eidx = 0\n for p in range(plan.nblocks):\n for thrcol in range(plan.nthrcol[p]):\n counter = numpy.zeros(NUM_NODES, dtype=numpy.uint32)\n for e in range(eidx, eidx + plan.nelems[p]):\n if plan.thrcol[e] == thrcol:\n counter[elem_node.values[e][0]] += 1\n assert (counter < 2).all()\n\n eidx += plan.nelems[p]",
"metadata": "root.TestColoring.test_thread_coloring",
"header": "['class', 'TestColoring', ':', '___EOS___']",
"index": 88
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"file",
" ",
"is",
" ",
"part",
" ",
"of",
" ",
"Py",
"OP",
"2_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Py",
"OP",
"2",
" ",
"is",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2012",
",",
" ",
"Impe",
"rial",
" ",
"Coll",
"ege",
" ",
"Lon",
"don",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"other",
"s",
".",
" ",
"Ple",
"ase",
" ",
"see",
" ",
"the",
" ",
"AUTHOR",
"S",
" ",
"file",
" ",
"in",
" ",
"the",
" ",
"main",
" ",
"source",
" ",
"director",
"y",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"a",
" ",
"full",
" ",
"list",
" ",
"of",
" ",
"copyr",
"ight",
" ",
"holder",
"s",
".",
" ",
" ",
"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",
" ",
"conditions_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"are",
" ",
"met",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"*",
" ",
"Redistributi",
"ons",
" ",
"of",
" ",
"source",
" ",
"code",
" ",
"must",
" ",
"retain",
" ",
"the",
" ",
"above",
" ",
"copyright_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"follow",
"ing",
" ",
"discl",
"aime",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"*",
" ",
"Redistributi",
"ons",
" ",
"in",
" ",
"binar",
"y",
" ",
"form",
" ",
"must",
" ",
"reproduce",
" ",
"the",
" ",
"above",
" ",
"copyright_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"follow",
"ing",
" ",
"discl",
"aime",
"r",
" ",
"in",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"documentation",
" ",
"and",
"/",
"or",
" ",
"other",
" ",
"material",
"s",
" ",
"provided",
" ",
"with",
" ",
"the",
" ",
"distribu",
"tion",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"*",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"Impe",
"rial",
" ",
"Coll",
"ege",
" ",
"Lon",
"don",
" ",
"or",
" ",
"tha",
"t",
" ",
"of",
" ",
"other_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"contributor",
"s",
" ",
"may",
" ",
"not",
" ",
"be",
" ",
"used",
" ",
"to",
" ",
"endo",
"rse",
" ",
"or",
" ",
"promote",
" ",
"products_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"derive",
"d",
" ",
"from",
" ",
"this",
" ",
"software",
" ",
"with",
"out",
" ",
"specific",
" ",
"prior",
" ",
"written_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"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",
"UT",
"ERS_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"''",
"AS",
" ",
"IS",
"''",
" ",
"AND",
" ",
"ANY",
" ",
"EXPR",
"ESS",
" ",
"OR",
" ",
"IMPL",
"IED",
" ",
"WAR",
"RAN",
"TIES",
",",
" ",
"INC",
"LU",
"DING",
",",
" ",
"BUT",
" ",
"NOT",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"LIMIT",
"ED",
" ",
"TO",
",",
" ",
"THE",
" ",
"IMPL",
"IED",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OF",
" ",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
" ",
"AND",
" ",
"FIT",
"NESS",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR",
" ",
"PUR",
"POS",
"E",
" ",
"ARE",
" ",
"DISC",
"LAI",
"MED",
".",
" ",
"IN",
" ",
"NO",
" ",
"EVENT",
" ",
"SHA",
"LL",
" ",
"THE",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"COPY",
"RIG",
"HT",
" ",
"HOLD",
"ERS",
" ",
"OR",
" ",
"CONTRIB",
"UTO",
"RS",
" ",
"BE",
" ",
"LI",
"AB",
"LE",
" ",
"FOR",
" ",
"ANY",
" ",
"DIRECT",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"INDI",
"RECT",
",",
" ",
"INC",
"IDENT",
"AL",
",",
" ",
"SPECIAL",
",",
" ",
"EXE",
"MPL",
"ARY",
",",
" ",
"OR",
" ",
"CONS",
"EQU",
"ENTI",
"AL",
" ",
"DA",
"MAGE",
"S_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"INC",
"LU",
"DING",
",",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
",",
" ",
"PROC",
"URE",
"MENT",
" ",
"OF",
" ",
"SUBST",
"ITU",
"TE",
" ",
"GOOD",
"S",
" ",
"OR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"SERVICES",
";",
" ",
"LOSS",
" ",
"OF",
" ",
"USE",
",",
" ",
"DATA",
",",
" ",
"OR",
" ",
"PROF",
"IT",
"S",
";",
" ",
"OR",
" ",
"BUS",
"INE",
"SS",
" ",
"INTER",
"RU",
"PTION",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"HO",
"WE",
"VER",
" ",
"CAU",
"SED",
" ",
"AND",
" ",
"ON",
" ",
"ANY",
" ",
"THE",
"ORY",
" ",
"OF",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"WHE",
"THER",
" ",
"IN",
" ",
"CONTR",
"ACT",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"STRI",
"CT",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"OR",
" ",
"TOR",
"T",
" ",
"(",
"INC",
"LU",
"DING",
" ",
"NEG",
"LIG",
"ENCE",
" ",
"OR",
" ",
"OTHER",
"WI",
"SE",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"ARI",
"SIN",
"G",
" ",
"IN",
" ",
"ANY",
" ",
"WAY",
" ",
"OUT",
" ",
"OF",
" ",
"THE",
" ",
"USE",
" ",
"OF",
" ",
"THIS",
" ",
"SOFT",
"WARE",
",",
" ",
"EVE",
"N",
" ",
"IF",
" ",
"ADV",
"ISE",
"D_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"OF",
" ",
"THE",
" ",
"POS",
"SIB",
"ILI",
"TY",
" ",
"OF",
" ",
"SUC",
"H",
" ",
"DA",
"MAGE",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"pytest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"numpy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"random_",
"import_",
"randrange_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"pyo",
"p2_",
"import_",
"plan_",
"as_",
"\\u",
"plan_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pyo",
"p2_",
"import_",
"op2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"backends_",
"=_",
"[_",
"'",
"openc",
"l",
"'_",
",_",
"'",
"openm",
"p",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Data",
" ",
"type_",
"\\u\\u\\uNL\\u\\u\\u_",
"value",
"type_",
"=_",
"numpy_",
"._",
"float64_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Constants_",
"\\u\\u\\uNL\\u\\u\\u_",
"NUM",
"\\u",
"ELE",
"_",
"=_",
"12_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"NUM",
"\\u",
"NODES",
"_",
"=_",
"36_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"NUM",
"\\u",
"ENTR",
"IES_",
"=_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Test",
"Color",
"ing_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Color",
"ing",
" ",
"tests",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Color",
"ing_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"pytest_",
"._",
"fixture_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"nodes_",
"(_",
"cls_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"op2_",
"._",
"Set_",
"(_",
"NUM",
"\\u",
"NODES",
"_",
",_",
"\"",
"nodes",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Color",
"ing_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"pytest_",
"._",
"fixture_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"elements_",
"(_",
"cls_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"op2_",
"._",
"Set_",
"(_",
"NUM",
"\\u",
"ELE",
"_",
",_",
"\"",
"element",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Color",
"ing_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"pytest_",
"._",
"fixture_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"dno",
"des_",
"(_",
"cls_",
",_",
"nodes_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"op2_",
"._",
"Data",
"Set_",
"(_",
"nodes_",
",_",
"1_",
",_",
"\"",
"dno",
"des",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Color",
"ing_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"pytest_",
"._",
"fixture_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"elem",
"\\u",
"node",
"\\u",
"map_",
"(_",
"cls_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"v_",
"=_",
"[_",
"randrange_",
"(_",
"NUM",
"\\u",
"ENTR",
"IES_",
")_",
"for_",
"i_",
"in_",
"range_",
"(_",
"NUM",
"\\u",
"ELE",
"_",
"*_",
"3_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"numpy_",
"._",
"asarray_",
"(_",
"v_",
",_",
"dtype_",
"=_",
"numpy_",
"._",
"uint32_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Color",
"ing_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"pytest_",
"._",
"fixture_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"elem",
"\\u",
"node_",
"(_",
"cls_",
",_",
"elements_",
",_",
"nodes_",
",_",
"elem",
"\\u",
"node",
"\\u",
"map_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"op2_",
"._",
"Map_",
"(_",
"elements_",
",_",
"nodes_",
",_",
"3_",
",_",
"elem",
"\\u",
"node",
"\\u",
"map_",
",_",
"\"",
"elem",
"\\u",
"node",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Color",
"ing_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"pytest_",
"._",
"fixture_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"mat_",
"(_",
"cls_",
",_",
"elem",
"\\u",
"node_",
",_",
"dno",
"des_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sparsity",
"_",
"=_",
"op2_",
"._",
"Spar",
"sity",
"_",
"(_",
"(_",
"dno",
"des_",
",_",
"dno",
"des_",
")_",
",_",
"(_",
"elem",
"\\u",
"node_",
",_",
"elem",
"\\u",
"node_",
")_",
",_",
"\"",
"sparsity",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"op2_",
"._",
"Mat_",
"(_",
"sparsity",
"_",
",_",
"value",
"type_",
",_",
"\"",
"mat",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Color",
"ing_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"pytest_",
"._",
"fixture_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"x_",
"(_",
"cls_",
",_",
"dno",
"des_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"op2_",
"._",
"Dat",
"_",
"(_",
"dno",
"des_",
",_",
"numpy_",
"._",
"zeros_",
"(_",
"NUM",
"\\u",
"NODES",
"_",
",_",
"dtype_",
"=_",
"numpy_",
"._",
"uint32_",
")_",
",_",
"numpy_",
"._",
"uint32_",
",_",
"\"",
"x",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Color",
"ing_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"thread",
"\\u",
"colori",
"ng_",
"(_",
"self_",
",_",
"backend_",
",_",
"skip",
"\\u",
"openc",
"l_",
",_",
"elements_",
",_",
"elem",
"\\u",
"node",
"\\u",
"map_",
",_",
"elem",
"\\u",
"node_",
",_",
"mat_",
",_",
"x_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"NUM",
"\\u",
"ELE",
"_",
"%_",
"2_",
"==_",
"0_",
",_",
"\"",
"NUM",
"\\u",
"ELE",
" ",
"must",
" ",
"be",
" ",
"even",
".\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"plan_",
"=_",
"\\u",
"plan_",
"._",
"Plan_",
"(_",
"elements_",
"._",
"all",
"\\u",
"part_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mat_",
"(_",
"op2_",
"._",
"INC",
"_",
",_",
"(_",
"elem",
"\\u",
"node_",
"[_",
"op2_",
"._",
"i_",
"[_",
"0_",
"]_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"elem",
"\\u",
"node_",
"[_",
"op2_",
"._",
"i_",
"[_",
"1_",
"]_",
"]_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"x_",
"(_",
"op2_",
"._",
"WRITE_",
",_",
"elem",
"\\u",
"node_",
"[_",
"0_",
"]_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"partit",
"ion",
"\\u",
"size_",
"=_",
"NUM",
"\\u",
"ELE",
"_",
"/_",
"2_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"matrix",
"\\u",
"colori",
"ng_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert_",
"plan_",
"._",
"nbl",
"ock",
"s_",
"==_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eid",
"x_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"p_",
"in_",
"range_",
"(_",
"plan_",
"._",
"nbl",
"ock",
"s_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"thr",
"col_",
"in_",
"range_",
"(_",
"plan_",
"._",
"nthr",
"col_",
"[_",
"p_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"counter_",
"=_",
"numpy_",
"._",
"zeros_",
"(_",
"NUM",
"\\u",
"NODES",
"_",
",_",
"dtype_",
"=_",
"numpy_",
"._",
"uint32_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"e_",
"in_",
"range_",
"(_",
"eid",
"x_",
",_",
"eid",
"x_",
"+_",
"plan_",
"._",
"nele",
"ms_",
"[_",
"p_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"plan_",
"._",
"thr",
"col_",
"[_",
"e_",
"]_",
"==_",
"thr",
"col_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"counter_",
"[_",
"elem",
"\\u",
"node_",
"._",
"values_",
"[_",
"e_",
"]_",
"[_",
"0_",
"]_",
"]_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\u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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | jookies/jasmin/jasmin/vendor/smpp/twisted/tests/test_smpp_server.py | [
{
"content": " @unittest.skip('''Jasmin update: All vendor tests shall be skipped)''')\n def testReceiverBindRequest(self):\n system_id = 'userA'\n pdu = operations.BindReceiver(\n system_id = system_id,\n password = 'valid',\n seqNum = 1\n )\n self.proto.dataReceived(self.encoder.encode(pdu))\n expected_pdu = operations.BindReceiverResp(system_id='userA', seqNum=1)\n self.assertEqual(self.tr.value(), self.encoder.encode(expected_pdu))\n self.tr.clear()\n connection = self.factory.getBoundConnections(system_id)\n self.assertEqual(connection.system_id, system_id)\n self.assertEqual(connection._binds[pdu_types.CommandId.bind_receiver][0], self.proto)\n bind_manager = self.factory.getBoundConnections(system_id)\n delivery_binding = bind_manager.getNextBindingForDelivery()\n self.assertTrue(delivery_binding is not None)\n # TODO Identify what should be returned here\n pdu = operations.SubmitSM(source_addr='t1', destination_addr='1208230', short_message='HELLO', seqNum=6)\n self.proto.dataReceived(self.encoder.encode(pdu))\n expected_pdu = operations.SubmitSMResp(seqNum=6)\n self.assertEqual(self.tr.value(), self.encoder.encode(expected_pdu))",
"metadata": "root.SMPPServerTestCase.testReceiverBindRequest",
"header": "['class', 'SMPPServerTestCase', '(', 'SMPPServerBaseTest', ')', ':', '___EOS___']",
"index": 322
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"SM",
"PP",
"Server",
"Test",
"Case_",
"(_",
"SM",
"PP",
"Server",
"Base",
"Test_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"unittest_",
"._",
"skip_",
"(_",
"'''",
"Ja",
"smi",
"n",
" ",
"update",
":",
" ",
"All",
" ",
"vendor",
" ",
"tests",
" ",
"sha",
"ll",
" ",
"be",
" ",
"skip",
"ped",
")'''_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test",
"Receive",
"r",
"Bind",
"Request_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"system",
"\\u",
"id_",
"=_",
"'",
"user",
"A",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pdu_",
"=_",
"operations_",
"._",
"Bind",
"Receiver_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"system",
"\\u",
"id_",
"=_",
"system",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"password_",
"=_",
"'",
"valid",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"seq",
"Num_",
"=_",
"1_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"proto_",
"._",
"data",
"Received_",
"(_",
"self_",
"._",
"encoder_",
"._",
"encode_",
"(_",
"pdu_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"pdu_",
"=_",
"operations_",
"._",
"Bind",
"Receive",
"r",
"Resp_",
"(_",
"system",
"\\u",
"id_",
"=_",
"'",
"user",
"A",
"'_",
",_",
"seq",
"Num_",
"=_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"tr_",
"._",
"value_",
"(_",
")_",
",_",
"self_",
"._",
"encoder_",
"._",
"encode_",
"(_",
"expected",
"\\u",
"pdu_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"tr_",
"._",
"clear_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"connection_",
"=_",
"self_",
"._",
"factory_",
"._",
"get",
"Bound",
"Connections_",
"(_",
"system",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"connection_",
"._",
"system",
"\\u",
"id_",
",_",
"system",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"connection_",
"._",
"\\u",
"binds_",
"[_",
"pdu",
"\\u",
"types_",
"._",
"Command",
"Id_",
"._",
"bind",
"\\u",
"receiver_",
"]_",
"[_",
"0_",
"]_",
",_",
"self_",
"._",
"proto_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bind",
"\\u",
"manager_",
"=_",
"self_",
"._",
"factory_",
"._",
"get",
"Bound",
"Connections_",
"(_",
"system",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"delivery",
"\\u",
"binding_",
"=_",
"bind",
"\\u",
"manager_",
"._",
"get",
"Ne",
"xt",
"Bind",
"ing",
"For",
"Deliver",
"y_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"delivery",
"\\u",
"binding_",
"is_",
"not_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
" ",
"Identif",
"y",
" ",
"what",
" ",
"shou",
"ld",
" ",
"be",
" ",
"return",
"ed",
" ",
"here_",
"\\u\\u\\uNL\\u\\u\\u_",
"pdu_",
"=_",
"operations_",
"._",
"Submit",
"SM_",
"(_",
"source",
"\\u",
"addr_",
"=_",
"'",
"t1",
"'_",
",_",
"destinat",
"ion",
"\\u",
"addr_",
"=_",
"'",
"120",
"823",
"0",
"'_",
",_",
"short",
"\\u",
"message_",
"=_",
"'",
"HELL",
"O",
"'_",
",_",
"seq",
"Num_",
"=_",
"6_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"proto_",
"._",
"data",
"Received_",
"(_",
"self_",
"._",
"encoder_",
"._",
"encode_",
"(_",
"pdu_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"pdu_",
"=_",
"operations_",
"._",
"Submit",
"SM",
"Resp_",
"(_",
"seq",
"Num_",
"=_",
"6_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | ncclient/ncclient/examples/nc03.py | [
{
"content": "#! /usr/bin/env python2.6 \n#\n# Retrieve a portion selected by an XPATH expression from the running\n# config from the NETCONF server passed on the command line using\n# get-config and write the XML configs to files.\n#\n# $ ./nc03.py broccoli \"aaa/authentication/users/user[name='schoenw']\"\n\nimport sys, os, warnings\nwarnings.simplefilter(\"ignore\", DeprecationWarning)\nfrom ncclient import manager\n\n\nif __name__ == '__main__':\n demo(sys.argv[1], os.getenv(\"USER\"), sys.argv[2])\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def demo(host, user, expr):\n with manager.connect(host=host, port=22, username=user) as m:\n assert(\":xpath\" in m.server_capabilities)\n c = m.get_config(source='running', filter=('xpath', expr)).data_xml\n with open(\"%s.xml\" % host, 'w') as f:\n f.write(c)",
"metadata": "root.demo",
"header": "['module', '___EOS___']",
"index": 12
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
" ",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python",
"2.6",
" _",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Retrieve",
" ",
"a",
" ",
"porti",
"on",
" ",
"selecte",
"d",
" ",
"by",
" ",
"an",
" ",
"XP",
"ATH",
" ",
"express",
"ion",
" ",
"from",
" ",
"the",
" ",
"running_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"config",
" ",
"from",
" ",
"the",
" ",
"NET",
"CONF",
" ",
"server",
" ",
"pass",
"ed",
" ",
"on",
" ",
"the",
" ",
"command",
" ",
"line",
" ",
"using_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"get",
"-",
"config",
" ",
"and",
" ",
"write",
" ",
"the",
" ",
"XML",
" ",
"configs",
" ",
"to",
" ",
"files",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"$",
" ",
"./",
"nc",
"03",
".",
"py",
" ",
"bro",
"cco",
"li",
" ",
"\"",
"aaa",
"/",
"authenticat",
"ion",
"/",
"users",
"/",
"user",
"[",
"name",
"='",
"scho",
"en",
"w",
"']\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
",_",
"os_",
",_",
"warnings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"warnings_",
"._",
"simplefilter_",
"(_",
"\"",
"ignore",
"\"_",
",_",
"Dep",
"reca",
"tion",
"Warning_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ncc",
"lient_",
"import_",
"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_",
"\\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 ",
" _",
"demo_",
"(_",
"sys_",
"._",
"argv_",
"[_",
"1_",
"]_",
",_",
"os_",
"._",
"getenv_",
"(_",
"\"",
"USER",
"\"_",
")_",
",_",
"sys_",
"._",
"argv_",
"[_",
"2_",
"]_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"demo_",
"(_",
"host_",
",_",
"user_",
",_",
"expr_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"manager_",
"._",
"connect_",
"(_",
"host_",
"=_",
"host_",
",_",
"port_",
"=_",
"22_",
",_",
"username_",
"=_",
"user_",
")_",
"as_",
"m_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"(_",
"\":",
"xpa",
"th",
"\"_",
"in_",
"m_",
"._",
"server",
"\\u",
"capabilities_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"m_",
"._",
"get",
"\\u",
"config_",
"(_",
"source_",
"=_",
"'",
"runn",
"ing",
"'_",
",_",
"filter_",
"=_",
"(_",
"'",
"xpa",
"th",
"'_",
",_",
"expr_",
")_",
")_",
"._",
"data\\u",
"xml_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"open_",
"(_",
"\"%",
"s",
".",
"xml",
"\"_",
"%_",
"host_",
",_",
"'",
"w",
"'_",
")_",
"as_",
"f_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"f_",
"._",
"write_",
"(_",
"c_",
")_",
"\\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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Redundant comparison | enthought/pyface/pyface/ui/wx/grid/trait_grid_model.py | [
{
"content": " def __init__(self, **traits):\n \"\"\" Create a TraitGridModel object. \"\"\"\n\n # Base class constructor\n super(TraitGridModel, self).__init__(**traits)\n\n # if no columns are pass in then create the list of names\n # from the first trait in the list. if the list is empty,\n # the columns should be an empty list as well.\n self._auto_columns = self.columns\n\n if self.columns is None or len(self.columns) == 0:\n if self.data is not None and len(self.data) > 0:\n self._auto_columns = []\n\n # we only add traits that aren't events, since events\n # are write-only\n for name, trait in self.data[0].traits().items():\n if trait.type != 'event':\n self._auto_columns.append(TraitGridColumn(name = name))\n else:\n self._auto_columns = []\n\n # attach trait handlers to the list object\n self.on_trait_event(self._on_data_changed, 'data')\n self.on_trait_event(self._on_data_items_changed, 'data_items')\n\n # attach appropriate trait handlers to objects in the list\n self.__manage_data_listeners(self.data)\n\n # attach a listener to the column definitions so we refresh when\n # they change\n self.on_trait_change(self._on_columns_changed,\n 'columns')\n self.on_trait_event(self._on_columns_items_changed,\n 'columns_items')\n # attach listeners to the column definitions themselves\n self.__manage_column_listeners(self.columns)\n\n # attach a listener to the row_name_trait\n self.on_trait_change(self._on_row_name_trait_changed, 'row_name_trait')\n\n return",
"metadata": "root.TraitGridModel.__init__",
"header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']",
"index": 89
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Redu",
"ndan",
"t_",
"comparison_",
"[SEP]_",
"class_",
"Trait",
"Grid",
"Model_",
"(_",
"Grid",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"**_",
"traits_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Creat",
"e",
" ",
"a",
" ",
"Trait",
"Grid",
"Model",
" ",
"object",
".",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Base",
" ",
"class",
" ",
"constructor_",
"\\u\\u\\uNL\\u\\u\\u_",
"super_",
"(_",
"Trait",
"Grid",
"Model_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"**_",
"traits_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"if",
" ",
"no",
" ",
"column",
"s",
" ",
"are",
" ",
"pass",
" ",
"in",
" ",
"then",
" ",
"create",
" ",
"the",
" ",
"list",
" ",
"of",
" ",
"names_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"from",
" ",
"the",
" ",
"first",
" ",
"tra",
"it",
" ",
"in",
" ",
"the",
" ",
"list",
".",
" ",
"if",
" ",
"the",
" ",
"list",
" ",
"is",
" ",
"empty",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"column",
"s",
" ",
"shou",
"ld",
" ",
"be",
" ",
"an",
" ",
"empty",
" ",
"list",
" ",
"as",
" ",
"well",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"auto",
"\\u",
"columns_",
"=_",
"self_",
"._",
"columns_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"columns_",
"is_",
"None_",
"or_",
"len_",
"(_",
"self_",
"._",
"columns_",
")_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"data_",
"is_",
"not_",
"None_",
"and_",
"len_",
"(_",
"self_",
"._",
"data_",
")_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"auto",
"\\u",
"columns_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"we",
" ",
"only",
" ",
"add",
" ",
"traits",
" ",
"tha",
"t",
" ",
"are",
"n",
"'",
"t",
" ",
"events",
",",
" ",
"sinc",
"e",
" ",
"events_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"are",
" ",
"write",
"-",
"only_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"name_",
",_",
"trait_",
"in_",
"self_",
"._",
"data_",
"[_",
"0_",
"]_",
"._",
"traits_",
"(_",
")_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"trait_",
"._",
"type_",
"!=_",
"'",
"event",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"\\u",
"auto",
"\\u",
"columns_",
"._",
"append_",
"(_",
"Trait",
"Grid",
"Column_",
"(_",
"name_",
"=_",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"auto",
"\\u",
"columns_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"attach",
" ",
"tra",
"it",
" ",
"handler",
"s",
" ",
"to",
" ",
"the",
" ",
"list",
" ",
"object_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"on",
"\\u",
"tra",
"it",
"\\u",
"event_",
"(_",
"self_",
"._",
"\\u",
"on",
"\\u",
"data\\u",
"changed_",
",_",
"'",
"data",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"on",
"\\u",
"tra",
"it",
"\\u",
"event_",
"(_",
"self_",
"._",
"\\u",
"on",
"\\u",
"data\\u",
"items",
"\\u",
"changed_",
",_",
"'",
"data\\u",
"items",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"attach",
" ",
"appropr",
"iate",
" ",
"tra",
"it",
" ",
"handler",
"s",
" ",
"to",
" ",
"object",
"s",
" ",
"in",
" ",
"the",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"manage",
"\\u",
"data\\u",
"listeners_",
"(_",
"self_",
"._",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"attach",
" ",
"a",
" ",
"listen",
"er",
" ",
"to",
" ",
"the",
" ",
"column",
" ",
"definit",
"ion",
"s",
" ",
"so",
" ",
"we",
" ",
"refre",
"sh",
" ",
"when_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
"y",
" ",
"change_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"on",
"\\u",
"tra",
"it",
"\\u",
"change_",
"(_",
"self_",
"._",
"\\u",
"on",
"\\u",
"column",
"s",
"\\u",
"changed_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"column",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"on",
"\\u",
"tra",
"it",
"\\u",
"event_",
"(_",
"self_",
"._",
"\\u",
"on",
"\\u",
"column",
"s",
"\\u",
"items",
"\\u",
"changed_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"column",
"s",
"\\u",
"items",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"attach",
" ",
"listeners",
" ",
"to",
" ",
"the",
" ",
"column",
" ",
"definit",
"ion",
"s",
" ",
"them",
"sel",
"ves_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"manage",
"\\u",
"column",
"\\u",
"listeners_",
"(_",
"self_",
"._",
"columns_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"attach",
" ",
"a",
" ",
"listen",
"er",
" ",
"to",
" ",
"the",
" ",
"row",
"\\u",
"name",
"\\u",
"trait_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"on",
"\\u",
"tra",
"it",
"\\u",
"change_",
"(_",
"self_",
"._",
"\\u",
"on",
"\\u",
"row",
"\\u",
"name",
"\\u",
"tra",
"it",
"\\u",
"changed_",
",_",
"'",
"row",
"\\u",
"name",
"\\u",
"tra",
"it",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
NotImplemented is not an Exception | ardekantur/pyglet/pyglet/media/avbin.py | [
{
"content": " def __init__(self, filename, file=None):\n if file is not None:\n raise NotImplementedError('TODO: Load from file stream')\n\n self._file = av.avbin_open_filename(filename)\n if not self._file:\n raise AVbinException('Could not open \"%s\"' % filename)\n\n self._video_stream = None\n self._video_stream_index = -1\n self._audio_stream = None\n self._audio_stream_index = -1\n\n file_info = AVbinFileInfo()\n file_info.structure_size = ctypes.sizeof(file_info)\n av.avbin_file_info(self._file, ctypes.byref(file_info))\n self._duration = timestamp_from_avbin(file_info.duration)\n\n self.info = SourceInfo()\n self.info.title = file_info.title\n self.info.author = file_info.author\n self.info.copyright = file_info.copyright\n self.info.comment = file_info.comment\n self.info.album = file_info.album\n self.info.year = file_info.year\n self.info.track = file_info.track\n self.info.genre = file_info.genre\n\n # Pick the first video and audio streams found, ignore others.\n for i in range(file_info.n_streams):\n info = AVbinStreamInfo8()\n info.structure_size = ctypes.sizeof(info)\n av.avbin_stream_info(self._file, i, info)\n\n if (info.type == AVBIN_STREAM_TYPE_VIDEO and \n not self._video_stream):\n\n stream = av.avbin_open_stream(self._file, i)\n if not stream:\n continue\n\n self.video_format = VideoFormat(\n width=info.u.video.width,\n height=info.u.video.height)\n if info.u.video.sample_aspect_num != 0:\n self.video_format.sample_aspect = (\n float(info.u.video.sample_aspect_num) /\n info.u.video.sample_aspect_den)\n if _have_frame_rate:\n self.video_format.frame_rate = (\n float(info.u.video.frame_rate_num) / \n info.u.video.frame_rate_den)\n self._video_stream = stream\n self._video_stream_index = i\n\n elif (info.type == AVBIN_STREAM_TYPE_AUDIO and\n info.u.audio.sample_bits in (8, 16) and\n info.u.audio.channels in (1, 2) and \n not self._audio_stream):\n\n stream = av.avbin_open_stream(self._file, i)\n if not stream:\n continue\n\n self.audio_format = AudioFormat(\n channels=info.u.audio.channels,\n sample_size=info.u.audio.sample_bits,\n sample_rate=info.u.audio.sample_rate)\n self._audio_stream = stream\n self._audio_stream_index = i\n\n self._packet = AVbinPacket()\n self._packet.structure_size = ctypes.sizeof(self._packet)\n self._packet.stream_index = -1\n\n self._events = []\n\n # Timestamp of last video packet added to decoder queue.\n self._video_timestamp = 0\n self._buffered_audio_data = []\n\n if self.audio_format:\n self._audio_buffer = \\\n (ctypes.c_uint8 * av.avbin_get_audio_buffer_size())()\n \n if self.video_format:\n self._video_packets = []\n self._decode_thread = WorkerThread()\n self._decode_thread.start()\n self._condition = threading.Condition()",
"metadata": "root.AVbinSource.__init__",
"header": "['class', 'AVbinSource', '(', 'StreamingSource', ')', ':', '___EOS___']",
"index": 226
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Not",
"Implemented_",
"is_",
"not_",
"an_",
"Exception_",
"[SEP]_",
"class_",
"AV",
"bin",
"Source_",
"(_",
"Stream",
"ing",
"Source_",
")_",
":_",
"\\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_",
",_",
"filename_",
",_",
"file_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"file_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Not",
"Impl",
"ement",
"ed",
"Error_",
"(_",
"'",
"TOD",
"O",
":",
" ",
"Load",
" ",
"from",
" ",
"file",
" ",
"stream",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"file_",
"=_",
"av_",
"._",
"av",
"bin",
"\\u",
"open",
"\\u",
"filename_",
"(_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"\\u",
"file_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"AV",
"bin",
"Exception_",
"(_",
"'",
"Cou",
"ld",
" ",
"not",
" ",
"open",
" ",
"\"%",
"s",
"\"'_",
"%_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"video",
"\\u",
"stream_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"video",
"\\u",
"stream",
"\\u",
"index_",
"=_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"audio",
"\\u",
"stream_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"audio",
"\\u",
"stream",
"\\u",
"index_",
"=_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"file",
"\\u",
"info_",
"=_",
"AV",
"bin",
"File",
"Info_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"file",
"\\u",
"info_",
"._",
"structure",
"\\u",
"size_",
"=_",
"ctypes_",
"._",
"sizeof_",
"(_",
"file",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"av_",
"._",
"av",
"bin",
"\\u",
"file",
"\\u",
"info_",
"(_",
"self_",
"._",
"\\u",
"file_",
",_",
"ctypes_",
"._",
"byref_",
"(_",
"file",
"\\u",
"info_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"duration_",
"=_",
"timestamp",
"\\u",
"from",
"\\u",
"av",
"bin_",
"(_",
"file",
"\\u",
"info_",
"._",
"duration_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"info_",
"=_",
"Sou",
"rce",
"Info_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"info_",
"._",
"title_",
"=_",
"file",
"\\u",
"info_",
"._",
"title_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"info_",
"._",
"author_",
"=_",
"file",
"\\u",
"info_",
"._",
"author_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"info_",
"._",
"copyright_",
"=_",
"file",
"\\u",
"info_",
"._",
"copyright_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"info_",
"._",
"comment_",
"=_",
"file",
"\\u",
"info_",
"._",
"comment_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"info_",
"._",
"album_",
"=_",
"file",
"\\u",
"info_",
"._",
"album_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"info_",
"._",
"year_",
"=_",
"file",
"\\u",
"info_",
"._",
"year_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"info_",
"._",
"track_",
"=_",
"file",
"\\u",
"info_",
"._",
"track_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"info_",
"._",
"genre_",
"=_",
"file",
"\\u",
"info_",
"._",
"genre_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Pick",
" ",
"the",
" ",
"first",
" ",
"video",
" ",
"and",
" ",
"audio",
" ",
"stream",
"s",
" ",
"found",
",",
" ",
"ignore",
" ",
"other",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"file",
"\\u",
"info_",
"._",
"n",
"\\u",
"streams_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"info_",
"=_",
"AV",
"bin",
"Stream",
"Info",
"8_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"info_",
"._",
"structure",
"\\u",
"size_",
"=_",
"ctypes_",
"._",
"sizeof_",
"(_",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"av_",
"._",
"av",
"bin",
"\\u",
"stream",
"\\u",
"info_",
"(_",
"self_",
"._",
"\\u",
"file_",
",_",
"i_",
",_",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"(_",
"info_",
"._",
"type_",
"==_",
"AV",
"BIN",
"\\u",
"STRE",
"AM",
"\\u",
"TYPE",
"\\u",
"VIDEO",
"_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"not_",
"self_",
"._",
"\\u",
"video",
"\\u",
"stream_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"stream_",
"=_",
"av_",
"._",
"av",
"bin",
"\\u",
"open",
"\\u",
"stream_",
"(_",
"self_",
"._",
"\\u",
"file_",
",_",
"i_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"stream_",
":_",
"\\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_",
"self_",
"._",
"video",
"\\u",
"format_",
"=_",
"Vid",
"eo",
"Format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"width_",
"=_",
"info_",
"._",
"u_",
"._",
"video_",
"._",
"width_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"height_",
"=_",
"info_",
"._",
"u_",
"._",
"video_",
"._",
"height_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"info_",
"._",
"u_",
"._",
"video_",
"._",
"sample",
"\\u",
"aspect",
"\\u",
"num_",
"!=_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"video",
"\\u",
"format_",
"._",
"sample",
"\\u",
"aspect_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"float_",
"(_",
"info_",
"._",
"u_",
"._",
"video_",
"._",
"sample",
"\\u",
"aspect",
"\\u",
"num_",
")_",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"info_",
"._",
"u_",
"._",
"video_",
"._",
"sample",
"\\u",
"aspect",
"\\u",
"den_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u",
"have",
"\\u",
"frame",
"\\u",
"rate_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"video",
"\\u",
"format_",
"._",
"frame",
"\\u",
"rate_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"float_",
"(_",
"info_",
"._",
"u_",
"._",
"video_",
"._",
"frame",
"\\u",
"rate",
"\\u",
"num_",
")_",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"info_",
"._",
"u_",
"._",
"video_",
"._",
"frame",
"\\u",
"rate",
"\\u",
"den_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"video",
"\\u",
"stream_",
"=_",
"stream_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"video",
"\\u",
"stream",
"\\u",
"index_",
"=_",
"i_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"(_",
"info_",
"._",
"type_",
"==_",
"AV",
"BIN",
"\\u",
"STRE",
"AM",
"\\u",
"TYPE",
"\\u",
"AUDIO",
"_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"info_",
"._",
"u_",
"._",
"audio_",
"._",
"sample",
"\\u",
"bits_",
"in_",
"(_",
"8_",
",_",
"16_",
")_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"info_",
"._",
"u_",
"._",
"audio_",
"._",
"channels_",
"in_",
"(_",
"1_",
",_",
"2_",
")_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"not_",
"self_",
"._",
"\\u",
"audio",
"\\u",
"stream_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"stream_",
"=_",
"av_",
"._",
"av",
"bin",
"\\u",
"open",
"\\u",
"stream_",
"(_",
"self_",
"._",
"\\u",
"file_",
",_",
"i_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"stream_",
":_",
"\\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_",
"self_",
"._",
"audio",
"\\u",
"format_",
"=_",
"Audi",
"o",
"Format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"channels_",
"=_",
"info_",
"._",
"u_",
"._",
"audio_",
"._",
"channels_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sample",
"\\u",
"size_",
"=_",
"info_",
"._",
"u_",
"._",
"audio_",
"._",
"sample",
"\\u",
"bits_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sample",
"\\u",
"rate_",
"=_",
"info_",
"._",
"u_",
"._",
"audio_",
"._",
"sample",
"\\u",
"rate_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"audio",
"\\u",
"stream_",
"=_",
"stream_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"audio",
"\\u",
"stream",
"\\u",
"index_",
"=_",
"i_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"packet_",
"=_",
"AV",
"bin",
"Packet_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"packet_",
"._",
"structure",
"\\u",
"size_",
"=_",
"ctypes_",
"._",
"sizeof_",
"(_",
"self_",
"._",
"\\u",
"packet_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"packet_",
"._",
"stream",
"\\u",
"index_",
"=_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"events_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Timest",
"amp",
" ",
"of",
" ",
"last",
" ",
"video",
" ",
"packet",
" ",
"adde",
"d",
" ",
"to",
" ",
"decode",
"r",
" ",
"queue",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"video",
"\\u",
"timestamp_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"buffered",
"\\u",
"audio",
"\\u",
"data_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"audio",
"\\u",
"format_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"audio",
"\\u",
"buffer_",
"=_",
"(_",
"ctypes_",
"._",
"c\\u",
"uint8_",
"*_",
"av_",
"._",
"av",
"bin",
"\\u",
"get",
"\\u",
"audio",
"\\u",
"buffer",
"\\u",
"size_",
"(_",
")_",
")_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"video",
"\\u",
"format_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"video",
"\\u",
"packets_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"decode",
"\\u",
"thread_",
"=_",
"Worke",
"r",
"Thread_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"decode",
"\\u",
"thread_",
"._",
"start_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"condition_",
"=_",
"threading_",
"._",
"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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | datastax/python-driver/tests/unit/test_exception.py | [
{
"content": "# Copyright 2013-2016 DataStax, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\nfrom cassandra import Unavailable, Timeout, ConsistencyLevel\nimport re\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class ConsistencyExceptionTest(unittest.TestCase):\n \"\"\"\n Verify Cassandra Exception string representation\n \"\"\"\n\n\n",
"metadata": "root.ConsistencyExceptionTest",
"header": "['module', '___EOS___']",
"index": 23
},
{
"content": " def extract_consistency(self, msg):\n \"\"\"\n Given message that has 'consistency': 'value', extract consistency value as a string\n :param msg: message with consistency value\n :return: String representing consistency value\n \"\"\"\n match = re.search(\"'consistency':\\s+'([\\w\\s]+)'\", msg)\n return match and match.group(1)",
"metadata": "root.ConsistencyExceptionTest.extract_consistency",
"header": "['class', 'ConsistencyExceptionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 28
},
{
"content": " def test_timeout_consistency(self):\n \"\"\"\n Verify that Timeout exception object translates consistency from input value to correct output string\n \"\"\"\n consistency_str = self.extract_consistency(repr(Timeout(\"Timeout Message\", consistency=None)))\n self.assertEqual(consistency_str, 'Not Set')\n for c in ConsistencyLevel.value_to_name.keys():\n consistency_str = self.extract_consistency(repr(Timeout(\"Timeout Message\", consistency=c)))\n self.assertEqual(consistency_str, ConsistencyLevel.value_to_name[c])",
"metadata": "root.ConsistencyExceptionTest.test_timeout_consistency",
"header": "['class', 'ConsistencyExceptionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 37
},
{
"content": " def test_unavailable_consistency(self):\n \"\"\"\n Verify that Unavailable exception object translates consistency from input value to correct output string\n \"\"\"\n consistency_str = self.extract_consistency(repr(Unavailable(\"Unavailable Message\", consistency=None)))\n self.assertEqual(consistency_str, 'Not Set')\n for c in ConsistencyLevel.value_to_name.keys():\n consistency_str = self.extract_consistency(repr(Unavailable(\"Timeout Message\", consistency=c)))\n self.assertEqual(consistency_str, ConsistencyLevel.value_to_name[c])",
"metadata": "root.ConsistencyExceptionTest.test_unavailable_consistency",
"header": "['class', 'ConsistencyExceptionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 47
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2013",
"-",
"2016",
" ",
"Data",
"Sta",
"x",
",",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"unittest2_",
"as_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"from_",
"cassandra_",
"import_",
"Una",
"vail",
"able_",
",_",
"Timeout_",
",_",
"Cons",
"iste",
"nc",
"y",
"Level_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Cons",
"iste",
"nc",
"y",
"Except",
"ion",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Verify",
" ",
"Cass",
"andra",
" ",
"Except",
"ion",
" ",
"string",
" ",
"represent",
"ation",
"\\",
"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_",
"[SEP]_",
"class_",
"Cons",
"iste",
"nc",
"y",
"Except",
"ion",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"extract",
"\\u",
"consiste",
"ncy_",
"(_",
"self_",
",_",
"msg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Give",
"n",
" ",
"message",
" ",
"tha",
"t",
" ",
"has",
" ",
"'",
"consiste",
"nc",
"y",
"':",
" ",
"'",
"value",
"',",
" ",
"extract",
" ",
"consiste",
"nc",
"y",
" ",
"value",
" ",
"as",
" ",
"a",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"msg",
":",
" ",
"message",
" ",
"with",
" ",
"consiste",
"nc",
"y",
" ",
"value",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"String",
" ",
"represent",
"ing",
" ",
"consiste",
"nc",
"y",
" ",
"value",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"match_",
"=_",
"re_",
"._",
"search_",
"(_",
"\"'",
"consiste",
"nc",
"y",
"':",
"\\\\",
"s",
"+'",
"([\\\\",
"w",
"\\\\",
"s",
"]+)",
"'\"_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"match_",
"and_",
"match_",
"._",
"group_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cons",
"iste",
"nc",
"y",
"Except",
"ion",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"timeo",
"ut",
"\\u",
"consiste",
"ncy_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Verify",
" ",
"tha",
"t",
" ",
"Time",
"out",
" ",
"exception",
" ",
"object",
" ",
"translat",
"es",
" ",
"consiste",
"nc",
"y",
" ",
"from",
" ",
"input",
" ",
"value",
" ",
"to",
" ",
"correct",
" ",
"output",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"consiste",
"nc",
"y",
"\\u",
"str_",
"=_",
"self_",
"._",
"extract",
"\\u",
"consiste",
"ncy_",
"(_",
"repr_",
"(_",
"Timeout_",
"(_",
"\"",
"Time",
"out",
" ",
"Messag",
"e",
"\"_",
",_",
"consiste",
"ncy_",
"=_",
"None_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"consiste",
"nc",
"y",
"\\u",
"str_",
",_",
"'",
"Not",
" ",
"Set",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"c_",
"in_",
"Cons",
"iste",
"nc",
"y",
"Level_",
"._",
"value",
"\\u",
"to",
"\\u",
"name_",
"._",
"keys_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"consiste",
"nc",
"y",
"\\u",
"str_",
"=_",
"self_",
"._",
"extract",
"\\u",
"consiste",
"ncy_",
"(_",
"repr_",
"(_",
"Timeout_",
"(_",
"\"",
"Time",
"out",
" ",
"Messag",
"e",
"\"_",
",_",
"consiste",
"ncy_",
"=_",
"c_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"consiste",
"nc",
"y",
"\\u",
"str_",
",_",
"Cons",
"iste",
"nc",
"y",
"Level_",
"._",
"value",
"\\u",
"to",
"\\u",
"name_",
"[_",
"c_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cons",
"iste",
"nc",
"y",
"Except",
"ion",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"unava",
"ilab",
"le",
"\\u",
"consiste",
"ncy_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Verify",
" ",
"tha",
"t",
" ",
"Una",
"vail",
"able",
" ",
"exception",
" ",
"object",
" ",
"translat",
"es",
" ",
"consiste",
"nc",
"y",
" ",
"from",
" ",
"input",
" ",
"value",
" ",
"to",
" ",
"correct",
" ",
"output",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"consiste",
"nc",
"y",
"\\u",
"str_",
"=_",
"self_",
"._",
"extract",
"\\u",
"consiste",
"ncy_",
"(_",
"repr_",
"(_",
"Una",
"vail",
"able_",
"(_",
"\"",
"Una",
"vail",
"able",
" ",
"Messag",
"e",
"\"_",
",_",
"consiste",
"ncy_",
"=_",
"None_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"consiste",
"nc",
"y",
"\\u",
"str_",
",_",
"'",
"Not",
" ",
"Set",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"c_",
"in_",
"Cons",
"iste",
"nc",
"y",
"Level_",
"._",
"value",
"\\u",
"to",
"\\u",
"name_",
"._",
"keys_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"consiste",
"nc",
"y",
"\\u",
"str_",
"=_",
"self_",
"._",
"extract",
"\\u",
"consiste",
"ncy_",
"(_",
"repr_",
"(_",
"Una",
"vail",
"able_",
"(_",
"\"",
"Time",
"out",
" ",
"Messag",
"e",
"\"_",
",_",
"consiste",
"ncy_",
"=_",
"c_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"consiste",
"nc",
"y",
"\\u",
"str_",
",_",
"Cons",
"iste",
"nc",
"y",
"Level_",
"._",
"value",
"\\u",
"to",
"\\u",
"name_",
"[_",
"c_",
"]_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
] |
Unused local variable | ziirish/burp-ui/burpui/misc/auth/ldap.py | [
{
"content": " def __init__(self, app=None, handler=None):\n \"\"\":func:`burpui.misc.auth.ldap.LdapLoader.__init__` establishes a\n connection to the LDAP server.\n\n :param app: Instance of the app we are running in\n :type app: :class:`burpui.server.BUIServer`\n \"\"\"\n self.app = app\n conf = self.app.config['CFG']\n defaults = {\n 'host': 'localhost',\n 'port': None,\n 'encryption': None,\n 'binddn': None,\n 'bindpw': None,\n 'filter': None,\n 'base': None,\n 'searchattr': 'uid',\n 'validate': 'none',\n 'version': None,\n 'cafile': None\n }\n mapping = {\n 'host': 'host',\n 'port': 'port',\n 'encryption': 'encryption',\n 'filt': 'filter',\n 'base': 'base',\n 'attr': 'searchattr',\n 'binddn': 'binddn',\n 'bindpw': 'bindpw',\n 'validate': 'validate',\n 'version': 'version',\n 'cafile': 'cafile'\n }\n c = ConfigParser.ConfigParser(defaults)\n with open(conf) as fp:\n c.readfp(fp)\n # Maybe the handler argument is None, maybe the 'priority'\n # option is missing. We don't care.\n try:\n handler.priority = c.getint('LDAP', 'priority')\n except:\n pass\n for (opt, key) in viewitems(mapping):\n try:\n setattr(self, opt, c.get('LDAP', key))\n except ConfigParser.NoOptionError as e:\n self.builogger.info(str(e))\n except ConfigParser.NoSectionError as e:\n self.builogger.error(str(e))\n\n if self.validate and self.validate.lower() in ['none', 'optional', 'required']:\n self.validate = getattr(ssl, 'CERT_{}'.format(self.validate.upper()))\n else:\n self.validate = None\n if self.version and self.version in ['SSLv2', 'SSLv3', 'SSLv23', 'TLSv1', 'TLSv1_1']:\n self.version = getattr(ssl, 'PROTOCOL_{}'.format(self.version))\n else:\n self.version = None\n self.tls = None\n self.ssl = False\n self.auto_bind = AUTO_BIND_NONE\n if self.encryption == 'ssl':\n self.ssl = True\n elif self.encryption == 'tls':\n self.tls = Tls(local_certificate_file=self.cafile, validate=self.validate, version=self.version)\n self.auto_bind = AUTO_BIND_TLS_BEFORE_BIND\n if self.port:\n try:\n self.port = int(self.port)\n except ValueError:\n self.builogger.error('LDAP port must be a valid integer')\n self.port = None\n self.builogger.info('LDAP host: {0}'.format(self.host))\n self.builogger.info('LDAP port: {0}'.format(self.port))\n self.builogger.info('LDAP encryption: {0}'.format(self.encryption))\n self.builogger.info('LDAP filter: {0}'.format(self.filt))\n self.builogger.info('LDAP base: {0}'.format(self.base))\n self.builogger.info('LDAP search attr: {0}'.format(self.attr))\n self.builogger.info('LDAP binddn: {0}'.format(self.binddn))\n self.builogger.info('LDAP bindpw: {0}'.format('*****' if self.bindpw else 'None'))\n self.builogger.info('TLS object: {0}'.format(self.tls))\n\n try:\n self.server = Server(host=self.host, port=self.port, use_ssl=self.ssl, get_info=ALL, tls=self.tls)\n self.builogger.debug('LDAP Server = {0}'.format(str(self.server)))\n if self.binddn:\n self.ldap = Connection(self.server, user=self.binddn, password=self.bindpw, raise_exceptions=True, client_strategy=RESTARTABLE, auto_bind=self.auto_bind, authentication=SIMPLE)\n else:\n self.ldap = Connection(self.server, raise_exceptions=True, client_strategy=RESTARTABLE, auto_bind=self.auto_bind)\n with self.ldap:\n self.builogger.debug('LDAP Connection = {0}'.format(str(self.ldap)))\n self.builogger.info('OK, connected to LDAP')\n return\n\n raise Exception('Not connected')\n except Exception as e:\n self.builogger.error('Could not connect to LDAP: {0}'.format(str(e)))\n self.server = None\n self.ldap = None",
"metadata": "root.LdapLoader.__init__",
"header": "['class', 'LdapLoader', '(', 'BUIloader', ')', ':', '___EOS___']",
"index": 18
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Lda",
"p",
"Loader_",
"(_",
"BU",
"Il",
"oad",
"er_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"app_",
"=_",
"None_",
",_",
"handler_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
":",
"func",
":`",
"bur",
"pu",
"i",
".",
"misc",
".",
"auth",
".",
"ldap",
".",
"Lda",
"p",
"Load",
"er",
".\\u",
"\\u",
"init",
"\\u\\u",
"`",
" ",
"establish",
"es",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"connecti",
"on",
" ",
"to",
" ",
"the",
" ",
"LDA",
"P",
" ",
"server",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"app",
":",
" ",
"Insta",
"nce",
" ",
"of",
" ",
"the",
" ",
"app",
" ",
"we",
" ",
"are",
" ",
"runn",
"ing",
" ",
"in",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"app",
":",
" ",
":",
"class",
":`",
"bur",
"pu",
"i",
".",
"server",
".",
"BU",
"IS",
"erver",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"app_",
"=_",
"app_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf_",
"=_",
"self_",
"._",
"app_",
"._",
"config_",
"[_",
"'",
"CF",
"G",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"defaults_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"host",
"'_",
":_",
"'",
"local",
"host",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"port",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"encrypt",
"ion",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bind",
"dn",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bind",
"pw",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"filter",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"base",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"searcha",
"ttr",
"'_",
":_",
"'",
"uid",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"validat",
"e",
"'_",
":_",
"'",
"none",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"version",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"caf",
"ile",
"'_",
":_",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mapping_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"host",
"'_",
":_",
"'",
"host",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"port",
"'_",
":_",
"'",
"port",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"encrypt",
"ion",
"'_",
":_",
"'",
"encrypt",
"ion",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"filt",
"'_",
":_",
"'",
"filter",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"base",
"'_",
":_",
"'",
"base",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"attr",
"'_",
":_",
"'",
"searcha",
"ttr",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bind",
"dn",
"'_",
":_",
"'",
"bind",
"dn",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bind",
"pw",
"'_",
":_",
"'",
"bind",
"pw",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"validat",
"e",
"'_",
":_",
"'",
"validat",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"version",
"'_",
":_",
"'",
"version",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"caf",
"ile",
"'_",
":_",
"'",
"caf",
"ile",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"Config",
"Parser_",
"._",
"Config",
"Parser_",
"(_",
"defaults_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"open_",
"(_",
"conf_",
")_",
"as_",
"fp_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"._",
"readf",
"p_",
"(_",
"fp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Ma",
"yb",
"e",
" ",
"the",
" ",
"handler",
" ",
"argu",
"ment",
" ",
"is",
" ",
"Non",
"e",
",",
" ",
"may",
"be",
" ",
"the",
" ",
"'",
"priorit",
"y",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"option",
" ",
"is",
" ",
"missi",
"ng",
".",
" ",
"We",
" ",
"don",
"'",
"t",
" ",
"care",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"handler_",
"._",
"priority_",
"=_",
"c_",
"._",
"getint_",
"(_",
"'",
"LDA",
"P",
"'_",
",_",
"'",
"priorit",
"y",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"(_",
"opt_",
",_",
"key_",
")_",
"in_",
"view",
"items_",
"(_",
"mapping_",
")_",
":_",
"\\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 ",
" ",
"_",
"setattr_",
"(_",
"self_",
",_",
"opt_",
",_",
"c_",
"._",
"get_",
"(_",
"'",
"LDA",
"P",
"'_",
",_",
"key_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Config",
"Parser_",
"._",
"No",
"Optio",
"n",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"str_",
"(_",
"e_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Config",
"Parser_",
"._",
"No",
"Sect",
"ion",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"bui",
"logger_",
"._",
"error_",
"(_",
"str_",
"(_",
"e_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"validate_",
"and_",
"self_",
"._",
"validate_",
"._",
"lower_",
"(_",
")_",
"in_",
"[_",
"'",
"none",
"'_",
",_",
"'",
"option",
"al",
"'_",
",_",
"'",
"require",
"d",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"validate_",
"=_",
"getattr_",
"(_",
"ssl_",
",_",
"'",
"CERT",
"\\u{}'_",
"._",
"format_",
"(_",
"self_",
"._",
"validate_",
"._",
"upper_",
"(_",
")_",
")_",
")_",
"\\u\\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_",
"._",
"validate_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"version_",
"and_",
"self_",
"._",
"version_",
"in_",
"[_",
"'",
"SS",
"Lv",
"2",
"'_",
",_",
"'",
"SS",
"Lv",
"3",
"'_",
",_",
"'",
"SS",
"Lv",
"23",
"'_",
",_",
"'",
"TLS",
"v1",
"'_",
",_",
"'",
"TLS",
"v1",
"\\u",
"1",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"version_",
"=_",
"getattr_",
"(_",
"ssl_",
",_",
"'",
"PROTOCOL",
"\\u{}'_",
"._",
"format_",
"(_",
"self_",
"._",
"version_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"version_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"tls_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ssl_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"auto",
"\\u",
"bind_",
"=_",
"AUTO",
"\\u",
"BIND",
"\\u",
"NONE_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"encryption_",
"==_",
"'",
"ssl",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"ssl_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"self_",
"._",
"encryption_",
"==_",
"'",
"tls",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"tls_",
"=_",
"Tl",
"s_",
"(_",
"local",
"\\u",
"certifica",
"te",
"\\u",
"file_",
"=_",
"self_",
"._",
"caf",
"ile_",
",_",
"validate_",
"=_",
"self_",
"._",
"validate_",
",_",
"version_",
"=_",
"self_",
"._",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"auto",
"\\u",
"bind_",
"=_",
"AUTO",
"\\u",
"BIND",
"\\u",
"TLS",
"\\u",
"BEFORE",
"\\u",
"BIND",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"port_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"port_",
"=_",
"int_",
"(_",
"self_",
"._",
"port_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"bui",
"logger_",
"._",
"error_",
"(_",
"'",
"LDA",
"P",
" ",
"port",
" ",
"must",
" ",
"be",
" ",
"a",
" ",
"valid",
" ",
"integ",
"er",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"port_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"'",
"LDA",
"P",
" ",
"host",
":",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"self_",
"._",
"host_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"'",
"LDA",
"P",
" ",
"port",
":",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"self_",
"._",
"port_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"'",
"LDA",
"P",
" ",
"encrypt",
"ion",
":",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"self_",
"._",
"encryption_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"'",
"LDA",
"P",
" ",
"filter",
":",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"self_",
"._",
"filt_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"'",
"LDA",
"P",
" ",
"base",
":",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"self_",
"._",
"base_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"'",
"LDA",
"P",
" ",
"search",
" ",
"attr",
":",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"self_",
"._",
"attr_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"'",
"LDA",
"P",
" ",
"bind",
"dn",
":",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"self_",
"._",
"bind",
"dn_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"'",
"LDA",
"P",
" ",
"bind",
"pw",
":",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"'**",
"***",
"'_",
"if_",
"self_",
"._",
"bind",
"pw_",
"else_",
"'",
"Non",
"e",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"'",
"TLS",
" ",
"object",
":",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"self_",
"._",
"tls_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"server_",
"=_",
"Server_",
"(_",
"host_",
"=_",
"self_",
"._",
"host_",
",_",
"port_",
"=_",
"self_",
"._",
"port_",
",_",
"use",
"\\u",
"ssl_",
"=_",
"self_",
"._",
"ssl_",
",_",
"get",
"\\u",
"info_",
"=_",
"ALL_",
",_",
"tls_",
"=_",
"self_",
"._",
"tls_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"debug_",
"(_",
"'",
"LDA",
"P",
" ",
"Server",
" ",
"=",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"str_",
"(_",
"self_",
"._",
"server_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"bind",
"dn_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"ldap_",
"=_",
"Connection_",
"(_",
"self_",
"._",
"server_",
",_",
"user_",
"=_",
"self_",
"._",
"bind",
"dn_",
",_",
"password_",
"=_",
"self_",
"._",
"bind",
"pw_",
",_",
"raise",
"\\u",
"exceptions_",
"=_",
"True_",
",_",
"client",
"\\u",
"strategy_",
"=_",
"RESTA",
"RT",
"ABLE_",
",_",
"auto",
"\\u",
"bind_",
"=_",
"self_",
"._",
"auto",
"\\u",
"bind_",
",_",
"authentication_",
"=_",
"SIMPLE",
"_",
")_",
"\\u\\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_",
"._",
"ldap_",
"=_",
"Connection_",
"(_",
"self_",
"._",
"server_",
",_",
"raise",
"\\u",
"exceptions_",
"=_",
"True_",
",_",
"client",
"\\u",
"strategy_",
"=_",
"RESTA",
"RT",
"ABLE_",
",_",
"auto",
"\\u",
"bind_",
"=_",
"self_",
"._",
"auto",
"\\u",
"bind_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"with_",
"self_",
"._",
"ldap_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"bui",
"logger_",
"._",
"debug_",
"(_",
"'",
"LDA",
"P",
" ",
"Connect",
"ion",
" ",
"=",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"str_",
"(_",
"self_",
"._",
"ldap_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"bui",
"logger_",
"._",
"info_",
"(_",
"'",
"OK",
",",
" ",
"connect",
"ed",
" ",
"to",
" ",
"LDA",
"P",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"raise_",
"Exception_",
"(_",
"'",
"Not",
" ",
"connect",
"ed",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"bui",
"logger_",
"._",
"error_",
"(_",
"'",
"Cou",
"ld",
" ",
"not",
" ",
"connect",
" ",
"to",
" ",
"LDA",
"P",
":",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"str_",
"(_",
"e_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"server_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ldap_",
"=_",
"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,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2,
2
] |
Unused import | dikien/Machine-Learning-Newspaper/nytimes/step1_data_wrangling.py | [
{
"content": "# -*- coding: UTF-8 -*-\n\nimport requests\nimport csv\nimport time\nimport sys\n\nbasic_url = \"http://api.nytimes.com/svc/search/v2/articlesearch.json\"\n\npayload = {\"api-key\" : \"input your api key\",\n \"callback\" : \"svc_search_v2_articlesearch\",\n \"sort\" : \"oldest\",\n \"fl\" : \"lead_paragraph,byline\",\n \"page\" : \"1\"\n}\n\n\n\nfor month in range(1,13):\n if month < 10:\n month = str(month)\n month = \"2010\" + \"0\" + month\n else:\n month = str(month)\n month = \"2010\" + month\n\n for day in range(1, 32):\n if day < 10:\n day = str(day)\n day = \"0\" + day\n date = month + day\n print \"%s is starting\" % date\n trans_json_to_csv(date)\n print \"%s is done\" % date\n else:\n day = str(day)\n date = month + day\n print \"%s is starting\" % date\n trans_json_to_csv(date)\n print \"%s is done\" % date",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def trans_json_to_csv(date):\n '''\n if data == 20101010 -> 20101010.csv will be saved with article that were written in 2010.10.10\n :param date: date\n :return: nothing\n '''\n ft = open(\"articles/\"+ date + \".csv\", \"wb+\")\n f = csv.writer(ft, delimiter='\\t')\n payload.update({\"begin_date\" : date, \"end_date\" : date})\n docs_lens = 1\n page = 1\n\n while(docs_lens > 0 and page < 15):\n # when page get around 100, there were some errors.\n try:\n r = requests.get(basic_url, params=payload)\n except:\n r = requests.get(basic_url, params=payload)\n\n # If one day limie query occurs, exit(0)\n if \"X-Mashery-Error-Code\" in r.headers:\n print \"ERR_403_DEVELOPER_OVER_RATE\"\n sys.exit(0)\n\n try:\n contents = r.json()\n for k in contents[\"response\"][\"docs\"]:\n # Don't save \"THE ASSOCIATED PRESS\" and \"REUTERS\" because these are not the goal of this.\n if type(k[\"byline\"]) == dict \\\n and type(k[\"lead_paragraph\"]) == unicode\\\n and k[\"byline\"][\"original\"].replace(\"By \", \"\").encode(\"UTF-8\", errors=\"ignore\") != \"THE ASSOCIATED PRESS\"\\\n and k[\"byline\"][\"original\"].replace(\"By \", \"\").encode(\"UTF-8\", errors=\"ignore\") != \"REUTERS\":\n f.writerow([k[\"byline\"][\"original\"].replace(\"By \", \"\").encode(\"UTF-8\", errors=\"ignore\"), # write \"writer\"\n k[\"lead_paragraph\"].encode(\"UTF-8\", errors=\"ignore\") # write \"lead paragraph\"\n ])\n print \"writer is %s\" % k[\"byline\"][\"original\"].replace(\"By \", \"\")\n time.sleep(0.5)\n # print \"paragraph is %s\" % k[\"lead_paragraph\"]\n\n print \"page number is %s\" % page\n page += 1\n\n docs_lens = len(contents[\"response\"][\"docs\"])\n print \"doc length is %s\" % docs_lens\n payload.update({\"page\" : page})\n\n except Exception as e:\n page += 1\n print \"page number is %s\" % page\n print e\n # print json.dumps(contents, indent=4, sort_keys=True)\n pass\n ft.close()",
"metadata": "root.trans_json_to_csv",
"header": "['module', '___EOS___']",
"index": 16
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"UT",
"F",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"requests_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"csv_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"basic",
"\\u",
"url_",
"=_",
"\"",
"http",
"://",
"api",
".",
"ny",
"times",
".",
"com",
"/",
"svc",
"/",
"search",
"/",
"v2",
"/",
"article",
"search",
".",
"json",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"payload_",
"=_",
"{_",
"\"",
"api",
"-",
"key",
"\"_",
":_",
"\"",
"input",
" ",
"your",
" ",
"api",
" ",
"key",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"callback",
"\"_",
":_",
"\"",
"svc",
"\\u",
"search",
"\\u",
"v2",
"\\u",
"article",
"search",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"sort",
"\"_",
":_",
"\"",
"oldest",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"fl",
"\"_",
":_",
"\"",
"lead",
"\\u",
"paragraph",
",",
"by",
"line",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"page",
"\"_",
":_",
"\"",
"1",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\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_",
"for_",
"month_",
"in_",
"range_",
"(_",
"1_",
",_",
"13_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"month_",
"<_",
"10_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"month_",
"=_",
"str_",
"(_",
"month_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"month_",
"=_",
"\"",
"2010",
"\"_",
"+_",
"\"",
"0",
"\"_",
"+_",
"month_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"month_",
"=_",
"str_",
"(_",
"month_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"month_",
"=_",
"\"",
"2010",
"\"_",
"+_",
"month_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"day_",
"in_",
"range_",
"(_",
"1_",
",_",
"32_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"day_",
"<_",
"10_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"day_",
"=_",
"str_",
"(_",
"day_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"day_",
"=_",
"\"",
"0",
"\"_",
"+_",
"day_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"date_",
"=_",
"month_",
"+_",
"day_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"%",
"s",
" ",
"is",
" ",
"startin",
"g",
"\"_",
"%_",
"date_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"trans",
"\\u",
"json",
"\\u",
"to",
"\\u",
"csv_",
"(_",
"date_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"%",
"s",
" ",
"is",
" ",
"don",
"e",
"\"_",
"%_",
"date_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"day_",
"=_",
"str_",
"(_",
"day_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"date_",
"=_",
"month_",
"+_",
"day_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"%",
"s",
" ",
"is",
" ",
"startin",
"g",
"\"_",
"%_",
"date_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"trans",
"\\u",
"json",
"\\u",
"to",
"\\u",
"csv_",
"(_",
"date_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"%",
"s",
" ",
"is",
" ",
"don",
"e",
"\"_",
"%_",
"date_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"trans",
"\\u",
"json",
"\\u",
"to",
"\\u",
"csv_",
"(_",
"date_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"if",
" ",
"data",
" ",
"==",
" ",
"2010",
"1010",
" ",
"->",
" ",
"2010",
"1010",
".",
"csv",
" ",
"will",
" ",
"be",
" ",
"saved",
" ",
"with",
" ",
"article",
" ",
"tha",
"t",
" ",
"wer",
"e",
" ",
"writt",
"en",
" ",
"in",
" ",
"2010",
".1",
"0.10",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"date",
":",
" ",
"date",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"not",
"hing",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ft_",
"=_",
"open_",
"(_",
"\"",
"article",
"s",
"/\"_",
"+_",
"date_",
"+_",
"\".",
"csv",
"\"_",
",_",
"\"",
"wb",
"+\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"=_",
"csv_",
"._",
"writer_",
"(_",
"ft_",
",_",
"delimiter_",
"=_",
"'\\\\",
"t",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"payload_",
"._",
"update_",
"(_",
"{_",
"\"",
"begin",
"\\u",
"date",
"\"_",
":_",
"date_",
",_",
"\"",
"end",
"\\u",
"date",
"\"_",
":_",
"date_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"docs",
"\\u",
"lens_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"page_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"while_",
"(_",
"docs",
"\\u",
"lens_",
">_",
"0_",
"and_",
"page_",
"<_",
"15_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"whe",
"n",
" ",
"page",
" ",
"get",
" ",
"aro",
"und",
" ",
"100",
",",
" ",
"there",
" ",
"wer",
"e",
" ",
"some",
" ",
"error",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r_",
"=_",
"requests_",
"._",
"get_",
"(_",
"basic",
"\\u",
"url_",
",_",
"params_",
"=_",
"payload_",
")_",
"\\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 ",
" _",
"r_",
"=_",
"requests_",
"._",
"get_",
"(_",
"basic",
"\\u",
"url_",
",_",
"params_",
"=_",
"payload_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"one",
" ",
"day",
" ",
"lim",
"ie",
" ",
"query",
" ",
"occur",
"s",
",",
" ",
"exit",
"(",
"0",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\"",
"X",
"-",
"Mas",
"her",
"y",
"-",
"Error",
"-",
"Code",
"\"_",
"in_",
"r_",
"._",
"headers_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
"ERR",
"\\u",
"403",
"\\u",
"DEVELO",
"PER",
"\\u",
"OVER",
"\\u",
"RAT",
"E",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"contents_",
"=_",
"r_",
"._",
"json_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"k_",
"in_",
"contents_",
"[_",
"\"",
"response",
"\"_",
"]_",
"[_",
"\"",
"docs",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Don",
"'",
"t",
" ",
"save",
" ",
"\"",
"THE",
" ",
"ASSOC",
"IAT",
"ED",
" ",
"PRESS",
"\"",
" ",
"and",
" ",
"\"",
"RE",
"UT",
"ERS",
"\"",
" ",
"bec",
"aus",
"e",
" ",
"these",
" ",
"are",
" ",
"not",
" ",
"the",
" ",
"goal",
" ",
"of",
" ",
"this",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"type_",
"(_",
"k_",
"[_",
"\"",
"by",
"line",
"\"_",
"]_",
")_",
"==_",
"dict_",
"and_",
"type_",
"(_",
"k_",
"[_",
"\"",
"lead",
"\\u",
"paragraph",
"\"_",
"]_",
")_",
"==_",
"unicode_",
"and_",
"k_",
"[_",
"\"",
"by",
"line",
"\"_",
"]_",
"[_",
"\"",
"original",
"\"_",
"]_",
"._",
"replace_",
"(_",
"\"",
"By",
" ",
"\"_",
",_",
"\"\"_",
")_",
"._",
"encode_",
"(_",
"\"",
"UT",
"F",
"-",
"8",
"\"_",
",_",
"errors_",
"=_",
"\"",
"ignore",
"\"_",
")_",
"!=_",
"\"",
"THE",
" ",
"ASSOC",
"IAT",
"ED",
" ",
"PRESS",
"\"_",
"and_",
"k_",
"[_",
"\"",
"by",
"line",
"\"_",
"]_",
"[_",
"\"",
"original",
"\"_",
"]_",
"._",
"replace_",
"(_",
"\"",
"By",
" ",
"\"_",
",_",
"\"\"_",
")_",
"._",
"encode_",
"(_",
"\"",
"UT",
"F",
"-",
"8",
"\"_",
",_",
"errors_",
"=_",
"\"",
"ignore",
"\"_",
")_",
"!=_",
"\"",
"RE",
"UT",
"ERS",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"f_",
"._",
"writerow_",
"(_",
"[_",
"k_",
"[_",
"\"",
"by",
"line",
"\"_",
"]_",
"[_",
"\"",
"original",
"\"_",
"]_",
"._",
"replace_",
"(_",
"\"",
"By",
" ",
"\"_",
",_",
"\"\"_",
")_",
"._",
"encode_",
"(_",
"\"",
"UT",
"F",
"-",
"8",
"\"_",
",_",
"errors_",
"=_",
"\"",
"ignore",
"\"_",
")_",
",_",
"#",
" ",
"write",
" ",
"\"",
"writer",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"k_",
"[_",
"\"",
"lead",
"\\u",
"paragraph",
"\"_",
"]_",
"._",
"encode_",
"(_",
"\"",
"UT",
"F",
"-",
"8",
"\"_",
",_",
"errors_",
"=_",
"\"",
"ignore",
"\"_",
")_",
"#",
" ",
"write",
" ",
"\"",
"lead",
" ",
"paragraph",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"",
"writer",
" ",
"is",
" ",
"%",
"s",
"\"_",
"%_",
"k_",
"[_",
"\"",
"by",
"line",
"\"_",
"]_",
"[_",
"\"",
"original",
"\"_",
"]_",
"._",
"replace_",
"(_",
"\"",
"By",
" ",
"\"_",
",_",
"\"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"0.5_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"print",
" ",
"\"",
"paragraph",
" ",
"is",
" ",
"%",
"s",
"\"",
" ",
"%",
" ",
"k",
"[\"",
"lead",
"\\u",
"paragraph",
"\"]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"\"",
"page",
" ",
"number",
" ",
"is",
" ",
"%",
"s",
"\"_",
"%_",
"page_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"page_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"docs",
"\\u",
"lens_",
"=_",
"len_",
"(_",
"contents_",
"[_",
"\"",
"response",
"\"_",
"]_",
"[_",
"\"",
"docs",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"",
"doc",
" ",
"length",
" ",
"is",
" ",
"%",
"s",
"\"_",
"%_",
"docs",
"\\u",
"lens_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"payload_",
"._",
"update_",
"(_",
"{_",
"\"",
"page",
"\"_",
":_",
"page_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\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 ",
" _",
"page_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"",
"page",
" ",
"number",
" ",
"is",
" ",
"%",
"s",
"\"_",
"%_",
"page_",
"\\u\\u\\uNEWLINE\\u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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | vim-awesome/vim-awesome/test/tools/scrape/github_test.py | [
{
"content": "import unittest\n\nfrom mock import patch\nfrom test.utils import fixture_data, mock_api_response\nfrom tools.scrape import github\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class GithubTest(unittest.TestCase):\n\n\n\n\n\n\n\n",
"metadata": "root.GithubTest",
"header": "['module', '___EOS___']",
"index": 7
},
{
"content": " def test_vundle_plugin_regex(self):\n vimrc = \"\"\"Bundle 'gmarik/vundle0'\n Bundle 'gmarik/vundle1'\n Bundle 'gmarik/vundle2'\n \\tBundle 'gmarik/vundle3'\n Bundle 'gmarik/vundle4' \" Comment: Merry Swiftmas!!!!\n Bundle \"gmarik/vundle5\"\n Bundle 'taglist'\n Bundle 'ervandew/supertab.git'\n Bundle 'git://github.com/scrooloose/nerdtree'\n Bundle 'git://github.com/kien/ctrlp.vim.git'\n Bundle 'calendar.vim--Matsumoto'\n Bundle 'git://git.wincent.com/command-t.git'\n Bundle '[email protected]:Valloric/YouCompleteMe.git'\n Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}\n Bundle 'https://github.com/Raimondi/delimitMate/'\n\n Bundle 'uh/oh\n \"Bundle 'commented/out'\n \"\"\"\n\n expected_matches = [\n 'gmarik/vundle0',\n 'gmarik/vundle1',\n 'gmarik/vundle2',\n 'gmarik/vundle3',\n 'gmarik/vundle4',\n 'gmarik/vundle5',\n 'taglist',\n 'ervandew/supertab.git',\n 'git://github.com/scrooloose/nerdtree',\n 'git://github.com/kien/ctrlp.vim.git',\n 'calendar.vim--Matsumoto',\n 'git://git.wincent.com/command-t.git',\n '[email protected]:Valloric/YouCompleteMe.git',\n 'rstacruz/sparkup',\n 'https://github.com/Raimondi/delimitMate/'\n ]\n\n rx = github._VUNDLE_PLUGIN_REGEX\n self.assertEquals(rx.findall(vimrc), expected_matches)",
"metadata": "root.GithubTest.test_vundle_plugin_regex",
"header": "['class', 'GithubTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 9
},
{
"content": " def test_neobundle_plugin_regex(self):\n vimrc = \"\"\"\n NeoBundle 'scrooloose/nerdtree'\n NeoBundleFetch 'Shougo/neobundle.vim'\n NeoBundleLazy 'Shougo/unite.vim'\n \"\"\"\n\n expected_matches = [\n 'scrooloose/nerdtree',\n 'Shougo/neobundle.vim',\n 'Shougo/unite.vim',\n ]\n\n rx = github._NEOBUNDLE_PLUGIN_REGEX\n self.assertEquals(rx.findall(vimrc), expected_matches)",
"metadata": "root.GithubTest.test_neobundle_plugin_regex",
"header": "['class', 'GithubTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 51
},
{
"content": " def test_bundle_owner_repo_regex(self):\n rx = github._BUNDLE_OWNER_REPO_REGEX\n\n def test(bundle, expected):\n self.assertEquals(rx.search(bundle).groups(), expected)\n\n test('gmarik/vundle', ('gmarik', 'vundle'))\n test('gmarik/vundle/', ('gmarik', 'vundle'))\n test('taglist', (None, 'taglist'))\n test('ervandew/supertab.git', ('ervandew', 'supertab'))\n test('git://github.com/scrooloose/nerdtree',\n ('scrooloose', 'nerdtree'))\n test('git://github.com/kien/ctrlp.vim.git', ('kien', 'ctrlp.vim'))\n test('calendar.vim--Matsumoto', (None, 'calendar.vim--Matsumoto'))\n\n # Don't care about non-GitHub repos. They'll just 404 when we scrape.\n test('git://git.wincent.com/command-t.git',\n ('git.wincent.com', 'command-t'))\n\n test('[email protected]:Valloric/YouCompleteMe.git',\n ('Valloric', 'YouCompleteMe'))\n test('https://github.com/vim-scripts/The-NERD-tree.git',\n ('vim-scripts', 'The-NERD-tree'))\n test('https://github.com/Raimondi/delimitMate/',\n ('Raimondi', 'delimitMate'))",
"metadata": "root.GithubTest.test_bundle_owner_repo_regex",
"header": "['class', 'GithubTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 67
},
{
"content": " def test_submodule_is_bundle_regex(self):\n s = github._SUBMODULE_IS_BUNDLE_REGEX.search\n\n self.assertIsNotNone(s('submodule \"bundle/ropevim\"'))\n self.assertIsNotNone(s('submodule \"vim/bundle/handlebars\"'))\n self.assertIsNotNone(s('submodule \"available-bundles/unimpaired\"'))\n self.assertIsNotNone(s(\n 'submodule \"vim/vim.symlink/bundle/vim-pathogen\"'))\n self.assertIsNotNone(s('submodule \"submodules/vim_plugins/ag.vim\"'))\n self.assertIsNotNone(s(\n 'submodule \"submodules/vim-plugins/python-mode\"'))\n\n self.assertIsNone(s('submodule \".emacs.d/packages/groovy\"'))\n self.assertIsNone(s('submodule \"theme/sundown\"'))\n self.assertIsNone(s('submodule \"jedi\"'))",
"metadata": "root.GithubTest.test_submodule_is_bundle_regex",
"header": "['class', 'GithubTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 93
},
{
"content": " def test_extract_bundle_repos_from_file(self):\n file_contents = \"\"\"\n Plug 'tpope/fugitive.vim'\n Plug 'https://github.com/Valoric/YouCompleteMe'\n\n Bundle 'ownerName/repository'\n NeoBundle 'anotherOwner/anotherRepo'\n \"\"\"\n\n actual = github._extract_bundle_repos_from_file(file_contents)\n\n expected = github.ReposByManager(\n [('ownerName', 'repository')],\n [('anotherOwner', 'anotherRepo')],\n [('tpope', 'fugitive.vim'), ('Valoric', 'YouCompleteMe')])\n\n self.assertEqual(actual, expected)",
"metadata": "root.GithubTest.test_extract_bundle_repos_from_file",
"header": "['class', 'GithubTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 109
},
{
"content": " @patch('tools.scrape.github.get_api_page')\n def test_extract_vimplug_bundle_repos_from_dir(self, mock_get_api_page):\n mock_get_api_page.side_effect = mock_api_response\n\n dir_data = fixture_data('/repos/captbaritone/dotfiles/contents')\n actual = github._extract_bundle_repos_from_dir(dir_data).vimplug\n\n expected = [\n ('captbaritone', 'molokai'),\n ('chriskempson', 'vim-tomorrow-theme'),\n ('altercation', 'vim-colors-solarized'),\n ('fxn', 'vim-monochrome'),\n ('chriskempson', 'base16-vim'),\n ('NLKNguyen', 'papercolor-theme'),\n ('tpope', 'vim-git'),\n ('cakebaker', 'scss-syntax.vim'),\n ('xsbeats', 'vim-blade'),\n ('qrps', 'lilypond-vim'),\n ('plasticboy', 'vim-markdown'),\n ('mattn', 'emmet-vim'),\n ('edsono', 'vim-matchit'),\n ('ervandew', 'supertab'),\n ('scrooloose', 'syntastic'),\n ('tpope', 'vim-unimpaired'),\n ('bling', 'vim-airline'),\n ('ctrlpvim', 'ctrlp.vim'),\n ('rking', 'ag.vim'),\n ('tpope', 'vim-eunuch'),\n ('tpope', 'vim-commentary'),\n ('tpope', 'vim-sleuth'),\n ('bkad', 'CamelCaseMotion'),\n ('AndrewRadev', 'splitjoin.vim'),\n ('gcmt', 'taboo.vim'),\n ('christoomey', 'vim-tmux-navigator'),\n ('tpope', 'vim-surround'),\n ('tpope', 'vim-repeat'),\n ('michaeljsmith', 'vim-indent-object'),\n ('bkad', 'CamelCaseMotion'),\n ('vim-scripts', 'argtextobj.vim'),\n ('tpope', 'vim-fugitive'),\n ('airblade', 'vim-gitgutter'),\n ('projects', 'vim-vigilant'),\n ('benmills', 'vimux'),\n ('davidhalter', 'jedi-vim'),\n ('vimwiki', 'vimwiki'),\n ('vim-scripts', 'pythonhelper'),\n ('pangloss', 'vim-javascript'),\n ('reedes', 'vim-pencil'),\n ('mbbill', 'undotree'),\n ('parkr', 'vim-jekyll'),\n ('mattn', 'webapi-vim'),\n ('mattn', 'gist-vim')]\n\n self.assertEqual(actual, expected)",
"metadata": "root.GithubTest.test_extract_vimplug_bundle_repos_from_dir",
"header": "['class', 'GithubTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 127
},
{
"content": " @patch('db.github_repos.DotfilesGithubRepos.get_with_owner_repo')\n @patch('db.github_repos.DotfilesGithubRepos.upsert_with_owner_repo')\n @patch('tools.scrape.github.get_api_page')\n def test_get_plugin_repose_from_dotfiles(self, mock_get_api_page,\n mock_get_dotfiles, mock_upsert_dotfiles):\n\n mock_get_api_page.side_effect = mock_api_response\n mock_get_dotfiles.return_value = {}\n mock_upsert_dotfiles.return_value = {}\n\n dotfiles = {\n 'full_name': 'captbaritone/dotfiles',\n 'pushed_at': '2015'}\n\n actual = github._get_plugin_repos_from_dotfiles(dotfiles, 'search')\n\n expected = {\n 'neobundle_repos_count': 0,\n 'pathogen_repos_count': 0,\n 'vimplug_repos_count': 44,\n 'vundle_repos_count': 0}\n\n self.assertDictEqual(actual, expected)",
"metadata": "root.GithubTest.test_get_plugin_repose_from_dotfiles",
"header": "['class', 'GithubTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 182
},
{
"content": " @patch('tools.scrape.github.get_api_page')\n def test_extract_pathogen_repos(self, mock_get_api_page):\n mock_get_api_page.side_effect = mock_api_response\n\n dir_data = fixture_data('/repos/jemiahlee/dotfiles/contents')\n actual = github._extract_pathogen_repos(dir_data)\n\n expected = [\n ('takac', 'vim-hardtime'),\n ('klen', 'python-mode'),\n ('rking', 'ag.vim'),\n ('hdima', 'python-syntax')\n ]\n\n self.assertListEqual(actual, expected)",
"metadata": "root.GithubTest.test_extract_pathogen_repos",
"header": "['class', 'GithubTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 206
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"mock_",
"import_",
"patch_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"test_",
"._",
"utils_",
"import_",
"fixture",
"\\u",
"data_",
",_",
"mock",
"\\u",
"api",
"\\u",
"response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tools_",
"._",
"scrape",
"_",
"import_",
"github_",
"\\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_",
"Git",
"hub",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Git",
"hub",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"vu",
"ndl",
"e\\u",
"plugin",
"\\u",
"regex_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"vim",
"rc_",
"=_",
"\"\"\"",
"Bun",
"dle",
" ",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e0",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e1",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
" ",
" ",
" ",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e2",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\\\",
"t",
"Bun",
"dle",
" ",
" ",
" ",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e3",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e4",
"'",
" ",
"\"",
" ",
"Comme",
"nt",
":",
" ",
"Mer",
"ry",
" ",
"Swi",
"ft",
"mas",
"!!!",
"!",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"\"",
"gma",
"rik",
"/",
"vu",
"ndl",
"e5",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"tagli",
"st",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"erv",
"and",
"ew",
"/",
"super",
"tab",
".",
"git",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"git",
"://",
"git",
"hub",
".",
"com",
"/",
"scr",
"ool",
"oos",
"e",
"/",
"ner",
"dtr",
"ee",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"git",
"://",
"git",
"hub",
".",
"com",
"/",
"kie",
"n",
"/",
"ctrl",
"p",
".",
"vim",
".",
"git",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"calendar",
".",
"vim",
"--",
"Mat",
"sum",
"oto",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"git",
"://",
"git",
".",
"win",
"cent",
".",
"com",
"/",
"command",
"-",
"t",
".",
"git",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"git",
"@",
"git",
"hub",
".",
"com",
":",
"Val",
"lor",
"ic",
"/",
"You",
"Complete",
"Me",
".",
"git",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"rsta",
"cru",
"z",
"/",
"spark",
"up",
"',",
" ",
"{",
"'",
"rtp",
"':",
" ",
"'",
"vim",
"/'",
"}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"Rai",
"mond",
"i",
"/",
"delim",
"it",
"Mat",
"e",
"/'",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"uh",
"/",
"oh",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"Bun",
"dle",
" ",
"'",
"commente",
"d",
"/",
"out",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected",
"\\u",
"matches_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e0",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e4",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e5",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"tagli",
"st",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"erv",
"and",
"ew",
"/",
"super",
"tab",
".",
"git",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"git",
"://",
"git",
"hub",
".",
"com",
"/",
"scr",
"ool",
"oos",
"e",
"/",
"ner",
"dtr",
"ee",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"git",
"://",
"git",
"hub",
".",
"com",
"/",
"kie",
"n",
"/",
"ctrl",
"p",
".",
"vim",
".",
"git",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"calendar",
".",
"vim",
"--",
"Mat",
"sum",
"oto",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"git",
"://",
"git",
".",
"win",
"cent",
".",
"com",
"/",
"command",
"-",
"t",
".",
"git",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"git",
"@",
"git",
"hub",
".",
"com",
":",
"Val",
"lor",
"ic",
"/",
"You",
"Complete",
"Me",
".",
"git",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"rsta",
"cru",
"z",
"/",
"spark",
"up",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"Rai",
"mond",
"i",
"/",
"delim",
"it",
"Mat",
"e",
"/'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"rx_",
"=_",
"github_",
"._",
"\\u",
"VU",
"ND",
"LE",
"\\u",
"PLUGIN",
"\\u",
"REGEX_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"rx_",
"._",
"findall_",
"(_",
"vim",
"rc_",
")_",
",_",
"expected",
"\\u",
"matches_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Git",
"hub",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"neo",
"bundle",
"\\u",
"plugin",
"\\u",
"regex_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"vim",
"rc_",
"=_",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Neo",
"Bun",
"dle",
" ",
"'",
"scr",
"ool",
"oos",
"e",
"/",
"ner",
"dtr",
"ee",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Neo",
"Bun",
"dle",
"Fe",
"tch",
" ",
"'",
"Sho",
"ug",
"o",
"/",
"neo",
"bundle",
".",
"vim",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Neo",
"Bun",
"dle",
"La",
"zy",
" ",
"'",
"Sho",
"ug",
"o",
"/",
"unit",
"e",
".",
"vim",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected",
"\\u",
"matches_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"scr",
"ool",
"oos",
"e",
"/",
"ner",
"dtr",
"ee",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Sho",
"ug",
"o",
"/",
"neo",
"bundle",
".",
"vim",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Sho",
"ug",
"o",
"/",
"unit",
"e",
".",
"vim",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"rx_",
"=_",
"github_",
"._",
"\\u",
"NE",
"OB",
"UND",
"LE",
"\\u",
"PLUGIN",
"\\u",
"REGEX_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"rx_",
"._",
"findall_",
"(_",
"vim",
"rc_",
")_",
",_",
"expected",
"\\u",
"matches_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Git",
"hub",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"bundle",
"\\u",
"owner",
"\\u",
"repo",
"\\u",
"regex_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rx_",
"=_",
"github_",
"._",
"\\u",
"BUN",
"DLE",
"\\u",
"OWNER",
"\\u",
"REPO",
"\\u",
"REGEX_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"test_",
"(_",
"bundle_",
",_",
"expected_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Equals_",
"(_",
"rx_",
"._",
"search_",
"(_",
"bundle_",
")_",
"._",
"groups_",
"(_",
")_",
",_",
"expected_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"test_",
"(_",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e",
"'_",
",_",
"(_",
"'",
"gma",
"rik",
"'_",
",_",
"'",
"vu",
"ndl",
"e",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"test_",
"(_",
"'",
"gma",
"rik",
"/",
"vu",
"ndl",
"e",
"/'_",
",_",
"(_",
"'",
"gma",
"rik",
"'_",
",_",
"'",
"vu",
"ndl",
"e",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"test_",
"(_",
"'",
"tagli",
"st",
"'_",
",_",
"(_",
"None_",
",_",
"'",
"tagli",
"st",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"test_",
"(_",
"'",
"erv",
"and",
"ew",
"/",
"super",
"tab",
".",
"git",
"'_",
",_",
"(_",
"'",
"erv",
"and",
"ew",
"'_",
",_",
"'",
"super",
"tab",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"test_",
"(_",
"'",
"git",
"://",
"git",
"hub",
".",
"com",
"/",
"scr",
"ool",
"oos",
"e",
"/",
"ner",
"dtr",
"ee",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"scr",
"ool",
"oos",
"e",
"'_",
",_",
"'",
"ner",
"dtr",
"ee",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"test_",
"(_",
"'",
"git",
"://",
"git",
"hub",
".",
"com",
"/",
"kie",
"n",
"/",
"ctrl",
"p",
".",
"vim",
".",
"git",
"'_",
",_",
"(_",
"'",
"kie",
"n",
"'_",
",_",
"'",
"ctrl",
"p",
".",
"vim",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"test_",
"(_",
"'",
"calendar",
".",
"vim",
"--",
"Mat",
"sum",
"oto",
"'_",
",_",
"(_",
"None_",
",_",
"'",
"calendar",
".",
"vim",
"--",
"Mat",
"sum",
"oto",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Don",
"'",
"t",
" ",
"care",
" ",
"abo",
"ut",
" ",
"non",
"-",
"Git",
"Hub",
" ",
"repos",
".",
" ",
"The",
"y",
"'",
"ll",
" ",
"just",
" ",
"404",
" ",
"whe",
"n",
" ",
"we",
" ",
"scrape",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"test_",
"(_",
"'",
"git",
"://",
"git",
".",
"win",
"cent",
".",
"com",
"/",
"command",
"-",
"t",
".",
"git",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"git",
".",
"win",
"cent",
".",
"com",
"'_",
",_",
"'",
"command",
"-",
"t",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"test_",
"(_",
"'",
"git",
"@",
"git",
"hub",
".",
"com",
":",
"Val",
"lor",
"ic",
"/",
"You",
"Complete",
"Me",
".",
"git",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"Val",
"lor",
"ic",
"'_",
",_",
"'",
"You",
"Complete",
"Me",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"test_",
"(_",
"'",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"vim",
"-",
"scripts",
"/",
"The",
"-",
"NER",
"D",
"-",
"tree",
".",
"git",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"vim",
"-",
"scripts",
"'_",
",_",
"'",
"The",
"-",
"NER",
"D",
"-",
"tree",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"test_",
"(_",
"'",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"Rai",
"mond",
"i",
"/",
"delim",
"it",
"Mat",
"e",
"/'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"Rai",
"mond",
"i",
"'_",
",_",
"'",
"delim",
"it",
"Mat",
"e",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Git",
"hub",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"submodule",
"\\u",
"is",
"\\u",
"bundle",
"\\u",
"regex_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"s_",
"=_",
"github_",
"._",
"\\u",
"SUB",
"MODUL",
"E",
"\\u",
"IS",
"\\u",
"BUN",
"DLE",
"\\u",
"REGEX_",
"._",
"search_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Not",
"None_",
"(_",
"s_",
"(_",
"'",
"submodule",
" ",
"\"",
"bundle",
"/",
"rope",
"vim",
"\"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Not",
"None_",
"(_",
"s_",
"(_",
"'",
"submodule",
" ",
"\"",
"vim",
"/",
"bundle",
"/",
"handle",
"bar",
"s",
"\"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Not",
"None_",
"(_",
"s_",
"(_",
"'",
"submodule",
" ",
"\"",
"avail",
"able",
"-",
"bundle",
"s",
"/",
"unim",
"paired",
"\"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Not",
"None_",
"(_",
"s_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"submodule",
" ",
"\"",
"vim",
"/",
"vim",
".",
"symlink",
"/",
"bundle",
"/",
"vim",
"-",
"patho",
"gen",
"\"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Not",
"None_",
"(_",
"s_",
"(_",
"'",
"submodule",
" ",
"\"",
"submodules",
"/",
"vim",
"\\u",
"plugin",
"s",
"/",
"ag",
".",
"vim",
"\"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Not",
"None_",
"(_",
"s_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"submodule",
" ",
"\"",
"submodules",
"/",
"vim",
"-",
"plugin",
"s",
"/",
"python",
"-",
"mode",
"\"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"None_",
"(_",
"s_",
"(_",
"'",
"submodule",
" ",
"\".",
"ema",
"cs",
".",
"d",
"/",
"package",
"s",
"/",
"groo",
"vy",
"\"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"None_",
"(_",
"s_",
"(_",
"'",
"submodule",
" ",
"\"",
"them",
"e",
"/",
"sund",
"own",
"\"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"None_",
"(_",
"s_",
"(_",
"'",
"submodule",
" ",
"\"",
"jedi",
"\"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Git",
"hub",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"extract",
"\\u",
"bundle",
"\\u",
"repos",
"\\u",
"from",
"\\u",
"file_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"file",
"\\u",
"contents_",
"=_",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Plug",
" ",
"'",
"tpo",
"pe",
"/",
"fu",
"giti",
"ve",
".",
"vim",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Plug",
" ",
"'",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"Valor",
"ic",
"/",
"You",
"Complete",
"Me",
"'",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Bun",
"dle",
" ",
"'",
"owner",
"Name",
"/",
"repos",
"itor",
"y",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Neo",
"Bun",
"dle",
" ",
"'",
"anot",
"her",
"Owne",
"r",
"/",
"anot",
"her",
"Rep",
"o",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"actual_",
"=_",
"github_",
"._",
"\\u",
"extract",
"\\u",
"bundle",
"\\u",
"repos",
"\\u",
"from",
"\\u",
"file_",
"(_",
"file",
"\\u",
"contents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected_",
"=_",
"github_",
"._",
"Repos",
"By",
"Manager_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"(_",
"'",
"owner",
"Name",
"'_",
",_",
"'",
"repos",
"itor",
"y",
"'_",
")_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"(_",
"'",
"anot",
"her",
"Owne",
"r",
"'_",
",_",
"'",
"anot",
"her",
"Rep",
"o",
"'_",
")_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"(_",
"'",
"tpo",
"pe",
"'_",
",_",
"'",
"fu",
"giti",
"ve",
".",
"vim",
"'_",
")_",
",_",
"(_",
"'",
"Valor",
"ic",
"'_",
",_",
"'",
"You",
"Complete",
"Me",
"'_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"actual_",
",_",
"expected_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Git",
"hub",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"patch_",
"(_",
"'",
"tool",
"s",
".",
"scrape",
".",
"git",
"hub",
".",
"get",
"\\u",
"api",
"\\u",
"page",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"extract",
"\\u",
"vim",
"plug",
"\\u",
"bundle",
"\\u",
"repos",
"\\u",
"from",
"\\u",
"dir_",
"(_",
"self_",
",_",
"mock",
"\\u",
"get",
"\\u",
"api",
"\\u",
"page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mock",
"\\u",
"get",
"\\u",
"api",
"\\u",
"page_",
"._",
"side",
"\\u",
"effect_",
"=_",
"mock",
"\\u",
"api",
"\\u",
"response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dir\\u",
"data_",
"=_",
"fixture",
"\\u",
"data_",
"(_",
"'/",
"repos",
"/",
"capt",
"bar",
"ito",
"ne",
"/",
"dot",
"files",
"/",
"content",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"actual_",
"=_",
"github_",
"._",
"\\u",
"extract",
"\\u",
"bundle",
"\\u",
"repos",
"\\u",
"from",
"\\u",
"dir_",
"(_",
"dir\\u",
"data_",
")_",
"._",
"vim",
"plug_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"capt",
"bar",
"ito",
"ne",
"'_",
",_",
"'",
"mol",
"oka",
"i",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"chris",
"ke",
"mps",
"on",
"'_",
",_",
"'",
"vim",
"-",
"tomorrow",
"-",
"them",
"e",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"alter",
"cation",
"'_",
",_",
"'",
"vim",
"-",
"colors",
"-",
"solar",
"ize",
"d",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"fx",
"n",
"'_",
",_",
"'",
"vim",
"-",
"mono",
"chrome",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"chris",
"ke",
"mps",
"on",
"'_",
",_",
"'",
"base",
"16",
"-",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"NL",
"KN",
"guy",
"en",
"'_",
",_",
"'",
"pape",
"rco",
"lor",
"-",
"them",
"e",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"tpo",
"pe",
"'_",
",_",
"'",
"vim",
"-",
"git",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"cake",
"bake",
"r",
"'_",
",_",
"'",
"scs",
"s",
"-",
"synta",
"x",
".",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"xs",
"beats",
"'_",
",_",
"'",
"vim",
"-",
"blade",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"qr",
"ps",
"'_",
",_",
"'",
"lilypond",
"-",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"plas",
"tic",
"boy",
"'_",
",_",
"'",
"vim",
"-",
"mark",
"down",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"matt",
"n",
"'_",
",_",
"'",
"emm",
"et",
"-",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"eds",
"ono",
"'_",
",_",
"'",
"vim",
"-",
"matchi",
"t",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"erv",
"and",
"ew",
"'_",
",_",
"'",
"super",
"tab",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"scr",
"ool",
"oos",
"e",
"'_",
",_",
"'",
"synta",
"stic",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"tpo",
"pe",
"'_",
",_",
"'",
"vim",
"-",
"unim",
"paired",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"blin",
"g",
"'_",
",_",
"'",
"vim",
"-",
"air",
"line",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"ctrl",
"pv",
"im",
"'_",
",_",
"'",
"ctrl",
"p",
".",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"rk",
"ing",
"'_",
",_",
"'",
"ag",
".",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"tpo",
"pe",
"'_",
",_",
"'",
"vim",
"-",
"eu",
"nuc",
"h",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"tpo",
"pe",
"'_",
",_",
"'",
"vim",
"-",
"comment",
"ary",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"tpo",
"pe",
"'_",
",_",
"'",
"vim",
"-",
"sle",
"uth",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"bk",
"ad",
"'_",
",_",
"'",
"Came",
"l",
"Case",
"Motion",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"Andre",
"w",
"Rad",
"ev",
"'_",
",_",
"'",
"split",
"join",
".",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"gcm",
"t",
"'_",
",_",
"'",
"tab",
"oo",
".",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"chris",
"too",
"me",
"y",
"'_",
",_",
"'",
"vim",
"-",
"tm",
"ux",
"-",
"navigator",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"tpo",
"pe",
"'_",
",_",
"'",
"vim",
"-",
"surround",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"tpo",
"pe",
"'_",
",_",
"'",
"vim",
"-",
"repeat",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"mich",
"ael",
"js",
"mit",
"h",
"'_",
",_",
"'",
"vim",
"-",
"indent",
"-",
"object",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"bk",
"ad",
"'_",
",_",
"'",
"Came",
"l",
"Case",
"Motion",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"vim",
"-",
"scripts",
"'_",
",_",
"'",
"arg",
"texto",
"bj",
".",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"tpo",
"pe",
"'_",
",_",
"'",
"vim",
"-",
"fu",
"giti",
"ve",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"air",
"blade",
"'_",
",_",
"'",
"vim",
"-",
"git",
"gut",
"ter",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"project",
"s",
"'_",
",_",
"'",
"vim",
"-",
"vig",
"ila",
"nt",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"ben",
"mill",
"s",
"'_",
",_",
"'",
"vim",
"ux",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"davi",
"dh",
"alter",
"'_",
",_",
"'",
"jedi",
"-",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"vim",
"wiki",
"'_",
",_",
"'",
"vim",
"wiki",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"vim",
"-",
"scripts",
"'_",
",_",
"'",
"python",
"help",
"er",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"pan",
"gloss",
"'_",
",_",
"'",
"vim",
"-",
"javascript",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"ree",
"des",
"'_",
",_",
"'",
"vim",
"-",
"penc",
"il",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"mb",
"bill",
"'_",
",_",
"'",
"undo",
"tree",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"park",
"r",
"'_",
",_",
"'",
"vim",
"-",
"je",
"ky",
"ll",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"matt",
"n",
"'_",
",_",
"'",
"webapi",
"-",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"matt",
"n",
"'_",
",_",
"'",
"gist",
"-",
"vim",
"'_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"actual_",
",_",
"expected_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Git",
"hub",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"patch_",
"(_",
"'",
"db",
".",
"git",
"hub",
"\\u",
"repos",
".",
"Dot",
"files",
"Git",
"hub",
"Repos",
".",
"get",
"\\u",
"with",
"\\u",
"owner",
"\\u",
"repo",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"patch_",
"(_",
"'",
"db",
".",
"git",
"hub",
"\\u",
"repos",
".",
"Dot",
"files",
"Git",
"hub",
"Repos",
".",
"upse",
"rt",
"\\u",
"with",
"\\u",
"owner",
"\\u",
"repo",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"patch_",
"(_",
"'",
"tool",
"s",
".",
"scrape",
".",
"git",
"hub",
".",
"get",
"\\u",
"api",
"\\u",
"page",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"plugin",
"\\u",
"repos",
"e\\u",
"from",
"\\u",
"dot",
"files_",
"(_",
"self_",
",_",
"mock",
"\\u",
"get",
"\\u",
"api",
"\\u",
"page_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"get",
"\\u",
"dot",
"files_",
",_",
"mock",
"\\u",
"upse",
"rt",
"\\u",
"dot",
"files_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mock",
"\\u",
"get",
"\\u",
"api",
"\\u",
"page_",
"._",
"side",
"\\u",
"effect_",
"=_",
"mock",
"\\u",
"api",
"\\u",
"response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"get",
"\\u",
"dot",
"files_",
"._",
"return",
"\\u",
"value_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"upse",
"rt",
"\\u",
"dot",
"files_",
"._",
"return",
"\\u",
"value_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dot",
"files_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"full",
"\\u",
"name",
"'_",
":_",
"'",
"capt",
"bar",
"ito",
"ne",
"/",
"dot",
"files",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"pushed",
"\\u",
"at",
"'_",
":_",
"'",
"201",
"5",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"actual_",
"=_",
"github_",
"._",
"\\u",
"get",
"\\u",
"plugin",
"\\u",
"repos",
"\\u",
"from",
"\\u",
"dot",
"files_",
"(_",
"dot",
"files_",
",_",
"'",
"search",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"neo",
"bundle",
"\\u",
"repos",
"\\u",
"count",
"'_",
":_",
"0_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"patho",
"gen",
"\\u",
"repos",
"\\u",
"count",
"'_",
":_",
"0_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"vim",
"plug",
"\\u",
"repos",
"\\u",
"count",
"'_",
":_",
"44_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"vu",
"ndl",
"e\\u",
"repos",
"\\u",
"count",
"'_",
":_",
"0_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Dict",
"Equal_",
"(_",
"actual_",
",_",
"expected_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Git",
"hub",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"patch_",
"(_",
"'",
"tool",
"s",
".",
"scrape",
".",
"git",
"hub",
".",
"get",
"\\u",
"api",
"\\u",
"page",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"extract",
"\\u",
"patho",
"gen",
"\\u",
"repos_",
"(_",
"self_",
",_",
"mock",
"\\u",
"get",
"\\u",
"api",
"\\u",
"page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mock",
"\\u",
"get",
"\\u",
"api",
"\\u",
"page_",
"._",
"side",
"\\u",
"effect_",
"=_",
"mock",
"\\u",
"api",
"\\u",
"response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dir\\u",
"data_",
"=_",
"fixture",
"\\u",
"data_",
"(_",
"'/",
"repos",
"/",
"je",
"mia",
"hle",
"e",
"/",
"dot",
"files",
"/",
"content",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"actual_",
"=_",
"github_",
"._",
"\\u",
"extract",
"\\u",
"patho",
"gen",
"\\u",
"repos_",
"(_",
"dir\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"tak",
"ac",
"'_",
",_",
"'",
"vim",
"-",
"hard",
"time",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"kle",
"n",
"'_",
",_",
"'",
"python",
"-",
"mode",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"rk",
"ing",
"'_",
",_",
"'",
"ag",
".",
"vim",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"hdi",
"ma",
"'_",
",_",
"'",
"python",
"-",
"synta",
"x",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"List",
"Equal_",
"(_",
"actual_",
",_",
"expected_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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
] |
Unused import | memsql/memsql-loader/memsql_loader/util/setuser.py | [
{
"content": "import pwd\nimport os\nimport sys\nimport itertools\nimport subprocess\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def __fix_perms(userinfo):\n \"\"\" If _MEIPASS is defined we are executing in a pyinstaller environment\n In that case we need to recursively chown that directory to our target user before continuing.\n \"\"\"\n try:\n # we can't check to see if this exists since it is set weirdly\n target = sys._MEIPASS\n except:\n return\n\n # try to use the chown command, if that fails then we fallback to python\n try:\n with open('/dev/null', 'wb') as devnull:\n subprocess.check_call(['chown', '-R', '%s:%s' % (userinfo.pw_uid, userinfo.pw_gid), target], stdout=devnull, stderr=devnull)\n except (OSError, subprocess.CalledProcessError):\n os.chown(target, userinfo.pw_uid, userinfo.pw_gid)\n for root, dirs, files in os.walk(target):\n for f in itertools.chain(dirs, files):\n os.chown(os.path.join(root, f), userinfo.pw_uid, userinfo.pw_gid)",
"metadata": "root.__fix_perms",
"header": "['module', '___EOS___']",
"index": 6
},
{
"content": "def setuser(user_or_pid):\n try:\n try:\n userinfo = pwd.getpwuid(int(user_or_pid))\n except ValueError:\n userinfo = pwd.getpwnam(user_or_pid)\n\n __fix_perms(userinfo)\n os.setgid(userinfo.pw_gid)\n os.setuid(userinfo.pw_uid)\n return True\n except KeyError as e:\n print(str(e))\n return False",
"metadata": "root.setuser",
"header": "['module', '___EOS___']",
"index": 26
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"pwd_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"itertools_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"subprocess_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"fix",
"\\u",
"perms_",
"(_",
"userinfo_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"If",
" ",
"\\u",
"ME",
"IPA",
"SS",
" ",
"is",
" ",
"defin",
"ed",
" ",
"we",
" ",
"are",
" ",
"executi",
"ng",
" ",
"in",
" ",
"a",
" ",
"pyi",
"nstal",
"ler",
" ",
"environ",
"ment",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"In",
" ",
"tha",
"t",
" ",
"case",
" ",
"we",
" ",
"need",
" ",
"to",
" ",
"recurs",
"ively",
" ",
"chown",
" ",
"tha",
"t",
" ",
"director",
"y",
" ",
"to",
" ",
"our",
" ",
"target",
" ",
"user",
" ",
"bef",
"ore",
" ",
"continui",
"ng",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"we",
" ",
"can",
"'",
"t",
" ",
"check",
" ",
"to",
" ",
"see",
" ",
"if",
" ",
"this",
" ",
"exist",
"s",
" ",
"sinc",
"e",
" ",
"it",
" ",
"is",
" ",
"set",
" ",
"weird",
"ly_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"target_",
"=_",
"sys_",
"._",
"\\u",
"ME",
"IPA",
"SS_",
"\\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_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"try",
" ",
"to",
" ",
"use",
" ",
"the",
" ",
"chown",
" ",
"command",
",",
" ",
"if",
" ",
"tha",
"t",
" ",
"fail",
"s",
" ",
"then",
" ",
"we",
" ",
"fall",
"back",
" ",
"to",
" ",
"python_",
"\\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 ",
" _",
"with_",
"open_",
"(_",
"'/",
"dev",
"/",
"null",
"'_",
",_",
"'",
"wb",
"'_",
")_",
"as_",
"devnull_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"subprocess_",
"._",
"check",
"\\u",
"call_",
"(_",
"[_",
"'",
"chown",
"'_",
",_",
"'-",
"R",
"'_",
",_",
"'%",
"s",
":",
"%",
"s",
"'_",
"%_",
"(_",
"userinfo_",
"._",
"pw",
"\\u",
"uid_",
",_",
"userinfo_",
"._",
"pw",
"\\u",
"gid_",
")_",
",_",
"target_",
"]_",
",_",
"stdout_",
"=_",
"devnull_",
",_",
"stderr_",
"=_",
"devnull_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"OSE",
"rror_",
",_",
"subprocess_",
"._",
"Call",
"ed",
"Process",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"chown",
"_",
"(_",
"target_",
",_",
"userinfo_",
"._",
"pw",
"\\u",
"uid_",
",_",
"userinfo_",
"._",
"pw",
"\\u",
"gid_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"root_",
",_",
"dirs_",
",_",
"files_",
"in_",
"os_",
"._",
"walk_",
"(_",
"target_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"f_",
"in_",
"itertools_",
"._",
"chain_",
"(_",
"dirs_",
",_",
"files_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"chown",
"_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"root_",
",_",
"f_",
")_",
",_",
"userinfo_",
"._",
"pw",
"\\u",
"uid_",
",_",
"userinfo_",
"._",
"pw",
"\\u",
"gid_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set",
"user_",
"(_",
"user",
"\\u",
"or",
"\\u",
"pid_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"userinfo_",
"=_",
"pwd_",
"._",
"getpw",
"uid_",
"(_",
"int_",
"(_",
"user",
"\\u",
"or",
"\\u",
"pid_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"userinfo_",
"=_",
"pwd_",
"._",
"getpw",
"nam_",
"(_",
"user",
"\\u",
"or",
"\\u",
"pid_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u",
"fix",
"\\u",
"perms_",
"(_",
"userinfo_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"os_",
"._",
"set",
"gid_",
"(_",
"userinfo_",
"._",
"pw",
"\\u",
"gid_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"os_",
"._",
"set",
"uid_",
"(_",
"userinfo_",
"._",
"pw",
"\\u",
"uid_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Key",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"str_",
"(_",
"e_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | AppScale/appscale/AppServer/lib/django-1.4/django/db/models/base.py | [
{
"content": " def save_base(self, raw=False, cls=None, origin=None, force_insert=False,\n force_update=False, using=None):\n \"\"\"\n Does the heavy-lifting involved in saving. Subclasses shouldn't need to\n override this method. It's separate from save() in order to hide the\n need for overrides of save() to pass around internal-only parameters\n ('raw', 'cls', and 'origin').\n \"\"\"\n using = using or router.db_for_write(self.__class__, instance=self)\n assert not (force_insert and force_update)\n if cls is None:\n cls = self.__class__\n meta = cls._meta\n if not meta.proxy:\n origin = cls\n else:\n meta = cls._meta\n\n if origin and not meta.auto_created:\n signals.pre_save.send(sender=origin, instance=self, raw=raw, using=using)\n\n # If we are in a raw save, save the object exactly as presented.\n # That means that we don't try to be smart about saving attributes\n # that might have come from the parent class - we just save the\n # attributes we have been given to the class we have been given.\n # We also go through this process to defer the save of proxy objects\n # to their actual underlying model.\n if not raw or meta.proxy:\n if meta.proxy:\n org = cls\n else:\n org = None\n for parent, field in meta.parents.items():\n # At this point, parent's primary key field may be unknown\n # (for example, from administration form which doesn't fill\n # this field). If so, fill it.\n if field and getattr(self, parent._meta.pk.attname) is None and getattr(self, field.attname) is not None:\n setattr(self, parent._meta.pk.attname, getattr(self, field.attname))\n\n self.save_base(cls=parent, origin=org, using=using)\n\n if field:\n setattr(self, field.attname, self._get_pk_val(parent._meta))\n if meta.proxy:\n return\n\n if not meta.proxy:\n non_pks = [f for f in meta.local_fields if not f.primary_key]\n\n # First, try an UPDATE. If that doesn't update anything, do an INSERT.\n pk_val = self._get_pk_val(meta)\n pk_set = pk_val is not None\n record_exists = True\n manager = cls._base_manager\n if pk_set:\n # Determine whether a record with the primary key already exists.\n if (force_update or (not force_insert and\n manager.using(using).filter(pk=pk_val).exists())):\n # It does already exist, so do an UPDATE.\n if force_update or non_pks:\n values = [(f, None, (raw and getattr(self, f.attname) or f.pre_save(self, False))) for f in non_pks]\n if values:\n rows = manager.using(using).filter(pk=pk_val)._update(values)\n if force_update and not rows:\n raise DatabaseError(\"Forced update did not affect any rows.\")\n else:\n record_exists = False\n if not pk_set or not record_exists:\n if meta.order_with_respect_to:\n # If this is a model with an order_with_respect_to\n # autopopulate the _order field\n field = meta.order_with_respect_to\n order_value = manager.using(using).filter(**{field.name: getattr(self, field.attname)}).count()\n self._order = order_value\n\n fields = meta.local_fields\n if not pk_set:\n if force_update:\n raise ValueError(\"Cannot force an update in save() with no primary key.\")\n fields = [f for f in fields if not isinstance(f, AutoField)]\n\n record_exists = False\n\n update_pk = bool(meta.has_auto_field and not pk_set)\n result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)\n\n if update_pk:\n setattr(self, meta.pk.attname, result)\n transaction.commit_unless_managed(using=using)\n\n # Store the database on which the object was saved\n self._state.db = using\n # Once saved, this is no longer a to-be-added instance.\n self._state.adding = False\n\n # Signal that the save is complete\n if origin and not meta.auto_created:\n signals.post_save.send(sender=origin, instance=self,\n created=(not record_exists), raw=raw, using=using)",
"metadata": "root.Model.save_base",
"header": "['class', 'Model', '(', 'object', ')', ':', '___EOS___']",
"index": 466
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"class_",
"Model_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"save",
"\\u",
"base_",
"(_",
"self_",
",_",
"raw_",
"=_",
"False_",
",_",
"cls_",
"=_",
"None_",
",_",
"origin_",
"=_",
"None_",
",_",
"force",
"\\u",
"insert_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"force",
"\\u",
"update_",
"=_",
"False_",
",_",
"using_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Do",
"es",
" ",
"the",
" ",
"heav",
"y",
"-",
"lift",
"ing",
" ",
"involved",
" ",
"in",
" ",
"saving",
".",
" ",
"Subc",
"lasse",
"s",
" ",
"shou",
"ld",
"n",
"'",
"t",
" ",
"need",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"override",
" ",
"this",
" ",
"method",
".",
" ",
"It",
"'",
"s",
" ",
"separate",
" ",
"from",
" ",
"save",
"()",
" ",
"in",
" ",
"order",
" ",
"to",
" ",
"hide",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"need",
" ",
"for",
" ",
"override",
"s",
" ",
"of",
" ",
"save",
"()",
" ",
"to",
" ",
"pass",
" ",
"aro",
"und",
" ",
"internal",
"-",
"only",
" ",
"parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"('",
"raw",
"',",
" ",
"'",
"cls",
"',",
" ",
"and",
" ",
"'",
"orig",
"in",
"')",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"using_",
"=_",
"using_",
"or_",
"router_",
"._",
"db",
"\\u",
"for",
"\\u",
"write_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
",_",
"instance_",
"=_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"not_",
"(_",
"force",
"\\u",
"insert_",
"and_",
"force",
"\\u",
"update_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"cls_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cls_",
"=_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"meta_",
"=_",
"cls_",
"._",
"\\u",
"meta_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"meta_",
"._",
"proxy_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"origin_",
"=_",
"cls_",
"\\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 ",
" _",
"meta_",
"=_",
"cls_",
"._",
"\\u",
"meta_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"origin_",
"and_",
"not_",
"meta_",
"._",
"auto",
"\\u",
"created_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"signals_",
"._",
"pre",
"\\u",
"save_",
"._",
"send_",
"(_",
"sender_",
"=_",
"origin_",
",_",
"instance_",
"=_",
"self_",
",_",
"raw_",
"=_",
"raw_",
",_",
"using_",
"=_",
"using_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"we",
" ",
"are",
" ",
"in",
" ",
"a",
" ",
"raw",
" ",
"save",
",",
" ",
"save",
" ",
"the",
" ",
"object",
" ",
"exact",
"ly",
" ",
"as",
" ",
"presente",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Tha",
"t",
" ",
"means",
" ",
"tha",
"t",
" ",
"we",
" ",
"don",
"'",
"t",
" ",
"try",
" ",
"to",
" ",
"be",
" ",
"smart",
" ",
"abo",
"ut",
" ",
"saving",
" ",
"attributes_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"tha",
"t",
" ",
"mig",
"ht",
" ",
"have",
" ",
"come",
" ",
"from",
" ",
"the",
" ",
"parent",
" ",
"class",
" ",
"-",
" ",
"we",
" ",
"just",
" ",
"save",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"attribute",
"s",
" ",
"we",
" ",
"have",
" ",
"bee",
"n",
" ",
"give",
"n",
" ",
"to",
" ",
"the",
" ",
"class",
" ",
"we",
" ",
"have",
" ",
"bee",
"n",
" ",
"give",
"n",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"als",
"o",
" ",
"go",
" ",
"through",
" ",
"this",
" ",
"process",
" ",
"to",
" ",
"defer",
" ",
"the",
" ",
"save",
" ",
"of",
" ",
"proxy",
" ",
"objects_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"thei",
"r",
" ",
"actual",
" ",
"underl",
"ying",
" ",
"model",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"raw_",
"or_",
"meta_",
"._",
"proxy_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"meta_",
"._",
"proxy_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"org_",
"=_",
"cls_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"org_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"parent_",
",_",
"field_",
"in_",
"meta_",
"._",
"parents_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"At",
" ",
"this",
" ",
"point",
",",
" ",
"parent",
"'",
"s",
" ",
"primary",
" ",
"key",
" ",
"field",
" ",
"may",
" ",
"be",
" ",
"unknown_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"for",
" ",
"example",
",",
" ",
"from",
" ",
"administrati",
"on",
" ",
"form",
" ",
"whi",
"ch",
" ",
"doe",
"sn",
"'",
"t",
" ",
"fill_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"field",
").",
" ",
"If",
" ",
"so",
",",
" ",
"fill",
" ",
"it",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"field_",
"and_",
"getattr_",
"(_",
"self_",
",_",
"parent_",
"._",
"\\u",
"meta_",
"._",
"pk_",
"._",
"attn",
"ame_",
")_",
"is_",
"None_",
"and_",
"getattr_",
"(_",
"self_",
",_",
"field_",
"._",
"attn",
"ame_",
")_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"setattr_",
"(_",
"self_",
",_",
"parent_",
"._",
"\\u",
"meta_",
"._",
"pk_",
"._",
"attn",
"ame_",
",_",
"getattr_",
"(_",
"self_",
",_",
"field_",
"._",
"attn",
"ame_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"save",
"\\u",
"base_",
"(_",
"cls_",
"=_",
"parent_",
",_",
"origin_",
"=_",
"org_",
",_",
"using_",
"=_",
"using_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"field_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"setattr_",
"(_",
"self_",
",_",
"field_",
"._",
"attn",
"ame_",
",_",
"self_",
"._",
"\\u",
"get",
"\\u",
"pk",
"\\u",
"val_",
"(_",
"parent_",
"._",
"\\u",
"meta_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"meta_",
"._",
"proxy_",
":_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"meta_",
"._",
"proxy_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"non",
"\\u",
"pks",
"_",
"=_",
"[_",
"f_",
"for_",
"f_",
"in_",
"meta_",
"._",
"local",
"\\u",
"fields_",
"if_",
"not_",
"f_",
"._",
"primary",
"\\u",
"key_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fi",
"rst",
",",
" ",
"try",
" ",
"an",
" ",
"UPDATE",
".",
" ",
"If",
" ",
"tha",
"t",
" ",
"doe",
"sn",
"'",
"t",
" ",
"update",
" ",
"anyt",
"hing",
",",
" ",
"do",
" ",
"an",
" ",
"INSERT",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"pk",
"\\u",
"val_",
"=_",
"self_",
"._",
"\\u",
"get",
"\\u",
"pk",
"\\u",
"val_",
"(_",
"meta_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pk",
"\\u",
"set_",
"=_",
"pk",
"\\u",
"val_",
"is_",
"not_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"record",
"\\u",
"exists_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"manager_",
"=_",
"cls_",
"._",
"\\u",
"base",
"\\u",
"manager_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"pk",
"\\u",
"set_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Det",
"erm",
"ine",
" ",
"whe",
"ther",
" ",
"a",
" ",
"record",
" ",
"with",
" ",
"the",
" ",
"primary",
" ",
"key",
" ",
"alr",
"ead",
"y",
" ",
"exist",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"force",
"\\u",
"update_",
"or_",
"(_",
"not_",
"force",
"\\u",
"insert_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"manager_",
"._",
"using_",
"(_",
"using_",
")_",
"._",
"filter_",
"(_",
"pk_",
"=_",
"pk",
"\\u",
"val_",
")_",
"._",
"exists_",
"(_",
")_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"It",
" ",
"doe",
"s",
" ",
"alr",
"ead",
"y",
" ",
"exist",
",",
" ",
"so",
" ",
"do",
" ",
"an",
" ",
"UPDATE",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"force",
"\\u",
"update_",
"or_",
"non",
"\\u",
"pks",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"values_",
"=_",
"[_",
"(_",
"f_",
",_",
"None_",
",_",
"(_",
"raw_",
"and_",
"getattr_",
"(_",
"self_",
",_",
"f_",
"._",
"attn",
"ame_",
")_",
"or_",
"f_",
"._",
"pre",
"\\u",
"save_",
"(_",
"self_",
",_",
"False_",
")_",
")_",
")_",
"for_",
"f_",
"in_",
"non",
"\\u",
"pks",
"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"values_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"rows_",
"=_",
"manager_",
"._",
"using_",
"(_",
"using_",
")_",
"._",
"filter_",
"(_",
"pk_",
"=_",
"pk",
"\\u",
"val_",
")_",
"._",
"\\u",
"update_",
"(_",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"force",
"\\u",
"update_",
"and_",
"not_",
"rows_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"raise_",
"Databa",
"se",
"Error_",
"(_",
"\"",
"Force",
"d",
" ",
"update",
" ",
"did",
" ",
"not",
" ",
"affect",
" ",
"any",
" ",
"rows",
".\"_",
")_",
"\\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 ",
" ",
"_",
"record",
"\\u",
"exists_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"pk",
"\\u",
"set_",
"or_",
"not_",
"record",
"\\u",
"exists_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"meta_",
"._",
"order",
"\\u",
"with",
"\\u",
"respec",
"t",
"\\u",
"to_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"this",
" ",
"is",
" ",
"a",
" ",
"model",
" ",
"with",
" ",
"an",
" ",
"order",
"\\u",
"with",
"\\u",
"respec",
"t",
"\\u",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"autop",
"opu",
"late",
" ",
"the",
" ",
"\\u",
"order",
" ",
"field_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"field_",
"=_",
"meta_",
"._",
"order",
"\\u",
"with",
"\\u",
"respec",
"t",
"\\u",
"to_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"order",
"\\u",
"value_",
"=_",
"manager_",
"._",
"using_",
"(_",
"using_",
")_",
"._",
"filter_",
"(_",
"**_",
"{_",
"field_",
"._",
"name_",
":_",
"getattr_",
"(_",
"self_",
",_",
"field_",
"._",
"attn",
"ame_",
")_",
"}_",
")_",
"._",
"count_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"order_",
"=_",
"order",
"\\u",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fields_",
"=_",
"meta_",
"._",
"local",
"\\u",
"fields_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"pk",
"\\u",
"set_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"force",
"\\u",
"update_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"",
"Cann",
"ot",
" ",
"force",
" ",
"an",
" ",
"update",
" ",
"in",
" ",
"save",
"()",
" ",
"with",
" ",
"no",
" ",
"primary",
" ",
"key",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fields_",
"=_",
"[_",
"f_",
"for_",
"f_",
"in_",
"fields_",
"if_",
"not_",
"isinstance_",
"(_",
"f_",
",_",
"Auto",
"Field_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"record",
"\\u",
"exists_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"update",
"\\u",
"pk_",
"=_",
"bool_",
"(_",
"meta_",
"._",
"has",
"\\u",
"auto",
"\\u",
"field_",
"and_",
"not_",
"pk",
"\\u",
"set_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"manager_",
"._",
"\\u",
"insert_",
"(_",
"[_",
"self_",
"]_",
",_",
"fields_",
"=_",
"fields_",
",_",
"return",
"\\u",
"id_",
"=_",
"update",
"\\u",
"pk_",
",_",
"using_",
"=_",
"using_",
",_",
"raw_",
"=_",
"raw_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"update",
"\\u",
"pk_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"setattr_",
"(_",
"self_",
",_",
"meta_",
"._",
"pk_",
"._",
"attn",
"ame_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"transaction_",
"._",
"commit",
"\\u",
"unl",
"ess",
"\\u",
"managed_",
"(_",
"using_",
"=_",
"using_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Stor",
"e",
" ",
"the",
" ",
"databa",
"se",
" ",
"on",
" ",
"whi",
"ch",
" ",
"the",
" ",
"object",
" ",
"was",
" ",
"saved_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"state_",
"._",
"db_",
"=_",
"using_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"On",
"ce",
" ",
"saved",
",",
" ",
"this",
" ",
"is",
" ",
"no",
" ",
"long",
"er",
" ",
"a",
" ",
"to",
"-",
"be",
"-",
"adde",
"d",
" ",
"instance",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"state_",
"._",
"addin",
"g_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Signal",
" ",
"tha",
"t",
" ",
"the",
" ",
"save",
" ",
"is",
" ",
"complete_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"origin_",
"and_",
"not_",
"meta_",
"._",
"auto",
"\\u",
"created_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"signals_",
"._",
"post",
"\\u",
"save_",
"._",
"send_",
"(_",
"sender_",
"=_",
"origin_",
",_",
"instance_",
"=_",
"self_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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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/static/structure/tatooine/shared_wall_damaged_tatooine_large_style_01.py | [
{
"content": "def create(kernel):\n\tresult = Static()\n\n\tresult.template = \"object/static/structure/tatooine/shared_wall_damaged_tatooine_large_style_01.iff\"\n\tresult.attribute_template_id = -1\n\tresult.stfName(\"obj_n\",\"unknown_object\")\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_",
"=_",
"Static",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"._",
"template_",
"=_",
"\"",
"object",
"/",
"static",
"/",
"structure",
"/",
"tat",
"oo",
"ine",
"/",
"shared",
"\\u",
"wall",
"\\u",
"damage",
"d\\u",
"tat",
"oo",
"ine",
"\\u",
"large",
"\\u",
"style",
"\\u",
"01",
".",
"iff",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"._",
"attribute",
"\\u",
"template",
"\\u",
"id_",
"=_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"._",
"stf",
"Name_",
"(_",
"\"",
"obj",
"\\u",
"n",
"\"_",
",_",
"\"",
"unknown",
"\\u",
"object",
"\"_",
")_",
"\\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,
2,
2
] |
Variable defined multiple times | openstack/ironic/ironic/common/image_service.py | [
{
"content": " def validate_href(self, image_href):\n \"\"\"Validate local image reference.\n\n :param image_href: Image reference.\n :raises: exception.ImageRefValidationFailed if source image file\n doesn't exist.\n :returns: Path to image file if it exists.\n \"\"\"\n image_path = urlparse.urlparse(image_href).path\n if not os.path.isfile(image_path):\n raise exception.ImageRefValidationFailed(\n image_href=image_href,\n reason=_(\"Specified image file not found.\"))\n return image_path",
"metadata": "root.FileImageService.validate_href",
"header": "['class', 'FileImageService', '(', 'BaseImageService', ')', ':', '___EOS___']",
"index": 227
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"File",
"Image",
"Service_",
"(_",
"Base",
"Image",
"Service_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"validat",
"e\\u",
"href_",
"(_",
"self_",
",_",
"image",
"\\u",
"href_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Validate",
" ",
"local",
" ",
"image",
" ",
"reference",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"image",
"\\u",
"href",
":",
" ",
"Image",
" ",
"reference",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"raise",
"s",
":",
" ",
"exception",
".",
"Image",
"Ref",
"Validat",
"ion",
"Fail",
"ed",
" ",
"if",
" ",
"source",
" ",
"image",
" ",
"file",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"doe",
"sn",
"'",
"t",
" ",
"exist",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
"s",
":",
" ",
"Path",
" ",
"to",
" ",
"image",
" ",
"file",
" ",
"if",
" ",
"it",
" ",
"exist",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"image",
"\\u",
"path_",
"=_",
"urlparse_",
"._",
"urlparse_",
"(_",
"image",
"\\u",
"href_",
")_",
"._",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"os_",
"._",
"path_",
"._",
"isfile_",
"(_",
"image",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"exception_",
"._",
"Image",
"Ref",
"Validat",
"ion",
"Failed_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"image",
"\\u",
"href_",
"=_",
"image",
"\\u",
"href_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"reason_",
"=_",
"\\u_",
"(_",
"\"",
"Specifie",
"d",
" ",
"image",
" ",
"file",
" ",
"not",
" ",
"found",
".\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"image",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | anantb/voicex/transport/voicex.py | [
{
"content": "\"\"\"\nCopyright (c) 2012 Anant Bhardwaj\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\n\nfrom google_voice.main import GoogleVoice\nfrom africa_talking.main import AfricaTalking\nimport config\n\n'''\n@author: anant bhardwaj\n@date: Oct 4, 2012\n\nVoiceX Transport public APIs\n'''\t\n\n\n\n\nif __name__ == \"__main__\":\n\tmain()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class VoiceXTransport:\n\n\n\n\n\n\n",
"metadata": "root.VoiceXTransport",
"header": "['module', '___EOS___']",
"index": 34
},
{
"content": "\tdef __init__(self, auth):\n\t\tif(auth['type'] == config.GV):\n\t\t\tself.client = GoogleVoice(auth['username'], auth['password'], d = False)\n\t\telif(auth['type'] == config.AT):\n\t\t\tself.client = AfricaTalking(auth['username'], auth['api_key'])\n\t\telse:\n\t\t\traise NotImplementedError(transport + \" not implemented\")",
"metadata": "root.VoiceXTransport.__init__",
"header": "['class', 'VoiceXTransport', ':', '___EOS___']",
"index": 35
},
{
"content": "\tdef set_callback(self, callback):\n\t\tself.client.set_callback(callback)",
"metadata": "root.VoiceXTransport.set_callback",
"header": "['class', 'VoiceXTransport', ':', '___EOS___']",
"index": 43
},
{
"content": "\tdef sms(self, to, text):\n\t\tself.client.sms(to, text)",
"metadata": "root.VoiceXTransport.sms",
"header": "['class', 'VoiceXTransport', ':', '___EOS___']",
"index": 46
},
{
"content": "\tdef mark_read(self, msg):\n\t\tself.client.mark_read(msg)",
"metadata": "root.VoiceXTransport.mark_read",
"header": "['class', 'VoiceXTransport', ':', '___EOS___']",
"index": 49
},
{
"content": "\tdef mark_unread(self, msg):\n\t\tself.client.mark_unread(msg)",
"metadata": "root.VoiceXTransport.mark_unread",
"header": "['class', 'VoiceXTransport', ':', '___EOS___']",
"index": 52
},
{
"content": "\tdef delete(self, msg):\n\t\tself.client.delete(msg)",
"metadata": "root.VoiceXTransport.delete",
"header": "['class', 'VoiceXTransport', ':', '___EOS___']",
"index": 55
},
{
"content": "\tdef fetch_unread_sms():\n\t\tself.client.fetch_unread_sms()",
"metadata": "root.VoiceXTransport.fetch_unread_sms",
"header": "['class', 'VoiceXTransport', ':', '___EOS___']",
"index": 58
},
{
"content": "\tdef fetch_all_sms(self):\n\t\tself.client.fetch_all_sms()",
"metadata": "root.VoiceXTransport.fetch_all_sms",
"header": "['class', 'VoiceXTransport', ':', '___EOS___']",
"index": 61
},
{
"content": "class Test():\n",
"metadata": "root.Test",
"header": "['module', '___EOS___']",
"index": 64
},
{
"content": "\tdef __init__(self):\t\t\n\t\tself.client = VoiceXTransport(username=config.GV_VOICEX['username'], password = config.GV_VOICEX['password'])\n\t\tself.client.set_callback(callback = self.msg_new)",
"metadata": "root.Test.__init__",
"header": "['class', 'Test', '(', ')', ':', '___EOS___']",
"index": 65
},
{
"content": "\tdef msg_new(self, msg):\n\t\tprint \"Got text [ %s ] from [%s].\" %(msg['text'], msg['from'])\n\t\tprint self.client.mark_read(msg)\n\t\tprint self.client.sms(msg['from'], \"Ack :\" + msg['text'])\n\t\tprint self.client.delete(msg)",
"metadata": "root.Test.msg_new",
"header": "['class', 'Test', '(', ')', ':', '___EOS___']",
"index": 69
},
{
"content": "def main():\t\n\tTest()",
"metadata": "root.main",
"header": "['module', '___EOS___']",
"index": 75
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2012",
" ",
"Ana",
"nt",
" ",
"Bh",
"ard",
"wa",
"j",
"\\",
"10",
";",
"\\",
"10",
";",
"Permi",
"ssion",
" ",
"is",
" ",
"here",
"by",
" ",
"grant",
"ed",
",",
" ",
"free",
" ",
"of",
" ",
"charge",
",",
" ",
"to",
" ",
"any",
" ",
"person",
" ",
"obtain",
"ing",
"\\",
"10",
";",
"a",
" ",
"copy",
" ",
"of",
" ",
"this",
" ",
"software",
" ",
"and",
" ",
"associate",
"d",
" ",
"documentation",
" ",
"files",
" ",
"(",
"the",
"\\",
"10",
";",
"\"",
"Sof",
"twa",
"re",
"\")",
",",
" ",
"to",
" ",
"deal",
" ",
"in",
" ",
"the",
" ",
"Sof",
"twa",
"re",
" ",
"with",
"out",
" ",
"restriction",
",",
" ",
"inclu",
"ding",
"\\",
"10",
";",
"with",
"out",
" ",
"limit",
"ation",
" ",
"the",
" ",
"rights",
" ",
"to",
" ",
"use",
",",
" ",
"copy",
",",
" ",
"modif",
"y",
",",
" ",
"merge",
",",
" ",
"publi",
"sh",
",",
"\\",
"10",
";",
"distribute",
",",
" ",
"subli",
"cens",
"e",
",",
" ",
"and",
"/",
"or",
" ",
"sell",
" ",
"copie",
"s",
" ",
"of",
" ",
"the",
" ",
"Sof",
"twa",
"re",
",",
" ",
"and",
" ",
"to",
"\\",
"10",
";",
"permit",
" ",
"person",
"s",
" ",
"to",
" ",
"who",
"m",
" ",
"the",
" ",
"Sof",
"twa",
"re",
" ",
"is",
" ",
"fur",
"nish",
"ed",
" ",
"to",
" ",
"do",
" ",
"so",
",",
" ",
"subject",
" ",
"to",
"\\",
"10",
";",
"the",
" ",
"follow",
"ing",
" ",
"condition",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
"The",
" ",
"above",
" ",
"copyr",
"ight",
" ",
"notice",
" ",
"and",
" ",
"this",
" ",
"permissi",
"on",
" ",
"notice",
" ",
"sha",
"ll",
" ",
"be",
"\\",
"10",
";",
"include",
"d",
" ",
"in",
" ",
"all",
" ",
"copie",
"s",
" ",
"or",
" ",
"substa",
"nti",
"al",
" ",
"porti",
"ons",
" ",
"of",
" ",
"the",
" ",
"Sof",
"twa",
"re",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"THE",
" ",
"SOFT",
"WARE",
" ",
"IS",
" ",
"PROVI",
"DED",
" ",
"\"",
"AS",
" ",
"IS",
"\",",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TY",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
"\\",
"10",
";",
"EXPR",
"ESS",
" ",
"OR",
" ",
"IMPL",
"IED",
",",
" ",
"INC",
"LU",
"DING",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
" ",
"THE",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OF",
"\\",
"10",
";",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
",",
" ",
"FIT",
"NESS",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR",
" ",
"PUR",
"POS",
"E",
" ",
"AND",
"\\",
"10",
";",
"NON",
"INF",
"RING",
"EME",
"NT",
".",
" ",
"IN",
" ",
"NO",
" ",
"EVENT",
" ",
"SHA",
"LL",
" ",
"THE",
" ",
"AUTHOR",
"S",
" ",
"OR",
" ",
"COPY",
"RIG",
"HT",
" ",
"HOLD",
"ERS",
" ",
"BE",
"\\",
"10",
";",
"LI",
"AB",
"LE",
" ",
"FOR",
" ",
"ANY",
" ",
"CLA",
"IM",
",",
" ",
"DA",
"MAGE",
"S",
" ",
"OR",
" ",
"OTHER",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"WHE",
"THER",
" ",
"IN",
" ",
"AN",
" ",
"ACTI",
"ON",
"\\",
"10",
";",
"OF",
" ",
"CONTR",
"ACT",
",",
" ",
"TOR",
"T",
" ",
"OR",
" ",
"OTHER",
"WI",
"SE",
",",
" ",
"ARI",
"SIN",
"G",
" ",
"FROM",
",",
" ",
"OUT",
" ",
"OF",
" ",
"OR",
" ",
"IN",
" ",
"CONNECTION",
"\\",
"10",
";",
"WITH",
" ",
"THE",
" ",
"SOFT",
"WARE",
" ",
"OR",
" ",
"THE",
" ",
"USE",
" ",
"OR",
" ",
"OTHER",
" ",
"DEA",
"LING",
"S",
" ",
"IN",
" ",
"THE",
" ",
"SOFT",
"WARE",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"google",
"\\u",
"voice_",
"._",
"main_",
"import_",
"Goo",
"gle",
"Voic",
"e_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"afr",
"ica",
"\\u",
"talk",
"ing_",
"._",
"main_",
"import_",
"Af",
"rica",
"Tal",
"king",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"config_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"'''",
"\\",
"10",
";",
"@",
"author",
":",
" ",
"ana",
"nt",
" ",
"bh",
"ard",
"wa",
"j",
"\\",
"10",
";",
"@",
"date",
":",
" ",
"Oct",
" ",
"4",
",",
" ",
"2012",
"\\",
"10",
";",
"\\",
"10",
";",
"Voic",
"e",
"X",
" ",
"Transp",
"ort",
" ",
"public",
" ",
"API",
"s",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"\"\\u\\u",
"main",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"main_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Voic",
"e",
"XT",
"rans",
"port_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Voic",
"e",
"XT",
"rans",
"port_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"auth_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"if_",
"(_",
"auth_",
"[_",
"'",
"type",
"'_",
"]_",
"==_",
"config_",
"._",
"GV",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"client_",
"=_",
"Goo",
"gle",
"Voic",
"e_",
"(_",
"auth_",
"[_",
"'",
"user",
"name",
"'_",
"]_",
",_",
"auth_",
"[_",
"'",
"password",
"'_",
"]_",
",_",
"d_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"(_",
"auth_",
"[_",
"'",
"type",
"'_",
"]_",
"==_",
"config_",
"._",
"AT_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"self_",
"._",
"client_",
"=_",
"Af",
"rica",
"Tal",
"king",
"_",
"(_",
"auth_",
"[_",
"'",
"user",
"name",
"'_",
"]_",
",_",
"auth_",
"[_",
"'",
"api",
"\\u",
"key",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"raise_",
"Not",
"Impl",
"ement",
"ed",
"Error_",
"(_",
"transport_",
"+_",
"\"",
" ",
"not",
" ",
"implemented",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Voic",
"e",
"XT",
"rans",
"port_",
":_",
"\\u\\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",
"callback_",
"(_",
"self_",
",_",
"callback_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"client_",
"._",
"set\\u",
"callback_",
"(_",
"callback_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Voic",
"e",
"XT",
"rans",
"port_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"sms_",
"(_",
"self_",
",_",
"to_",
",_",
"text_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"client_",
"._",
"sms_",
"(_",
"to_",
",_",
"text_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Voic",
"e",
"XT",
"rans",
"port_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"mark",
"\\u",
"read_",
"(_",
"self_",
",_",
"msg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"client_",
"._",
"mark",
"\\u",
"read_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Voic",
"e",
"XT",
"rans",
"port_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"mark",
"\\u",
"unread",
"_",
"(_",
"self_",
",_",
"msg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"client_",
"._",
"mark",
"\\u",
"unread",
"_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Voic",
"e",
"XT",
"rans",
"port_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"delete_",
"(_",
"self_",
",_",
"msg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"client_",
"._",
"delete_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Voic",
"e",
"XT",
"rans",
"port_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"fetch",
"\\u",
"unread",
"\\u",
"sms_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"client_",
"._",
"fetch",
"\\u",
"unread",
"\\u",
"sms_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Voic",
"e",
"XT",
"rans",
"port_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"fetch",
"\\u",
"all",
"\\u",
"sms_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"client_",
"._",
"fetch",
"\\u",
"all",
"\\u",
"sms_",
"(_",
")_",
"\\u\\u\\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_",
"Test_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test_",
"(_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"client_",
"=_",
"Voic",
"e",
"XT",
"rans",
"port_",
"(_",
"username_",
"=_",
"config_",
"._",
"GV",
"\\u",
"VO",
"ICE",
"X_",
"[_",
"'",
"user",
"name",
"'_",
"]_",
",_",
"password_",
"=_",
"config_",
"._",
"GV",
"\\u",
"VO",
"ICE",
"X_",
"[_",
"'",
"password",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"client_",
"._",
"set\\u",
"callback_",
"(_",
"callback_",
"=_",
"self_",
"._",
"msg",
"\\u",
"new_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test_",
"(_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"msg",
"\\u",
"new_",
"(_",
"self_",
",_",
"msg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"print_",
"\"",
"Got",
" ",
"text",
" ",
"[",
" ",
"%",
"s",
" ",
"]",
" ",
"from",
" ",
"[",
"%",
"s",
"].",
"\"_",
"%_",
"(_",
"msg_",
"[_",
"'",
"text",
"'_",
"]_",
",_",
"msg_",
"[_",
"'",
"from",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"self_",
"._",
"client_",
"._",
"mark",
"\\u",
"read_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"self_",
"._",
"client_",
"._",
"sms_",
"(_",
"msg_",
"[_",
"'",
"from",
"'_",
"]_",
",_",
"\"",
"Ack",
" ",
":\"_",
"+_",
"msg_",
"[_",
"'",
"text",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"self_",
"._",
"client_",
"._",
"delete_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"main_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"Test_",
"(_",
")_",
"\\u\\u\\uNEWLINE\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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | divmain/GitSavvy/common/util/dates.py | [
{
"content": "from datetime import datetime\n\nTEN_MINS = 600\nONE_HOUR = 3600\nTWO_HOURS = 7200\nONE_DAY = 86400\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def fuzzy(event, base=None, date_format=None):\n if not base:\n base = datetime.now()\n\n if date_format:\n event = datetime.strptime(event, date_format)\n elif type(event) == str:\n event = datetime.fromtimestamp(int(event))\n elif type(event) == int:\n event = datetime.fromtimestamp(event)\n elif type(event) != datetime:\n raise Exception(\n \"Cannot convert object `{}` to fuzzy date string\".format(event))\n\n delta = base - event\n\n if delta.days == 0:\n if delta.seconds < 60:\n return \"{} seconds ago\".format(delta.seconds)\n\n elif delta.seconds < 120:\n return \"1 min and {} secs ago\".format(delta.seconds - 60)\n\n elif delta.seconds < TEN_MINS:\n return \"{} mins and {} secs ago\".format(\n delta.seconds // 60,\n delta.seconds % 60)\n\n elif delta.seconds < ONE_HOUR:\n return \"{} minutes ago\".format(delta.seconds // 60)\n\n elif delta.seconds < TWO_HOURS:\n return \"1 hour and {} mins ago\".format(\n delta.seconds % ONE_HOUR // 60)\n\n return \"over {} hours ago\".format(delta.seconds // ONE_HOUR)\n\n elif delta.days < 2:\n return \"over a day ago\"\n\n elif delta.days < 7:\n return \"over {} days ago\".format(delta.days)\n\n return \"{date:%b} {date.day}, {date.year}\".format(date=event)",
"metadata": "root.fuzzy",
"header": "['module', '___EOS___']",
"index": 8
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"datetime_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"TEN",
"\\u",
"MIN",
"S_",
"=_",
"600_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ONE",
"\\u",
"HOUR",
"_",
"=_",
"3600_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"TWO",
"\\u",
"HOUR",
"S_",
"=_",
"7200",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ONE",
"\\u",
"DAY_",
"=_",
"86400_",
"\\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_",
"fuzzy_",
"(_",
"event_",
",_",
"base_",
"=_",
"None_",
",_",
"date",
"\\u",
"format_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"base_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"base_",
"=_",
"datetime_",
"._",
"now_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"date",
"\\u",
"format_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event_",
"=_",
"datetime_",
"._",
"strptime_",
"(_",
"event_",
",_",
"date",
"\\u",
"format_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"type_",
"(_",
"event_",
")_",
"==_",
"str_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event_",
"=_",
"datetime_",
"._",
"fromtimestamp_",
"(_",
"int_",
"(_",
"event_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"type_",
"(_",
"event_",
")_",
"==_",
"int_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event_",
"=_",
"datetime_",
"._",
"fromtimestamp_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"type_",
"(_",
"event_",
")_",
"!=_",
"datetime_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Cann",
"ot",
" ",
"convert",
" ",
"object",
" ",
"`{}`",
" ",
"to",
" ",
"fuzz",
"y",
" ",
"date",
" ",
"string",
"\"_",
"._",
"format_",
"(_",
"event_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"delta_",
"=_",
"base_",
"-_",
"event_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"delta_",
"._",
"days_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"delta_",
"._",
"seconds_",
"<_",
"60_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"{}",
" ",
"second",
"s",
" ",
"ago",
"\"_",
"._",
"format_",
"(_",
"delta_",
"._",
"seconds_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"delta_",
"._",
"seconds_",
"<_",
"120_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"1",
" ",
"min",
" ",
"and",
" ",
"{}",
" ",
"secs",
" ",
"ago",
"\"_",
"._",
"format_",
"(_",
"delta_",
"._",
"seconds_",
"-_",
"60_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"delta_",
"._",
"seconds_",
"<_",
"TEN",
"\\u",
"MIN",
"S_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"{}",
" ",
"mins",
" ",
"and",
" ",
"{}",
" ",
"secs",
" ",
"ago",
"\"_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"delta_",
"._",
"seconds_",
"//_",
"60_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"delta_",
"._",
"seconds_",
"%_",
"60_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"delta_",
"._",
"seconds_",
"<_",
"ONE",
"\\u",
"HOUR",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"{}",
" ",
"minute",
"s",
" ",
"ago",
"\"_",
"._",
"format_",
"(_",
"delta_",
"._",
"seconds_",
"//_",
"60_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"delta_",
"._",
"seconds_",
"<_",
"TWO",
"\\u",
"HOUR",
"S_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"1",
" ",
"hour",
" ",
"and",
" ",
"{}",
" ",
"mins",
" ",
"ago",
"\"_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"delta_",
"._",
"seconds_",
"%_",
"ONE",
"\\u",
"HOUR",
"_",
"//_",
"60_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\"",
"over",
" ",
"{}",
" ",
"hour",
"s",
" ",
"ago",
"\"_",
"._",
"format_",
"(_",
"delta_",
"._",
"seconds_",
"//_",
"ONE",
"\\u",
"HOUR",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"delta_",
"._",
"days_",
"<_",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"over",
" ",
"a",
" ",
"day",
" ",
"ago",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"delta_",
"._",
"days_",
"<_",
"7_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"over",
" ",
"{}",
" ",
"day",
"s",
" ",
"ago",
"\"_",
"._",
"format_",
"(_",
"delta_",
"._",
"days_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\"{",
"date",
":",
"%",
"b",
"}",
" ",
"{",
"date",
".",
"day",
"},",
" ",
"{",
"date",
".",
"year",
"}\"_",
"._",
"format_",
"(_",
"date_",
"=_",
"event_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,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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
] |
Unreachable code | cloudtools/nymms/nymms/config/tests/test_yaml_config.py | [
{
"content": " def setUp(self):\n self.root = os.path.dirname(__file__)",
"metadata": "root.TestIncludeLoader.setUp",
"header": "['class', 'TestIncludeLoader', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 7
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Test",
"Include",
"Loader_",
"(_",
"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 ",
" _",
"self_",
"._",
"root_",
"=_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"\\u\\u",
"file\\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
] |
Unused local variable | gholt/swiftly/swiftly/cli/cli.py | [
{
"content": " def _resolve_option(self, options, option_name, section_name):\n \"\"\"Resolves an option value into options.\n\n Sets options.<option_name> to a resolved value. Any value\n already in options overrides a value in os.environ which\n overrides self.context.conf.\n\n :param options: The options instance as returned by optparse.\n :param option_name: The name of the option, such as\n ``auth_url``.\n :param section_name: The name of the section, such as\n ``swiftly``.\n \"\"\"\n if getattr(options, option_name, None) is not None:\n return\n if option_name.startswith(section_name + '_'):\n environ_name = option_name.upper()\n conf_name = option_name[len(section_name) + 1:]\n else:\n environ_name = (section_name + '_' + option_name).upper()\n conf_name = option_name\n setattr(\n options, option_name,\n os.environ.get(\n environ_name,\n (self.context.conf.get(section_name, {})).get(conf_name)))",
"metadata": "root.CLI._resolve_option",
"header": "['class', 'CLI', '(', 'object', ')', ':', '___EOS___']",
"index": 422
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"CLI_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"resolve",
"\\u",
"option_",
"(_",
"self_",
",_",
"options_",
",_",
"option",
"\\u",
"name_",
",_",
"section",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Resolv",
"es",
" ",
"an",
" ",
"option",
" ",
"value",
" ",
"int",
"o",
" ",
"options",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Set",
"s",
" ",
"options",
".",
"<",
"option",
"\\u",
"name",
">",
" ",
"to",
" ",
"a",
" ",
"resolve",
"d",
" ",
"value",
".",
" ",
"Any",
" ",
"value",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"alr",
"ead",
"y",
" ",
"in",
" ",
"options",
" ",
"override",
"s",
" ",
"a",
" ",
"value",
" ",
"in",
" ",
"os",
".",
"environ",
" ",
"whi",
"ch",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"override",
"s",
" ",
"self",
".",
"context",
".",
"conf",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"options",
":",
" ",
"The",
" ",
"options",
" ",
"instance",
" ",
"as",
" ",
"return",
"ed",
" ",
"by",
" ",
"optparse",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"option",
"\\u",
"name",
":",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"option",
",",
" ",
"suc",
"h",
" ",
"as",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"auth",
"\\u",
"url",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"section",
"\\u",
"name",
":",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"section",
",",
" ",
"suc",
"h",
" ",
"as",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"swift",
"ly",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"getattr_",
"(_",
"options_",
",_",
"option",
"\\u",
"name_",
",_",
"None_",
")_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"option",
"\\u",
"name_",
"._",
"startswith_",
"(_",
"section",
"\\u",
"name_",
"+_",
"'\\u'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"environ",
"\\u",
"name_",
"=_",
"option",
"\\u",
"name_",
"._",
"upper_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf",
"\\u",
"name_",
"=_",
"option",
"\\u",
"name_",
"[_",
"len_",
"(_",
"section",
"\\u",
"name_",
")_",
"+_",
"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 ",
" _",
"environ",
"\\u",
"name_",
"=_",
"(_",
"section",
"\\u",
"name_",
"+_",
"'\\u'_",
"+_",
"option",
"\\u",
"name_",
")_",
"._",
"upper_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf",
"\\u",
"name_",
"=_",
"option",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"setattr_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"options_",
",_",
"option",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"environ",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"self_",
"._",
"context_",
"._",
"conf_",
"._",
"get_",
"(_",
"section",
"\\u",
"name_",
",_",
"{_",
"}_",
")_",
")_",
"._",
"get_",
"(_",
"conf",
"\\u",
"name_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | VisTrails/VisTrails/vistrails/core/console_mode.py | [
{
"content": "def get_wf_graph(w_list, output_dir, pdf=False):\n \"\"\"run_and_get_results(w_list: list of (locator, version), \n output_dir:str, pdf:bool)\n Load all workflows in wf_list and dump their graph to output_dir.\n \n \"\"\"\n result = []\n if is_running_gui():\n from vistrails.gui.vistrail_controller import VistrailController as \\\n GUIVistrailController\n for locator, workflow in w_list:\n try:\n (v, abstractions , thumbnails, mashups) = load_vistrail(locator)\n controller = GUIVistrailController(v, locator, abstractions, \n thumbnails, mashups,\n auto_save=False)\n # FIXME TE: why is this needed\n controller.current_pipeline_view.set_controller(controller)\n\n version = None\n if isinstance(workflow, basestring):\n version = v.get_version_number(workflow)\n elif isinstance(workflow, (int, long)):\n version = workflow\n elif workflow is None:\n version = controller.get_latest_version_in_graph()\n else:\n msg = \"Invalid version tag or number: %s\" % workflow\n raise VistrailsInternalError(msg)\n\n controller.change_selected_version(version)\n\n if controller.current_pipeline is not None:\n controller.updatePipelineScene()\n if pdf:\n base_fname = \"%s_%s_pipeline.pdf\" % \\\n (locator.short_filename, version)\n filename = os.path.join(output_dir, base_fname)\n controller.current_pipeline_scene.saveToPDF(filename)\n else:\n base_fname = \"%s_%s_pipeline.png\" % \\\n (locator.short_filename, version)\n filename = os.path.join(output_dir, base_fname)\n controller.current_pipeline_scene.saveToPNG(filename)\n result.append((True, \"\"))\n except Exception, e:\n result.append((False, debug.format_exception(e)))\n else:\n error_str = \"Cannot save pipeline figure when not \" \\\n \"running in gui mode\"\n debug.critical(error_str)\n result.append((False, error_str))\n return result",
"metadata": "root.get_wf_graph",
"header": "['module', '___EOS___']",
"index": 162
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"wf",
"\\u",
"graph_",
"(_",
"w",
"\\u",
"list_",
",_",
"output",
"\\u",
"dir_",
",_",
"pdf_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"run",
"\\u",
"and",
"\\u",
"get",
"\\u",
"results",
"(",
"w",
"\\u",
"list",
":",
" ",
"list",
" ",
"of",
" ",
"(",
"locator",
",",
" ",
"version",
"),",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"output",
"\\u",
"dir",
":",
"str",
",",
" ",
"pdf",
":",
"bool",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Load",
" ",
"all",
" ",
"workf",
"lows",
" ",
"in",
" ",
"wf",
"\\u",
"list",
" ",
"and",
" ",
"dump",
" ",
"thei",
"r",
" ",
"graph",
" ",
"to",
" ",
"output",
"\\u",
"dir",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"is",
"\\u",
"runn",
"ing",
"\\u",
"gui_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"vist",
"rail",
"s_",
"._",
"gui_",
"._",
"vist",
"rail",
"\\u",
"controller_",
"import_",
"Vis",
"trail",
"Controller_",
"as_",
"GU",
"IV",
"istr",
"ail",
"Controller_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"locator_",
",_",
"workflow_",
"in_",
"w",
"\\u",
"list_",
":_",
"\\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 ",
" _",
"(_",
"v_",
",_",
"abstract",
"ions_",
",_",
"thumbnail",
"s_",
",_",
"mas",
"hu",
"ps_",
")_",
"=_",
"load",
"\\u",
"vist",
"rail",
"_",
"(_",
"locator_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"controller_",
"=_",
"GU",
"IV",
"istr",
"ail",
"Controller_",
"(_",
"v_",
",_",
"locator_",
",_",
"abstract",
"ions_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"thumbnail",
"s_",
",_",
"mas",
"hu",
"ps_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"auto",
"\\u",
"save_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"FIX",
"ME",
" ",
"TE",
":",
" ",
"wh",
"y",
" ",
"is",
" ",
"this",
" ",
"needed_",
"\\u\\u\\uNL\\u\\u\\u_",
"controller_",
"._",
"current",
"\\u",
"pipeline",
"\\u",
"view_",
"._",
"set\\u",
"controller_",
"(_",
"controller_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"version_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"workflow_",
",_",
"basestring_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"version_",
"=_",
"v_",
"._",
"get",
"\\u",
"version",
"\\u",
"number_",
"(_",
"workflow_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"workflow_",
",_",
"(_",
"int_",
",_",
"long_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"version_",
"=_",
"workflow_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"workflow_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"version_",
"=_",
"controller_",
"._",
"get",
"\\u",
"late",
"st",
"\\u",
"version",
"\\u",
"in",
"\\u",
"graph_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"msg_",
"=_",
"\"",
"Inva",
"lid",
" ",
"version",
" ",
"tag",
" ",
"or",
" ",
"number",
":",
" ",
"%",
"s",
"\"_",
"%_",
"workflow_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Vis",
"trail",
"s",
"Intern",
"al",
"Error_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"controller_",
"._",
"change",
"\\u",
"selecte",
"d\\u",
"version_",
"(_",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"controller_",
"._",
"current",
"\\u",
"pipeline_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"controller_",
"._",
"update",
"Pipe",
"line",
"Scene_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"pdf_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"base",
"\\u",
"fname_",
"=_",
"\"%",
"s",
"\\u",
"%",
"s",
"\\u",
"pipeline",
".",
"pdf",
"\"_",
"%_",
"(_",
"locator_",
"._",
"short",
"\\u",
"filename_",
",_",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"filename_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"output",
"\\u",
"dir_",
",_",
"base",
"\\u",
"fname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"controller_",
"._",
"current",
"\\u",
"pipeline",
"\\u",
"scene_",
"._",
"save",
"To",
"PDF_",
"(_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"base",
"\\u",
"fname_",
"=_",
"\"%",
"s",
"\\u",
"%",
"s",
"\\u",
"pipeline",
".",
"png",
"\"_",
"%_",
"(_",
"locator_",
"._",
"short",
"\\u",
"filename_",
",_",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"filename_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"output",
"\\u",
"dir_",
",_",
"base",
"\\u",
"fname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"controller_",
"._",
"current",
"\\u",
"pipeline",
"\\u",
"scene_",
"._",
"save",
"To",
"PNG",
"_",
"(_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"(_",
"True_",
",_",
"\"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"._",
"append_",
"(_",
"(_",
"False_",
",_",
"debug_",
"._",
"format\\u",
"exception_",
"(_",
"e_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"error",
"\\u",
"str_",
"=_",
"\"",
"Cann",
"ot",
" ",
"save",
" ",
"pipeline",
" ",
"figure",
" ",
"whe",
"n",
" ",
"not",
" ",
"\"_",
"\"",
"runn",
"ing",
" ",
"in",
" ",
"gui",
" ",
"mode",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"debug_",
"._",
"critical_",
"(_",
"error",
"\\u",
"str_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"(_",
"False_",
",_",
"error",
"\\u",
"str_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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