query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
list
label_sequence
list
Unused local variable
statsmodels/statsmodels/statsmodels/sandbox/stats/multicomp.py
[ { "content": "def Tukeythreegene(first,second,third):\n #Performing the Tukey HSD post-hoc test for three genes\n## qwb = xlrd.open_workbook('F:/Lab/bioinformatics/qcrittable.xls')\n## #opening the workbook containing the q crit table\n## qwb.sheet_names()\n## qcrittable = qwb.sheet_by_name(u'Sheet1')\n\n firstmean = numpy.mean(first) #means of the three arrays\n secondmean = numpy.mean(second)\n thirdmean = numpy.mean(third)\n\n firststd = numpy.std(first) #standard deviations of the threearrays\n secondstd = numpy.std(second)\n thirdstd = numpy.std(third)\n\n firsts2 = math.pow(firststd,2) #standard deviation squared of the three arrays\n seconds2 = math.pow(secondstd,2)\n thirds2 = math.pow(thirdstd,2)\n\n mserrornum = firsts2*2+seconds2*2+thirds2*2 #numerator for mean square error\n mserrorden = (len(first)+len(second)+len(third))-3 #denominator for mean square error\n mserror = mserrornum/mserrorden #mean square error\n\n standarderror = math.sqrt(mserror/len(first))\n #standard error, which is square root of mserror and the number of samples in a group\n\n dftotal = len(first)+len(second)+len(third)-1 #various degrees of freedom\n dfgroups = 2\n dferror = dftotal-dfgroups\n\n qcrit = 0.5 # fix arbitrary#qcrittable.cell(dftotal, 3).value\n qcrit = get_tukeyQcrit(3, dftotal, alpha=0.05)\n #getting the q critical value, for degrees of freedom total and 3 groups\n\n qtest3to1 = (math.fabs(thirdmean-firstmean))/standarderror\n #calculating q test statistic values\n qtest3to2 = (math.fabs(thirdmean-secondmean))/standarderror\n qtest2to1 = (math.fabs(secondmean-firstmean))/standarderror\n\n conclusion = []\n\n## print(qcrit\n print(qtest3to1)\n print(qtest3to2)\n print(qtest2to1)\n\n if(qtest3to1>qcrit): #testing all q test statistic values to q critical values\n conclusion.append('3to1null')\n else:\n conclusion.append('3to1alt')\n if(qtest3to2>qcrit):\n conclusion.append('3to2null')\n else:\n conclusion.append('3to2alt')\n if(qtest2to1>qcrit):\n conclusion.append('2to1null')\n else:\n conclusion.append('2to1alt')\n\n return conclusion", "metadata": "root.Tukeythreegene", "header": "['module', '___EOS___']", "index": 178 }, { "content": "def Tukeythreegene2(genes): #Performing the Tukey HSD post-hoc test for three genes\n \"\"\"gend is a list, ie [first, second, third]\"\"\"\n# qwb = xlrd.open_workbook('F:/Lab/bioinformatics/qcrittable.xls')\n #opening the workbook containing the q crit table\n# qwb.sheet_names()\n# qcrittable = qwb.sheet_by_name(u'Sheet1')\n\n means = []\n stds = []\n for gene in genes:\n means.append(numpy.mean(gene))\n std.append(numpy.std(gene))\n\n #firstmean = numpy.mean(first) #means of the three arrays\n #secondmean = numpy.mean(second)\n #thirdmean = numpy.mean(third)\n\n #firststd = numpy.std(first) #standard deviations of the three arrays\n #secondstd = numpy.std(second)\n #thirdstd = numpy.std(third)\n\n stds2 = []\n for std in stds:\n stds2.append(math.pow(std,2))\n\n\n #firsts2 = math.pow(firststd,2) #standard deviation squared of the three arrays\n #seconds2 = math.pow(secondstd,2)\n #thirds2 = math.pow(thirdstd,2)\n\n #mserrornum = firsts2*2+seconds2*2+thirds2*2 #numerator for mean square error\n mserrornum = sum(stds2)*2\n mserrorden = (len(genes[0])+len(genes[1])+len(genes[2]))-3 #denominator for mean square error\n mserror = mserrornum/mserrorden #mean square error", "metadata": "root.Tukeythreegene2", "header": "['module', '___EOS___']", "index": 241 }, { "content": "def mcfdr(nrepl=100, nobs=50, ntests=10, ntrue=6, mu=0.5, alpha=0.05, rho=0.):\n '''MonteCarlo to test fdrcorrection\n '''\n nfalse = ntests - ntrue\n locs = np.array([0.]*ntrue + [mu]*(ntests - ntrue))\n results = []\n for i in range(nrepl):\n #rvs = locs + stats.norm.rvs(size=(nobs, ntests))\n rvs = locs + randmvn(rho, size=(nobs, ntests))\n tt, tpval = stats.ttest_1samp(rvs, 0)\n res = fdrcorrection_bak(np.abs(tpval), alpha=alpha, method='i')\n res0 = fdrcorrection0(np.abs(tpval), alpha=alpha)\n #res and res0 give the same results\n results.append([np.sum(res[:ntrue]), np.sum(res[ntrue:])] +\n [np.sum(res0[:ntrue]), np.sum(res0[ntrue:])] +\n res.tolist() +\n np.sort(tpval).tolist() +\n [np.sum(tpval[:ntrue]<alpha),\n np.sum(tpval[ntrue:]<alpha)] +\n [np.sum(tpval[:ntrue]<alpha/ntests),\n np.sum(tpval[ntrue:]<alpha/ntests)])\n return np.array(results)", "metadata": "root.mcfdr", "header": "['module', '___EOS___']", "index": 414 }, { "content": " def __init__(self, x, useranks=False, uni=None, intlab=None):\n '''descriptive statistics by groups\n\n Parameters\n ----------\n x : array, 2d\n first column data, second column group labels\n useranks : boolean\n if true, then use ranks as data corresponding to the\n scipy.stats.rankdata definition (start at 1, ties get mean)\n uni, intlab : arrays (optional)\n to avoid call to unique, these can be given as inputs\n\n\n '''\n self.x = np.asarray(x)\n if intlab is None:\n uni, intlab = np.unique(x[:,1], return_inverse=True)\n elif uni is None:\n uni = np.unique(x[:,1])\n\n self.useranks = useranks\n\n\n self.uni = uni\n self.intlab = intlab\n self.groupnobs = groupnobs = np.bincount(intlab)\n\n #temporary until separated and made all lazy\n self.runbasic(useranks=useranks)", "metadata": "root.GroupsStats.__init__", "header": "['class', 'GroupsStats', '(', 'object', ')', ':', '___EOS___']", "index": 507 }, { "content": "def rankdata(x):\n '''rankdata, equivalent to scipy.stats.rankdata\n\n just a different implementation, I have not yet compared speed\n\n '''\n uni, intlab = np.unique(x[:,0], return_inverse=True)\n groupnobs = np.bincount(intlab)\n groupxsum = np.bincount(intlab, weights=X[:,0])\n groupxmean = groupxsum * 1.0 / groupnobs\n\n rankraw = x[:,0].argsort().argsort()\n groupranksum = np.bincount(intlab, weights=rankraw)\n # start at 1 for stats.rankdata :\n grouprankmean = groupranksum * 1.0 / groupnobs + 1\n return grouprankmean[intlab]", "metadata": "root.rankdata", "header": "['module', '___EOS___']", "index": 994 }, { "content": "def compare_ordered(vals, alpha):\n '''simple ordered sequential comparison of means\n\n vals : array_like\n means or rankmeans for independent groups\n\n incomplete, no return, not used yet\n '''\n vals = np.asarray(vals)\n alphaf = alpha # Notation ?\n sortind = np.argsort(vals)\n pvals = vals[sortind]\n sortrevind = sortind.argsort()\n ntests = len(vals)\n #alphacSidak = 1 - np.power((1. - alphaf), 1./ntests)\n #alphacBonf = alphaf / float(ntests)\n v1, v2 = np.triu_indices(ntests, 1)\n #v1,v2 have wrong sequence\n for i in range(4):\n for j in range(4,i, -1):\n print(i,j)", "metadata": "root.compare_ordered", "header": "['module', '___EOS___']", "index": 1014 }, { "content": "def tukeyhsd(mean_all, nobs_all, var_all, df=None, alpha=0.05, q_crit=None):\n '''simultaneous Tukey HSD\n\n\n check: instead of sorting, I use absolute value of pairwise differences\n in means. That's irrelevant for the test, but maybe reporting actual\n differences would be better.\n CHANGED: meandiffs are with sign, studentized range uses abs\n\n q_crit added for testing\n\n TODO: error in variance calculation when nobs_all is scalar, missing 1/n\n\n '''\n mean_all = np.asarray(mean_all)\n #check if or when other ones need to be arrays\n\n n_means = len(mean_all)\n\n if df is None:\n df = nobs_all - 1\n\n if np.size(df) == 1: # assumes balanced samples with df = n - 1, n_i = n\n df_total = n_means * df\n df = np.ones(n_means) * df\n else:\n df_total = np.sum(df)\n\n if (np.size(nobs_all) == 1) and (np.size(var_all) == 1):\n #balanced sample sizes and homogenous variance\n var_pairs = 1. * var_all / nobs_all * np.ones((n_means, n_means))\n\n elif np.size(var_all) == 1:\n #unequal sample sizes and homogenous variance\n var_pairs = var_all * varcorrection_pairs_unbalanced(nobs_all,\n srange=True)\n elif np.size(var_all) > 1:\n var_pairs, df_sum = varcorrection_pairs_unequal(nobs_all, var_all, df)\n var_pairs /= 2.\n #check division by two for studentized range\n\n else:\n raise ValueError('not supposed to be here')\n\n #meandiffs_ = mean_all[:,None] - mean_all\n meandiffs_ = mean_all - mean_all[:,None] #reverse sign, check with R example\n std_pairs_ = np.sqrt(var_pairs)\n\n #select all pairs from upper triangle of matrix\n idx1, idx2 = np.triu_indices(n_means, 1)\n meandiffs = meandiffs_[idx1, idx2]\n std_pairs = std_pairs_[idx1, idx2]\n\n st_range = np.abs(meandiffs) / std_pairs #studentized range statistic\n\n df_total_ = max(df_total, 5) #TODO: smallest df in table\n if q_crit is None:\n q_crit = get_tukeyQcrit2(n_means, df_total, alpha=alpha)\n\n reject = st_range > q_crit\n crit_int = std_pairs * q_crit\n reject2 = np.abs(meandiffs) > crit_int\n\n confint = np.column_stack((meandiffs - crit_int, meandiffs + crit_int))\n\n return (idx1, idx2), reject, meandiffs, std_pairs, confint, q_crit, \\\n df_total, reject2", "metadata": "root.tukeyhsd", "header": "['module', '___EOS___']", "index": 1221 }, { "content": "def distance_st_range(mean_all, nobs_all, var_all, df=None, triu=False):\n '''pairwise distance matrix, outsourced from tukeyhsd\n\n\n\n CHANGED: meandiffs are with sign, studentized range uses abs\n\n q_crit added for testing\n\n TODO: error in variance calculation when nobs_all is scalar, missing 1/n\n\n '''\n mean_all = np.asarray(mean_all)\n #check if or when other ones need to be arrays\n\n n_means = len(mean_all)\n\n if df is None:\n df = nobs_all - 1\n\n if np.size(df) == 1: # assumes balanced samples with df = n - 1, n_i = n\n df_total = n_means * df\n else:\n df_total = np.sum(df)\n\n if (np.size(nobs_all) == 1) and (np.size(var_all) == 1):\n #balanced sample sizes and homogenous variance\n var_pairs = 1. * var_all / nobs_all * np.ones((n_means, n_means))\n\n elif np.size(var_all) == 1:\n #unequal sample sizes and homogenous variance\n var_pairs = var_all * varcorrection_pairs_unbalanced(nobs_all,\n srange=True)\n elif np.size(var_all) > 1:\n var_pairs, df_sum = varcorrection_pairs_unequal(nobs_all, var_all, df)\n var_pairs /= 2.\n #check division by two for studentized range\n\n else:\n raise ValueError('not supposed to be here')\n\n #meandiffs_ = mean_all[:,None] - mean_all\n meandiffs = mean_all - mean_all[:,None] #reverse sign, check with R example\n std_pairs = np.sqrt(var_pairs)\n\n idx1, idx2 = np.triu_indices(n_means, 1)\n if triu:\n #select all pairs from upper triangle of matrix\n meandiffs = meandiffs_[idx1, idx2]\n std_pairs = std_pairs_[idx1, idx2]\n\n st_range = np.abs(meandiffs) / std_pairs #studentized range statistic\n\n return st_range, meandiffs, std_pairs, (idx1,idx2) #return square arrays", "metadata": "root.distance_st_range", "header": "['module', '___EOS___']", "index": 1352 }, { "content": "def multicontrast_pvalues(tstat, tcorr, df=None, dist='t', alternative='two-sided'):\n '''pvalues for simultaneous tests\n\n '''\n from statsmodels.sandbox.distributions.multivariate import mvstdtprob\n if (df is None) and (dist == 't'):\n raise ValueError('df has to be specified for the t-distribution')\n tstat = np.asarray(tstat)\n ntests = len(tstat)\n cc = np.abs(tstat)\n pval_global = 1 - mvstdtprob(-cc,cc, tcorr, df)\n pvals = []\n for ti in cc:\n limits = ti*np.ones(ntests)\n pvals.append(1 - mvstdtprob(-cc,cc, tcorr, df))\n\n return pval_global, np.asarray(pvals)", "metadata": "root.multicontrast_pvalues", "header": "['module', '___EOS___']", "index": 1477 } ]
[ { "span": "dferror ", "start_line": 206, "start_column": 3, "end_line": 206, "end_column": 10 }, { "span": "mserror ", "start_line": 274, "start_column": 3, "end_line": 274, "end_column": 10 }, { "span": "nfalse ", "start_line": 417, "start_column": 4, "end_line": 417, "end_column": 10 }, { "span": "groupnobs ", "start_line": 533, "start_column": 25, "end_line": 533, "end_column": 34 }, { "span": "groupxmean ", "start_line": 1003, "start_column": 4, "end_line": 1003, "end_column": 14 }, { "span": "alphaf ", "start_line": 1023, "start_column": 4, "end_line": 1023, "end_column": 10 }, { "span": "pvals ", "start_line": 1025, "start_column": 4, "end_line": 1025, "end_column": 9 }, { "span": "sortrevind ", "start_line": 1026, "start_column": 4, "end_line": 1026, "end_column": 14 }, { "span": "v1,", "start_line": 1030, "start_column": 4, "end_line": 1030, "end_column": 6 }, { "span": "v2 ", "start_line": 1030, "start_column": 8, "end_line": 1030, "end_column": 10 }, { "span": "df_total_ ", "start_line": 1276, "start_column": 4, "end_line": 1276, "end_column": 13 }, { "span": "df_total ", "start_line": 1373, "start_column": 8, "end_line": 1373, "end_column": 16 }, { "span": "df_total ", "start_line": 1375, "start_column": 8, "end_line": 1375, "end_column": 16 }, { "span": "limits ", "start_line": 1490, "start_column": 8, "end_line": 1490, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tu", "keyt", "hre", "ege", "ne_", "(_", "first_", ",_", "second_", ",_", "third_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Perform", "ing", " ", "the", " ", "Tu", "key", " ", "HS", "D", " ", "post", "-", "hoc", " ", "test", " ", "for", " ", "three", " ", "genes_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", "qw", "b", " ", "=", " ", "xlr", "d", ".", "open", "\\u", "workbook", "('", "F", ":/", "Lab", "/", "bio", "informati", "cs", "/", "qc", "rit", "table", ".", "xls", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "#", "opening", " ", "the", " ", "workbook", " ", "contain", "ing", " ", "the", " ", "q", " ", "crit", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", "qw", "b", ".", "sheet", "\\u", "names", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", "qc", "rit", "table", " ", "=", " ", "qw", "b", ".", "sheet", "\\u", "by", "\\u", "name", "(", "u", "'", "She", "et", "1", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first", "mean_", "=_", "numpy_", "._", "mean_", "(_", "first_", ")_", "#", "means", " ", "of", " ", "the", " ", "three", " ", "arrays_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "mean_", "=_", "numpy_", "._", "mean_", "(_", "second_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "third", "mean_", "=_", "numpy_", "._", "mean_", "(_", "third_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "first", "std_", "=_", "numpy_", "._", "std_", "(_", "first_", ")_", "#", "standard", " ", "deviation", "s", " ", "of", " ", "the", " ", "three", "arrays_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "std_", "=_", "numpy_", "._", "std_", "(_", "second_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "third", "std_", "=_", "numpy_", "._", "std_", "(_", "third_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "first", "s2_", "=_", "math_", "._", "pow_", "(_", "first", "std_", ",_", "2_", ")_", "#", "standard", " ", "deviation", " ", "square", "d", " ", "of", " ", "the", " ", "three", " ", "arrays_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second", "s2_", "=_", "math_", "._", "pow_", "(_", "second", "std_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "third", "s2_", "=_", "math_", "._", "pow_", "(_", "third", "std_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mse", "rror", "num_", "=_", "first", "s2_", "*_", "2_", "+_", "second", "s2_", "*_", "2_", "+_", "third", "s2_", "*_", "2_", "#", "numerat", "or", " ", "for", " ", "mean", " ", "square", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mse", "rror", "den_", "=_", "(_", "len_", "(_", "first_", ")_", "+_", "len_", "(_", "second_", ")_", "+_", "len_", "(_", "third_", ")_", ")_", "-_", "3_", "#", "denominator", " ", "for", " ", "mean", " ", "square", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mse", "rror_", "=_", "mse", "rror", "num_", "/_", "mse", "rror", "den_", "#", "mean", " ", "square", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "standard", "error_", "=_", "math_", "._", "sqrt_", "(_", "mse", "rror_", "/_", "len_", "(_", "first_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "standard", " ", "error", ",", " ", "whi", "ch", " ", "is", " ", "square", " ", "root", " ", "of", " ", "mse", "rror", " ", "and", " ", "the", " ", "number", " ", "of", " ", "samples", " ", "in", " ", "a", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dft", "otal", "_", "=_", "len_", "(_", "first_", ")_", "+_", "len_", "(_", "second_", ")_", "+_", "len_", "(_", "third_", ")_", "-_", "1_", "#", "vari", "ous", " ", "degr", "ees", " ", "of", " ", "freed", "om_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "groups_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "error_", "=_", "dft", "otal", "_", "-_", "df", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qc", "rit", "_", "=_", "0.5_", "#", " ", "fix", " ", "arbitra", "ry", "#", "qc", "rit", "table", ".", "cell", "(", "dft", "otal", ",", " ", "3", ").", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qc", "rit", "_", "=_", "get", "\\u", "tu", "key", "Qc", "rit", "_", "(_", "3_", ",_", "dft", "otal", "_", ",_", "alpha_", "=_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "getti", "ng", " ", "the", " ", "q", " ", "critic", "al", " ", "value", ",", " ", "for", " ", "degr", "ees", " ", "of", " ", "freed", "om", " ", "total", " ", "and", " ", "3", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qt", "est", "3", "to", "1_", "=_", "(_", "math_", "._", "fabs_", "(_", "third", "mean_", "-_", "first", "mean_", ")_", ")_", "/_", "standard", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "calculati", "ng", " ", "q", " ", "test", " ", "statistic", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "qt", "est", "3", "to", "2_", "=_", "(_", "math_", "._", "fabs_", "(_", "third", "mean_", "-_", "second", "mean_", ")_", ")_", "/_", "standard", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qt", "est", "2t", "o1_", "=_", "(_", "math_", "._", "fabs_", "(_", "second", "mean_", "-_", "first", "mean_", ")_", ")_", "/_", "standard", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "concl", "usion", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "print", "(", "qc", "rit", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "qt", "est", "3", "to", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "qt", "est", "3", "to", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "qt", "est", "2t", "o1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "qt", "est", "3", "to", "1_", ">_", "qc", "rit", "_", ")_", ":_", "#", "testi", "ng", " ", "all", " ", "q", " ", "test", " ", "statistic", " ", "values", " ", "to", " ", "q", " ", "critic", "al", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "concl", "usion", "_", "._", "append_", "(_", "'", "3", "to", "1", "null", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "concl", "usion", "_", "._", "append_", "(_", "'", "3", "to", "1a", "lt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "qt", "est", "3", "to", "2_", ">_", "qc", "rit", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "concl", "usion", "_", "._", "append_", "(_", "'", "3", "to", "2n", "ull", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "concl", "usion", "_", "._", "append_", "(_", "'", "3", "to", "2a", "lt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "qt", "est", "2t", "o1_", ">_", "qc", "rit", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "concl", "usion", "_", "._", "append_", "(_", "'", "2t", "o", "1", "null", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "concl", "usion", "_", "._", "append_", "(_", "'", "2t", "o", "1a", "lt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "concl", "usion", "_", "\\u\\u\\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_", "Tu", "keyt", "hre", "ege", "ne", "2_", "(_", "genes_", ")_", ":_", "#", "Perform", "ing", " ", "the", " ", "Tu", "key", " ", "HS", "D", " ", "post", "-", "hoc", " ", "test", " ", "for", " ", "three", " ", "genes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "gen", "d", " ", "is", " ", "a", " ", "list", ",", " ", "ie", " ", "[", "first", ",", " ", "second", ",", " ", "third", "]\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", "qw", "b", " ", "=", " ", "xlr", "d", ".", "open", "\\u", "workbook", "('", "F", ":/", "Lab", "/", "bio", "informati", "cs", "/", "qc", "rit", "table", ".", "xls", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "opening", " ", "the", " ", "workbook", " ", "contain", "ing", " ", "the", " ", "q", " ", "crit", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "qw", "b", ".", "sheet", "\\u", "names", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "qc", "rit", "table", " ", "=", " ", "qw", "b", ".", "sheet", "\\u", "by", "\\u", "name", "(", "u", "'", "She", "et", "1", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "means_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stds", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "gene_", "in_", "genes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "means_", "._", "append_", "(_", "numpy_", "._", "mean_", "(_", "gene_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std_", "._", "append_", "(_", "numpy_", "._", "std_", "(_", "gene_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "first", "mean", " ", "=", " ", "nump", "y", ".", "mean", "(", "first", ")", " ", "#", "means", " ", "of", " ", "the", " ", "three", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "#", "second", "mean", " ", "=", " ", "nump", "y", ".", "mean", "(", "second", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "third", "mean", " ", "=", " ", "nump", "y", ".", "mean", "(", "third", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "first", "std", " ", "=", " ", "nump", "y", ".", "std", "(", "first", ")", " ", "#", "standard", " ", "deviation", "s", " ", "of", " ", "the", " ", "three", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "#", "second", "std", " ", "=", " ", "nump", "y", ".", "std", "(", "second", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "third", "std", " ", "=", " ", "nump", "y", ".", "std", "(", "third", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stds", "2_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "std_", "in_", "stds", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stds", "2_", "._", "append_", "(_", "math_", "._", "pow_", "(_", "std_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "first", "s2", " ", "=", " ", "math", ".", "pow", "(", "first", "std", ",", "2", ")", " ", "#", "standard", " ", "deviation", " ", "square", "d", " ", "of", " ", "the", " ", "three", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "#", "second", "s2", " ", "=", " ", "math", ".", "pow", "(", "second", "std", ",", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "third", "s2", " ", "=", " ", "math", ".", "pow", "(", "third", "std", ",", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "mse", "rror", "num", " ", "=", " ", "first", "s2", "*", "2", "+", "second", "s2", "*", "2", "+", "third", "s2", "*", "2", " ", "#", "numerat", "or", " ", "for", " ", "mean", " ", "square", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mse", "rror", "num_", "=_", "sum_", "(_", "stds", "2_", ")_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mse", "rror", "den_", "=_", "(_", "len_", "(_", "genes_", "[_", "0_", "]_", ")_", "+_", "len_", "(_", "genes_", "[_", "1_", "]_", ")_", "+_", "len_", "(_", "genes_", "[_", "2_", "]_", ")_", ")_", "-_", "3_", "#", "denominator", " ", "for", " ", "mean", " ", "square", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mse", "rror_", "=_", "mse", "rror", "num_", "/_", "mse", "rror", "den_", "#", "mean", " ", "square", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mc", "fd", "r_", "(_", "nre", "pl_", "=_", "100_", ",_", "nob", "s_", "=_", "50_", ",_", "ntes", "ts_", "=_", "10_", ",_", "ntr", "ue_", "=_", "6_", ",_", "mu_", "=_", "0.5_", ",_", "alpha_", "=_", "0.05_", ",_", "rho_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Monte", "Carlo", " ", "to", " ", "test", " ", "fd", "rco", "rrect", "ion", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nfa", "lse", "_", "=_", "ntes", "ts_", "-_", "ntr", "ue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locs_", "=_", "np_", "._", "array_", "(_", "[_", "0._", "]_", "*_", "ntr", "ue_", "+_", "[_", "mu_", "]_", "*_", "(_", "ntes", "ts_", "-_", "ntr", "ue_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nre", "pl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "rv", "s", " ", "=", " ", "locs", " ", "+", " ", "stats", ".", "norm", ".", "rv", "s", "(", "size", "=(", "nob", "s", ",", " ", "ntes", "ts", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rvs_", "=_", "locs_", "+_", "rand", "mv", "n_", "(_", "rho_", ",_", "size_", "=_", "(_", "nob", "s_", ",_", "ntes", "ts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tt_", ",_", "tp", "val_", "=_", "stats_", "._", "tte", "st", "\\u", "1s", "amp_", "(_", "rvs_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "fd", "rco", "rrect", "ion", "\\u", "bak", "_", "(_", "np_", "._", "abs_", "(_", "tp", "val_", ")_", ",_", "alpha_", "=_", "alpha_", ",_", "method_", "=_", "'", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "0_", "=_", "fd", "rco", "rrect", "ion", "0_", "(_", "np_", "._", "abs_", "(_", "tp", "val_", ")_", ",_", "alpha_", "=_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "res", " ", "and", " ", "res", "0", " ", "give", " ", "the", " ", "same", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "np_", "._", "sum_", "(_", "res_", "[_", ":_", "ntr", "ue_", "]_", ")_", ",_", "np_", "._", "sum_", "(_", "res_", "[_", "ntr", "ue_", ":_", "]_", ")_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "np_", "._", "sum_", "(_", "res", "0_", "[_", ":_", "ntr", "ue_", "]_", ")_", ",_", "np_", "._", "sum_", "(_", "res", "0_", "[_", "ntr", "ue_", ":_", "]_", ")_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "tolist_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "sort_", "(_", "tp", "val_", ")_", "._", "tolist_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "np_", "._", "sum_", "(_", "tp", "val_", "[_", ":_", "ntr", "ue_", "]_", "<_", "alpha_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "sum_", "(_", "tp", "val_", "[_", "ntr", "ue_", ":_", "]_", "<_", "alpha_", ")_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "np_", "._", "sum_", "(_", "tp", "val_", "[_", ":_", "ntr", "ue_", "]_", "<_", "alpha_", "/_", "ntes", "ts_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "sum_", "(_", "tp", "val_", "[_", "ntr", "ue_", ":_", "]_", "<_", "alpha_", "/_", "ntes", "ts_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "array_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "s", "Stats_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "x_", ",_", "usera", "nks", "_", "=_", "False_", ",_", "uni_", "=_", "None_", ",_", "intl", "ab_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "descripti", "ve", " ", "statistic", "s", " ", "by", " ", "group", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "x", " ", ":", " ", "array", ",", " ", "2d", "\\", "10", ";", " ", " ", " ", " ", "first", " ", "column", " ", "data", ",", " ", "second", " ", "column", " ", "group", " ", "labels", "\\", "10", ";", " ", " ", " ", " ", "usera", "nks", " ", ":", " ", "boolean", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "true", ",", " ", "then", " ", "use", " ", "ranks", " ", "as", " ", "data", " ", "correspond", "ing", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "sci", "py", ".", "stats", ".", "rank", "data", " ", "definit", "ion", " ", "(", "start", " ", "at", " ", "1", ",", " ", "ties", " ", "get", " ", "mean", ")", "\\", "10", ";", " ", " ", " ", " ", "uni", ",", " ", "intl", "ab", " ", ":", " ", "arrays", " ", "(", "option", "al", ")", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "avoid", " ", "call", " ", "to", " ", "unique", ",", " ", "these", " ", "can", " ", "be", " ", "give", "n", " ", "as", " ", "inputs", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "x_", "=_", "np_", "._", "asarray_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "intl", "ab_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uni_", ",_", "intl", "ab_", "=_", "np_", "._", "unique_", "(_", "x_", "[_", ":_", ",_", "1_", "]_", ",_", "return", "\\u", "inverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "uni_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uni_", "=_", "np_", "._", "unique_", "(_", "x_", "[_", ":_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "usera", "nks", "_", "=_", "usera", "nks", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "uni_", "=_", "uni_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "intl", "ab_", "=_", "intl", "ab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "group", "nob", "s_", "=_", "group", "nob", "s_", "=_", "np_", "._", "binc", "ount_", "(_", "intl", "ab_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "temporar", "y", " ", "unti", "l", " ", "separate", "d", " ", "and", " ", "made", " ", "all", " ", "lazy_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "run", "basic_", "(_", "usera", "nks", "_", "=_", "usera", "nks", "_", ")_", "\\u\\u\\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_", "rank", "data_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "rank", "data", ",", " ", "equivalent", " ", "to", " ", "sci", "py", ".", "stats", ".", "rank", "data", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "just", " ", "a", " ", "different", " ", "implementation", ",", " ", "I", " ", "have", " ", "not", " ", "ye", "t", " ", "compare", "d", " ", "speed", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uni_", ",_", "intl", "ab_", "=_", "np_", "._", "unique_", "(_", "x_", "[_", ":_", ",_", "0_", "]_", ",_", "return", "\\u", "inverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "nob", "s_", "=_", "np_", "._", "binc", "ount_", "(_", "intl", "ab_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "xs", "um_", "=_", "np_", "._", "binc", "ount_", "(_", "intl", "ab_", ",_", "weights_", "=_", "X_", "[_", ":_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "xm", "ean_", "=_", "group", "xs", "um_", "*_", "1.0_", "/_", "group", "nob", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rank", "raw_", "=_", "x_", "[_", ":_", ",_", "0_", "]_", "._", "argsort_", "(_", ")_", "._", "argsort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "ranks", "um_", "=_", "np_", "._", "binc", "ount_", "(_", "intl", "ab_", ",_", "weights_", "=_", "rank", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "start", " ", "at", " ", "1", " ", "for", " ", "stats", ".", "rank", "data", " ", ":_", "\\u\\u\\uNL\\u\\u\\u_", "group", "rank", "mean_", "=_", "group", "ranks", "um_", "*_", "1.0_", "/_", "group", "nob", "s_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "group", "rank", "mean_", "[_", "intl", "ab_", "]_", "\\u\\u\\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_", "compare", "\\u", "ordered_", "(_", "vals_", ",_", "alpha_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "simple", " ", "order", "ed", " ", "sequential", " ", "compa", "ris", "on", " ", "of", " ", "means", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "vals", " ", ":", " ", "array", "\\u", "like", "\\", "10", ";", " ", " ", " ", " ", "means", " ", "or", " ", "rank", "means", " ", "for", " ", "independent", " ", "group", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "incomplete", ",", " ", "no", " ", "return", ",", " ", "not", " ", "used", " ", "ye", "t", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vals_", "=_", "np_", "._", "asarray_", "(_", "vals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha", "f_", "=_", "alpha_", "#", " ", "Nota", "tion", " ", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "ind_", "=_", "np_", "._", "argsort_", "(_", "vals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pval", "s_", "=_", "vals_", "[_", "sort", "ind_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "revi", "nd_", "=_", "sort", "ind_", "._", "argsort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ntes", "ts_", "=_", "len_", "(_", "vals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "alpha", "c", "Si", "da", "k", " ", "=", " ", "1", " ", "-", " ", "np", ".", "power", "((", "1", ".", " ", "-", " ", "alpha", "f", "),", " ", "1", "./", "ntes", "ts", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "alpha", "c", "Bon", "f", " ", "=", " ", "alpha", "f", " ", "/", " ", "float", "(", "ntes", "ts", ")_", "\\u\\u\\uNL\\u\\u\\u_", "v1_", ",_", "v2_", "=_", "np_", "._", "tri", "u\\u", "indices_", "(_", "ntes", "ts_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "v1", ",", "v2", " ", "have", " ", "wrong", " ", "sequence_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "4_", ",_", "i_", ",_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "i_", ",_", "j_", ")_", "\\u\\u\\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_", "tu", "key", "hs", "d_", "(_", "mean", "\\u", "all_", ",_", "nob", "s", "\\u", "all_", ",_", "var", "\\u", "all_", ",_", "df_", "=_", "None_", ",_", "alpha_", "=_", "0.05_", ",_", "q", "\\u", "crit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "simultaneous", " ", "Tu", "key", " ", "HS", "D", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "check", ":", " ", "inst", "ead", " ", "of", " ", "sorting", ",", " ", "I", " ", "use", " ", "abs", "olute", " ", "value", " ", "of", " ", "pairwise", " ", "difference", "s", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "means", ".", " ", "Tha", "t", "'", "s", " ", "irre", "lev", "ant", " ", "for", " ", "the", " ", "test", ",", " ", "but", " ", "may", "be", " ", "reporting", " ", "actual", "\\", "10", ";", " ", " ", " ", " ", "difference", "s", " ", "wou", "ld", " ", "be", " ", "bett", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "CHANGED", ":", " ", "mean", "diffs", " ", "are", " ", "with", " ", "sign", ",", " ", "student", "ize", "d", " ", "range", " ", "use", "s", " ", "abs", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "q", "\\u", "crit", " ", "adde", "d", " ", "for", " ", "testi", "ng", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "TOD", "O", ":", " ", "error", " ", "in", " ", "varian", "ce", " ", "calculati", "on", " ", "whe", "n", " ", "nob", "s", "\\u", "all", " ", "is", " ", "scala", "r", ",", " ", "missi", "ng", " ", "1", "/", "n", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "all_", "=_", "np_", "._", "asarray_", "(_", "mean", "\\u", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "if", " ", "or", " ", "whe", "n", " ", "other", " ", "ones", " ", "need", " ", "to", " ", "be", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "means_", "=_", "len_", "(_", "mean", "\\u", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "df_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "nob", "s", "\\u", "all_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "np_", "._", "size_", "(_", "df_", ")_", "==_", "1_", ":_", "#", " ", "assume", "s", " ", "balance", "d", " ", "samples", " ", "with", " ", "df", " ", "=", " ", "n", " ", "-", " ", "1", ",", " ", "n", "\\u", "i", " ", "=", " ", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "\\u", "total_", "=_", "n", "\\u", "means_", "*_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "np_", "._", "ones_", "(_", "n", "\\u", "means_", ")_", "*_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "\\u", "total_", "=_", "np_", "._", "sum_", "(_", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "np_", "._", "size_", "(_", "nob", "s", "\\u", "all_", ")_", "==_", "1_", ")_", "and_", "(_", "np_", "._", "size_", "(_", "var", "\\u", "all_", ")_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "balance", "d", " ", "sample", " ", "size", "s", " ", "and", " ", "homo", "geno", "us", " ", "variance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "\\u", "pairs_", "=_", "1._", "*_", "var", "\\u", "all_", "/_", "nob", "s", "\\u", "all_", "*_", "np_", "._", "ones_", "(_", "(_", "n", "\\u", "means_", ",_", "n", "\\u", "means_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "np_", "._", "size_", "(_", "var", "\\u", "all_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "une", "qual", " ", "sample", " ", "size", "s", " ", "and", " ", "homo", "geno", "us", " ", "variance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "\\u", "pairs_", "=_", "var", "\\u", "all_", "*_", "var", "correcti", "on", "\\u", "pair", "s", "\\u", "unb", "alance", "d_", "(_", "nob", "s", "\\u", "all_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sra", "nge_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "np_", "._", "size_", "(_", "var", "\\u", "all_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "\\u", "pairs_", ",_", "df", "\\u", "sum_", "=_", "var", "correcti", "on", "\\u", "pair", "s", "\\u", "une", "qual_", "(_", "nob", "s", "\\u", "all_", ",_", "var", "\\u", "all_", ",_", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "pairs_", "/=_", "2._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "divisi", "on", " ", "by", " ", "two", " ", "for", " ", "student", "ize", "d", " ", "range_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "not", " ", "supposed", " ", "to", " ", "be", " ", "here", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "mean", "diffs", "\\u", " ", "=", " ", "mean", "\\u", "all", "[:,", "Non", "e", "]", " ", "-", " ", "mean", "\\u", "all_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "diffs", "\\u_", "=_", "mean", "\\u", "all_", "-_", "mean", "\\u", "all_", "[_", ":_", ",_", "None_", "]_", "#", "reverse", " ", "sign", ",", " ", "check", " ", "with", " ", "R", " ", "example_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "\\u", "pair", "s\\u_", "=_", "np_", "._", "sqrt_", "(_", "var", "\\u", "pairs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "select", " ", "all", " ", "pair", "s", " ", "from", " ", "upper", " ", "triangle", " ", "of", " ", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "idx1_", ",_", "idx2_", "=_", "np_", "._", "tri", "u\\u", "indices_", "(_", "n", "\\u", "means_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "diffs_", "=_", "mean", "diffs", "\\u_", "[_", "idx1_", ",_", "idx2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "\\u", "pairs_", "=_", "std", "\\u", "pair", "s\\u_", "[_", "idx1_", ",_", "idx2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "st", "\\u", "range_", "=_", "np_", "._", "abs_", "(_", "mean", "diffs_", ")_", "/_", "std", "\\u", "pairs_", "#", "student", "ize", "d", " ", "range", " ", "statistic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "\\u", "total", "\\u_", "=_", "max_", "(_", "df", "\\u", "total_", ",_", "5_", ")_", "#", "TOD", "O", ":", " ", "smallest", " ", "df", " ", "in", " ", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q", "\\u", "crit_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q", "\\u", "crit_", "=_", "get", "\\u", "tu", "key", "Qc", "rit", "2_", "(_", "n", "\\u", "means_", ",_", "df", "\\u", "total_", ",_", "alpha_", "=_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reject_", "=_", "st", "\\u", "range_", ">_", "q", "\\u", "crit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "crit", "\\u", "int_", "=_", "std", "\\u", "pairs_", "*_", "q", "\\u", "crit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reject", "2_", "=_", "np_", "._", "abs_", "(_", "mean", "diffs_", ")_", ">_", "crit", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "confi", "nt_", "=_", "np_", "._", "column", "\\u", "stack_", "(_", "(_", "mean", "diffs_", "-_", "crit", "\\u", "int_", ",_", "mean", "diffs_", "+_", "crit", "\\u", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "idx1_", ",_", "idx2_", ")_", ",_", "reject_", ",_", "mean", "diffs_", ",_", "std", "\\u", "pairs_", ",_", "confi", "nt_", ",_", "q", "\\u", "crit_", ",_", "df", "\\u", "total_", ",_", "reject", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "distance", "\\u", "st", "\\u", "range_", "(_", "mean", "\\u", "all_", ",_", "nob", "s", "\\u", "all_", ",_", "var", "\\u", "all_", ",_", "df_", "=_", "None_", ",_", "tri", "u_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "pairwise", " ", "distance", " ", "matrix", ",", " ", "outs", "ource", "d", " ", "from", " ", "tu", "key", "hs", "d", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CHANGED", ":", " ", "mean", "diffs", " ", "are", " ", "with", " ", "sign", ",", " ", "student", "ize", "d", " ", "range", " ", "use", "s", " ", "abs", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "q", "\\u", "crit", " ", "adde", "d", " ", "for", " ", "testi", "ng", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "TOD", "O", ":", " ", "error", " ", "in", " ", "varian", "ce", " ", "calculati", "on", " ", "whe", "n", " ", "nob", "s", "\\u", "all", " ", "is", " ", "scala", "r", ",", " ", "missi", "ng", " ", "1", "/", "n", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "all_", "=_", "np_", "._", "asarray_", "(_", "mean", "\\u", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "if", " ", "or", " ", "whe", "n", " ", "other", " ", "ones", " ", "need", " ", "to", " ", "be", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "means_", "=_", "len_", "(_", "mean", "\\u", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "df_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "nob", "s", "\\u", "all_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "np_", "._", "size_", "(_", "df_", ")_", "==_", "1_", ":_", "#", " ", "assume", "s", " ", "balance", "d", " ", "samples", " ", "with", " ", "df", " ", "=", " ", "n", " ", "-", " ", "1", ",", " ", "n", "\\u", "i", " ", "=", " ", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "\\u", "total_", "=_", "n", "\\u", "means_", "*_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "\\u", "total_", "=_", "np_", "._", "sum_", "(_", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "np_", "._", "size_", "(_", "nob", "s", "\\u", "all_", ")_", "==_", "1_", ")_", "and_", "(_", "np_", "._", "size_", "(_", "var", "\\u", "all_", ")_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "balance", "d", " ", "sample", " ", "size", "s", " ", "and", " ", "homo", "geno", "us", " ", "variance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "\\u", "pairs_", "=_", "1._", "*_", "var", "\\u", "all_", "/_", "nob", "s", "\\u", "all_", "*_", "np_", "._", "ones_", "(_", "(_", "n", "\\u", "means_", ",_", "n", "\\u", "means_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "np_", "._", "size_", "(_", "var", "\\u", "all_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "une", "qual", " ", "sample", " ", "size", "s", " ", "and", " ", "homo", "geno", "us", " ", "variance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "\\u", "pairs_", "=_", "var", "\\u", "all_", "*_", "var", "correcti", "on", "\\u", "pair", "s", "\\u", "unb", "alance", "d_", "(_", "nob", "s", "\\u", "all_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sra", "nge_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "np_", "._", "size_", "(_", "var", "\\u", "all_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "\\u", "pairs_", ",_", "df", "\\u", "sum_", "=_", "var", "correcti", "on", "\\u", "pair", "s", "\\u", "une", "qual_", "(_", "nob", "s", "\\u", "all_", ",_", "var", "\\u", "all_", ",_", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "pairs_", "/=_", "2._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "divisi", "on", " ", "by", " ", "two", " ", "for", " ", "student", "ize", "d", " ", "range_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "not", " ", "supposed", " ", "to", " ", "be", " ", "here", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "mean", "diffs", "\\u", " ", "=", " ", "mean", "\\u", "all", "[:,", "Non", "e", "]", " ", "-", " ", "mean", "\\u", "all_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "diffs_", "=_", "mean", "\\u", "all_", "-_", "mean", "\\u", "all_", "[_", ":_", ",_", "None_", "]_", "#", "reverse", " ", "sign", ",", " ", "check", " ", "with", " ", "R", " ", "example_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "\\u", "pairs_", "=_", "np_", "._", "sqrt_", "(_", "var", "\\u", "pairs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "idx1_", ",_", "idx2_", "=_", "np_", "._", "tri", "u\\u", "indices_", "(_", "n", "\\u", "means_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tri", "u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "select", " ", "all", " ", "pair", "s", " ", "from", " ", "upper", " ", "triangle", " ", "of", " ", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mean", "diffs_", "=_", "mean", "diffs", "\\u_", "[_", "idx1_", ",_", "idx2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "\\u", "pairs_", "=_", "std", "\\u", "pair", "s\\u_", "[_", "idx1_", ",_", "idx2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "st", "\\u", "range_", "=_", "np_", "._", "abs_", "(_", "mean", "diffs_", ")_", "/_", "std", "\\u", "pairs_", "#", "student", "ize", "d", " ", "range", " ", "statistic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "st", "\\u", "range_", ",_", "mean", "diffs_", ",_", "std", "\\u", "pairs_", ",_", "(_", "idx1_", ",_", "idx2_", ")_", "#", "return", " ", "square", " ", "arrays_", "\\u\\u\\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_", "multico", "ntra", "st", "\\u", "pvalue", "s_", "(_", "tsta", "t_", ",_", "tco", "rr_", ",_", "df_", "=_", "None_", ",_", "dist_", "=_", "'", "t", "'_", ",_", "alternative", "_", "=_", "'", "two", "-", "side", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "pvalue", "s", " ", "for", " ", "simultaneous", " ", "tests", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "sandbox_", "._", "distributions_", "._", "multivariate", "_", "import_", "mv", "std", "tpr", "ob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "df_", "is_", "None_", ")_", "and_", "(_", "dist_", "==_", "'", "t", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "df", " ", "has", " ", "to", " ", "be", " ", "specified", " ", "for", " ", "the", " ", "t", "-", "distribu", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tsta", "t_", "=_", "np_", "._", "asarray_", "(_", "tsta", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ntes", "ts_", "=_", "len_", "(_", "tsta", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "np_", "._", "abs_", "(_", "tsta", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pval", "\\u", "global_", "=_", "1_", "-_", "mv", "std", "tpr", "ob_", "(_", "-_", "cc_", ",_", "cc_", ",_", "tco", "rr_", ",_", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pval", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ti_", "in_", "cc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limits_", "=_", "ti_", "*_", "np_", "._", "ones_", "(_", "ntes", "ts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pval", "s_", "._", "append_", "(_", "1_", "-_", "mv", "std", "tpr", "ob_", "(_", "-_", "cc_", ",_", "cc_", ",_", "tco", "rr_", ",_", "df_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pval", "\\u", "global_", ",_", "np_", "._", "asarray_", "(_", "pval", "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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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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dpgaspar/Flask-AppBuilder/examples/extendsecurity/app/sec_forms.py
[ { "content": "from wtforms import StringField, BooleanField, PasswordField\nfrom flask_wtf.recaptcha import RecaptchaField\nfrom flask_babelpkg import lazy_gettext\nfrom wtforms.validators import DataRequired, EqualTo, Email\nfrom flask_appbuilder.fieldwidgets import BS3PasswordFieldWidget, BS3TextFieldWidget\nfrom flask_appbuilder.forms import DynamicForm\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UserInfoEdit(DynamicForm):\n first_name = StringField(lazy_gettext('First Name'), validators=[DataRequired()], widget=BS3TextFieldWidget(),\n description=lazy_gettext('Write the user first name or names'))\n last_name = StringField(lazy_gettext('Last Name'), validators=[DataRequired()], widget=BS3TextFieldWidget(),\n description=lazy_gettext('Write the user last name'))\n emp_number = StringField(lazy_gettext('Emp. Number'), validators=[DataRequired()], widget=BS3TextFieldWidget(),\n description=lazy_gettext('Employee Number'))", "metadata": "root.UserInfoEdit", "header": "['module', '___EOS___']", "index": 8 } ]
[ { "span": "from wtforms import StringField, BooleanField, PasswordField", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 60 }, { "span": "from flask_wtf.recaptcha import RecaptchaField", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 46 }, { "span": "from wtforms.validators import DataRequired, EqualTo, Email", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 59 }, { "span": "from flask_appbuilder.fieldwidgets import BS3PasswordFieldWidget, BS3TextFieldWidget", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 84 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "wtforms_", "import_", "String", "Field_", ",_", "Boo", "lean", "Field_", ",_", "Passw", "ord", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "wtf", "_", "._", "recap", "tcha", "_", "import_", "Rec", "apt", "cha", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "babel", "pkg_", "import_", "lazy", "\\u", "gettext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wtforms_", "._", "validators_", "import_", "Data", "Required_", ",_", "Equal", "To_", ",_", "Email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "app", "builder_", "._", "field", "widgets_", "import_", "BS", "3", "Passw", "ord", "Field", "Widget_", ",_", "BS", "3", "Text", "Field", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "app", "builder_", "._", "forms_", "import_", "Dynamic", "Form_", "\\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_", "User", "Info", "Edit_", "(_", "Dynamic", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first", "\\u", "name_", "=_", "String", "Field_", "(_", "lazy", "\\u", "gettext_", "(_", "'", "Fi", "rst", " ", "Name", "'_", ")_", ",_", "validators_", "=_", "[_", "Data", "Required_", "(_", ")_", "]_", ",_", "widget_", "=_", "BS", "3", "Text", "Field", "Widget_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "lazy", "\\u", "gettext_", "(_", "'", "Write", " ", "the", " ", "user", " ", "first", " ", "name", " ", "or", " ", "names", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "name_", "=_", "String", "Field_", "(_", "lazy", "\\u", "gettext_", "(_", "'", "Las", "t", " ", "Name", "'_", ")_", ",_", "validators_", "=_", "[_", "Data", "Required_", "(_", ")_", "]_", ",_", "widget_", "=_", "BS", "3", "Text", "Field", "Widget_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "lazy", "\\u", "gettext_", "(_", "'", "Write", " ", "the", " ", "user", " ", "last", " ", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "emp", "\\u", "number_", "=_", "String", "Field_", "(_", "lazy", "\\u", "gettext_", "(_", "'", "Emp", ".", " ", "Number", "'_", ")_", ",_", "validators_", "=_", "[_", "Data", "Required_", "(_", ")_", "]_", ",_", "widget_", "=_", "BS", "3", "Text", "Field", "Widget_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "lazy", "\\u", "gettext_", "(_", "'", "Employe", "e", " ", "Number", "'_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
coleifer/peewee/playhouse/sqlite_udf.py
[ { "content": "@udf(FILE)\ndef file_read(filename):\n try:\n with open(filename) as fh:\n return fh.read()\n except:\n pass", "metadata": "root.file_read", "header": "['module', '___EOS___']", "index": 185 }, { "content": "@udf(MATH)\ndef tonumber(s):\n try:\n return int(s)\n except ValueError:\n try:\n return float(s)\n except:\n return None", "metadata": "root.tonumber", "header": "['module', '___EOS___']", "index": 264 } ]
[ { "span": "except:", "start_line": 190, "start_column": 4, "end_line": 190, "end_column": 11 }, { "span": "except:", "start_line": 271, "start_column": 8, "end_line": 271, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "udf", "_", "(_", "FILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "file", "\\u", "read_", "(_", "filename_", ")_", ":_", "\\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 ", " _", "with_", "open_", "(_", "filename_", ")_", "as_", "fh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "fh_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "udf", "_", "(_", "MATH", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ton", "umber_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "s_", ")_", "\\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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
jart/fabulous/fabulous/utils.py
[ { "content": " @property\n def dimensions(self):\n \"\"\"Returns terminal dimensions\n\n Don't save this information for long periods of time because\n the user might resize their terminal.\n\n :return: Returns ``(width, height)``. If there's no terminal\n to be found, we'll just return ``(79, 40)``.\n \"\"\"\n try:\n call = fcntl.ioctl(self.termfd, termios.TIOCGWINSZ, \"\\000\" * 8)\n except:\n return (79, 40)\n else:\n height, width = struct.unpack(\"hhhh\", call)[:2]\n return (width, height)", "metadata": "root.TerminalInfo.dimensions", "header": "['class', 'TerminalInfo', '(', 'object', ')', ':', '___EOS___']", "index": 82 } ]
[ { "span": "except:", "start_line": 94, "start_column": 8, "end_line": 94, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Termin", "al", "Info_", "(_", "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_", "dimensions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "termina", "l", " ", "dimension", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Don", "'", "t", " ", "save", " ", "this", " ", "informati", "on", " ", "for", " ", "long", " ", "period", "s", " ", "of", " ", "time", " ", "bec", "aus", "e", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "user", " ", "mig", "ht", " ", "resiz", "e", " ", "thei", "r", " ", "termina", "l", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "Return", "s", " ", "``", "(", "widt", "h", ",", " ", "height", ")``.", " ", " ", "If", " ", "there", "'", "s", " ", "no", " ", "termina", "l", "\\", "10", ";", " ", " ", " ", " ", " ", "to", " ", "be", " ", "found", ",", " ", "we", "'", "ll", " ", "just", " ", "return", " ", "``", "(", "7", "9", ",", " ", "40", ")``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call_", "=_", "fcntl_", "._", "ioct", "l_", "(_", "self_", "._", "term", "fd_", ",_", "termios_", "._", "TIO", "CG", "WIN", "SZ", "_", ",_", "\"\\\\", "000", "\"_", "*_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "79_", ",_", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "height_", ",_", "width_", "=_", "struct_", "._", "unpack_", "(_", "\"", "hh", "hh", "\"_", ",_", "call_", ")_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "width_", ",_", "height_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
kmike/port-for/port_for/docopt.py
[ { "content": " def __init__(self, *children):\n self.children = list(children)", "metadata": "root.Pattern.__init__", "header": "['class', 'Pattern', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": "class Argument(Pattern):\n\n\n", "metadata": "root.Argument", "header": "['module', '___EOS___']", "index": 102 }, { "content": " def __init__(self, name, value=None):\n self.name = name\n self.value = value", "metadata": "root.Argument.__init__", "header": "['class', 'Argument', '(', 'Pattern', ')', ':', '___EOS___']", "index": 104 }, { "content": "class Command(Pattern):\n\n\n", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 129 }, { "content": " def __init__(self, name, value=False):\n self.name = name\n self.value = value", "metadata": "root.Command.__init__", "header": "['class', 'Command', '(', 'Pattern', ')', ':', '___EOS___']", "index": 131 }, { "content": "class Option(Pattern):\n\n\n\n\n", "metadata": "root.Option", "header": "['module', '___EOS___']", "index": 147 }, { "content": " def __init__(self, short=None, long=None, argcount=0, value=False):\n assert argcount in (0, 1)\n self.short, self.long = short, long\n self.argcount, self.value = argcount, value\n self.value = None if value == False and argcount else value # HACK", "metadata": "root.Option.__init__", "header": "['class', 'Option', '(', 'Pattern', ')', ':', '___EOS___']", "index": 149 } ]
[ { "span": "class Argument(Pattern):", "start_line": 102, "start_column": 0, "end_line": 102, "end_column": 24 }, { "span": "class Command(Pattern):", "start_line": 129, "start_column": 0, "end_line": 129, "end_column": 23 }, { "span": "class Option(Pattern):", "start_line": 147, "start_column": 0, "end_line": 147, "end_column": 22 } ]
[ { "span": "def __init__(self, *children):", "start_line": 22, "start_column": 4, "end_line": 22, "end_column": 34 }, { "span": "def __init__(self, name, value=None):", "start_line": 104, "start_column": 4, "end_line": 104, "end_column": 41 }, { "span": "def __init__(self, name, value=False):", "start_line": 131, "start_column": 4, "end_line": 131, "end_column": 42 }, { "span": "def __init__(self, short=None, long=None, argcount=0, value=False):", "start_line": 149, "start_column": 4, "end_line": 149, "end_column": 71 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Pattern_", "(_", "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_", ",_", "*_", "children_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "children_", "=_", "list_", "(_", "children_", ")_", "\\u\\u\\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_", "Argument_", "(_", "Pattern_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Argument_", "(_", "Pattern_", ")_", ":_", "\\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_", ",_", "name_", ",_", "value_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Command_", "(_", "Pattern_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Command_", "(_", "Pattern_", ")_", ":_", "\\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_", ",_", "name_", ",_", "value_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Option_", "(_", "Pattern_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Option_", "(_", "Pattern_", ")_", ":_", "\\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_", ",_", "short_", "=_", "None_", ",_", "long_", "=_", "None_", ",_", "argc", "ount_", "=_", "0_", ",_", "value_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "argc", "ount_", "in_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "short_", ",_", "self_", "._", "long_", "=_", "short_", ",_", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "argc", "ount_", ",_", "self_", "._", "value_", "=_", "argc", "ount_", ",_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value_", "=_", "None_", "if_", "value_", "==_", "False_", "and_", "argc", "ount_", "else_", "value_", "#", " ", "HA", "CK_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
AppScale/appscale/AppServer/lib/jinja2-2.6/examples/rwbench/djangoext.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom rwbench import ROOT\nfrom os.path import join\nfrom django.conf import settings\nsettings.configure(\n TEMPLATE_DIRS=(join(ROOT, 'django'),),\n TEMPLATE_LOADERS=(\n ('django.template.loaders.cached.Loader', (\n 'django.template.loaders.filesystem.Loader',\n )),\n )\n)\nfrom django.template import loader as django_loader, Context as DjangoContext, \\\n Node, NodeList, Variable, TokenParser\nfrom django import template as django_template_module\nfrom django.template import Library\n\n\n# for django extensions. We monkey patch our extensions in so that\n# we don't have to initialize a more complex django setup.\ndjango_extensions = django_template_module.Library()\ndjango_template_module.builtins.append(django_extensions)\n\n\nfrom rwbench import dateformat\ndjango_extensions.filter(dateformat)\n\n\n\n\n# and more django extensions\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def var_or_none(x):\n if x is not None:\n return Variable(x)", "metadata": "root.var_or_none", "header": "['module', '___EOS___']", "index": 28 }, { "content": "@django_extensions.tag\ndef input_field(parser, token):\n p = TokenParser(token.contents)\n args = [p.value()]\n while p.more():\n args.append(p.value())\n return InputFieldNode(*args)", "metadata": "root.input_field", "header": "['module', '___EOS___']", "index": 34 }, { "content": "@django_extensions.tag\ndef textarea(parser, token):\n p = TokenParser(token.contents)\n args = [p.value()]\n while p.more():\n args.append(p.value())\n return TextareaNode(*args)", "metadata": "root.textarea", "header": "['module', '___EOS___']", "index": 43 }, { "content": "@django_extensions.tag\ndef form(parser, token):\n p = TokenParser(token.contents)\n args = []\n while p.more():\n args.append(p.value())\n body = parser.parse(('endform',))\n parser.delete_first_token()\n return FormNode(body, *args)", "metadata": "root.form", "header": "['module', '___EOS___']", "index": 52 }, { "content": "class InputFieldNode(Node):\n\n", "metadata": "root.InputFieldNode", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def __init__(self, name, type=None, value=None):\n self.name = var_or_none(name)\n self.type = var_or_none(type)\n self.value = var_or_none(value)", "metadata": "root.InputFieldNode.__init__", "header": "['class', 'InputFieldNode', '(', 'Node', ')', ':', '___EOS___']", "index": 65 }, { "content": " def render(self, context):\n name = self.name.resolve(context)\n type = 'text'\n value = ''\n if self.type is not None:\n type = self.type.resolve(context)\n if self.value is not None:\n value = self.value.resolve(context)\n tmpl = django_loader.get_template('_input_field.html')\n return tmpl.render(DjangoContext({\n 'name': name,\n 'type': type,\n 'value': value\n }))", "metadata": "root.InputFieldNode.render", "header": "['class', 'InputFieldNode', '(', 'Node', ')', ':', '___EOS___']", "index": 70 }, { "content": "class TextareaNode(Node):\n\n", "metadata": "root.TextareaNode", "header": "['module', '___EOS___']", "index": 86 }, { "content": " def __init__(self, name, rows=None, cols=None, value=None):\n self.name = var_or_none(name)\n self.rows = var_or_none(rows)\n self.cols = var_or_none(cols)\n self.value = var_or_none(value)", "metadata": "root.TextareaNode.__init__", "header": "['class', 'TextareaNode', '(', 'Node', ')', ':', '___EOS___']", "index": 88 }, { "content": " def render(self, context):\n name = self.name.resolve(context)\n rows = 10\n cols = 40\n value = ''\n if self.rows is not None:\n rows = int(self.rows.resolve(context))\n if self.cols is not None:\n cols = int(self.cols.resolve(context))\n if self.value is not None:\n value = self.value.resolve(context)\n tmpl = django_loader.get_template('_textarea.html')\n return tmpl.render(DjangoContext({\n 'name': name,\n 'rows': rows,\n 'cols': cols,\n 'value': value\n }))", "metadata": "root.TextareaNode.render", "header": "['class', 'TextareaNode', '(', 'Node', ')', ':', '___EOS___']", "index": 94 }, { "content": "class FormNode(Node):\n\n", "metadata": "root.FormNode", "header": "['module', '___EOS___']", "index": 114 }, { "content": " def __init__(self, body, action=None, method=None):\n self.body = body\n self.action = action\n self.method = method", "metadata": "root.FormNode.__init__", "header": "['class', 'FormNode', '(', 'Node', ')', ':', '___EOS___']", "index": 116 }, { "content": " def render(self, context):\n body = self.body.render(context)\n action = ''\n method = 'post'\n if self.action is not None:\n action = self.action.resolve(context)\n if self.method is not None:\n method = self.method.resolve(context)\n tmpl = django_loader.get_template('_form.html')\n return tmpl.render(DjangoContext({\n 'body': body,\n 'action': action,\n 'method': method\n }))", "metadata": "root.FormNode.render", "header": "['class', 'FormNode', '(', 'Node', ')', ':', '___EOS___']", "index": 121 } ]
[ { "span": "from django.template import loader as django_loader, Context as DjangoContext, \\\n Node, NodeList, Variable, TokenParser", "start_line": 12, "start_column": 0, "end_line": 13, "end_column": 42 }, { "span": "from django.template import Library", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rw", "bench_", "import_", "ROOT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "configure_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DIRS_", "=_", "(_", "join_", "(_", "ROOT_", ",_", "'", "django", "'_", ")_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "LOADER", "S_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "django", ".", "template", ".", "load", "ers", ".", "cache", "d", ".", "Load", "er", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "template", ".", "load", "ers", ".", "filesystem", ".", "Load", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "loader_", "as_", "django", "\\u", "loader_", ",_", "Context_", "as_", "Dj", "ang", "o", "Context_", ",_", "Node_", ",_", "Node", "List_", ",_", "Variable_", ",_", "Token", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "template_", "as_", "django", "\\u", "template", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Library_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "django", " ", "extensi", "ons", ".", " ", " ", "We", " ", "monkey", " ", "patch", " ", "our", " ", "extensi", "ons", " ", "in", " ", "so", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "have", " ", "to", " ", "initialize", " ", "a", " ", "more", " ", "complex", " ", "django", " ", "setup", "._", "\\u\\u\\uNL\\u\\u\\u_", "django", "\\u", "extensions_", "=_", "django", "\\u", "template", "\\u", "module_", "._", "Library_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "django", "\\u", "template", "\\u", "module_", "._", "builtins_", "._", "append_", "(_", "django", "\\u", "extensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rw", "bench_", "import_", "datef", "ormat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "django", "\\u", "extensions_", "._", "filter_", "(_", "datef", "ormat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "more", " ", "django", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "var", "\\u", "or", "\\u", "none_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Variable_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "django", "\\u", "extensions_", "._", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "input", "\\u", "field_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Token", "Parser_", "(_", "token_", "._", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "p_", "._", "value_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "p_", "._", "more_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "append_", "(_", "p_", "._", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Inp", "ut", "Field", "Node_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "django", "\\u", "extensions_", "._", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "text", "area_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Token", "Parser_", "(_", "token_", "._", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "p_", "._", "value_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "p_", "._", "more_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "append_", "(_", "p_", "._", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Text", "area", "Node_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "django", "\\u", "extensions_", "._", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "form_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Token", "Parser_", "(_", "token_", "._", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "p_", "._", "more_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "append_", "(_", "p_", "._", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body_", "=_", "parser_", "._", "parse_", "(_", "(_", "'", "endf", "orm", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "delete", "\\u", "first", "\\u", "token_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Form", "Node_", "(_", "body_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Inp", "ut", "Field", "Node_", "(_", "Node_", ")_", ":_", "\\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_", "Inp", "ut", "Field", "Node_", "(_", "Node_", ")_", ":_", "\\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_", ",_", "name_", ",_", "type_", "=_", "None_", ",_", "value_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "var", "\\u", "or", "\\u", "none_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "type_", "=_", "var", "\\u", "or", "\\u", "none_", "(_", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value_", "=_", "var", "\\u", "or", "\\u", "none_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Inp", "ut", "Field", "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 ", " _", "name_", "=_", "self_", "._", "name_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", "=_", "'", "text", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "type_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type_", "=_", "self_", "._", "type_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "value_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmpl_", "=_", "django", "\\u", "loader_", "._", "get", "\\u", "template_", "(_", "'\\u", "input", "\\u", "field", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tmpl_", "._", "render_", "(_", "Dj", "ang", "o", "Context_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "value_", "\\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_", "Text", "area", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Text", "area", "Node_", "(_", "Node_", ")_", ":_", "\\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_", ",_", "name_", ",_", "rows_", "=_", "None_", ",_", "cols_", "=_", "None_", ",_", "value_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "var", "\\u", "or", "\\u", "none_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rows_", "=_", "var", "\\u", "or", "\\u", "none_", "(_", "rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cols_", "=_", "var", "\\u", "or", "\\u", "none_", "(_", "cols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value_", "=_", "var", "\\u", "or", "\\u", "none_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text", "area", "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 ", " _", "name_", "=_", "self_", "._", "name_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cols_", "=_", "40_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "rows_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "int_", "(_", "self_", "._", "rows_", "._", "resolve_", "(_", "context_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "cols_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cols_", "=_", "int_", "(_", "self_", "._", "cols_", "._", "resolve_", "(_", "context_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "value_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmpl_", "=_", "django", "\\u", "loader_", "._", "get", "\\u", "template_", "(_", "'\\u", "text", "area", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tmpl_", "._", "render_", "(_", "Dj", "ang", "o", "Context_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rows", "'_", ":_", "rows_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cols", "'_", ":_", "cols_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "value_", "\\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_", "Form", "Node_", "(_", "Node_", ")_", ":_", "\\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_", "Form", "Node_", "(_", "Node_", ")_", ":_", "\\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_", ",_", "body_", ",_", "action_", "=_", "None_", ",_", "method_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "body_", "=_", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "action_", "=_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Form", "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 ", " _", "body_", "=_", "self_", "._", "body_", "._", "render_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "'", "post", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "action_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action_", "=_", "self_", "._", "action_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "method_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "=_", "self_", "._", "method_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmpl_", "=_", "django", "\\u", "loader_", "._", "get", "\\u", "template_", "(_", "'\\u", "form", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tmpl_", "._", "render_", "(_", "Dj", "ang", "o", "Context_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "'_", ":_", "action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "method_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused import
scieloorg/scielo-manager/scielomanager/editorialmanager/migrations/0001_initial.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n 'auth.group': {\n 'Meta': {'object_name': 'Group'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n 'auth.permission': {\n 'Meta': {'ordering': \"('content_type__app_label', 'content_type__model', 'codename')\", 'unique_together': \"(('content_type', 'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n 'auth.user': {\n 'Meta': {'object_name': 'User'},\n 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),\n 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Group']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n 'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n 'editorialmanager.editorialboard': {\n 'Meta': {'object_name': 'EditorialBoard'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'issue': ('django.db.models.fields.related.OneToOneField', [], {'to': \"orm['journalmanager.Issue']\", 'unique': 'True'})\n },\n 'editorialmanager.editorialmember': {\n 'Meta': {'ordering': \"('board', 'order', 'pk')\", 'object_name': 'EditorialMember'},\n 'board': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['editorialmanager.EditorialBoard']\"}),\n 'city': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}),\n 'country': ('django_countries.fields.CountryField', [], {'default': \"''\", 'max_length': '2'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),\n 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'institution': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '256'}),\n 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),\n 'link_cv': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),\n 'orcid': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}),\n 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}),\n 'research_id': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}),\n 'role': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['editorialmanager.RoleType']\"}),\n 'state': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'})\n },\n 'editorialmanager.roletype': {\n 'Meta': {'ordering': \"('name',)\", 'object_name': 'RoleType'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '256'})\n },\n 'editorialmanager.roletypetranslation': {\n 'Meta': {'unique_together': \"(('role', 'language'),)\", 'object_name': 'RoleTypeTranslation'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'language': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Language']\"}),\n 'name': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '256'}),\n 'role': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'translations'\", 'to': \"orm['editorialmanager.RoleType']\"})\n },\n 'journalmanager.collection': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Collection'},\n 'acronym': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '16', 'blank': 'True'}),\n 'address': ('django.db.models.fields.TextField', [], {}),\n 'address_complement': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),\n 'address_number': ('django.db.models.fields.CharField', [], {'max_length': '8'}),\n 'city': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),\n 'collection': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': \"'user_collection'\", 'to': \"orm['auth.User']\", 'through': \"orm['journalmanager.UserCollections']\", 'blank': 'True', 'symmetrical': 'False', 'null': 'True'}),\n 'country': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),\n 'fax': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),\n 'name_slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}),\n 'phone': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'state': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),\n 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),\n 'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'})\n },\n 'journalmanager.institution': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Institution'},\n 'acronym': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '16', 'blank': 'True'}),\n 'address': ('django.db.models.fields.TextField', [], {}),\n 'address_complement': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),\n 'address_number': ('django.db.models.fields.CharField', [], {'max_length': '8'}),\n 'cel': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'city': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),\n 'complement': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'country': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),\n 'fax': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_trashed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '256', 'db_index': 'True'}),\n 'phone': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'state': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),\n 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'})\n },\n 'journalmanager.issue': {\n 'Meta': {'ordering': \"('created', 'id')\", 'object_name': 'Issue'},\n 'cover': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'ctrl_vocabulary': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),\n 'editorial_standard': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_marked_up': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_trashed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Journal']\"}),\n 'label': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '64', 'null': 'True', 'blank': 'True'}),\n 'number': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'order': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),\n 'publication_end_month': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'publication_start_month': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'publication_year': ('django.db.models.fields.IntegerField', [], {}),\n 'section': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['journalmanager.Section']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'spe_text': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),\n 'suppl_text': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),\n 'total_documents': ('django.db.models.fields.IntegerField', [], {'default': '0'}),\n 'type': ('django.db.models.fields.CharField', [], {'default': \"'regular'\", 'max_length': '15'}),\n 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'use_license': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.UseLicense']\", 'null': 'True'}),\n 'volume': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'})\n },\n 'journalmanager.journal': {\n 'Meta': {'ordering': \"('title', 'id')\", 'object_name': 'Journal'},\n 'abstract_keyword_languages': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': \"'abstract_keyword_languages'\", 'symmetrical': 'False', 'to': \"orm['journalmanager.Language']\"}),\n 'acronym': ('django.db.models.fields.CharField', [], {'max_length': '16'}),\n 'collections': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['journalmanager.Collection']\", 'through': \"orm['journalmanager.Membership']\", 'symmetrical': 'False'}),\n 'copyrighter': ('django.db.models.fields.CharField', [], {'max_length': '254'}),\n 'cover': ('scielomanager.custom_fields.ContentTypeRestrictedFileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'creator': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'enjoy_creator'\", 'to': \"orm['auth.User']\"}),\n 'ctrl_vocabulary': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'current_ahead_documents': ('django.db.models.fields.IntegerField', [], {'default': '0', 'max_length': '3', 'null': 'True', 'blank': 'True'}),\n 'editor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'editor_journal'\", 'null': 'True', 'to': \"orm['auth.User']\"}),\n 'editor_address': ('django.db.models.fields.CharField', [], {'max_length': '512'}),\n 'editor_address_city': ('django.db.models.fields.CharField', [], {'max_length': '256'}),\n 'editor_address_country': ('scielo_extensions.modelfields.CountryField', [], {'max_length': '2'}),\n 'editor_address_state': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'editor_address_zip': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'editor_email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),\n 'editor_name': ('django.db.models.fields.CharField', [], {'max_length': '512'}),\n 'editor_phone1': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'editor_phone2': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),\n 'editorial_standard': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'eletronic_issn': ('django.db.models.fields.CharField', [], {'max_length': '9', 'db_index': 'True'}),\n 'final_num': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'final_vol': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),\n 'final_year': ('django.db.models.fields.CharField', [], {'max_length': '4', 'null': 'True', 'blank': 'True'}),\n 'frequency': ('django.db.models.fields.CharField', [], {'max_length': '16'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'index_coverage': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'init_num': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),\n 'init_vol': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),\n 'init_year': ('django.db.models.fields.CharField', [], {'max_length': '4'}),\n 'is_indexed_aehci': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_indexed_scie': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_indexed_ssci': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_trashed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'languages': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['journalmanager.Language']\", 'symmetrical': 'False'}),\n 'logo': ('scielomanager.custom_fields.ContentTypeRestrictedFileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'medline_code': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),\n 'medline_title': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}),\n 'national_code': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),\n 'notes': ('django.db.models.fields.TextField', [], {'max_length': '254', 'null': 'True', 'blank': 'True'}),\n 'other_previous_title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n 'previous_ahead_documents': ('django.db.models.fields.IntegerField', [], {'default': '0', 'max_length': '3', 'null': 'True', 'blank': 'True'}),\n 'previous_title': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'prev_title'\", 'null': 'True', 'to': \"orm['journalmanager.Journal']\"}),\n 'print_issn': ('django.db.models.fields.CharField', [], {'max_length': '9', 'db_index': 'True'}),\n 'pub_level': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'publication_city': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'publisher_country': ('scielo_extensions.modelfields.CountryField', [], {'max_length': '2'}),\n 'publisher_name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),\n 'publisher_state': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'scielo_issn': ('django.db.models.fields.CharField', [], {'max_length': '16'}),\n 'secs_code': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),\n 'short_title': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'db_index': 'True'}),\n 'sponsor': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': \"'journal_sponsor'\", 'null': 'True', 'symmetrical': 'False', 'to': \"orm['journalmanager.Sponsor']\"}),\n 'study_areas': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"'journals_migration_tmp'\", 'null': 'True', 'to': \"orm['journalmanager.StudyArea']\"}),\n 'subject_categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"'journals'\", 'null': 'True', 'to': \"orm['journalmanager.SubjectCategory']\"}),\n 'subject_descriptors': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '256', 'db_index': 'True'}),\n 'title_iso': ('django.db.models.fields.CharField', [], {'max_length': '256', 'db_index': 'True'}),\n 'twitter_user': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),\n 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'url_journal': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),\n 'url_online_submission': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),\n 'use_license': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.UseLicense']\"})\n },\n 'journalmanager.language': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Language'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'iso_code': ('django.db.models.fields.CharField', [], {'max_length': '2'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'})\n },\n 'journalmanager.membership': {\n 'Meta': {'unique_together': \"(('journal', 'collection'),)\", 'object_name': 'Membership'},\n 'collection': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Collection']\"}),\n 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Journal']\"}),\n 'reason': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'since': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'status': ('django.db.models.fields.CharField', [], {'default': \"'inprogress'\", 'max_length': '16'})\n },\n 'journalmanager.section': {\n 'Meta': {'ordering': \"('id',)\", 'object_name': 'Section'},\n 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '21', 'blank': 'True'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_trashed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'journal': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Journal']\"}),\n 'legacy_code': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),\n 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})\n },\n 'journalmanager.sponsor': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Sponsor', '_ormbases': ['journalmanager.Institution']},\n 'collections': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['journalmanager.Collection']\", 'symmetrical': 'False'}),\n 'institution_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': \"orm['journalmanager.Institution']\", 'unique': 'True', 'primary_key': 'True'})\n },\n 'journalmanager.studyarea': {\n 'Meta': {'object_name': 'StudyArea'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'study_area': ('django.db.models.fields.CharField', [], {'max_length': '256'})\n },\n 'journalmanager.subjectcategory': {\n 'Meta': {'object_name': 'SubjectCategory'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'term': ('django.db.models.fields.CharField', [], {'max_length': '256', 'db_index': 'True'})\n },\n 'journalmanager.uselicense': {\n 'Meta': {'ordering': \"['license_code']\", 'object_name': 'UseLicense'},\n 'disclaimer': ('django.db.models.fields.TextField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_default': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'license_code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}),\n 'reference_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})\n },\n 'journalmanager.usercollections': {\n 'Meta': {'unique_together': \"(('user', 'collection'),)\", 'object_name': 'UserCollections'},\n 'collection': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['journalmanager.Collection']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_default': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_manager': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\"})\n }\n }\n\n complete_apps = ['editorialmanager']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding model 'EditorialBoard'\n db.create_table('editorialmanager_editorialboard', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('issue', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['journalmanager.Issue'], unique=True)),\n ))\n db.send_create_signal('editorialmanager', ['EditorialBoard'])\n\n # Adding model 'EditorialMember'\n db.create_table('editorialmanager_editorialmember', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('role', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['editorialmanager.RoleType'])),\n ('board', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['editorialmanager.EditorialBoard'])),\n ('first_name', self.gf('django.db.models.fields.CharField')(max_length=256)),\n ('last_name', self.gf('django.db.models.fields.CharField')(max_length=256)),\n ('email', self.gf('django.db.models.fields.EmailField')(max_length=75, null=True, blank=True)),\n ('institution', self.gf('django.db.models.fields.CharField')(default='', max_length=256)),\n ('link_cv', self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True)),\n ('city', self.gf('django.db.models.fields.CharField')(max_length=256, null=True, blank=True)),\n ('state', self.gf('django.db.models.fields.CharField')(max_length=256, null=True, blank=True)),\n ('country', self.gf('django_countries.fields.CountryField')(default='', max_length=2)),\n ('research_id', self.gf('django.db.models.fields.CharField')(max_length=256, null=True, blank=True)),\n ('orcid', self.gf('django.db.models.fields.CharField')(max_length=256, null=True, blank=True)),\n ('order', self.gf('django.db.models.fields.IntegerField')(default=1)),\n ))\n db.send_create_signal('editorialmanager', ['EditorialMember'])\n\n # Adding model 'RoleType'\n db.create_table('editorialmanager_roletype', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=256)),\n ))\n db.send_create_signal('editorialmanager', ['RoleType'])\n\n # Adding model 'RoleTypeTranslation'\n db.create_table('editorialmanager_roletypetranslation', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('role', self.gf('django.db.models.fields.related.ForeignKey')(related_name='translations', to=orm['editorialmanager.RoleType'])),\n ('name', self.gf('django.db.models.fields.CharField')(default='', max_length=256)),\n ('language', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['journalmanager.Language'])),\n ))\n db.send_create_signal('editorialmanager', ['RoleTypeTranslation'])\n\n # Adding unique constraint on 'RoleTypeTranslation', fields ['role', 'language']\n db.create_unique('editorialmanager_roletypetranslation', ['role_id', 'language_id'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Removing unique constraint on 'RoleTypeTranslation', fields ['role', 'language']\n db.delete_unique('editorialmanager_roletypetranslation', ['role_id', 'language_id'])\n\n # Deleting model 'EditorialBoard'\n db.delete_table('editorialmanager_editorialboard')\n\n # Deleting model 'EditorialMember'\n db.delete_table('editorialmanager_editorialmember')\n\n # Deleting model 'RoleType'\n db.delete_table('editorialmanager_roletype')\n\n # Deleting model 'RoleTypeTranslation'\n db.delete_table('editorialmanager_roletypetranslation')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 56 } ]
[ { "span": "from south.utils import datetime_utils as datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 50 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "south_", "._", "utils_", "import_", "datetime", "\\u", "utils_", "as_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "80", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "content", "\\u", "type", "',", " ", "'", "code", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Permi", "ssion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "user", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Group", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "super", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "login", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "ial", "manage", "r", ".", "editor", "ial", "board", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Edit", "oria", "l", "Boa", "rd", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "issue", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Issue", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "ial", "manage", "r", ".", "editor", "ial", "member", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "board", "',", " ", "'", "order", "',", " ", "'", "pk", "')\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Edit", "oria", "l", "Mem", "ber", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "board", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "editor", "ial", "manage", "r", ".", "Edit", "oria", "l", "Boa", "rd", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "countr", "y", "'_", ":_", "(_", "'", "django", "\\u", "countr", "ies", ".", "fields", ".", "Count", "ry", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "institution", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "\\u", "cv", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "orcid", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "research", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "role", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "editor", "ial", "manage", "r", ".", "Ro", "le", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "ial", "manage", "r", ".", "role", "type", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Ro", "le", "Type", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "ial", "manage", "r", ".", "role", "type", "translatio", "n", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "role", "',", " ", "'", "language", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Ro", "le", "Type", "Translat", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Lang", "ua", "ge", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "role", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "translatio", "ns", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "editor", "ial", "manage", "r", ".", "Ro", "le", "Type", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "collection", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Collecti", "on", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "acronym", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "complement", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "8", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "user", "\\u", "collection", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", ",_", "'", "through", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "User", "Collections", "']\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "countr", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fax", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "logo", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "files", ".", "Image", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "\\u", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phone", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zip", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "institution", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Institut", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "acronym", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "complement", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "8", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cel", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "complement", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "countr", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fax", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "trash", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phone", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zip", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "issue", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "created", "',", " ", "'", "id", "')\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Issue", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cover", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "files", ".", "Image", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ctrl", "\\u", "vocab", "ular", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "ial", "\\u", "standard", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "marked", "\\u", "up", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "trash", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publicat", "ion", "\\u", "end", "\\u", "month", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publicat", "ion", "\\u", "start", "\\u", "month", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publicat", "ion", "\\u", "year", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "section", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Sect", "ion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "spe", "\\u", "text", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "15", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "suppl", "\\u", "text", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "15", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "total", "\\u", "document", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "regular", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "15", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "use", "\\u", "license", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Us", "e", "License", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "journal", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "title", "',", " ", "'", "id", "')\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Journ", "al", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "abstract", "\\u", "keyw", "ord", "\\u", "language", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "abstract", "\\u", "keyw", "ord", "\\u", "language", "s", "'\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Lang", "ua", "ge", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "acronym", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Collecti", "on", "']\"_", ",_", "'", "through", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Membership", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "copyr", "ight", "er", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cover", "'_", ":_", "(_", "'", "scie", "lom", "anager", ".", "custom", "\\u", "fields", ".", "Conten", "t", "Type", "Restrict", "ed", "File", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creat", "or", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "enj", "oy", "\\u", "creat", "or", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ctrl", "\\u", "vocab", "ular", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "\\u", "ahe", "ad", "\\u", "document", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "3", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "editor", "\\u", "journal", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "address", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "512", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "address", "\\u", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "address", "\\u", "countr", "y", "'_", ":_", "(_", "'", "scie", "lo", "\\u", "extensi", "ons", ".", "modelf", "ields", ".", "Count", "ry", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "address", "\\u", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "address", "\\u", "zip", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "512", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "phone", "1", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "\\u", "phone", "2", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "editor", "ial", "\\u", "standard", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ele", "tron", "ic", "\\u", "issn", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "9", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "final", "\\u", "num", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "final", "\\u", "vol", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "final", "\\u", "year", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "4", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "freque", "nc", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "index", "\\u", "covera", "ge", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "init", "\\u", "num", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "init", "\\u", "vol", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "init", "\\u", "year", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "4", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "indexe", "d\\u", "ae", "hc", "i", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "indexe", "d\\u", "scie", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "indexe", "d\\u", "ssc", "i", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "trash", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Lang", "ua", "ge", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "logo", "'_", ":_", "(_", "'", "scie", "lom", "anager", ".", "custom", "\\u", "fields", ".", "Conten", "t", "Type", "Restrict", "ed", "File", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "med", "line", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "med", "line", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "national", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "note", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "other", "\\u", "previ", "ous", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "previ", "ous", "\\u", "ahe", "ad", "\\u", "document", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "3", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "previ", "ous", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "prev", "\\u", "title", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "print", "\\u", "issn", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "9", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pub", "\\u", "level", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publicat", "ion", "\\u", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sher", "\\u", "countr", "y", "'_", ":_", "(_", "'", "scie", "lo", "\\u", "extensi", "ons", ".", "modelf", "ields", ".", "Count", "ry", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sher", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sher", "\\u", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "scie", "lo", "\\u", "issn", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "secs", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "short", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sponsor", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "journal", "\\u", "sponsor", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Spo", "nsor", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stud", "y", "\\u", "area", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "journal", "s", "\\u", "migrati", "on", "\\u", "tmp", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Stud", "y", "Area", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "\\u", "categor", "ies", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "journal", "s", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Sub", "ject", "Cate", "gory", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "\\u", "descrip", "tors", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1024", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "\\u", "iso", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "twit", "ter", "\\u", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "onli", "ne", "\\u", "subm", "ission", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "use", "\\u", "license", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Us", "e", "License", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "language", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Lang", "ua", "ge", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "iso", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "member", "ship", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "journal", "',", " ", "'", "collection", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Membership", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Collecti", "on", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "by", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sinc", "e", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "inpr", "ogr", "ess", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "section", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "id", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Sect", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "21", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "trash", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Journ", "al", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lega", "cy", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "16", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "sponsor", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Spo", "nsor", "'_", ",_", "'\\u", "ormbase", "s", "'_", ":_", "[_", "'", "journal", "manage", "r", ".", "Institut", "ion", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Collecti", "on", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "institution", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Institut", "ion", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "stud", "yar", "ea", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Stud", "y", "Area", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stud", "y", "\\u", "area", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "subject", "category", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Sub", "ject", "Cate", "gory", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "term", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "usel", "ice", "nse", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "license", "\\u", "code", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Us", "e", "License", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "discl", "aime", "r", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "512", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "default", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "license", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "\\u", "url", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "journal", "manage", "r", ".", "userco", "lle", "ctions", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "user", "',", " ", "'", "collection", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "User", "Collections", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "journal", "manage", "r", ".", "Collecti", "on", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "default", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "manage", "r", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "editor", "ial", "manage", "r", "'_", "]_", "[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_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Edit", "oria", "l", "Boa", "rd", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "'", "editor", "ial", "manage", "r", "\\u", "editor", "ial", "board", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "issue", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "journal", "manage", "r", ".", "Issue", "'_", "]_", ",_", "unique_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "editor", "ial", "manage", "r", "'_", ",_", "[_", "'", "Edit", "oria", "l", "Boa", "rd", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Edit", "oria", "l", "Mem", "ber", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "editor", "ial", "manage", "r", "\\u", "editor", "ial", "member", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "role", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "editor", "ial", "manage", "r", ".", "Ro", "le", "Type", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "board", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "editor", "ial", "manage", "r", ".", "Edit", "oria", "l", "Boa", "rd", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "first", "\\u", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "256_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "last", "\\u", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "256_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "email", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "75_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "institution", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "''_", ",_", "max", "\\u", "length_", "=_", "256_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "link", "\\u", "cv", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "200_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "city", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "256_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "state", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "256_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "countr", "y", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", "\\u", "countr", "ies", ".", "fields", ".", "Count", "ry", "Field", "'_", ")_", "(_", "default_", "=_", "''_", ",_", "max", "\\u", "length_", "=_", "2_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "research", "\\u", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "256_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orcid", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "256_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "order", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ")_", "(_", "default_", "=_", "1_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "editor", "ial", "manage", "r", "'_", ",_", "[_", "'", "Edit", "oria", "l", "Mem", "ber", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Ro", "le", "Type", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "editor", "ial", "manage", "r", "\\u", "role", "type", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "unique_", "=_", "True_", ",_", "max", "\\u", "length_", "=_", "256_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "editor", "ial", "manage", "r", "'_", ",_", "[_", "'", "Ro", "le", "Type", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Ro", "le", "Type", "Translat", "ion", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "editor", "ial", "manage", "r", "\\u", "role", "type", "translatio", "n", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "role", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "relate", "d\\u", "name_", "=_", "'", "translatio", "ns", "'_", ",_", "to_", "=_", "orm_", "[_", "'", "editor", "ial", "manage", "r", ".", "Ro", "le", "Type", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "''_", ",_", "max", "\\u", "length_", "=_", "256_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "language", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "journal", "manage", "r", ".", "Lang", "ua", "ge", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "editor", "ial", "manage", "r", "'_", ",_", "[_", "'", "Ro", "le", "Type", "Translat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "unique", " ", "constraint", " ", "on", " ", "'", "Ro", "le", "Type", "Translat", "ion", "',", " ", "fields", " ", "['", "role", "',", " ", "'", "language", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "unique_", "(_", "'", "editor", "ial", "manage", "r", "\\u", "role", "type", "translatio", "n", "'_", ",_", "[_", "'", "role", "\\u", "id", "'_", ",_", "'", "language", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "unique", " ", "constraint", " ", "on", " ", "'", "Ro", "le", "Type", "Translat", "ion", "',", " ", "fields", " ", "['", "role", "',", " ", "'", "language", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "unique_", "(_", "'", "editor", "ial", "manage", "r", "\\u", "role", "type", "translatio", "n", "'_", ",_", "[_", "'", "role", "\\u", "id", "'_", ",_", "'", "language", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Edit", "oria", "l", "Boa", "rd", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "editor", "ial", "manage", "r", "\\u", "editor", "ial", "board", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Edit", "oria", "l", "Mem", "ber", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "editor", "ial", "manage", "r", "\\u", "editor", "ial", "member", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Ro", "le", "Type", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "editor", "ial", "manage", "r", "\\u", "role", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Ro", "le", "Type", "Translat", "ion", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "editor", "ial", "manage", "r", "\\u", "role", "type", "translatio", "n", "'_", ")_", "\\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 ]
Imprecise assert
openstack/fuel-web/nailgun/nailgun/test/integration/test_orchestrator_serializer_70.py
[ { "content": " def test_network_scheme_custom_networks(self):\n cluster = self.env.create(\n cluster_kwargs={\n 'release_id': self.env.releases[0].id,\n 'mode': consts.CLUSTER_MODES.ha_compact,\n 'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron,\n 'net_segment_type': self.segmentation_type})\n self.cluster_db = objects.Cluster.get_by_uid(cluster['id'])\n self.env._create_network_group(cluster=self.cluster_db,\n name=self.custom_network['name'],\n cidr=self.custom_network['cidr'],\n vlan_start=self.custom_network[\n 'vlan_start'\n ])\n self.env.create_plugin(\n cluster=self.cluster_db,\n network_roles_metadata=self.plugin_network_roles,\n package_version='3.0.0')\n\n self.env.create_node(\n api=True,\n cluster_id=cluster['id'],\n pending_roles=['controller'],\n pending_addition=True)\n objects.Cluster.prepare_for_deployment(self.cluster_db)\n serializer = self.create_serializer(self.cluster_db)\n serialized_for_astute = serializer.serialize(\n self.cluster_db, self.cluster_db.nodes\n )\n for node in serialized_for_astute:\n vips = node['network_metadata']['vips']\n roles = node['network_scheme']['roles']\n transformations = node['network_scheme']['transformations']\n node_network_roles = (node['network_metadata']['nodes']\n ['node-' + node['uid']]['network_roles'])\n custom_ip = node_network_roles.get(self.custom_network['role'],\n '0.0.0.0')\n custom_brs = filter(lambda t: t.get('name') ==\n self.custom_network['bridge'],\n transformations)\n custom_ports = filter(lambda t: t.get('name') ==\n (\"eth0.%s\" %\n self.custom_network['vlan_start']),\n transformations)\n self.assertEqual(roles.get(self.custom_network['role']),\n self.custom_network['bridge'])\n self.assertEqual(vips.get(self.custom_network['name'],\n {}).get('network_role'),\n self.custom_network['role'])\n self.assertTrue(netaddr.IPAddress(custom_ip) in\n netaddr.IPNetwork(self.custom_network['cidr']))\n self.assertEqual(len(custom_brs), 1)\n self.assertEqual(len(custom_ports), 1)\n self.assertEqual(custom_ports[0]['bridge'],\n self.custom_network['bridge'])", "metadata": "root.TestDeploymentAttributesSerialization70.test_network_scheme_custom_networks", "header": "['class', 'TestDeploymentAttributesSerialization70', '(', '___NL___', 'BaseTestDeploymentAttributesSerialization70', '___NL___', ')', ':', '___EOS___']", "index": 373 }, { "content": " def test_gateway_not_set_for_none_ip(self):\n attrs = copy.deepcopy(self.cluster.attributes.editable)\n attrs['neutron_advanced_configuration']['neutron_dvr']['value'] = True\n resp = self.app.patch(\n reverse(\n 'ClusterAttributesHandler',\n kwargs={'cluster_id': self.cluster.id}),\n params=jsonutils.dumps({'editable': attrs}),\n headers=self.default_headers\n )\n self.assertEqual(200, resp.status_code)\n self.assertTrue(objects.Cluster.neutron_dvr_enabled(self.cluster))\n\n objects.Cluster.set_network_template(self.cluster, None)\n\n computes = filter(lambda n: 'compute' in n.roles, self.cluster.nodes)\n self.assertTrue(len(computes) > 0)\n compute = computes[0]\n\n serializer = get_serializer_for_cluster(self.cluster)\n net_serializer = serializer.get_net_provider_serializer(self.cluster)\n self.assertIs(net_serializer, self.general_serializer)\n\n nm = objects.Cluster.get_network_manager(self.cluster)\n networks = nm.get_node_networks(compute)\n\n self.assertFalse(objects.Node.should_have_public_with_ip(compute))\n network_scheme = net_serializer.generate_network_scheme(\n compute, networks)\n self.assertNotIn('gateway', network_scheme['endpoints']['br-ex'])\n self.assertEqual('none', network_scheme['endpoints']['br-ex']['IP'])", "metadata": "root.TestNetworkTemplateSerializer70.test_gateway_not_set_for_none_ip", "header": "['class', 'TestNetworkTemplateSerializer70', '(', 'BaseDeploymentSerializer', ',', '___NL___', 'PrepareDataMixin', ')', ':', '___EOS___']", "index": 1311 }, { "content": " def test_public_iface_added_to_br_ex_in_dvr(self):\n attrs = copy.deepcopy(self.cluster.attributes.editable)\n attrs['neutron_advanced_configuration']['neutron_dvr']['value'] = True\n resp = self.app.patch(\n reverse(\n 'ClusterAttributesHandler',\n kwargs={'cluster_id': self.cluster.id}),\n params=jsonutils.dumps({'editable': attrs}),\n headers=self.default_headers\n )\n self.assertEqual(200, resp.status_code)\n self.assertTrue(objects.Cluster.neutron_dvr_enabled(self.cluster))\n\n objects.Cluster.set_network_template(self.cluster, None)\n\n computes = filter(lambda n: 'compute' in n.roles, self.cluster.nodes)\n self.assertTrue(len(computes) > 0)\n compute = computes[0]\n\n serializer = get_serializer_for_cluster(self.cluster)\n net_serializer = serializer.get_net_provider_serializer(self.cluster)\n self.assertIs(net_serializer, self.general_serializer)\n\n nm = objects.Cluster.get_network_manager(self.cluster)\n networks = nm.get_node_networks(compute)\n public_net = next((net for net in networks if net['name'] == 'public'),\n None)\n self.assertIsNotNone(public_net)\n\n self.assertFalse(objects.Node.should_have_public_with_ip(compute))\n network_scheme = net_serializer.generate_network_scheme(\n compute, networks)\n expected = {'action': 'add-port',\n 'bridge': 'br-ex',\n 'name': public_net['dev']}\n self.assertIn(expected, network_scheme['transformations'])", "metadata": "root.TestNetworkTemplateSerializer70.test_public_iface_added_to_br_ex_in_dvr", "header": "['class', 'TestNetworkTemplateSerializer70', '(', 'BaseDeploymentSerializer', ',', '___NL___', 'PrepareDataMixin', ')', ':', '___EOS___']", "index": 1343 } ]
[ { "span": "self.assertTrue(netaddr.IPAddress(custom_ip) in\n netaddr.IPNetwork(self.custom_network['cidr']))", "start_line": 422, "start_column": 12, "end_line": 423, "end_column": 75 }, { "span": "self.assertTrue(len(computes) > 0)", "start_line": 1327, "start_column": 8, "end_line": 1327, "end_column": 42 }, { "span": "self.assertTrue(len(computes) > 0)", "start_line": 1359, "start_column": 8, "end_line": 1359, "end_column": 42 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Deployment", "Attribute", "s", "Serializa", "tion", "70_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Base", "Test", "Deployment", "Attribute", "s", "Serializa", "tion", "70_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "network", "\\u", "sche", "me", "\\u", "custom", "\\u", "networks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster_", "=_", "self_", "._", "env_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "release", "\\u", "id", "'_", ":_", "self_", "._", "env_", "._", "releases_", "[_", "0_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mode", "'_", ":_", "consts_", "._", "CLUSTER", "\\u", "MODES_", "._", "ha", "\\u", "compact_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "net", "\\u", "provide", "r", "'_", ":_", "consts_", "._", "CLUSTER", "\\u", "NET", "\\u", "PROVIDERS_", "._", "neutron_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "net", "\\u", "segment", "\\u", "type", "'_", ":_", "self_", "._", "segmentation", "\\u", "type_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cluster", "\\u", "db_", "=_", "objects_", "._", "Cluster_", "._", "get", "\\u", "by", "\\u", "uid_", "(_", "cluster_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "env_", "._", "\\u", "create", "\\u", "network", "\\u", "group_", "(_", "cluster_", "=_", "self_", "._", "cluster", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cidr_", "=_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "cid", "r", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vlan", "\\u", "start_", "=_", "self_", "._", "custom", "\\u", "network_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vlan", "\\u", "start", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "env_", "._", "create", "\\u", "plugin_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cluster_", "=_", "self_", "._", "cluster", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "role", "s", "\\u", "metadata_", "=_", "self_", "._", "plugin", "\\u", "network", "\\u", "roles_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package", "\\u", "version_", "=_", "'", "3.0", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "env_", "._", "create", "\\u", "node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "api_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "id_", "=_", "cluster_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pend", "ing", "\\u", "roles_", "=_", "[_", "'", "controlle", "r", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pend", "ing", "\\u", "addition", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "Cluster_", "._", "prepar", "e\\u", "for", "\\u", "deployment_", "(_", "self_", "._", "cluster", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serializer_", "=_", "self_", "._", "create", "\\u", "serializer_", "(_", "self_", "._", "cluster", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serialize", "d\\u", "for", "\\u", "ast", "ute", "_", "=_", "serializer_", "._", "serialize_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cluster", "\\u", "db_", ",_", "self_", "._", "cluster", "\\u", "db_", "._", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "serialize", "d\\u", "for", "\\u", "ast", "ute", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vip", "s_", "=_", "node_", "[_", "'", "network", "\\u", "metadata", "'_", "]_", "[_", "'", "vip", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roles_", "=_", "node_", "[_", "'", "network", "\\u", "sche", "me", "'_", "]_", "[_", "'", "role", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transformations_", "=_", "node_", "[_", "'", "network", "\\u", "sche", "me", "'_", "]_", "[_", "'", "transformation", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "network", "\\u", "roles_", "=_", "(_", "node_", "[_", "'", "network", "\\u", "metadata", "'_", "]_", "[_", "'", "nodes", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "node", "-'_", "+_", "node_", "[_", "'", "uid", "'_", "]_", "]_", "[_", "'", "network", "\\u", "role", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "ip_", "=_", "node", "\\u", "network", "\\u", "roles_", "._", "get_", "(_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "role", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "0.", "0.", "0.", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "br", "s_", "=_", "filter_", "(_", "lambda_", "t_", ":_", "t_", "._", "get_", "(_", "'", "name", "'_", ")_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "bridge", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transformations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "ports_", "=_", "filter_", "(_", "lambda_", "t_", ":_", "t_", "._", "get_", "(_", "'", "name", "'_", ")_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "eth", "0.", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "vlan", "\\u", "start", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transformations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "roles_", "._", "get_", "(_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "role", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "bridge", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "vip", "s_", "._", "get_", "(_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "}_", ")_", "._", "get_", "(_", "'", "network", "\\u", "role", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "role", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "netaddr_", "._", "IPA", "ddress", "_", "(_", "custom", "\\u", "ip_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "netaddr_", "._", "IP", "Network_", "(_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "cid", "r", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "custom", "\\u", "br", "s_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "custom", "\\u", "ports_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "custom", "\\u", "ports_", "[_", "0_", "]_", "[_", "'", "bridge", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "custom", "\\u", "network_", "[_", "'", "bridge", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Network", "Templa", "te", "Seriali", "zer", "70_", "(_", "Base", "Deployment", "Serializer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Prepare", "Data", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "gateway", "\\u", "not", "\\u", "set\\u", "for", "\\u", "none", "\\u", "ip_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "cluster_", "._", "attributes_", "._", "editable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "[_", "'", "neut", "ron", "\\u", "advanced", "\\u", "configura", "tion", "'_", "]_", "[_", "'", "neut", "ron", "\\u", "dvr", "'_", "]_", "[_", "'", "value", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "app_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cluster", "Attribute", "s", "Handle", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "cluster", "\\u", "id", "'_", ":_", "self_", "._", "cluster_", "._", "id_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "jsonutils_", "._", "dumps_", "(_", "{_", "'", "edita", "ble", "'_", ":_", "attrs_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "self_", "._", "default", "\\u", "headers_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "resp_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "objects_", "._", "Cluster_", "._", "neut", "ron", "\\u", "dvr", "\\u", "enabled_", "(_", "self_", "._", "cluster_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "objects_", "._", "Cluster_", "._", "set\\u", "network", "\\u", "template_", "(_", "self_", "._", "cluster_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "compute", "s_", "=_", "filter_", "(_", "lambda_", "n_", ":_", "'", "compute", "'_", "in_", "n_", "._", "roles_", ",_", "self_", "._", "cluster_", "._", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "compute", "s_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "compute", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "serializer_", "=_", "get", "\\u", "serialize", "r", "\\u", "for", "\\u", "cluster_", "(_", "self_", "._", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net", "\\u", "serializer_", "=_", "serializer_", "._", "get", "\\u", "net", "\\u", "provide", "r", "\\u", "serializer_", "(_", "self_", "._", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "net", "\\u", "serializer_", ",_", "self_", "._", "genera", "l\\u", "serializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nm_", "=_", "objects_", "._", "Cluster_", "._", "get", "\\u", "network", "\\u", "manager_", "(_", "self_", "._", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "nm_", "._", "get", "\\u", "node", "\\u", "networks_", "(_", "compute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "objects_", "._", "Node_", "._", "shou", "ld", "\\u", "have", "\\u", "public", "\\u", "with", "\\u", "ip_", "(_", "compute_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "scheme_", "=_", "net", "\\u", "serializer_", "._", "generat", "e\\u", "network", "\\u", "scheme_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", ",_", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "'", "gateway", "'_", ",_", "network", "\\u", "scheme_", "[_", "'", "endpoint", "s", "'_", "]_", "[_", "'", "br", "-", "ex", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "none", "'_", ",_", "network", "\\u", "scheme_", "[_", "'", "endpoint", "s", "'_", "]_", "[_", "'", "br", "-", "ex", "'_", "]_", "[_", "'", "IP", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Network", "Templa", "te", "Seriali", "zer", "70_", "(_", "Base", "Deployment", "Serializer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Prepare", "Data", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "public", "\\u", "ifa", "ce", "\\u", "adde", "d\\u", "to", "\\u", "br", "\\u", "ex", "\\u", "in", "\\u", "dvr", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "cluster_", "._", "attributes_", "._", "editable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "[_", "'", "neut", "ron", "\\u", "advanced", "\\u", "configura", "tion", "'_", "]_", "[_", "'", "neut", "ron", "\\u", "dvr", "'_", "]_", "[_", "'", "value", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "app_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cluster", "Attribute", "s", "Handle", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "cluster", "\\u", "id", "'_", ":_", "self_", "._", "cluster_", "._", "id_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "jsonutils_", "._", "dumps_", "(_", "{_", "'", "edita", "ble", "'_", ":_", "attrs_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "self_", "._", "default", "\\u", "headers_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "resp_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "objects_", "._", "Cluster_", "._", "neut", "ron", "\\u", "dvr", "\\u", "enabled_", "(_", "self_", "._", "cluster_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "objects_", "._", "Cluster_", "._", "set\\u", "network", "\\u", "template_", "(_", "self_", "._", "cluster_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "compute", "s_", "=_", "filter_", "(_", "lambda_", "n_", ":_", "'", "compute", "'_", "in_", "n_", "._", "roles_", ",_", "self_", "._", "cluster_", "._", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "compute", "s_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "compute", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "serializer_", "=_", "get", "\\u", "serialize", "r", "\\u", "for", "\\u", "cluster_", "(_", "self_", "._", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net", "\\u", "serializer_", "=_", "serializer_", "._", "get", "\\u", "net", "\\u", "provide", "r", "\\u", "serializer_", "(_", "self_", "._", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "net", "\\u", "serializer_", ",_", "self_", "._", "genera", "l\\u", "serializer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nm_", "=_", "objects_", "._", "Cluster_", "._", "get", "\\u", "network", "\\u", "manager_", "(_", "self_", "._", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "nm_", "._", "get", "\\u", "node", "\\u", "networks_", "(_", "compute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "public", "\\u", "net_", "=_", "next_", "(_", "(_", "net_", "for_", "net_", "in_", "networks_", "if_", "net_", "[_", "'", "name", "'_", "]_", "==_", "'", "public", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "public", "\\u", "net_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "objects_", "._", "Node_", "._", "shou", "ld", "\\u", "have", "\\u", "public", "\\u", "with", "\\u", "ip_", "(_", "compute_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "scheme_", "=_", "net", "\\u", "serializer_", "._", "generat", "e\\u", "network", "\\u", "scheme_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "compute_", ",_", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "'", "action", "'_", ":_", "'", "add", "-", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bridge", "'_", ":_", "'", "br", "-", "ex", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "public", "\\u", "net_", "[_", "'", "dev", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "expected_", ",_", "network", "\\u", "scheme_", "[_", "'", "transformation", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
AppScale/appscale/AppTaskQueue/tq_config.py
[ { "content": "\"\"\" \n AppScale TaskQueue configuration class. It deals with the configuration\n file given with an application 'queue.yaml' or 'queue.xml'.\n When a previous version was deployed, the older configuration from the database\n\"\"\"\n\nimport json\nimport logging\nimport os\nimport re\nimport sys \nimport urllib2\n\nimport xml.etree.ElementTree as et\n\nsys.path.append(os.path.join(os.path.dirname(__file__), \"../AppServer\"))\nfrom google.appengine.api import queueinfo\nfrom google.appengine.api import datastore\nfrom google.appengine.api import datastore_types\n\nsys.path.append(os.path.join(os.path.dirname(__file__), \"../lib\"))\nimport appscale_info\nimport file_io\nimport xmltodict\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TaskQueueConfig():\n \"\"\" Contains configuration of the TaskQueue system. \"\"\"\n\n # The kind name for storing Queue info.\n QUEUE_KIND = \"__queue__\"\n\n # Enum code for broker to use.\n RABBITMQ = 0\n \n # Max concurrency per worker.\n CELERY_CONCURRENCY = 10\n\n # The default YAML used if a queue.yaml or queue.xml is not supplied.\n DEFAULT_QUEUE_YAML = \\\n\"\"\"\nqueue:\n- name: default\n rate: 5/s\n\"\"\"\n \n # The default rate for a queue if not specified in the queue.yaml. \n # In Google App Engine it is unlimited so we use a high rate here.\n DEFAULT_RATE = \"10000/s\"\n \n # The application id used for storing queue info.\n APPSCALE_QUEUES = \"__appscale_queues__\"\n\n # The property index for which we store the queue info.\n QUEUE_INFO = \"queueinfo\"\n\n # The property index for which we store app name.\n APP_NAME = \"appname\"\n\n # Queue info location codes.\n QUEUE_INFO_DB = 0\n QUEUE_INFO_FILE = 1 \n\n # Location of all celery configuration files.\n CELERY_CONFIG_DIR = '/etc/appscale/celery/configuration/'\n\n # Location of all celery workers scripts.\n CELERY_WORKER_DIR = '/etc/appscale/celery/workers/'\n\n # Location where celery workers back up state to.\n CELERY_STATE_DIR = '/opt/appscale/celery/'\n\n # Directory with the task templates.\n TEMPLATE_DIR = os.path.dirname(os.path.realpath(__file__)) + \"/templates/\"\n\n\n # The location of a header of a queue worker script.\n HEADER_LOC = TEMPLATE_DIR + 'header.py'\n \n # The location of the task template code.\n TASK_LOC = TEMPLATE_DIR + 'task.py'\n\n MAX_QUEUE_NAME_LENGTH = 100\n\n QUEUE_NAME_PATTERN = r'^[a-zA-Z0-9_]{1,%s}$' % MAX_QUEUE_NAME_LENGTH\n\n QUEUE_NAME_RE = re.compile(QUEUE_NAME_PATTERN)\n\n # XML configs use \"-\" while yaml uses \"_\". These are the tags which \n # need to be converted to match the yaml tags.\n YAML_TO_XML_TAGS_TO_CONVERT = ['bucket-size', 'max-concurrent-request', \n 'retry-parameters', 'task-age-limit', \n 'total-storage-limit', 'user-email',\n 'write-email', 'min-backoff-seconds',\n 'max-backoff-seconds', 'max-doublings',\n 'task-retry-limit', 'max-concurrent-requests']\n\n # Tags from queue.xml that are ignored.\n TAGS_TO_IGNORE = ['#text']\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.TaskQueueConfig", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def __init__(self, broker, app_id):\n \"\"\" Configuration constructor. \n\n Args:\n broker: The broker to use.\n app_id: Application id.\n \"\"\"\n file_io.set_logging_format()\n self._broker = broker\n self._broker_location = self.__broker_location(broker)\n self._app_id = app_id\n self._queue_info_db = None\n self._queue_info_file = None\n file_io.mkdir(self.CELERY_CONFIG_DIR)\n file_io.mkdir(self.CELERY_WORKER_DIR)", "metadata": "root.TaskQueueConfig.__init__", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 99 }, { "content": " def get_queue_file_location(self, app_id):\n \"\"\" Gets the location of the queue.yaml or queue.xml file\n of a given application.\n Args:\n app_id: The application ID.\n Returns:\n The location of the queue.yaml or queue.xml file, and \n an empty string if it could not be found.\n \"\"\"\n queue_yaml = appscale_info.get_app_path(app_id) + 'queue.yaml'\n queue_xml = appscale_info.get_app_path(app_id) + '/war/WEB-INF/queue.xml'\n if file_io.exists(queue_yaml):\n return queue_yaml\n elif file_io.exists(queue_xml):\n return queue_xml\n else:\n return \"\"", "metadata": "root.TaskQueueConfig.get_queue_file_location", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 115 }, { "content": " def load_queues_from_file(self, app_id):\n \"\"\" Parses the queue.yaml or queue.xml file of an application\n and loads it into the class.\n \n Args:\n app_id: The application ID.\n Returns:\n A dictionary of the queue settings.\n Raises:\n ValueError: If queue_file is unable to get loaded.\n \"\"\"\n queue_file = self.get_queue_file_location(app_id)\n info = \"\"\n using_default = False\n try:\n info = file_io.read(queue_file)\n logging.info(\"Found queue file for app {0}\".format(app_id))\n except IOError:\n logging.info(\"No queue file found for app {0}, using default queue\" \\\n .format(app_id))\n info = self.DEFAULT_QUEUE_YAML\n using_default = True\n queue_info = \"\"\n\n #TODO handle bad xml/yaml files.\n if queue_file.endswith('yaml') or using_default:\n queue_info = queueinfo.LoadSingleQueue(info).ToDict()\n elif queue_file.endswith('xml'):\n queue_info = self.parse_queue_xml(info)\n else:\n raise ValueError(\"Unable to load queue information with %s\" % queue_file)\n\n if not queue_info:\n raise ValueError(\"Queue information with %s not set\" % queue_file)\n\n # We add in the default queue if its not already in there.\n has_default = False\n if 'queue' not in queue_info or len(queue_info['queue']) == 0:\n queue_info = {'queue' : [{'rate':'5/s', 'name': 'default'}]}\n\n for queue in queue_info['queue']:\n if queue['name'] == 'default':\n has_default = True\n if not has_default:\n queue_info['queue'].append({'rate':'5/s', 'name': 'default'})\n\n self._queue_info_file = queue_info\n logging.info(\"AppID {0} -- Loaded queue {1}\".format(app_id, queue_info))\n return queue_info ", "metadata": "root.TaskQueueConfig.load_queues_from_file", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 133 }, { "content": " def parse_queue_xml(self, xml_string):\n \"\"\" Turns an xml string into a dictionary tree using the \n same format at the yaml conversion.\n\n Args:\n xml: A string contents in XML format.\n Returns:\n A dictionary tree of the xml.\n \"\"\"\n xml_dict = xmltodict.parse(xml_string)\n # Now we convert it to look the same as the yaml dictionary\n converted = {'queue':[]}\n if isinstance(xml_dict['queue-entries']['queue'], list):\n all_queues = xml_dict['queue-entries']['queue']\n else:\n all_queues = [xml_dict['queue-entries']['queue']]\n\n for queue in all_queues:\n single_queue = {}\n for tag, value in queue.iteritems():\n if tag in self.YAML_TO_XML_TAGS_TO_CONVERT:\n tag = tag.replace('-','_')\n if tag == \"retry_parameters\":\n retry_dict = {}\n for retry_tag in queue['retry-parameters']:\n value = queue['retry-parameters'][retry_tag]\n if retry_tag in self.YAML_TO_XML_TAGS_TO_CONVERT:\n retry_tag = retry_tag.replace('-','_')\n if retry_tag not in self.TAGS_TO_IGNORE:\n retry_dict[str(retry_tag)] = str(value).strip('\\n ')\n single_queue['retry_parameters'] = retry_dict\n elif tag not in self.TAGS_TO_IGNORE:\n single_queue[str(tag)] = str(value).strip('\\n ')\n\n converted['queue'].append(single_queue)\n\n logging.debug(\"XML queue info is {0}\".format(converted))\n return converted", "metadata": "root.TaskQueueConfig.parse_queue_xml", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 183 }, { "content": " def get_file_queue_info(self):\n \"\"\" Retrives the queues declared in the queue.yaml or queue.xml\n configuration. \n \n Returns:\n A dictionary representing the queues for this application.\n \"\"\"\n return self._queue_info_file", "metadata": "root.TaskQueueConfig.get_file_queue_info", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 222 }, { "content": " def get_db_queue_info(self):\n \"\"\" Retrives the queues for this application configuration. \n \n Returns:\n A dictionary representing the \n \"\"\"\n return self._queue_info_db", "metadata": "root.TaskQueueConfig.get_db_queue_info", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 231 }, { "content": " def __get_queues_from_db(self):\n \"\"\" Retrives queue info from the database. \n\n Returns:\n A dictionary representation of queues. \n \"\"\"\n queues_key = datastore.Key.from_path(self.QUEUE_KIND, \n self._app_id,\n _app=self.APPSCALE_QUEUES)\n queues = datastore.Get(queues_key) \n return json.loads(queues[self.QUEUE_INFO])", "metadata": "root.TaskQueueConfig.__get_queues_from_db", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 239 }, { "content": " def load_queues_from_db(self):\n \"\"\" Gets the current queues stored in the datastore for \n the current application and loads them into this class. \n \n Returns:\n A dictionary of queues. \n \"\"\"\n self._queue_info_db = self.__get_queues_from_db()\n return self._queue_info_db", "metadata": "root.TaskQueueConfig.load_queues_from_db", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 251 }, { "content": " def save_queues_to_db(self):\n \"\"\" Stores file queue information into the datastore. \n \n Raises:\n ValueError: If queue info has not been set. \n \"\"\"\n if not self._queue_info_file:\n raise ValueError(\"Queue info must be set before saving the queues\")\n json_queues = json.dumps(self._queue_info_file)\n entity = datastore.Entity(self.QUEUE_KIND, \n name=self._app_id,\n _app=self.APPSCALE_QUEUES)\n entity.update({self.QUEUE_INFO: datastore_types.Blob(json_queues),\n self.APP_NAME: datastore_types.ByteString(self._app_id)})\n datastore.Put(entity)", "metadata": "root.TaskQueueConfig.save_queues_to_db", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 261 }, { "content": " def create_celery_worker_scripts(self, input_type):\n \"\"\" Creates the task worker python script. It uses\n a configuration file for setup.\n\n Args:\n input_type: Whether to use the config file or the \n database queue info. Default: config file.\n Returns: \n The full path of the worker script.\n \"\"\"\n queue_info = self._queue_info_file\n if input_type == self.QUEUE_INFO_DB:\n queue_info = self._queue_info_db \n\n header_template = file_io.read(self.HEADER_LOC)\n task_template = file_io.read(self.TASK_LOC)\n header_template = header_template.replace(\"APP_ID\", self._app_id)\n script = header_template.replace(\"CELERY_CONFIGURATION\", \n self._app_id) + '\\n'\n for queue in queue_info['queue']:\n queue_name = queue['name'] \n # The queue name is used as a function name so replace invalid chars\n queue_name = queue_name.replace('-', '_')\n self.validate_queue_name(queue_name)\n new_task = task_template.replace(\"QUEUE_NAME\", \n self.get_queue_function_name(queue_name))\n script += new_task + '\\n'\n\n worker_file = self.get_celery_worker_script_path(self._app_id)\n file_io.write(worker_file, script)\n return worker_file", "metadata": "root.TaskQueueConfig.create_celery_worker_scripts", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 277 }, { "content": " @staticmethod\n def remove_config_files(app_id):\n \"\"\" Removed celery worker and config files.\n \n Args:\n app_id: The application identifer.\n \"\"\"\n worker_file = TaskQueueConfig.get_celery_worker_script_path(app_id)\n config_file = TaskQueueConfig.get_celery_configuration_path(app_id)\n file_io.delete(worker_file)\n file_io.delete(config_file)", "metadata": "root.TaskQueueConfig.remove_config_files", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 309 }, { "content": " @staticmethod\n def get_queue_function_name(queue_name):\n \"\"\" Returns the function name of a queue which is not the queue name \n for namespacing and collision reasons.\n\n Args:\n queue_name: The name of a queue.\n Returns:\n The string representing the function name.\n \"\"\"\n # Remove '-' because that character is not valid for a function name.\n queue_name = queue_name.replace('-', '_')\n return \"queue___%s\" % queue_name ", "metadata": "root.TaskQueueConfig.get_queue_function_name", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 321 }, { "content": " @staticmethod\n def get_celery_annotation_name(app_id, queue_name):\n \"\"\" Returns the annotation name for a celery configuration of \n a queue for a given application id.\n \n Args:\n app_id: The application ID.\n queue_name: The application queue name.\n Returns:\n A string for the annotation tag.\n \"\"\" \n module_name = TaskQueueConfig.get_celery_worker_module_name(app_id)\n function_name = TaskQueueConfig.get_queue_function_name(queue_name)\n return \"%s.%s\" % (module_name, function_name)", "metadata": "root.TaskQueueConfig.get_celery_annotation_name", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 335 }, { "content": " @staticmethod\n def get_celery_worker_script_path(app_id):\n \"\"\" Returns the full path of the worker script used for celery.\n \n Args:\n app_id: The application identifier.\n Returns:\n A string of the full file name of the worker script.\n \"\"\"\n return TaskQueueConfig.CELERY_WORKER_DIR + \"app___\" + app_id + \".py\"", "metadata": "root.TaskQueueConfig.get_celery_worker_script_path", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 350 }, { "content": " @staticmethod\n def get_celery_worker_module_name(app_id):\n \"\"\" Returns the python module name of the queue worker script.\n \n Args:\n app_id: The application identifier.\n Returns:\n A string of the module name.\n \"\"\"\n return \"app___\" + app_id ", "metadata": "root.TaskQueueConfig.get_celery_worker_module_name", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 361 }, { "content": " @staticmethod\n def get_celery_configuration_path(app_id):\n \"\"\" Returns the full path of the configuration used for celery.\n \n Args:\n app_id: The application identifier.\n Returns:\n A string of the full file name of the configuration file.\n \"\"\"\n return TaskQueueConfig.CELERY_CONFIG_DIR + app_id + \".py\"", "metadata": "root.TaskQueueConfig.get_celery_configuration_path", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 373 }, { "content": " def create_celery_file(self, input_type):\n \"\"\" Creates the Celery configuration file describing \n queues and exchanges for an application. Uses either\n the queue.yaml/queue.xml input or what was stored in the \n datastore to create the celery file. \n\n Args:\n input_type: Whether to use the config file or the \n database queue info. Default: config file.\n Returns:\n A string representing the full path location of the \n configuration file.\n \"\"\"\n queue_info = self._queue_info_file\n if input_type == self.QUEUE_INFO_DB:\n queue_info = self._queue_info_db \n \n celery_queues = []\n celery_annotations = []\n for queue in queue_info['queue']:\n if 'mode' in queue and queue['mode'] == \"pull\":\n continue # celery does not handle pull queues\n celery_queue_name = \\\n TaskQueueConfig.get_celery_queue_name(self._app_id, queue['name'])\n celery_queues.append(\"Queue('\" + celery_queue_name + \\\n \"', Exchange('\" + self._app_id + \\\n \"'), routing_key='\" + celery_queue_name + \"'),\")\n\n rate_limit = self.DEFAULT_RATE\n if 'rate' in queue:\n rate_limit = queue['rate']\n\n annotation_name = \\\n TaskQueueConfig.get_celery_annotation_name(self._app_id,\n queue['name'])\n celery_annotations.append(\"'\" + annotation_name + \\\n \"': {'rate_limit': '\" + rate_limit + \"'},\")\n\n celery_queues = '\\n'.join(celery_queues)\n celery_annotations = '\\n'.join(celery_annotations)\n config = \\\n\"\"\"\nfrom kombu import Exchange\nfrom kombu import Queue\nCELERY_QUEUES = (\n\"\"\"\n config += celery_queues\n config += \\\n\"\"\"\n)\nCELERY_ANNOTATIONS = {\n\"\"\"\n config += celery_annotations\n config += \\\n\"\"\"\n}\n# Everytime a task is enqueued a temporary queue is created to store\n# results into rabbitmq. This can be bad in a high enqueue environment\n# We use the following to make sure these temp queues are not created. \n# See http://stackoverflow.com/questions/7144025/temporary-queue-made-in-celery\n# for more information on this issue.\nCELERY_IGNORE_RESULT = True\nCELERY_STORE_ERRORS_EVEN_IF_IGNORED = False\n\n# One month expiration date because a task can be deferred that long.\nCELERY_AMQP_TASK_RESULT_EXPIRES = 2678400\n\n# Disable prefetching for celery workers. If tasks are small in duration this\n# should be set to a higher value (64-128) for increased performance.\n# See: http://celery.readthedocs.org/en/latest/userguide/optimizing.html#worker-settings\nCELERYD_PREFETCH_MULTIPLIER = 1\n\"\"\"\n config_file = self._app_id + \".py\" \n file_io.write(self.CELERY_CONFIG_DIR + config_file, config)\n return self.CELERY_CONFIG_DIR + config_file", "metadata": "root.TaskQueueConfig.create_celery_file", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 385 }, { "content": " def __broker_location(self, broker):\n \"\"\" Gets the broker location connection string.\n \n Args:\n broker: The broker enum value.\n Returns:\n A broker connection string.\n Raises:\n NotImplementedError: If the broker is not implemented\n \"\"\" \n if broker == self.RABBITMQ:\n from brokers import rabbitmq\n return rabbitmq.get_connection_string()\n else:\n raise NotImplementedError(\n \"The given broker of code %d is not implemented\" % broker)", "metadata": "root.TaskQueueConfig.__broker_location", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 461 }, { "content": " def get_broker_string(self):\n \"\"\" Gets the broker connection string.\n\n Returns:\n A string which tells of the location of the configured broker.\n \"\"\"\n return self._broker_location", "metadata": "root.TaskQueueConfig.get_broker_string", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 478 }, { "content": " def validate_queue_name(self, queue_name):\n \"\"\" Validates the queue name to make sure it can be used as a function name.\n \n Args:\n queue_name: A string representing a queue name.\n Raises:\n NameError if the name is invalid.\n \"\"\"\n if not self.QUEUE_NAME_RE.match(queue_name):\n raise NameError(\"Queue name %s did not match the regex %s\" %\\\n (queue_name, self.QUEUE_NAME_PATTERN))", "metadata": "root.TaskQueueConfig.validate_queue_name", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 486 }, { "content": " @staticmethod\n def get_celery_queue_name(app_id, queue_name):\n \"\"\" Gets a usable queue name for celery to prevent\n collisions where mulitple apps have the same name \n for a queue.\n \n Args:\n app_id: The application ID.\n queue_name: String name of the queue.\n Returns:\n A string to reference the queue name in celery.\n \"\"\"\n return app_id + \"___\" + queue_name", "metadata": "root.TaskQueueConfig.get_celery_queue_name", "header": "['class', 'TaskQueueConfig', '(', ')', ':', '___EOS___']", "index": 498 } ]
[ { "span": "import urllib2", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 14 }, { "span": "import xml.etree.ElementTree as et", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", " ", "\\", "10", ";", " ", " ", " ", " ", "App", "Scale", " ", "Task", "Queue", " ", "configura", "tion", " ", "class", ".", " ", "It", " ", "deal", "s", " ", "with", " ", "the", " ", "configura", "tion", "\\", "10", ";", " ", " ", " ", " ", "file", " ", "give", "n", " ", "with", " ", "an", " ", "applica", "tion", " ", "'", "queue", ".", "yaml", "'", " ", "or", " ", "'", "queue", ".", "xml", "'.", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "a", " ", "previ", "ous", " ", "version", " ", "was", " ", "deploye", "d", ",", " ", "the", " ", "older", " ", "configura", "tion", " ", "from", " ", "the", " ", "databa", "se", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "xml_", "._", "etree_", "._", "Element", "Tree_", "as_", "et_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\"..", "/", "App", "Server", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "queue", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datastore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datast", "ore", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\"..", "/", "lib", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "apps", "cale", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "file", "\\u", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xmlt", "odict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Contain", "s", " ", "configura", "tion", " ", "of", " ", "the", " ", "Task", "Queue", " ", "system", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "kind", " ", "name", " ", "for", " ", "stor", "ing", " ", "Queue", " ", "info", "._", "\\u\\u\\uNL\\u\\u\\u_", "QUEUE", "\\u", "KIND", "_", "=_", "\"\\u\\u", "queue", "\\u\\u\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enum", " ", "code", " ", "for", " ", "broker", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "RA", "BB", "IT", "MQ", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Max", " ", "concurrency", " ", "per", " ", "worker", "._", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "CONC", "URRE", "NCY", "_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "default", " ", "YAM", "L", " ", "used", " ", "if", " ", "a", " ", "queue", ".", "yaml", " ", "or", " ", "queue", ".", "xml", " ", "is", " ", "not", " ", "supplie", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "QUEUE", "\\u", "YAM", "L_", "=_", "\"\"\"", "\\", "10", ";", "queue", ":", "\\", "10", ";", "-", " ", "name", ":", " ", "default", "\\", "10", ";", " ", " ", "rate", ":", " ", "5", "/", "s", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "default", " ", "rate", " ", "for", " ", "a", " ", "queue", " ", "if", " ", "not", " ", "specified", " ", "in", " ", "the", " ", "queue", ".", "yaml", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "Goo", "gle", " ", "App", " ", "Engine", " ", "it", " ", "is", " ", "unlimited", " ", "so", " ", "we", " ", "use", " ", "a", " ", "high", " ", "rate", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "RATE_", "=_", "\"", "10000", "/", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "applica", "tion", " ", "id", " ", "used", " ", "for", " ", "stor", "ing", " ", "queue", " ", "info", "._", "\\u\\u\\uNL\\u\\u\\u_", "APP", "SCALE", "\\u", "QUEUE", "S_", "=_", "\"\\u\\u", "apps", "cale", "\\u", "queue", "s", "\\u\\u\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "property", " ", "index", " ", "for", " ", "whi", "ch", " ", "we", " ", "store", " ", "the", " ", "queue", " ", "info", "._", "\\u\\u\\uNL\\u\\u\\u_", "QUEUE", "\\u", "INFO_", "=_", "\"", "queue", "info", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "property", " ", "index", " ", "for", " ", "whi", "ch", " ", "we", " ", "store", " ", "app", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "APP", "\\u", "NAME_", "=_", "\"", "app", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Queue", " ", "info", " ", "location", " ", "codes", "._", "\\u\\u\\uNL\\u\\u\\u_", "QUEUE", "\\u", "INFO", "\\u", "DB_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "QUEUE", "\\u", "INFO", "\\u", "FILE_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Locat", "ion", " ", "of", " ", "all", " ", "celery", " ", "configura", "tion", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "CONFIG", "\\u", "DIR_", "=_", "'/", "etc", "/", "apps", "cale", "/", "celery", "/", "configura", "tion", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Locat", "ion", " ", "of", " ", "all", " ", "celery", " ", "worker", "s", " ", "scripts", "._", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "WORKER", "\\u", "DIR_", "=_", "'/", "etc", "/", "apps", "cale", "/", "celery", "/", "worker", "s", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Locat", "ion", " ", "where", " ", "celery", " ", "worker", "s", " ", "back", " ", "up", " ", "state", " ", "to", "._", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "STATE", "\\u", "DIR_", "=_", "'/", "opt", "/", "apps", "cale", "/", "celery", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Director", "y", " ", "with", " ", "the", " ", "task", " ", "template", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DIR_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "+_", "\"/", "template", "s", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "location", " ", "of", " ", "a", " ", "header", " ", "of", " ", "a", " ", "queue", " ", "worker", " ", "script", "._", "\\u\\u\\uNL\\u\\u\\u_", "HEAD", "ER", "\\u", "LOC", "_", "=_", "TEMPL", "ATE", "\\u", "DIR_", "+_", "'", "header", ".", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "location", " ", "of", " ", "the", " ", "task", " ", "template", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "TASK", "\\u", "LOC", "_", "=_", "TEMPL", "ATE", "\\u", "DIR_", "+_", "'", "task", ".", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "QUEUE", "\\u", "NAME", "\\u", "LENGTH_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "QUEUE", "\\u", "NAME", "\\u", "PATTERN_", "=_", "r", "'", "^", "[", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\u]", "{", "1", ",%", "s", "}$'_", "%_", "MAX", "\\u", "QUEUE", "\\u", "NAME", "\\u", "LENGTH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "QUEUE", "\\u", "NAME", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "QUEUE", "\\u", "NAME", "\\u", "PATTERN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XML", " ", "configs", " ", "use", " ", "\"-", "\"", " ", "whi", "le", " ", "yaml", " ", "use", "s", " ", "\"\\u", "\".", " ", "The", "se", " ", "are", " ", "the", " ", "tags", " ", "whi", "ch", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "be", " ", "convert", "ed", " ", "to", " ", "match", " ", "the", " ", "yaml", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "YAM", "L", "\\u", "TO", "\\u", "XML", "\\u", "TAG", "S", "\\u", "TO", "\\u", "CONVERT", "_", "=_", "[_", "'", "bucket", "-", "size", "'_", ",_", "'", "max", "-", "concurrent", "-", "request", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "retr", "y", "-", "parameter", "s", "'_", ",_", "'", "task", "-", "age", "-", "limit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "total", "-", "storage", "-", "limit", "'_", ",_", "'", "user", "-", "email", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "write", "-", "email", "'_", ",_", "'", "min", "-", "backoff", "-", "second", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "-", "backoff", "-", "second", "s", "'_", ",_", "'", "max", "-", "dou", "blin", "gs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "task", "-", "retr", "y", "-", "limit", "'_", ",_", "'", "max", "-", "concurrent", "-", "request", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ta", "gs", " ", "from", " ", "queue", ".", "xml", " ", "tha", "t", " ", "are", " ", "ignore", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "TAG", "S", "\\u", "TO", "\\u", "IGNORE", "_", "=_", "[_", "'#", "text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "broker_", ",_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Configura", "tion", " ", "construct", "or", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "broker", ":", " ", "The", " ", "broker", " ", "to", " ", "use", ".", "\\", "10", ";", " ", " ", "app", "\\u", "id", ":", " ", "Applica", "tion", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "io_", "._", "set\\u", "logg", "ing", "\\u", "format_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "broker_", "=_", "broker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "broker", "\\u", "location_", "=_", "self_", "._", "\\u\\u", "broker", "\\u", "location_", "(_", "broker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "app", "\\u", "id_", "=_", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "db_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "io_", "._", "mkdir_", "(_", "self_", "._", "CEL", "ER", "Y", "\\u", "CONFIG", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "io_", "._", "mkdir_", "(_", "self_", "._", "CEL", "ER", "Y", "\\u", "WORKER", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "queue", "\\u", "file", "\\u", "location_", "(_", "self_", ",_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", "s", " ", "the", " ", "location", " ", "of", " ", "the", " ", "queue", ".", "yaml", " ", "or", " ", "queue", ".", "xml", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "a", " ", "give", "n", " ", "applica", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "app", "\\u", "id", ":", " ", "The", " ", "applica", "tion", " ", "ID", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "location", " ", "of", " ", "the", " ", "queue", ".", "yaml", " ", "or", " ", "queue", ".", "xml", " ", "file", ",", " ", "and", " ", "\\", "10", ";", " ", " ", "an", " ", "empty", " ", "string", " ", "if", " ", "it", " ", "coul", "d", " ", "not", " ", "be", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "\\u", "yaml_", "=_", "apps", "cale", "\\u", "info_", "._", "get", "\\u", "app", "\\u", "path_", "(_", "app", "\\u", "id_", ")_", "+_", "'", "queue", ".", "yaml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "\\u", "xml_", "=_", "apps", "cale", "\\u", "info_", "._", "get", "\\u", "app", "\\u", "path_", "(_", "app", "\\u", "id_", ")_", "+_", "'/", "war", "/", "WEB", "-", "INF", "/", "queue", ".", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "\\u", "io_", "._", "exists_", "(_", "queue", "\\u", "yaml_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "queue", "\\u", "yaml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "file", "\\u", "io_", "._", "exists_", "(_", "queue", "\\u", "xml_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "queue", "\\u", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "queue", "s", "\\u", "from", "\\u", "file_", "(_", "self_", ",_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Pars", "es", " ", "the", " ", "queue", ".", "yaml", " ", "or", " ", "queue", ".", "xml", " ", "file", " ", "of", " ", "an", " ", "applica", "tion", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "load", "s", " ", "it", " ", "int", "o", " ", "the", " ", "class", ".", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "app", "\\u", "id", ":", " ", "The", " ", "applica", "tion", " ", "ID", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "dictionar", "y", " ", "of", " ", "the", " ", "queue", " ", "settings", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Value", "Error", ":", " ", "If", " ", "queue", "\\u", "file", " ", "is", " ", "una", "ble", " ", "to", " ", "get", " ", "load", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "\\u", "file_", "=_", "self_", "._", "get", "\\u", "queue", "\\u", "file", "\\u", "location_", "(_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usi", "ng", "\\u", "default_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "file", "\\u", "io_", "._", "read_", "(_", "queue", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Foun", "d", " ", "queue", " ", "file", " ", "for", " ", "app", " ", "{", "0", "}\"_", "._", "format_", "(_", "app", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "No", " ", "queue", " ", "file", " ", "found", " ", "for", " ", "app", " ", "{", "0", "},", " ", "usi", "ng", " ", "default", " ", "queue", "\"_", "._", "format_", "(_", "app", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "self_", "._", "DEF", "AUL", "T", "\\u", "QUEUE", "\\u", "YAM", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usi", "ng", "\\u", "default_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "queue", "\\u", "info_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "handle", " ", "bad", " ", "xml", "/", "yaml", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "queue", "\\u", "file_", "._", "endswith_", "(_", "'", "yaml", "'_", ")_", "or_", "usi", "ng", "\\u", "default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "\\u", "info_", "=_", "queue", "info_", "._", "Load", "Sing", "le", "Queue_", "(_", "info_", ")_", "._", "To", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "queue", "\\u", "file_", "._", "endswith_", "(_", "'", "xml", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "\\u", "info_", "=_", "self_", "._", "parse", "\\u", "queue", "\\u", "xml_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Una", "ble", " ", "to", " ", "load", " ", "queue", " ", "informati", "on", " ", "with", " ", "%", "s", "\"_", "%_", "queue", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "queue", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Queue", " ", "informati", "on", " ", "with", " ", "%", "s", " ", "not", " ", "set", "\"_", "%_", "queue", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "add", " ", "in", " ", "the", " ", "default", " ", "queue", " ", "if", " ", "its", " ", "not", " ", "alr", "ead", "y", " ", "in", " ", "there", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "has", "\\u", "default_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "queue", "'_", "not_", "in_", "queue", "\\u", "info_", "or_", "len_", "(_", "queue", "\\u", "info_", "[_", "'", "queue", "'_", "]_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "\\u", "info_", "=_", "{_", "'", "queue", "'_", ":_", "[_", "{_", "'", "rate", "'_", ":_", "'", "5", "/", "s", "'_", ",_", "'", "name", "'_", ":_", "'", "default", "'_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "queue_", "in_", "queue", "\\u", "info_", "[_", "'", "queue", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "queue_", "[_", "'", "name", "'_", "]_", "==_", "'", "default", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "default_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "has", "\\u", "default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "\\u", "info_", "[_", "'", "queue", "'_", "]_", "._", "append_", "(_", "{_", "'", "rate", "'_", ":_", "'", "5", "/", "s", "'_", ",_", "'", "name", "'_", ":_", "'", "default", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "file_", "=_", "queue", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "App", "ID", " ", "{", "0", "}", " ", "--", " ", "Load", "ed", " ", "queue", " ", "{", "1", "}\"_", "._", "format_", "(_", "app", "\\u", "id_", ",_", "queue", "\\u", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "queue", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "queue", "\\u", "xml_", "(_", "self_", ",_", "xml", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Turn", "s", " ", "an", " ", "xml", " ", "string", " ", "int", "o", " ", "a", " ", "dictionar", "y", " ", "tree", " ", "usi", "ng", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "same", " ", "format", " ", "at", " ", "the", " ", "yaml", " ", "conve", "rsi", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "xml", ":", " ", "A", " ", "string", " ", "content", "s", " ", "in", " ", "XML", " ", "format", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "dictionar", "y", " ", "tree", " ", "of", " ", "the", " ", "xml", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml", "\\u", "dict_", "=_", "xmlt", "odict_", "._", "parse_", "(_", "xml", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "we", " ", "convert", " ", "it", " ", "to", " ", "look", " ", "the", " ", "same", " ", "as", " ", "the", " ", "yaml", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "converted_", "=_", "{_", "'", "queue", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "xml", "\\u", "dict_", "[_", "'", "queue", "-", "entri", "es", "'_", "]_", "[_", "'", "queue", "'_", "]_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "queues_", "=_", "xml", "\\u", "dict_", "[_", "'", "queue", "-", "entri", "es", "'_", "]_", "[_", "'", "queue", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "queues_", "=_", "[_", "xml", "\\u", "dict_", "[_", "'", "queue", "-", "entri", "es", "'_", "]_", "[_", "'", "queue", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "queue_", "in_", "all", "\\u", "queues_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "single", "\\u", "queue_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tag_", ",_", "value_", "in_", "queue_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tag_", "in_", "self_", "._", "YAM", "L", "\\u", "TO", "\\u", "XML", "\\u", "TAG", "S", "\\u", "TO", "\\u", "CONVERT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "tag_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tag_", "==_", "\"", "retr", "y", "\\u", "parameter", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retr", "y", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "retr", "y", "\\u", "tag_", "in_", "queue_", "[_", "'", "retr", "y", "-", "parameter", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "queue_", "[_", "'", "retr", "y", "-", "parameter", "s", "'_", "]_", "[_", "retr", "y", "\\u", "tag_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "retr", "y", "\\u", "tag_", "in_", "self_", "._", "YAM", "L", "\\u", "TO", "\\u", "XML", "\\u", "TAG", "S", "\\u", "TO", "\\u", "CONVERT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retr", "y", "\\u", "tag_", "=_", "retr", "y", "\\u", "tag_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "retr", "y", "\\u", "tag_", "not_", "in_", "self_", "._", "TAG", "S", "\\u", "TO", "\\u", "IGNORE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retr", "y", "\\u", "dict_", "[_", "str_", "(_", "retr", "y", "\\u", "tag_", ")_", "]_", "=_", "str_", "(_", "value_", ")_", "._", "strip_", "(_", "'\\\\", "n", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "single", "\\u", "queue_", "[_", "'", "retr", "y", "\\u", "parameter", "s", "'_", "]_", "=_", "retr", "y", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "not_", "in_", "self_", "._", "TAG", "S", "\\u", "TO", "\\u", "IGNORE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "single", "\\u", "queue_", "[_", "str_", "(_", "tag_", ")_", "]_", "=_", "str_", "(_", "value_", ")_", "._", "strip_", "(_", "'\\\\", "n", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "converted_", "[_", "'", "queue", "'_", "]_", "._", "append_", "(_", "single", "\\u", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "XML", " ", "queue", " ", "info", " ", "is", " ", "{", "0", "}\"_", "._", "format_", "(_", "converted_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "converted_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "file", "\\u", "queue", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Retri", "ves", " ", "the", " ", "queue", "s", " ", "declared", " ", "in", " ", "the", " ", "queue", ".", "yaml", " ", "or", " ", "queue", ".", "xml", "\\", "10", ";", " ", " ", " ", " ", "configura", "tion", ".", " ", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "dictionar", "y", " ", "represent", "ing", " ", "the", " ", "queue", "s", " ", "for", " ", "this", " ", "applica", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "db", "\\u", "queue", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Retri", "ves", " ", "the", " ", "queue", "s", " ", "for", " ", "this", " ", "applica", "tion", " ", "configura", "tion", ".", " ", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "dictionar", "y", " ", "represent", "ing", " ", "the", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "queue", "s", "\\u", "from", "\\u", "db_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Retri", "ves", " ", "queue", " ", "info", " ", "from", " ", "the", " ", "databa", "se", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "dictionar", "y", " ", "represent", "ation", " ", "of", " ", "queue", "s", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "s", "\\u", "key_", "=_", "datastore_", "._", "Key_", "._", "from", "\\u", "path_", "(_", "self_", "._", "QUEUE", "\\u", "KIND", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "app", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "app_", "=_", "self_", "._", "APP", "SCALE", "\\u", "QUEUE", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queues_", "=_", "datastore_", "._", "Get_", "(_", "queue", "s", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "queues_", "[_", "self_", "._", "QUEUE", "\\u", "INFO_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "queue", "s", "\\u", "from", "\\u", "db_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", "s", " ", "the", " ", "current", " ", "queue", "s", " ", "store", "d", " ", "in", " ", "the", " ", "datast", "ore", " ", "for", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "current", " ", "applica", "tion", " ", "and", " ", "load", "s", " ", "them", " ", "int", "o", " ", "this", " ", "class", ".", " ", "\\", "10", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "dictionar", "y", " ", "of", " ", "queue", "s", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "db_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "queue", "s", "\\u", "from", "\\u", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "queue", "s", "\\u", "to", "\\u", "db_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Stor", "es", " ", "file", " ", "queue", " ", "informati", "on", " ", "int", "o", " ", "the", " ", "datast", "ore", ".", " ", "\\", "10", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Value", "Error", ":", " ", "If", " ", "queue", " ", "info", " ", "has", " ", "not", " ", "bee", "n", " ", "set", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Queue", " ", "info", " ", "must", " ", "be", " ", "set", " ", "bef", "ore", " ", "saving", " ", "the", " ", "queue", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json", "\\u", "queues_", "=_", "json_", "._", "dumps_", "(_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "=_", "datastore_", "._", "Entity_", "(_", "self_", "._", "QUEUE", "\\u", "KIND", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "self_", "._", "\\u", "app", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "app_", "=_", "self_", "._", "APP", "SCALE", "\\u", "QUEUE", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "update_", "(_", "{_", "self_", "._", "QUEUE", "\\u", "INFO_", ":_", "datast", "ore", "\\u", "types_", "._", "Blob_", "(_", "json", "\\u", "queues_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "APP", "\\u", "NAME_", ":_", "datast", "ore", "\\u", "types_", "._", "Byte", "String_", "(_", "self_", "._", "\\u", "app", "\\u", "id_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datastore_", "._", "Put", "_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "celery", "\\u", "worker", "\\u", "scripts_", "(_", "self_", ",_", "input", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "es", " ", "the", " ", "task", " ", "worker", " ", "python", " ", "script", ".", " ", "It", " ", "use", "s", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "configura", "tion", " ", "file", " ", "for", " ", "setup", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "input", "\\u", "type", ":", " ", "Whe", "ther", " ", "to", " ", "use", " ", "the", " ", "config", " ", "file", " ", "or", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "databa", "se", " ", "queue", " ", "info", ".", " ", "Default", ":", " ", "config", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", " ", "\\", "10", ";", " ", " ", "The", " ", "full", " ", "path", " ", "of", " ", "the", " ", "worker", " ", "script", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "\\u", "info_", "=_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "\\u", "type_", "==_", "self_", "._", "QUEUE", "\\u", "INFO", "\\u", "DB_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "\\u", "info_", "=_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header", "\\u", "template_", "=_", "file", "\\u", "io_", "._", "read_", "(_", "self_", "._", "HEAD", "ER", "\\u", "LOC", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "template_", "=_", "file", "\\u", "io_", "._", "read_", "(_", "self_", "._", "TASK", "\\u", "LOC", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "\\u", "template_", "=_", "header", "\\u", "template_", "._", "replace_", "(_", "\"", "APP", "\\u", "ID", "\"_", ",_", "self_", "._", "\\u", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "=_", "header", "\\u", "template_", "._", "replace_", "(_", "\"", "CEL", "ER", "Y", "\\u", "CONFIGURATION", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "app", "\\u", "id_", ")_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "queue_", "in_", "queue", "\\u", "info_", "[_", "'", "queue", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "\\u", "name_", "=_", "queue_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "queue", " ", "name", " ", "is", " ", "used", " ", "as", " ", "a", " ", "function", " ", "name", " ", "so", " ", "replace", " ", "invalid", " ", "chars_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", "=_", "queue", "\\u", "name_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validat", "e\\u", "queue", "\\u", "name_", "(_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "task_", "=_", "task", "\\u", "template_", "._", "replace_", "(_", "\"", "QUEUE", "\\u", "NAME", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "queue", "\\u", "function", "\\u", "name_", "(_", "queue", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "+=_", "new", "\\u", "task_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "worker", "\\u", "file_", "=_", "self_", "._", "get", "\\u", "celery", "\\u", "worker", "\\u", "script", "\\u", "path_", "(_", "self_", "._", "\\u", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "io_", "._", "write_", "(_", "worker", "\\u", "file_", ",_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "worker", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\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_", "remove", "\\u", "config", "\\u", "files_", "(_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Remove", "d", " ", "celery", " ", "worker", " ", "and", " ", "config", " ", "files", ".", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "app", "\\u", "id", ":", " ", "The", " ", "applica", "tion", " ", "identi", "fer", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker", "\\u", "file_", "=_", "Task", "Queue", "Config_", "._", "get", "\\u", "celery", "\\u", "worker", "\\u", "script", "\\u", "path_", "(_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "file_", "=_", "Task", "Queue", "Config_", "._", "get", "\\u", "celery", "\\u", "configura", "tion", "\\u", "path_", "(_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "io_", "._", "delete_", "(_", "worker", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "io_", "._", "delete_", "(_", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\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", "queue", "\\u", "function", "\\u", "name_", "(_", "queue", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "the", " ", "function", " ", "name", " ", "of", " ", "a", " ", "queue", " ", "whi", "ch", " ", "is", " ", "not", " ", "the", " ", "queue", " ", "name", " ", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "names", "pacing", " ", "and", " ", "colli", "sion", " ", "reasons", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "queue", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "a", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "string", " ", "represent", "ing", " ", "the", " ", "function", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "'-'", " ", "bec", "aus", "e", " ", "tha", "t", " ", "character", " ", "is", " ", "not", " ", "valid", " ", "for", " ", "a", " ", "function", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", "=_", "queue", "\\u", "name_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "queue", "\\u\\u\\u", "%", "s", "\"_", "%_", "queue", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\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", "celery", "\\u", "annot", "ation", "\\u", "name_", "(_", "app", "\\u", "id_", ",_", "queue", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "the", " ", "annot", "ation", " ", "name", " ", "for", " ", "a", " ", "celery", " ", "configura", "tion", " ", "of", " ", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "queue", " ", "for", " ", "a", " ", "give", "n", " ", "applica", "tion", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "app", "\\u", "id", ":", " ", "The", " ", "applica", "tion", " ", "ID", ".", "\\", "10", ";", " ", " ", "queue", "\\u", "name", ":", " ", "The", " ", "applica", "tion", " ", "queue", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "string", " ", "for", " ", "the", " ", "annot", "ation", " ", "tag", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "name_", "=_", "Task", "Queue", "Config_", "._", "get", "\\u", "celery", "\\u", "worker", "\\u", "module", "\\u", "name_", "(_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "\\u", "name_", "=_", "Task", "Queue", "Config_", "._", "get", "\\u", "queue", "\\u", "function", "\\u", "name_", "(_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", ".", "%", "s", "\"_", "%_", "(_", "module", "\\u", "name_", ",_", "function", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\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", "celery", "\\u", "worker", "\\u", "script", "\\u", "path_", "(_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "the", " ", "full", " ", "path", " ", "of", " ", "the", " ", "worker", " ", "script", " ", "used", " ", "for", " ", "celery", ".", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "app", "\\u", "id", ":", " ", "The", " ", "applica", "tion", " ", "identifi", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "string", " ", "of", " ", "the", " ", "full", " ", "file", " ", "name", " ", "of", " ", "the", " ", "worker", " ", "script", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Task", "Queue", "Config_", "._", "CEL", "ER", "Y", "\\u", "WORKER", "\\u", "DIR_", "+_", "\"", "app", "\\u\\u\\u", "\"_", "+_", "app", "\\u", "id_", "+_", "\".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\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", "celery", "\\u", "worker", "\\u", "module", "\\u", "name_", "(_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "the", " ", "python", " ", "module", " ", "name", " ", "of", " ", "the", " ", "queue", " ", "worker", " ", "script", ".", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "app", "\\u", "id", ":", " ", "The", " ", "applica", "tion", " ", "identifi", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "string", " ", "of", " ", "the", " ", "module", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "app", "\\u\\u\\u", "\"_", "+_", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\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", "celery", "\\u", "configura", "tion", "\\u", "path_", "(_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "the", " ", "full", " ", "path", " ", "of", " ", "the", " ", "configura", "tion", " ", "used", " ", "for", " ", "celery", ".", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "app", "\\u", "id", ":", " ", "The", " ", "applica", "tion", " ", "identifi", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "string", " ", "of", " ", "the", " ", "full", " ", "file", " ", "name", " ", "of", " ", "the", " ", "configura", "tion", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Task", "Queue", "Config_", "._", "CEL", "ER", "Y", "\\u", "CONFIG", "\\u", "DIR_", "+_", "app", "\\u", "id_", "+_", "\".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "celery", "\\u", "file_", "(_", "self_", ",_", "input", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "es", " ", "the", " ", "Celery", " ", "configura", "tion", " ", "file", " ", "descri", "bing", " ", "\\", "10", ";", " ", " ", " ", " ", "queue", "s", " ", "and", " ", "exchange", "s", " ", "for", " ", "an", " ", "applica", "tion", ".", " ", "Us", "es", " ", "eit", "her", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "queue", ".", "yaml", "/", "queue", ".", "xml", " ", "input", " ", "or", " ", "what", " ", "was", " ", "store", "d", " ", "in", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "datast", "ore", " ", "to", " ", "create", " ", "the", " ", "celery", " ", "file", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "input", "\\u", "type", ":", " ", "Whe", "ther", " ", "to", " ", "use", " ", "the", " ", "config", " ", "file", " ", "or", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "databa", "se", " ", "queue", " ", "info", ".", " ", "Default", ":", " ", "config", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "string", " ", "represent", "ing", " ", "the", " ", "full", " ", "path", " ", "location", " ", "of", " ", "the", " ", "\\", "10", ";", " ", " ", "configura", "tion", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "\\u", "info_", "=_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "\\u", "type_", "==_", "self_", "._", "QUEUE", "\\u", "INFO", "\\u", "DB_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "\\u", "info_", "=_", "self_", "._", "\\u", "queue", "\\u", "info", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "celery", "\\u", "queues_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "celery", "\\u", "annotations_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "queue_", "in_", "queue", "\\u", "info_", "[_", "'", "queue", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "mode", "'_", "in_", "queue_", "and_", "queue_", "[_", "'", "mode", "'_", "]_", "==_", "\"", "pull", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", " ", "celery", " ", "doe", "s", " ", "not", " ", "handle", " ", "pull", " ", "queues_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "celery", "\\u", "queue", "\\u", "name_", "=_", "Task", "Queue", "Config_", "._", "get", "\\u", "celery", "\\u", "queue", "\\u", "name_", "(_", "self_", "._", "\\u", "app", "\\u", "id_", ",_", "queue_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "celery", "\\u", "queues_", "._", "append_", "(_", "\"", "Queue", "('", "\"_", "+_", "celery", "\\u", "queue", "\\u", "name_", "+_", "\"',", " ", "Exc", "hange", "('", "\"_", "+_", "self_", "._", "\\u", "app", "\\u", "id_", "+_", "\"')", ",", " ", "routin", "g", "\\u", "key", "='\"_", "+_", "celery", "\\u", "queue", "\\u", "name_", "+_", "\"')", ",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rate", "\\u", "limit_", "=_", "self_", "._", "DEF", "AUL", "T", "\\u", "RATE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "rate", "'_", "in_", "queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rate", "\\u", "limit_", "=_", "queue_", "[_", "'", "rate", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "annot", "ation", "\\u", "name_", "=_", "Task", "Queue", "Config_", "._", "get", "\\u", "celery", "\\u", "annot", "ation", "\\u", "name_", "(_", "self_", "._", "\\u", "app", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "celery", "\\u", "annotations_", "._", "append_", "(_", "\"'\"_", "+_", "annot", "ation", "\\u", "name_", "+_", "\"'", ":", " ", "{", "'", "rate", "\\u", "limit", "':", " ", "'\"_", "+_", "rate", "\\u", "limit_", "+_", "\"'", "},\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "celery", "\\u", "queues_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "celery", "\\u", "queues_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "celery", "\\u", "annotations_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "celery", "\\u", "annotations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "\"\"\"", "\\", "10", ";", "from", " ", "kom", "bu", " ", "import", " ", "Exc", "hange", "\\", "10", ";", "from", " ", "kom", "bu", " ", "import", " ", "Queue", "\\", "10", ";", "CEL", "ER", "Y", "\\u", "QUEUE", "S", " ", "=", " ", "(", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "+=_", "celery", "\\u", "queues_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "+=_", "\"\"\"", "\\", "10", ";)", "\\", "10", ";", "CEL", "ER", "Y", "\\u", "ANNOTAT", "IONS", " ", "=", " ", "{", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "+=_", "celery", "\\u", "annotations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "+=_", "\"\"\"", "\\", "10", ";}", "\\", "10", ";", "#", " ", "Every", "time", " ", "a", " ", "task", " ", "is", " ", "enqueue", "d", " ", "a", " ", "temporar", "y", " ", "queue", " ", "is", " ", "created", " ", "to", " ", "store", "\\", "10", ";", "#", " ", "results", " ", "int", "o", " ", "rabbitmq", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "bad", " ", "in", " ", "a", " ", "high", " ", "enqueue", " ", "environ", "ment", "\\", "10", ";", "#", " ", "We", " ", "use", " ", "the", " ", "follow", "ing", " ", "to", " ", "make", " ", "sure", " ", "these", " ", "temp", " ", "queue", "s", " ", "are", " ", "not", " ", "created", ".", " ", "\\", "10", ";", "#", " ", "See", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "714", "402", "5", "/", "temporar", "y", "-", "queue", "-", "made", "-", "in", "-", "celery", "\\", "10", ";", "#", " ", "for", " ", "more", " ", "informati", "on", " ", "on", " ", "this", " ", "issue", ".", "\\", "10", ";", "CEL", "ER", "Y", "\\u", "IGNORE", "\\u", "RESU", "LT", " ", "=", " ", "Tru", "e", "\\", "10", ";", "CEL", "ER", "Y", "\\u", "STORE", "\\u", "ERRORS", "\\u", "EVE", "N", "\\u", "IF", "\\u", "IGNORE", "D", " ", "=", " ", "Fal", "se", "\\", "10", ";", "\\", "10", ";", "#", " ", "One", " ", "month", " ", "expir", "ation", " ", "date", " ", "bec", "aus", "e", " ", "a", " ", "task", " ", "can", " ", "be", " ", "defer", "red", " ", "tha", "t", " ", "long", ".", "\\", "10", ";", "CEL", "ER", "Y", "\\u", "AMQ", "P", "\\u", "TASK", "\\u", "RESU", "LT", "\\u", "EXPIRE", "S", " ", "=", " ", "267", "840", "0", "\\", "10", ";", "\\", "10", ";", "#", " ", "Disa", "ble", " ", "prefetch", "ing", " ", "for", " ", "celery", " ", "worker", "s", ".", " ", "If", " ", "task", "s", " ", "are", " ", "small", " ", "in", " ", "duration", " ", "this", "\\", "10", ";", "#", " ", "shou", "ld", " ", "be", " ", "set", " ", "to", " ", "a", " ", "higher", " ", "value", " ", "(", "64", "-1", "2", "8", ")", " ", "for", " ", "increase", "d", " ", "perform", "anc", "e", ".", "\\", "10", ";", "#", " ", "See", ":", " ", "http", "://", "celery", ".", "read", "the", "docs", ".", "org", "/", "en", "/", "late", "st", "/", "user", "guide", "/", "optim", "izi", "ng", ".", "html", "#", "worker", "-", "settings", "\\", "10", ";", "CEL", "ER", "YD", "\\u", "PREF", "ETC", "H", "\\u", "MULTIP", "LIE", "R", " ", "=", " ", "1", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "file_", "=_", "self_", "._", "\\u", "app", "\\u", "id_", "+_", "\".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "io_", "._", "write_", "(_", "self_", "._", "CEL", "ER", "Y", "\\u", "CONFIG", "\\u", "DIR_", "+_", "config", "\\u", "file_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "CEL", "ER", "Y", "\\u", "CONFIG", "\\u", "DIR_", "+_", "config", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "broker", "\\u", "location_", "(_", "self_", ",_", "broker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", "s", " ", "the", " ", "broker", " ", "location", " ", "connecti", "on", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "broker", ":", " ", "The", " ", "broker", " ", "enum", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "broker", " ", "connecti", "on", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Not", "Impl", "ement", "ed", "Error", ":", " ", "If", " ", "the", " ", "broker", " ", "is", " ", "not", " ", "implemented", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "broker_", "==_", "self_", "._", "RA", "BB", "IT", "MQ", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "broker", "s_", "import_", "rabbitmq", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rabbitmq", "_", "._", "get", "\\u", "connecti", "on", "\\u", "string_", "(_", ")_", "\\u\\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_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "give", "n", " ", "broker", " ", "of", " ", "code", " ", "%", "d", " ", "is", " ", "not", " ", "implemented", "\"_", "%_", "broker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\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", "broker", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", "s", " ", "the", " ", "broker", " ", "connecti", "on", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "string", " ", "whi", "ch", " ", "tell", "s", " ", "of", " ", "the", " ", "location", " ", "of", " ", "the", " ", "configur", "ed", " ", "broker", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "broker", "\\u", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validat", "e\\u", "queue", "\\u", "name_", "(_", "self_", ",_", "queue", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Validate", "s", " ", "the", " ", "queue", " ", "name", " ", "to", " ", "make", " ", "sure", " ", "it", " ", "can", " ", "be", " ", "used", " ", "as", " ", "a", " ", "function", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "queue", "\\u", "name", ":", " ", "A", " ", "string", " ", "represent", "ing", " ", "a", " ", "queue", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Name", "Error", " ", "if", " ", "the", " ", "name", " ", "is", " ", "invalid", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "QUEUE", "\\u", "NAME", "\\u", "RE_", "._", "match_", "(_", "queue", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Name", "Error_", "(_", "\"", "Queue", " ", "name", " ", "%", "s", " ", "did", " ", "not", " ", "match", " ", "the", " ", "regex", " ", "%", "s", "\"_", "%_", "(_", "queue", "\\u", "name_", ",_", "self_", "._", "QUEUE", "\\u", "NAME", "\\u", "PATTERN_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Queue", "Config_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "celery", "\\u", "queue", "\\u", "name_", "(_", "app", "\\u", "id_", ",_", "queue", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", "s", " ", "a", " ", "usable", " ", "queue", " ", "name", " ", "for", " ", "celery", " ", "to", " ", "prevent", "\\", "10", ";", " ", " ", " ", " ", "collisions", " ", "where", " ", "mul", "it", "ple", " ", "apps", " ", "have", " ", "the", " ", "same", " ", "name", " ", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "a", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "app", "\\u", "id", ":", " ", "The", " ", "applica", "tion", " ", "ID", ".", "\\", "10", ";", " ", " ", "queue", "\\u", "name", ":", " ", "String", " ", "name", " ", "of", " ", "the", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "string", " ", "to", " ", "reference", " ", "the", " ", "queue", " ", "name", " ", "in", " ", "celery", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "app", "\\u", "id_", "+_", "\"\\u\\u", "\\u\"_", "+_", "queue", "\\u", "name_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Unused import
cimatosa/jobmanager/jobmanager/clients.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nThe clients module\n\nThis module provides special subclasses of the JobManager_Client\n\"\"\"\n\nimport os\nimport sys\nimport traceback\n\nfrom .jobmanager import JobManager_Client\nfrom . import ode_wrapper\n\n\n\n\n \n \n \n \n \n \n \n \n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def merge_arg_and_const_arg(arg, const_arg):\n \"\"\"\n prepares data from arg and const_arg such that they can be passed\n to the general integration routine\n \n arg and const_arg are both assumed to be dictionaries\n \n the merge process must not alter arg nor const_arg\n in order to be used in the jobmanager context\n \n returns the arguments passed to the function\n defining the derivative such that\n args_dgl = arg['args'] + const_arg['args']\n where as arg['args'] and const_arg['args'] have been assumed to be tuples\n \n e.g. \n arg['args'] = (2, 'low')\n const_arg['args'] = (15, np.pi)\n f will be called with\n f(t, x, 2, 'low', 15, np.pi)\n \n returns further the combined dictionary\n arg + const_arg with the keyword 'args' removed\n \n For any duplicate keys the value will be the value\n from the 'arg' dictionary. \n \"\"\"\n \n # allows arg to be a namedtuple (or any other object that\n # can be converted to a dict)\n # the purpose is that dicts are not allowed as keys for\n # the persistent data structure, where as namedtupled are\n # and therefore arg as a neamedtuple may be used to identify\n # the result of this calculation in the database\n if hasattr(arg, '_asdict'):\n arg = arg._asdict()\n \n # same for const_arg, as a reason of consistency\n if hasattr(const_arg, '_asdict'):\n const_arg = const_arg._asdict() \n \n # extract the args keyword from arg and const_arg\n args_dgl = tuple()\n if 'args' in arg:\n args_dgl += arg['args']\n if 'args' in const_arg:\n args_dgl += const_arg['args']\n\n kwargs = {}\n kwargs.update(const_arg)\n kwargs.update(arg)\n # remove args as they have been constructed explicitly\n if 'args' in kwargs:\n del kwargs['args']\n \n # remove id, when it comes from the persistentDataServer \n if 'id' in kwargs:\n del kwargs['id']\n \n return args_dgl, kwargs", "metadata": "root.merge_arg_and_const_arg", "header": "['module', '___EOS___']", "index": 16 }, { "content": "class Integration_Client_CPLX(JobManager_Client):\n \"\"\"\n A JobManager_Client subclass to integrate a set of complex valued ODE.\n \n 'arg' and 'const_arg' are understood as keyword arguments in oder to\n call ode_wrapper.integrate_cplx. They are passed to merge_arg_and_const_arg\n in order to separate the kwargs needed by ode_wrapper.integrate_cplx\n from the args (as tupled) passed to the function calculating derivative of the DGL.\n This tuple of parameters itself is passed as a special argument to\n ode_wrapper.integrate_cplx namely 'args'.\n \n If 'arg' or 'const_arg' provide the attribute '_asdict' it will be called\n in order to construct dictionaries and use them for further processing.\n \n The following keys MUST be provided by 'arg' or 'const_arg'\n \n t0 : initial time\n t1 : final time\n N : number of time steps for the solution x(t)\n t = linspace(t0, t1, N)\n f : function holding the derivatives \n args : additional positional arguments passed to f(t, x, *args)\n x0 : initial value\n integrator : type of integration method\n 'zvode': complex version of vode,\n in case of stiff ode, f needs to be analytic\n see also scipy.integrate.ode -> 'zvode'\n most efficient for complex ODE\n 'vode', 'lsoda': both do automatic converkwargs.pop('args')sion from the\n complex ODE to the doubly dimensioned real\n system of ODE, and use the corresponding real\n integrator methods.\n Might be of the order of one magnitude slower\n that 'zvode'. Consider using Integration_Client_REAL\n in the first place. \n \n optional keys are:\n verbose : default 0\n integrator related arguments (see the scipy doc ODE)\n \n The key 'args' itself (should be tuple) will be merged as\n kwargs['args'] = arg['args'] + const_arg['args'] \n which means that the call signature of f has to be\n f(t, x, arg_1, arg_2, ... const_arg_1, const_arg_2, ...). \n \"\"\"\n ", "metadata": "root.Integration_Client_CPLX", "header": "['module', '___EOS___']", "index": 78 }, { "content": " def __init__(self, **kwargs):\n super(Integration_Client_CPLX, self).__init__(**kwargs)", "metadata": "root.Integration_Client_CPLX.__init__", "header": "['class', 'Integration_Client_CPLX', '(', 'JobManager_Client', ')', ':', '___EOS___']", "index": 123 }, { "content": " @staticmethod\n def func(arg, const_arg, c, m):\n # named tupled to dict conversion moved to merge_arg_and_const_arg\n args_dgl, kwargs = merge_arg_and_const_arg(arg, const_arg)\n m.value = kwargs['N']\n \n # t0, t1, N, f, args, x0, integrator, verbose, c, **kwargs\n return ode_wrapper.integrate_cplx(c=c, args=args_dgl, **kwargs)", "metadata": "root.Integration_Client_CPLX.func", "header": "['class', 'Integration_Client_CPLX', '(', 'JobManager_Client', ')', ':', '___EOS___']", "index": 126 }, { "content": "class Integration_Client_REAL(JobManager_Client):\n \"\"\"\n A JobManager_Client subclass to integrate a set of complex real ODE.\n \n same behavior as described for Integration_Client_CPLX except\n that 'vode' and 'lsoda' do not do any wrapping, so there is no\n performance issue and 'zvode' is obviously not supported. \n \"\"\"\n ", "metadata": "root.Integration_Client_REAL", "header": "['module', '___EOS___']", "index": 137 }, { "content": " def __init__(self, **kwargs):\n super(Integration_Client_REAL, self).__init__(**kwargs)", "metadata": "root.Integration_Client_REAL.__init__", "header": "['class', 'Integration_Client_REAL', '(', 'JobManager_Client', ')', ':', '___EOS___']", "index": 145 }, { "content": " @staticmethod\n def func(arg, const_arg, c, m):\n # named tupled to dict conversion moved to merge_arg_and_const_arg\n args_dgl, kwargs = merge_arg_and_const_arg(arg, const_arg)\n m.value = kwargs['N']\n \n # t0, t1, N, f, args, x0, integrator, verbose, c, **kwargs\n return ode_wrapper.integrate_real(c=c, args=args_dgl, **kwargs)", "metadata": "root.Integration_Client_REAL.func", "header": "['class', 'Integration_Client_REAL', '(', 'JobManager_Client', ')', ':', '___EOS___']", "index": 148 }, { "content": "class FunctionCall_Client(JobManager_Client):", "metadata": "root.FunctionCall_Client", "header": "['module', '___EOS___']", "index": 159 }, { "content": " @staticmethod\n def func(arg, const_arg, c, m):\n if hasattr(arg, '_asdict'):\n arg = arg._asdict()\n if hasattr(const_arg, '_asdict'):\n const_arg = const_arg._asdict() \n \n f = const_arg['f']\n f_kwargs = {}\n f_kwargs.update(arg)\n f_kwargs.update(const_arg)\n f_kwargs.pop('f')\n f_kwargs['__c'] = c\n f_kwargs['__m'] = m\n \n return f(**f_kwargs)", "metadata": "root.FunctionCall_Client.func", "header": "['class', 'FunctionCall_Client', '(', 'JobManager_Client', ')', ':', '___EOS___']", "index": 160 } ]
[ { "span": "import os", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 9 }, { "span": "import sys", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 10 }, { "span": "import traceback", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "The", " ", "clients", " ", "module", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "module", " ", "provide", "s", " ", "special", " ", "subclasses", " ", "of", " ", "the", " ", "Jo", "b", "Manager", "\\u", "Client", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "job", "manager_", "import_", "Jo", "b", "Manager", "\\u", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "ode", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "merge", "\\u", "arg", "\\u", "and", "\\u", "const", "\\u", "arg_", "(_", "arg_", ",_", "const", "\\u", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "prepar", "es", " ", "data", " ", "from", " ", "arg", " ", "and", " ", "const", "\\u", "arg", " ", "suc", "h", " ", "tha", "t", " ", "the", "y", " ", "can", " ", "be", " ", "pass", "ed", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "genera", "l", " ", "integrati", "on", " ", "routin", "e", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "arg", " ", "and", " ", "const", "\\u", "arg", " ", "are", " ", "bot", "h", " ", "assume", "d", " ", "to", " ", "be", " ", "dictionar", "ies", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "merge", " ", "process", " ", "must", " ", "not", " ", "alter", " ", "arg", " ", "nor", " ", "const", "\\u", "arg", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "order", " ", "to", " ", "be", " ", "used", " ", "in", " ", "the", " ", "job", "manage", "r", " ", "context", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "the", " ", "argu", "ment", "s", " ", "pass", "ed", " ", "to", " ", "the", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "defini", "ng", " ", "the", " ", "deriv", "ative", " ", "suc", "h", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "args", "\\u", "dg", "l", " ", "=", " ", "arg", "['", "args", "']", " ", "+", " ", "const", "\\u", "arg", "['", "args", "']", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "as", " ", "arg", "['", "args", "']", " ", "and", " ", "const", "\\u", "arg", "['", "args", "']", " ", "have", " ", "bee", "n", " ", "assume", "d", " ", "to", " ", "be", " ", "tuple", "s", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "arg", "['", "args", "']", " ", "=", " ", "(", "2", ",", " ", "'", "low", "')", "\\", "10", ";", " ", " ", " ", " ", "const", "\\u", "arg", "['", "args", "']", " ", "=", " ", "(", "15", ",", " ", "np", ".", "pi", ")", "\\", "10", ";", " ", " ", " ", " ", "f", " ", "will", " ", "be", " ", "call", "ed", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "f", "(", "t", ",", " ", "x", ",", " ", "2", ",", " ", "'", "low", "',", " ", "15", ",", " ", "np", ".", "pi", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "fur", "ther", " ", "the", " ", "combin", "ed", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "arg", " ", "+", " ", "const", "\\u", "arg", " ", "with", " ", "the", " ", "keyw", "ord", " ", "'", "args", "'", " ", "remove", "d", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "any", " ", "duplicat", "e", " ", "keys", " ", "the", " ", "value", " ", "will", " ", "be", " ", "the", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "the", " ", "'", "arg", "'", " ", "dictionar", "y", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "allow", "s", " ", "arg", " ", "to", " ", "be", " ", "a", " ", "namedtupl", "e", " ", "(", "or", " ", "any", " ", "other", " ", "object", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "be", " ", "convert", "ed", " ", "to", " ", "a", " ", "dict", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "purpose", " ", "is", " ", "tha", "t", " ", "dict", "s", " ", "are", " ", "not", " ", "allow", "ed", " ", "as", " ", "keys", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "persiste", "nt", " ", "data", " ", "structure", ",", " ", "where", " ", "as", " ", "namedtupl", "ed", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "there", "fore", " ", "arg", " ", "as", " ", "a", " ", "nea", "med", "tuple", " ", "may", " ", "be", " ", "used", " ", "to", " ", "identify", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "result", " ", "of", " ", "this", " ", "calculati", "on", " ", "in", " ", "the", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "arg_", ",_", "'\\u", "asd", "ict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg_", "=_", "arg_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "same", " ", "for", " ", "const", "\\u", "arg", ",", " ", "as", " ", "a", " ", "reason", " ", "of", " ", "consiste", "ncy_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "const", "\\u", "arg_", ",_", "'\\u", "asd", "ict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "const", "\\u", "arg_", "=_", "const", "\\u", "arg_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "the", " ", "args", " ", "keyw", "ord", " ", "from", " ", "arg", " ", "and", " ", "const", "\\u", "arg_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args", "\\u", "dg", "l_", "=_", "tuple_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "args", "'_", "in_", "arg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dg", "l_", "+=_", "arg_", "[_", "'", "args", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "args", "'_", "in_", "const", "\\u", "arg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dg", "l_", "+=_", "const", "\\u", "arg_", "[_", "'", "args", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "const", "\\u", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "args", " ", "as", " ", "the", "y", " ", "have", " ", "bee", "n", " ", "construct", "ed", " ", "explicit", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "args", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "kwargs_", "[_", "'", "args", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "id", ",", " ", "whe", "n", " ", "it", " ", "come", "s", " ", "from", " ", "the", " ", "persiste", "nt", "Data", "Server", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "id", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "kwargs_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "args", "\\u", "dg", "l_", ",_", "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_", "class_", "Integrati", "on", "\\u", "Client", "\\u", "CP", "LX", "_", "(_", "Jo", "b", "Manager", "\\u", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Jo", "b", "Manager", "\\u", "Client", " ", "subclass", " ", "to", " ", "integrate", " ", "a", " ", "set", " ", "of", " ", "complex", " ", "valued", " ", "ODE", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "'", "arg", "'", " ", "and", " ", "'", "const", "\\u", "arg", "'", " ", "are", " ", "underst", "oo", "d", " ", "as", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "in", " ", "ode", "r", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "call", " ", "ode", "\\u", "wrapp", "er", ".", "integrate", "\\u", "cpl", "x", ".", " ", "The", "y", " ", "are", " ", "pass", "ed", " ", "to", " ", "merge", "\\u", "arg", "\\u", "and", "\\u", "const", "\\u", "arg", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "order", " ", "to", " ", "separate", " ", "the", " ", "kwarg", "s", " ", "need", "ed", " ", "by", " ", "ode", "\\u", "wrapp", "er", ".", "integrate", "\\u", "cpl", "x", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "the", " ", "args", " ", "(", "as", " ", "tuple", "d", ")", " ", "pass", "ed", " ", "to", " ", "the", " ", "function", " ", "calculati", "ng", " ", "deriv", "ative", " ", "of", " ", "the", " ", "DG", "L", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "tuple", " ", "of", " ", "parameter", "s", " ", "its", "elf", " ", "is", " ", "pass", "ed", " ", "as", " ", "a", " ", "special", " ", "argu", "ment", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "ode", "\\u", "wrapp", "er", ".", "integrate", "\\u", "cpl", "x", " ", "namel", "y", " ", "'", "args", "'.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "'", "arg", "'", " ", "or", " ", "'", "const", "\\u", "arg", "'", " ", "provide", " ", "the", " ", "attribute", " ", "'\\u", "asd", "ict", "'", " ", "it", " ", "will", " ", "be", " ", "call", "ed", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "order", " ", "to", " ", "construct", " ", "dictionar", "ies", " ", "and", " ", "use", " ", "them", " ", "for", " ", "fur", "ther", " ", "process", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "follow", "ing", " ", "keys", " ", "MUS", "T", " ", "be", " ", "provided", " ", "by", " ", "'", "arg", "'", " ", "or", " ", "'", "const", "\\u", "arg", "'", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "t0", " ", " ", " ", " ", ":", " ", "initial", " ", "time", "\\", "10", ";", " ", " ", " ", " ", "t1", " ", " ", " ", " ", ":", " ", "final", " ", "time", "\\", "10", ";", " ", " ", " ", " ", "N", " ", " ", " ", " ", " ", ":", " ", "number", " ", "of", " ", "time", " ", "step", "s", " ", "for", " ", "the", " ", "solut", "ion", " ", "x", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "t", " ", "=", " ", "lins", "pace", "(", "t0", ",", " ", "t1", ",", " ", "N", ")", "\\", "10", ";", " ", " ", " ", " ", "f", " ", " ", " ", " ", " ", ":", " ", "function", " ", "holding", " ", "the", " ", "derivatives", " ", "\\", "10", ";", " ", " ", " ", " ", "args", " ", " ", ":", " ", "addition", "al", " ", "positional", " ", "argu", "ment", "s", " ", "pass", "ed", " ", "to", " ", "f", "(", "t", ",", " ", "x", ",", " ", "*", "args", ")", "\\", "10", ";", " ", " ", " ", " ", "x0", " ", " ", " ", " ", ":", " ", "initial", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "integra", "tor", " ", " ", " ", " ", ":", " ", "type", " ", "of", " ", "integrati", "on", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "'", "zv", "ode", "':", " ", "complex", " ", "version", " ", "of", " ", "vod", "e", ",", "\\", "10", ";", " ", " ", " ", "in", " ", "case", " ", "of", " ", "sti", "ff", " ", "ode", ",", " ", "f", " ", "need", "s", " ", "to", " ", "be", " ", "analytic", "\\", "10", ";", " ", " ", " ", "see", " ", "als", "o", " ", "sci", "py", ".", "integrate", ".", "ode", " ", "->", " ", "'", "zv", "ode", "'", "\\", "10", ";", " ", " ", " ", "most", " ", "efficien", "t", " ", "for", " ", "complex", " ", "ODE", "\\", "10", ";", " ", " ", " ", " ", "'", "vod", "e", "',", " ", "'", "lso", "da", "':", " ", "bot", "h", " ", "do", " ", "automati", "c", " ", "conve", "rk", "war", "gs", ".", "pop", "('", "args", "')", "sion", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", "complex", " ", "ODE", " ", "to", " ", "the", " ", "dou", "bly", " ", "dimension", "ed", " ", "real", "\\", "10", ";", " ", " ", " ", "system", " ", "of", " ", "ODE", ",", " ", "and", " ", "use", " ", "the", " ", "correspond", "ing", " ", "real", "\\", "10", ";", " ", " ", " ", "integra", "tor", " ", "method", "s", ".", "\\", "10", ";", " ", " ", " ", "Mi", "ght", " ", "be", " ", "of", " ", "the", " ", "order", " ", "of", " ", "one", " ", "magnitude", " ", "slowe", "r", "\\", "10", ";", " ", " ", " ", "tha", "t", " ", "'", "zv", "ode", "'.", " ", "Consider", " ", "usi", "ng", " ", "Integrati", "on", "\\u", "Client", "\\u", "REAL", "\\", "10", ";", " ", " ", " ", "in", " ", "the", " ", "first", " ", "place", ".", " ", " ", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "option", "al", " ", "keys", " ", "are", ":", "\\", "10", ";", " ", " ", " ", " ", "verbo", "se", " ", " ", " ", " ", ":", " ", "default", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "integra", "tor", " ", "relate", "d", " ", "argu", "ment", "s", " ", "(", "see", " ", "the", " ", "sci", "py", " ", "doc", " ", "ODE", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "key", " ", "'", "args", "'", " ", "its", "elf", " ", "(", "shou", "ld", " ", "be", " ", "tuple", ")", " ", "will", " ", "be", " ", "merge", "d", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", "['", "args", "']", " ", "=", " ", "arg", "['", "args", "']", " ", "+", " ", "const", "\\u", "arg", "['", "args", "']", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "means", " ", "tha", "t", " ", "the", " ", "call", " ", "signa", "ture", " ", "of", " ", "f", " ", "has", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "f", "(", "t", ",", " ", "x", ",", " ", "arg", "\\u", "1", ",", " ", "arg", "\\u", "2", ",", " ", "...", " ", "const", "\\u", "arg", "\\u", "1", ",", " ", "const", "\\u", "arg", "\\u", "2", ",", " ", "...)", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Integrati", "on", "\\u", "Client", "\\u", "CP", "LX", "_", "(_", "Jo", "b", "Manager", "\\u", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Integrati", "on", "\\u", "Client", "\\u", "CP", "LX", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Integrati", "on", "\\u", "Client", "\\u", "CP", "LX", "_", "(_", "Jo", "b", "Manager", "\\u", "Client_", ")_", ":_", "\\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_", "func_", "(_", "arg_", ",_", "const", "\\u", "arg_", ",_", "c_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "named", " ", "tuple", "d", " ", "to", " ", "dict", " ", "conve", "rsi", "on", " ", "moved", " ", "to", " ", "merge", "\\u", "arg", "\\u", "and", "\\u", "const", "\\u", "arg_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dg", "l_", ",_", "kwargs_", "=_", "merge", "\\u", "arg", "\\u", "and", "\\u", "const", "\\u", "arg_", "(_", "arg_", ",_", "const", "\\u", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "value_", "=_", "kwargs_", "[_", "'", "N", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "t0", ",", " ", "t1", ",", " ", "N", ",", " ", "f", ",", " ", "args", ",", " ", "x0", ",", " ", "integra", "tor", ",", " ", "verbo", "se", ",", " ", "c", ",", " ", "**", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "ode", "\\u", "wrapper_", "._", "integrate", "\\u", "cpl", "x_", "(_", "c_", "=_", "c_", ",_", "args_", "=_", "args", "\\u", "dg", "l_", ",_", "**_", "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_", "Integrati", "on", "\\u", "Client", "\\u", "REAL", "_", "(_", "Jo", "b", "Manager", "\\u", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Jo", "b", "Manager", "\\u", "Client", " ", "subclass", " ", "to", " ", "integrate", " ", "a", " ", "set", " ", "of", " ", "complex", " ", "real", " ", "ODE", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "same", " ", "behavior", " ", "as", " ", "descri", "bed", " ", "for", " ", "Integrati", "on", "\\u", "Client", "\\u", "CP", "LX", " ", "except", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "'", "vod", "e", "'", " ", "and", " ", "'", "lso", "da", "'", " ", "do", " ", "not", " ", "do", " ", "any", " ", "wrapp", "ing", ",", " ", "so", " ", "there", " ", "is", " ", "no", "\\", "10", ";", " ", " ", " ", " ", "perform", "anc", "e", " ", "issue", " ", "and", " ", "'", "zv", "ode", "'", " ", "is", " ", "ob", "vio", "usl", "y", " ", "not", " ", "support", "ed", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Integrati", "on", "\\u", "Client", "\\u", "REAL", "_", "(_", "Jo", "b", "Manager", "\\u", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Integrati", "on", "\\u", "Client", "\\u", "REAL", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Integrati", "on", "\\u", "Client", "\\u", "REAL", "_", "(_", "Jo", "b", "Manager", "\\u", "Client_", ")_", ":_", "\\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_", "func_", "(_", "arg_", ",_", "const", "\\u", "arg_", ",_", "c_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "named", " ", "tuple", "d", " ", "to", " ", "dict", " ", "conve", "rsi", "on", " ", "moved", " ", "to", " ", "merge", "\\u", "arg", "\\u", "and", "\\u", "const", "\\u", "arg_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dg", "l_", ",_", "kwargs_", "=_", "merge", "\\u", "arg", "\\u", "and", "\\u", "const", "\\u", "arg_", "(_", "arg_", ",_", "const", "\\u", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "value_", "=_", "kwargs_", "[_", "'", "N", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "t0", ",", " ", "t1", ",", " ", "N", ",", " ", "f", ",", " ", "args", ",", " ", "x0", ",", " ", "integra", "tor", ",", " ", "verbo", "se", ",", " ", "c", ",", " ", "**", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "ode", "\\u", "wrapper_", "._", "integrate", "\\u", "real_", "(_", "c_", "=_", "c_", ",_", "args_", "=_", "args", "\\u", "dg", "l_", ",_", "**_", "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_", "Function", "Call", "\\u", "Client_", "(_", "Jo", "b", "Manager", "\\u", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Call", "\\u", "Client_", "(_", "Jo", "b", "Manager", "\\u", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "func_", "(_", "arg_", ",_", "const", "\\u", "arg_", ",_", "c_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "arg_", ",_", "'\\u", "asd", "ict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg_", "=_", "arg_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "const", "\\u", "arg_", ",_", "'\\u", "asd", "ict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "const", "\\u", "arg_", "=_", "const", "\\u", "arg_", "._", "\\u", "asd", "ict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "const", "\\u", "arg_", "[_", "'", "f", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "kwargs_", "._", "update_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "kwargs_", "._", "update_", "(_", "const", "\\u", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "kwargs_", "._", "pop_", "(_", "'", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "kwargs_", "[_", "'\\u", "\\u", "c", "'_", "]_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "kwargs_", "[_", "'\\u", "\\u", "m", "'_", "]_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "f_", "(_", "**_", "f", "\\u", "kwargs_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
rvanlaar/easy-transifex/src/transifex/transifex/resources/tests/lib/qt/__init__.py
[ { "content": " def test_context_generation(self):\n \"\"\"Test creating the context of a source entity.\"\"\"\n testfile = os.path.join(\n os.path.dirname(__file__),\n 'comment/en.ts'\n )\n handler = LinguistHandler(testfile)\n handler.bind_resource(self.resource)\n handler.set_language(self.language)\n handler.parse_file(is_source=True)\n handler.save2db(is_source=True)\n handler.compile()\n doc = xml.dom.minidom.parseString(handler.compiled_template)\n root = doc.documentElement\n for message in doc.getElementsByTagName(\"message\"):\n source = _getElementByTagName(message, \"source\")\n sourceString = _getText(source.childNodes)\n generated_context = handler._context_of_message(message)\n # this shouldn't raise any exceptions\n se = SourceEntity.objects.get(\n resource=self.resource, string=sourceString,\n context=generated_context or u\"None\"\n )", "metadata": "root.TestQtFile.test_context_generation", "header": "['class', 'TestQtFile', '(', 'FormatsBaseTestCase', ')', ':', '___EOS___']", "index": 373 } ]
[ { "span": "root ", "start_line": 386, "start_column": 8, "end_line": 386, "end_column": 12 }, { "span": "se ", "start_line": 392, "start_column": 12, "end_line": 392, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Qt", "File_", "(_", "Format", "s", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "context", "\\u", "generation_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "creati", "ng", " ", "the", " ", "context", " ", "of", " ", "a", " ", "source", " ", "entity", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "comment", "/", "en", ".", "ts", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "Lin", "gui", "st", "Handler_", "(_", "testfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "bind", "\\u", "resource_", "(_", "self_", "._", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set\\u", "language_", "(_", "self_", "._", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "parse", "\\u", "file_", "(_", "is", "\\u", "source_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "save", "2d", "b_", "(_", "is", "\\u", "source_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "xml_", "._", "dom_", "._", "minidom_", "._", "parse", "String_", "(_", "handler_", "._", "compile", "d\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "doc_", "._", "document", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "message_", "in_", "doc_", "._", "get", "Element", "s", "By", "Ta", "g", "Name_", "(_", "\"", "message", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "\\u", "get", "Element", "By", "Ta", "g", "Name_", "(_", "message_", ",_", "\"", "source", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "String_", "=_", "\\u", "get", "Text_", "(_", "source_", "._", "child", "Nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generat", "ed", "\\u", "context_", "=_", "handler_", "._", "\\u", "context", "\\u", "of", "\\u", "message_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", "n", "'", "t", " ", "raise", " ", "any", " ", "exceptions_", "\\u\\u\\uNL\\u\\u\\u_", "se_", "=_", "Sou", "rce", "Entity_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "self_", "._", "resource_", ",_", "string_", "=_", "source", "String_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "generat", "ed", "\\u", "context_", "or_", "u", "\"", "Non", "e", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
lisa-lab/pylearn2/pylearn2/models/tests/test_s3c_inference.py
[ { "content": " def test_grad_s(self):\n\n \"tests that the gradients with respect to s_i are 0 after doing a mean field update of s_i \"\n\n model = self.model\n e_step = self.e_step\n X = self.X\n\n assert X.shape[0] == self.m\n\n model.test_batch_size = X.shape[0]\n\n init_H = e_step.init_H_hat(V = X)\n init_Mu1 = e_step.init_S_hat(V = X)\n\n prev_setting = config.compute_test_value\n config.compute_test_value= 'off'\n H, Mu1 = function([], outputs=[init_H, init_Mu1])()\n config.compute_test_value = prev_setting\n\n H = broadcast(H, self.m)\n Mu1 = broadcast(Mu1, self.m)\n\n H = np.cast[config.floatX](self.model.rng.uniform(0.,1.,H.shape))\n Mu1 = np.cast[config.floatX](self.model.rng.uniform(-5.,5.,Mu1.shape))\n\n\n\n H_var = T.matrix(name='H_var')\n H_var.tag.test_value = H\n Mu1_var = T.matrix(name='Mu1_var')\n Mu1_var.tag.test_value = Mu1\n idx = T.iscalar()\n idx.tag.test_value = 0\n\n\n S = e_step.infer_S_hat(V = X, H_hat = H_var, S_hat = Mu1_var)\n\n s_idx = S[:,idx]\n\n s_i_func = function([H_var,Mu1_var,idx],s_idx)\n\n sigma0 = 1. / model.alpha\n Sigma1 = e_step.infer_var_s1_hat()\n mu0 = T.zeros_like(model.mu)\n\n #by truncated KL, I mean that I am dropping terms that don't depend on H and Mu1\n # (they don't affect the outcome of this test and some of them are intractable )\n trunc_kl = - model.entropy_hs(H_hat = H_var, var_s0_hat = sigma0, var_s1_hat = Sigma1) + \\\n model.expected_energy_vhs(V = X, H_hat = H_var, S_hat = Mu1_var, var_s0_hat = sigma0, var_s1_hat = Sigma1)\n\n grad_Mu1 = T.grad(trunc_kl.sum(), Mu1_var)\n\n grad_Mu1_idx = grad_Mu1[:,idx]\n\n grad_func = function([H_var, Mu1_var, idx], grad_Mu1_idx)\n\n for i in xrange(self.N):\n Mu1[:,i] = s_i_func(H, Mu1, i)\n\n g = grad_func(H,Mu1,i)\n\n assert not contains_nan(g)\n\n g_abs_max = np.abs(g).max()\n\n\n if g_abs_max > self.tol:\n raise Exception('after mean field step, gradient of kl divergence wrt mean field parameter should be 0, but here the max magnitude of a gradient element is '+str(g_abs_max)+' after updating s_'+str(i))", "metadata": "root.Test_S3C_Inference.test_grad_s", "header": "['class', 'Test_S3C_Inference', ':', '___EOS___']", "index": 117 }, { "content": " def test_value_s(self):\n\n \"tests that the value of the kl divergence decreases with each update to s_i \"\n\n model = self.model\n e_step = self.e_step\n X = self.X\n\n assert X.shape[0] == self.m\n\n init_H = e_step.init_H_hat(V = X)\n init_Mu1 = e_step.init_S_hat(V = X)\n\n prev_setting = config.compute_test_value\n config.compute_test_value= 'off'\n H, Mu1 = function([], outputs=[init_H, init_Mu1])()\n config.compute_test_value = prev_setting\n\n H = broadcast(H, self.m)\n Mu1 = broadcast(Mu1, self.m)\n\n H = np.cast[config.floatX](self.model.rng.uniform(0.,1.,H.shape))\n Mu1 = np.cast[config.floatX](self.model.rng.uniform(-5.,5.,Mu1.shape))\n\n\n H_var = T.matrix(name='H_var')\n H_var.tag.test_value = H\n Mu1_var = T.matrix(name='Mu1_var')\n Mu1_var.tag.test_value = Mu1\n idx = T.iscalar()\n idx.tag.test_value = 0\n\n S = e_step.infer_S_hat( V = X, H_hat = H_var, S_hat = Mu1_var)\n\n s_idx = S[:,idx]\n\n s_i_func = function([H_var,Mu1_var,idx],s_idx)\n\n sigma0 = 1. / model.alpha\n Sigma1 = e_step.infer_var_s1_hat()\n mu0 = T.zeros_like(model.mu)\n\n #by truncated KL, I mean that I am dropping terms that don't depend on H and Mu1\n # (they don't affect the outcome of this test and some of them are intractable )\n trunc_kl = - model.entropy_hs(H_hat = H_var, var_s0_hat = sigma0, var_s1_hat = Sigma1) + \\\n model.expected_energy_vhs(V = X, H_hat = H_var, S_hat = Mu1_var, var_s0_hat = sigma0, var_s1_hat = Sigma1)\n\n trunc_kl_func = function([H_var, Mu1_var], trunc_kl)\n\n for i in xrange(self.N):\n prev_kl = trunc_kl_func(H,Mu1)\n\n Mu1[:,i] = s_i_func(H, Mu1, i)\n\n new_kl = trunc_kl_func(H,Mu1)\n\n\n increase = new_kl - prev_kl\n\n\n mx = increase.max()\n\n if mx > 1e-3:\n raise Exception('after mean field step in s, kl divergence should decrease, but some elements increased by as much as '+str(mx)+' after updating s_'+str(i))", "metadata": "root.Test_S3C_Inference.test_value_s", "header": "['class', 'Test_S3C_Inference', ':', '___EOS___']", "index": 187 }, { "content": " def test_grad_h(self):\n\n \"tests that the gradients with respect to h_i are 0 after doing a mean field update of h_i \"\n\n model = self.model\n e_step = self.e_step\n X = self.X\n\n assert X.shape[0] == self.m\n\n init_H = e_step.init_H_hat(V = X)\n init_Mu1 = e_step.init_S_hat(V = X)\n\n prev_setting = config.compute_test_value\n config.compute_test_value= 'off'\n H, Mu1 = function([], outputs=[init_H, init_Mu1])()\n config.compute_test_value = prev_setting\n\n H = broadcast(H, self.m)\n Mu1 = broadcast(Mu1, self.m)\n\n H = np.cast[config.floatX](self.model.rng.uniform(0.,1.,H.shape))\n Mu1 = np.cast[config.floatX](self.model.rng.uniform(-5.,5.,Mu1.shape))\n\n\n H_var = T.matrix(name='H_var')\n H_var.tag.test_value = H\n Mu1_var = T.matrix(name='Mu1_var')\n Mu1_var.tag.test_value = Mu1\n idx = T.iscalar()\n idx.tag.test_value = 0\n\n\n new_H = e_step.infer_H_hat(V = X, H_hat = H_var, S_hat = Mu1_var)\n h_idx = new_H[:,idx]\n\n updates_func = function([H_var,Mu1_var,idx], h_idx)\n\n sigma0 = 1. / model.alpha\n Sigma1 = e_step.infer_var_s1_hat()\n mu0 = T.zeros_like(model.mu)\n\n #by truncated KL, I mean that I am dropping terms that don't depend on H and Mu1\n # (they don't affect the outcome of this test and some of them are intractable )\n trunc_kl = - model.entropy_hs(H_hat = H_var, var_s0_hat = sigma0, var_s1_hat = Sigma1) + \\\n model.expected_energy_vhs(V = X, H_hat = H_var, S_hat = Mu1_var, var_s0_hat = sigma0,\n var_s1_hat = Sigma1)\n\n grad_H = T.grad(trunc_kl.sum(), H_var)\n\n assert len(grad_H.type.broadcastable) == 2\n\n #from theano.printing import min_informative_str\n #print min_informative_str(grad_H)\n\n #grad_H = Print('grad_H')(grad_H)\n\n #grad_H_idx = grad_H[:,idx]\n\n grad_func = function([H_var, Mu1_var], grad_H)\n\n failed = False\n\n for i in xrange(self.N):\n rval = updates_func(H, Mu1, i)\n H[:,i] = rval\n\n g = grad_func(H,Mu1)[:,i]\n\n assert not contains_nan(g)\n\n g_abs_max = np.abs(g).max()\n\n if g_abs_max > self.tol:\n #print \"new values of H\"\n #print H[:,i]\n #print \"gradient on new values of H\"\n #print g\n\n failed = True\n\n print('iteration ',i)\n #print 'max value of new H: ',H[:,i].max()\n #print 'H for failing g: '\n failing_h = H[np.abs(g) > self.tol, i]\n #print failing_h\n\n #from matplotlib import pyplot as plt\n #plt.scatter(H[:,i],g)\n #plt.show()\n\n #ignore failures extremely close to h=1\n\n high_mask = failing_h > .001\n low_mask = failing_h < .999\n\n mask = high_mask * low_mask\n\n print('masked failures: ',mask.shape[0],' err ',g_abs_max)\n\n if mask.sum() > 0:\n print('failing h passing the range mask')\n print(failing_h[ mask.astype(bool) ])\n raise Exception('after mean field step, gradient of kl divergence'\n ' wrt freshly updated variational parameter should be 0, '\n 'but here the max magnitude of a gradient element is '\n +str(g_abs_max)+' after updating h_'+str(i))\n\n\n #assert not failed", "metadata": "root.Test_S3C_Inference.test_grad_h", "header": "['class', 'Test_S3C_Inference', ':', '___EOS___']", "index": 252 }, { "content": " def test_value_h(self):\n\n \"tests that the value of the kl divergence decreases with each update to h_i \"\n\n model = self.model\n e_step = self.e_step\n X = self.X\n\n assert X.shape[0] == self.m\n\n init_H = e_step.init_H_hat(V = X)\n init_Mu1 = e_step.init_S_hat(V = X)\n\n prev_setting = config.compute_test_value\n config.compute_test_value= 'off'\n H, Mu1 = function([], outputs=[init_H, init_Mu1])()\n config.compute_test_value = prev_setting\n\n H = broadcast(H, self.m)\n Mu1 = broadcast(Mu1, self.m)\n\n H = np.cast[config.floatX](self.model.rng.uniform(0.,1.,H.shape))\n Mu1 = np.cast[config.floatX](self.model.rng.uniform(-5.,5.,Mu1.shape))\n\n\n H_var = T.matrix(name='H_var')\n H_var.tag.test_value = H\n Mu1_var = T.matrix(name='Mu1_var')\n Mu1_var.tag.test_value = Mu1\n idx = T.iscalar()\n idx.tag.test_value = 0\n\n newH = e_step.infer_H_hat(V = X, H_hat = H_var, S_hat = Mu1_var)\n\n\n h_idx = newH[:,idx]\n\n\n h_i_func = function([H_var,Mu1_var,idx],h_idx)\n\n sigma0 = 1. / model.alpha\n Sigma1 = e_step.infer_var_s1_hat()\n mu0 = T.zeros_like(model.mu)\n\n #by truncated KL, I mean that I am dropping terms that don't depend on H and Mu1\n # (they don't affect the outcome of this test and some of them are intractable )\n trunc_kl = - model.entropy_hs(H_hat = H_var, var_s0_hat = sigma0, var_s1_hat = Sigma1) + \\\n model.expected_energy_vhs(V = X, H_hat = H_var, S_hat = Mu1_var, var_s0_hat = sigma0, var_s1_hat = Sigma1)\n\n trunc_kl_func = function([H_var, Mu1_var], trunc_kl)\n\n for i in xrange(self.N):\n prev_kl = trunc_kl_func(H,Mu1)\n\n H[:,i] = h_i_func(H, Mu1, i)\n #we don't update mu, the whole point of the split e step is we don't have to\n\n new_kl = trunc_kl_func(H,Mu1)\n\n\n increase = new_kl - prev_kl\n\n\n print('failures after iteration ',i,': ',(increase > self.tol).sum())\n\n mx = increase.max()\n\n if mx > 1e-4:\n print('increase amounts of failing examples:')\n print(increase[increase > self.tol])\n print('failing H:')\n print(H[increase > self.tol,:])\n print('failing Mu1:')\n print(Mu1[increase > self.tol,:])\n print('failing V:')\n print(X[increase > self.tol,:])\n\n\n raise Exception('after mean field step in h, kl divergence should decrease, but some elements increased by as much as '+str(mx)+' after updating h_'+str(i))", "metadata": "root.Test_S3C_Inference.test_value_h", "header": "['class', 'Test_S3C_Inference', ':', '___EOS___']", "index": 364 } ]
[ { "span": "mu0 ", "start_line": 161, "start_column": 8, "end_line": 161, "end_column": 11 }, { "span": "mu0 ", "start_line": 227, "start_column": 8, "end_line": 227, "end_column": 11 }, { "span": "mu0 ", "start_line": 292, "start_column": 8, "end_line": 292, "end_column": 11 }, { "span": "failed ", "start_line": 331, "start_column": 16, "end_line": 331, "end_column": 22 }, { "span": "mu0 ", "start_line": 406, "start_column": 8, "end_line": 406, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "\\u", "S", "3", "C", "\\u", "Infer", "ence_", ":_", "\\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", "grad", "\\u", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "tests", " ", "tha", "t", " ", "the", " ", "gradi", "ents", " ", "with", " ", "respec", "t", " ", "to", " ", "s", "\\u", "i", " ", "are", " ", "0", " ", "after", " ", "doi", "ng", " ", "a", " ", "mean", " ", "field", " ", "update", " ", "of", " ", "s", "\\u", "i", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "self_", "._", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "step_", "=_", "self_", "._", "e\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "self_", "._", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "X_", "._", "shape_", "[_", "0_", "]_", "==_", "self_", "._", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "test\\u", "batch", "\\u", "size_", "=_", "X_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "H_", "=_", "e\\u", "step_", "._", "init", "\\u", "H", "\\u", "hat_", "(_", "V_", "=_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "\\u", "Mu", "1_", "=_", "e\\u", "step_", "._", "init", "\\u", "S", "\\u", "hat_", "(_", "V_", "=_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prev", "\\u", "setting_", "=_", "config_", "._", "compute", "\\u", "test\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "compute", "\\u", "test\\u", "value_", "=_", "'", "off", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H_", ",_", "Mu", "1_", "=_", "function_", "(_", "[_", "]_", ",_", "outputs_", "=_", "[_", "init", "\\u", "H_", ",_", "init", "\\u", "Mu", "1_", "]_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "compute", "\\u", "test\\u", "value_", "=_", "prev", "\\u", "setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "=_", "broadcast_", "(_", "H_", ",_", "self_", "._", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1_", "=_", "broadcast_", "(_", "Mu", "1_", ",_", "self_", "._", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "=_", "np_", "._", "cast_", "[_", "config_", "._", "float", "X_", "]_", "(_", "self_", "._", "model_", "._", "rng_", "._", "uniform_", "(_", "0._", ",_", "1._", ",_", "H_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1_", "=_", "np_", "._", "cast_", "[_", "config_", "._", "float", "X_", "]_", "(_", "self_", "._", "model_", "._", "rng_", "._", "uniform_", "(_", "-_", "5._", ",_", "5._", ",_", "Mu", "1_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H", "\\u", "var_", "=_", "T_", "._", "matrix_", "(_", "name_", "=_", "'", "H", "\\u", "var", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H", "\\u", "var_", "._", "tag_", "._", "test\\u", "value_", "=_", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1", "\\u", "var_", "=_", "T_", "._", "matrix_", "(_", "name_", "=_", "'", "Mu", "1", "\\u", "var", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1", "\\u", "var_", "._", "tag_", "._", "test\\u", "value_", "=_", "Mu", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "T_", "._", "isc", "ala", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "._", "tag_", "._", "test\\u", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "e\\u", "step_", "._", "infer", "\\u", "S", "\\u", "hat_", "(_", "V_", "=_", "X_", ",_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "S", "\\u", "hat_", "=_", "Mu", "1", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s", "\\u", "idx_", "=_", "S_", "[_", ":_", ",_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s", "\\u", "i", "\\u", "func_", "=_", "function_", "(_", "[_", "H", "\\u", "var_", ",_", "Mu", "1", "\\u", "var_", ",_", "idx_", "]_", ",_", "s", "\\u", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sigma", "0_", "=_", "1._", "/_", "model_", "._", "alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sigm", "a1_", "=_", "e\\u", "step_", "._", "infer", "\\u", "var", "\\u", "s1", "\\u", "hat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu", "0_", "=_", "T_", "._", "zero", "s", "\\u", "like_", "(_", "model_", "._", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "by", " ", "truncat", "ed", " ", "KL", ",", " ", "I", " ", "mean", " ", "tha", "t", " ", "I", " ", "am", " ", "drop", "ping", " ", "term", "s", " ", "tha", "t", " ", "don", "'", "t", " ", "depend", " ", "on", " ", "H", " ", "and", " ", "Mu", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "the", "y", " ", "don", "'", "t", " ", "affect", " ", "the", " ", "outco", "me", " ", "of", " ", "this", " ", "test", " ", "and", " ", "some", " ", "of", " ", "them", " ", "are", " ", "intra", "ctab", "le", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "trunc", "\\u", "kl_", "=_", "-_", "model_", "._", "entr", "opy", "\\u", "hs_", "(_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "var", "\\u", "s0", "\\u", "hat_", "=_", "sigma", "0_", ",_", "var", "\\u", "s1", "\\u", "hat_", "=_", "Sigm", "a1_", ")_", "+_", "model_", "._", "expected", "\\u", "energ", "y", "\\u", "vh", "s_", "(_", "V_", "=_", "X_", ",_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "S", "\\u", "hat_", "=_", "Mu", "1", "\\u", "var_", ",_", "var", "\\u", "s0", "\\u", "hat_", "=_", "sigma", "0_", ",_", "var", "\\u", "s1", "\\u", "hat_", "=_", "Sigm", "a1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grad", "\\u", "Mu", "1_", "=_", "T_", "._", "grad_", "(_", "trunc", "\\u", "kl_", "._", "sum_", "(_", ")_", ",_", "Mu", "1", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grad", "\\u", "Mu", "1", "\\u", "idx_", "=_", "grad", "\\u", "Mu", "1_", "[_", ":_", ",_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grad", "\\u", "func_", "=_", "function_", "(_", "[_", "H", "\\u", "var_", ",_", "Mu", "1", "\\u", "var_", ",_", "idx_", "]_", ",_", "grad", "\\u", "Mu", "1", "\\u", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Mu", "1_", "[_", ":_", ",_", "i_", "]_", "=_", "s", "\\u", "i", "\\u", "func_", "(_", "H_", ",_", "Mu", "1_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "grad", "\\u", "func_", "(_", "H_", ",_", "Mu", "1_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "contain", "s", "\\u", "nan_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g", "\\u", "abs", "\\u", "max_", "=_", "np_", "._", "abs_", "(_", "g_", ")_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "g", "\\u", "abs", "\\u", "max_", ">_", "self_", "._", "tol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "after", " ", "mean", " ", "field", " ", "step", ",", " ", "gradi", "ent", " ", "of", " ", "kl", " ", "divergence", " ", "wrt", " ", "mean", " ", "field", " ", "parameter", " ", "shou", "ld", " ", "be", " ", "0", ",", " ", "but", " ", "here", " ", "the", " ", "max", " ", "magnitude", " ", "of", " ", "a", " ", "gradi", "ent", " ", "element", " ", "is", " ", "'_", "+_", "str_", "(_", "g", "\\u", "abs", "\\u", "max_", ")_", "+_", "'", " ", "after", " ", "updat", "ing", " ", "s", "\\u'_", "+_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "S", "3", "C", "\\u", "Infer", "ence_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "value", "\\u", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "tests", " ", "tha", "t", " ", "the", " ", "value", " ", "of", " ", "the", " ", "kl", " ", "divergence", " ", "decrease", "s", " ", "with", " ", "each", " ", "update", " ", "to", " ", "s", "\\u", "i", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "self_", "._", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "step_", "=_", "self_", "._", "e\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "self_", "._", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "X_", "._", "shape_", "[_", "0_", "]_", "==_", "self_", "._", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "H_", "=_", "e\\u", "step_", "._", "init", "\\u", "H", "\\u", "hat_", "(_", "V_", "=_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "\\u", "Mu", "1_", "=_", "e\\u", "step_", "._", "init", "\\u", "S", "\\u", "hat_", "(_", "V_", "=_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prev", "\\u", "setting_", "=_", "config_", "._", "compute", "\\u", "test\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "compute", "\\u", "test\\u", "value_", "=_", "'", "off", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H_", ",_", "Mu", "1_", "=_", "function_", "(_", "[_", "]_", ",_", "outputs_", "=_", "[_", "init", "\\u", "H_", ",_", "init", "\\u", "Mu", "1_", "]_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "compute", "\\u", "test\\u", "value_", "=_", "prev", "\\u", "setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "=_", "broadcast_", "(_", "H_", ",_", "self_", "._", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1_", "=_", "broadcast_", "(_", "Mu", "1_", ",_", "self_", "._", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "=_", "np_", "._", "cast_", "[_", "config_", "._", "float", "X_", "]_", "(_", "self_", "._", "model_", "._", "rng_", "._", "uniform_", "(_", "0._", ",_", "1._", ",_", "H_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1_", "=_", "np_", "._", "cast_", "[_", "config_", "._", "float", "X_", "]_", "(_", "self_", "._", "model_", "._", "rng_", "._", "uniform_", "(_", "-_", "5._", ",_", "5._", ",_", "Mu", "1_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H", "\\u", "var_", "=_", "T_", "._", "matrix_", "(_", "name_", "=_", "'", "H", "\\u", "var", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H", "\\u", "var_", "._", "tag_", "._", "test\\u", "value_", "=_", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1", "\\u", "var_", "=_", "T_", "._", "matrix_", "(_", "name_", "=_", "'", "Mu", "1", "\\u", "var", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1", "\\u", "var_", "._", "tag_", "._", "test\\u", "value_", "=_", "Mu", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "T_", "._", "isc", "ala", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "._", "tag_", "._", "test\\u", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "e\\u", "step_", "._", "infer", "\\u", "S", "\\u", "hat_", "(_", "V_", "=_", "X_", ",_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "S", "\\u", "hat_", "=_", "Mu", "1", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s", "\\u", "idx_", "=_", "S_", "[_", ":_", ",_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s", "\\u", "i", "\\u", "func_", "=_", "function_", "(_", "[_", "H", "\\u", "var_", ",_", "Mu", "1", "\\u", "var_", ",_", "idx_", "]_", ",_", "s", "\\u", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sigma", "0_", "=_", "1._", "/_", "model_", "._", "alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sigm", "a1_", "=_", "e\\u", "step_", "._", "infer", "\\u", "var", "\\u", "s1", "\\u", "hat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu", "0_", "=_", "T_", "._", "zero", "s", "\\u", "like_", "(_", "model_", "._", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "by", " ", "truncat", "ed", " ", "KL", ",", " ", "I", " ", "mean", " ", "tha", "t", " ", "I", " ", "am", " ", "drop", "ping", " ", "term", "s", " ", "tha", "t", " ", "don", "'", "t", " ", "depend", " ", "on", " ", "H", " ", "and", " ", "Mu", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "the", "y", " ", "don", "'", "t", " ", "affect", " ", "the", " ", "outco", "me", " ", "of", " ", "this", " ", "test", " ", "and", " ", "some", " ", "of", " ", "them", " ", "are", " ", "intra", "ctab", "le", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "trunc", "\\u", "kl_", "=_", "-_", "model_", "._", "entr", "opy", "\\u", "hs_", "(_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "var", "\\u", "s0", "\\u", "hat_", "=_", "sigma", "0_", ",_", "var", "\\u", "s1", "\\u", "hat_", "=_", "Sigm", "a1_", ")_", "+_", "model_", "._", "expected", "\\u", "energ", "y", "\\u", "vh", "s_", "(_", "V_", "=_", "X_", ",_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "S", "\\u", "hat_", "=_", "Mu", "1", "\\u", "var_", ",_", "var", "\\u", "s0", "\\u", "hat_", "=_", "sigma", "0_", ",_", "var", "\\u", "s1", "\\u", "hat_", "=_", "Sigm", "a1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trunc", "\\u", "kl", "\\u", "func_", "=_", "function_", "(_", "[_", "H", "\\u", "var_", ",_", "Mu", "1", "\\u", "var_", "]_", ",_", "trunc", "\\u", "kl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "\\u", "kl_", "=_", "trunc", "\\u", "kl", "\\u", "func_", "(_", "H_", ",_", "Mu", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mu", "1_", "[_", ":_", ",_", "i_", "]_", "=_", "s", "\\u", "i", "\\u", "func_", "(_", "H_", ",_", "Mu", "1_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "kl_", "=_", "trunc", "\\u", "kl", "\\u", "func_", "(_", "H_", ",_", "Mu", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "increase", "_", "=_", "new", "\\u", "kl_", "-_", "prev", "\\u", "kl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mx_", "=_", "increase", "_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mx_", ">_", "1e-3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "after", " ", "mean", " ", "field", " ", "step", " ", "in", " ", "s", ",", " ", "kl", " ", "divergence", " ", "shou", "ld", " ", "decrease", ",", " ", "but", " ", "some", " ", "element", "s", " ", "increase", "d", " ", "by", " ", "as", " ", "muc", "h", " ", "as", " ", "'_", "+_", "str_", "(_", "mx_", ")_", "+_", "'", " ", "after", " ", "updat", "ing", " ", "s", "\\u'_", "+_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "S", "3", "C", "\\u", "Infer", "ence_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "grad", "\\u", "h_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "tests", " ", "tha", "t", " ", "the", " ", "gradi", "ents", " ", "with", " ", "respec", "t", " ", "to", " ", "h", "\\u", "i", " ", "are", " ", "0", " ", "after", " ", "doi", "ng", " ", "a", " ", "mean", " ", "field", " ", "update", " ", "of", " ", "h", "\\u", "i", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "self_", "._", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "step_", "=_", "self_", "._", "e\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "self_", "._", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "X_", "._", "shape_", "[_", "0_", "]_", "==_", "self_", "._", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "H_", "=_", "e\\u", "step_", "._", "init", "\\u", "H", "\\u", "hat_", "(_", "V_", "=_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "\\u", "Mu", "1_", "=_", "e\\u", "step_", "._", "init", "\\u", "S", "\\u", "hat_", "(_", "V_", "=_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prev", "\\u", "setting_", "=_", "config_", "._", "compute", "\\u", "test\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "compute", "\\u", "test\\u", "value_", "=_", "'", "off", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H_", ",_", "Mu", "1_", "=_", "function_", "(_", "[_", "]_", ",_", "outputs_", "=_", "[_", "init", "\\u", "H_", ",_", "init", "\\u", "Mu", "1_", "]_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "compute", "\\u", "test\\u", "value_", "=_", "prev", "\\u", "setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "=_", "broadcast_", "(_", "H_", ",_", "self_", "._", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1_", "=_", "broadcast_", "(_", "Mu", "1_", ",_", "self_", "._", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "=_", "np_", "._", "cast_", "[_", "config_", "._", "float", "X_", "]_", "(_", "self_", "._", "model_", "._", "rng_", "._", "uniform_", "(_", "0._", ",_", "1._", ",_", "H_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1_", "=_", "np_", "._", "cast_", "[_", "config_", "._", "float", "X_", "]_", "(_", "self_", "._", "model_", "._", "rng_", "._", "uniform_", "(_", "-_", "5._", ",_", "5._", ",_", "Mu", "1_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H", "\\u", "var_", "=_", "T_", "._", "matrix_", "(_", "name_", "=_", "'", "H", "\\u", "var", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H", "\\u", "var_", "._", "tag_", "._", "test\\u", "value_", "=_", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1", "\\u", "var_", "=_", "T_", "._", "matrix_", "(_", "name_", "=_", "'", "Mu", "1", "\\u", "var", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1", "\\u", "var_", "._", "tag_", "._", "test\\u", "value_", "=_", "Mu", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "T_", "._", "isc", "ala", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "._", "tag_", "._", "test\\u", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "H_", "=_", "e\\u", "step_", "._", "infer", "\\u", "H", "\\u", "hat_", "(_", "V_", "=_", "X_", ",_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "S", "\\u", "hat_", "=_", "Mu", "1", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "\\u", "idx_", "=_", "new", "\\u", "H_", "[_", ":_", ",_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "s", "\\u", "func_", "=_", "function_", "(_", "[_", "H", "\\u", "var_", ",_", "Mu", "1", "\\u", "var_", ",_", "idx_", "]_", ",_", "h", "\\u", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sigma", "0_", "=_", "1._", "/_", "model_", "._", "alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sigm", "a1_", "=_", "e\\u", "step_", "._", "infer", "\\u", "var", "\\u", "s1", "\\u", "hat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu", "0_", "=_", "T_", "._", "zero", "s", "\\u", "like_", "(_", "model_", "._", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "by", " ", "truncat", "ed", " ", "KL", ",", " ", "I", " ", "mean", " ", "tha", "t", " ", "I", " ", "am", " ", "drop", "ping", " ", "term", "s", " ", "tha", "t", " ", "don", "'", "t", " ", "depend", " ", "on", " ", "H", " ", "and", " ", "Mu", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "the", "y", " ", "don", "'", "t", " ", "affect", " ", "the", " ", "outco", "me", " ", "of", " ", "this", " ", "test", " ", "and", " ", "some", " ", "of", " ", "them", " ", "are", " ", "intra", "ctab", "le", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "trunc", "\\u", "kl_", "=_", "-_", "model_", "._", "entr", "opy", "\\u", "hs_", "(_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "var", "\\u", "s0", "\\u", "hat_", "=_", "sigma", "0_", ",_", "var", "\\u", "s1", "\\u", "hat_", "=_", "Sigm", "a1_", ")_", "+_", "model_", "._", "expected", "\\u", "energ", "y", "\\u", "vh", "s_", "(_", "V_", "=_", "X_", ",_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "S", "\\u", "hat_", "=_", "Mu", "1", "\\u", "var_", ",_", "var", "\\u", "s0", "\\u", "hat_", "=_", "sigma", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "s1", "\\u", "hat_", "=_", "Sigm", "a1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grad", "\\u", "H_", "=_", "T_", "._", "grad_", "(_", "trunc", "\\u", "kl_", "._", "sum_", "(_", ")_", ",_", "H", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "grad", "\\u", "H_", "._", "type_", "._", "broadcast", "able_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "theano", ".", "printin", "g", " ", "import", " ", "min", "\\u", "informati", "ve", "\\u", "str_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "min", "\\u", "informati", "ve", "\\u", "str", "(", "grad", "\\u", "H", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "grad", "\\u", "H", " ", "=", " ", "Print", "('", "grad", "\\u", "H", "')", "(", "grad", "\\u", "H", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "grad", "\\u", "H", "\\u", "idx", " ", "=", " ", "grad", "\\u", "H", "[:,", "idx", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grad", "\\u", "func_", "=_", "function_", "(_", "[_", "H", "\\u", "var_", ",_", "Mu", "1", "\\u", "var_", "]_", ",_", "grad", "\\u", "H_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "failed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rval_", "=_", "update", "s", "\\u", "func_", "(_", "H_", ",_", "Mu", "1_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H_", "[_", ":_", ",_", "i_", "]_", "=_", "rval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "grad", "\\u", "func_", "(_", "H_", ",_", "Mu", "1_", ")_", "[_", ":_", ",_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "contain", "s", "\\u", "nan_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g", "\\u", "abs", "\\u", "max_", "=_", "np_", "._", "abs_", "(_", "g_", ")_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "g", "\\u", "abs", "\\u", "max_", ">_", "self_", "._", "tol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "new", " ", "values", " ", "of", " ", "H", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "H", "[:,", "i", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "gradi", "ent", " ", "on", " ", "new", " ", "values", " ", "of", " ", "H", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "g_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "failed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "iterati", "on", " ", "'_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "max", " ", "value", " ", "of", " ", "new", " ", "H", ":", " ", "',", "H", "[:,", "i", "].", "max", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "H", " ", "for", " ", "faili", "ng", " ", "g", ":", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "faili", "ng", "\\u", "h_", "=_", "H_", "[_", "np_", "._", "abs_", "(_", "g_", ")_", ">_", "self_", "._", "tol_", ",_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "faili", "ng", "\\u", "h_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "mat", "plotlib", " ", "import", " ", "pypl", "ot", " ", "as", " ", "plt_", "\\u\\u\\uNL\\u\\u\\u_", "#", "plt", ".", "scatter", "(", "H", "[:,", "i", "],", "g", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "plt", ".", "show", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "ignore", " ", "fail", "ure", "s", " ", "extreme", "ly", " ", "close", " ", "to", " ", "h", "=", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "high", "\\u", "mask_", "=_", "faili", "ng", "\\u", "h_", ">_", ".00", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "low", "\\u", "mask_", "=_", "faili", "ng", "\\u", "h_", "<_", ".99", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mask_", "=_", "high", "\\u", "mask_", "*_", "low", "\\u", "mask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "mask", "ed", " ", "fail", "ure", "s", ":", " ", "'_", ",_", "mask_", "._", "shape_", "[_", "0_", "]_", ",_", "'", " ", "err", " ", "'_", ",_", "g", "\\u", "abs", "\\u", "max_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mask_", "._", "sum_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'", "faili", "ng", " ", "h", " ", "passi", "ng", " ", "the", " ", "range", " ", "mask", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "faili", "ng", "\\u", "h_", "[_", "mask_", "._", "astype_", "(_", "bool_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "'", "after", " ", "mean", " ", "field", " ", "step", ",", " ", "gradi", "ent", " ", "of", " ", "kl", " ", "divergence", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "wrt", " ", "fresh", "ly", " ", "update", "d", " ", "variatio", "nal", " ", "parameter", " ", "shou", "ld", " ", "be", " ", "0", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "but", " ", "here", " ", "the", " ", "max", " ", "magnitude", " ", "of", " ", "a", " ", "gradi", "ent", " ", "element", " ", "is", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "str_", "(_", "g", "\\u", "abs", "\\u", "max_", ")_", "+_", "'", " ", "after", " ", "updat", "ing", " ", "h", "\\u'_", "+_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", " ", "not", " ", "failed_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "S", "3", "C", "\\u", "Infer", "ence_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "value", "\\u", "h_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "tests", " ", "tha", "t", " ", "the", " ", "value", " ", "of", " ", "the", " ", "kl", " ", "divergence", " ", "decrease", "s", " ", "with", " ", "each", " ", "update", " ", "to", " ", "h", "\\u", "i", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "self_", "._", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "step_", "=_", "self_", "._", "e\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "self_", "._", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "X_", "._", "shape_", "[_", "0_", "]_", "==_", "self_", "._", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "H_", "=_", "e\\u", "step_", "._", "init", "\\u", "H", "\\u", "hat_", "(_", "V_", "=_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "\\u", "Mu", "1_", "=_", "e\\u", "step_", "._", "init", "\\u", "S", "\\u", "hat_", "(_", "V_", "=_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prev", "\\u", "setting_", "=_", "config_", "._", "compute", "\\u", "test\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "compute", "\\u", "test\\u", "value_", "=_", "'", "off", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H_", ",_", "Mu", "1_", "=_", "function_", "(_", "[_", "]_", ",_", "outputs_", "=_", "[_", "init", "\\u", "H_", ",_", "init", "\\u", "Mu", "1_", "]_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "compute", "\\u", "test\\u", "value_", "=_", "prev", "\\u", "setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "=_", "broadcast_", "(_", "H_", ",_", "self_", "._", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1_", "=_", "broadcast_", "(_", "Mu", "1_", ",_", "self_", "._", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "=_", "np_", "._", "cast_", "[_", "config_", "._", "float", "X_", "]_", "(_", "self_", "._", "model_", "._", "rng_", "._", "uniform_", "(_", "0._", ",_", "1._", ",_", "H_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1_", "=_", "np_", "._", "cast_", "[_", "config_", "._", "float", "X_", "]_", "(_", "self_", "._", "model_", "._", "rng_", "._", "uniform_", "(_", "-_", "5._", ",_", "5._", ",_", "Mu", "1_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H", "\\u", "var_", "=_", "T_", "._", "matrix_", "(_", "name_", "=_", "'", "H", "\\u", "var", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H", "\\u", "var_", "._", "tag_", "._", "test\\u", "value_", "=_", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1", "\\u", "var_", "=_", "T_", "._", "matrix_", "(_", "name_", "=_", "'", "Mu", "1", "\\u", "var", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mu", "1", "\\u", "var_", "._", "tag_", "._", "test\\u", "value_", "=_", "Mu", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "T_", "._", "isc", "ala", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "._", "tag_", "._", "test\\u", "value_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "H_", "=_", "e\\u", "step_", "._", "infer", "\\u", "H", "\\u", "hat_", "(_", "V_", "=_", "X_", ",_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "S", "\\u", "hat_", "=_", "Mu", "1", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h", "\\u", "idx_", "=_", "new", "H_", "[_", ":_", ",_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h", "\\u", "i", "\\u", "func_", "=_", "function_", "(_", "[_", "H", "\\u", "var_", ",_", "Mu", "1", "\\u", "var_", ",_", "idx_", "]_", ",_", "h", "\\u", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sigma", "0_", "=_", "1._", "/_", "model_", "._", "alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sigm", "a1_", "=_", "e\\u", "step_", "._", "infer", "\\u", "var", "\\u", "s1", "\\u", "hat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu", "0_", "=_", "T_", "._", "zero", "s", "\\u", "like_", "(_", "model_", "._", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "by", " ", "truncat", "ed", " ", "KL", ",", " ", "I", " ", "mean", " ", "tha", "t", " ", "I", " ", "am", " ", "drop", "ping", " ", "term", "s", " ", "tha", "t", " ", "don", "'", "t", " ", "depend", " ", "on", " ", "H", " ", "and", " ", "Mu", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "the", "y", " ", "don", "'", "t", " ", "affect", " ", "the", " ", "outco", "me", " ", "of", " ", "this", " ", "test", " ", "and", " ", "some", " ", "of", " ", "them", " ", "are", " ", "intra", "ctab", "le", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "trunc", "\\u", "kl_", "=_", "-_", "model_", "._", "entr", "opy", "\\u", "hs_", "(_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "var", "\\u", "s0", "\\u", "hat_", "=_", "sigma", "0_", ",_", "var", "\\u", "s1", "\\u", "hat_", "=_", "Sigm", "a1_", ")_", "+_", "model_", "._", "expected", "\\u", "energ", "y", "\\u", "vh", "s_", "(_", "V_", "=_", "X_", ",_", "H", "\\u", "hat_", "=_", "H", "\\u", "var_", ",_", "S", "\\u", "hat_", "=_", "Mu", "1", "\\u", "var_", ",_", "var", "\\u", "s0", "\\u", "hat_", "=_", "sigma", "0_", ",_", "var", "\\u", "s1", "\\u", "hat_", "=_", "Sigm", "a1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trunc", "\\u", "kl", "\\u", "func_", "=_", "function_", "(_", "[_", "H", "\\u", "var_", ",_", "Mu", "1", "\\u", "var_", "]_", ",_", "trunc", "\\u", "kl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "\\u", "kl_", "=_", "trunc", "\\u", "kl", "\\u", "func_", "(_", "H_", ",_", "Mu", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "[_", ":_", ",_", "i_", "]_", "=_", "h", "\\u", "i", "\\u", "func_", "(_", "H_", ",_", "Mu", "1_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "we", " ", "don", "'", "t", " ", "update", " ", "mu", ",", " ", "the", " ", "whole", " ", "point", " ", "of", " ", "the", " ", "split", " ", "e", " ", "step", " ", "is", " ", "we", " ", "don", "'", "t", " ", "have", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "kl_", "=_", "trunc", "\\u", "kl", "\\u", "func_", "(_", "H_", ",_", "Mu", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "increase", "_", "=_", "new", "\\u", "kl_", "-_", "prev", "\\u", "kl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "fail", "ure", "s", " ", "after", " ", "iterati", "on", " ", "'_", ",_", "i_", ",_", "':", " ", "'_", ",_", "(_", "increase", "_", ">_", "self_", "._", "tol_", ")_", "._", "sum_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mx_", "=_", "increase", "_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mx_", ">_", "1e-4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "increase", " ", "amounts", " ", "of", " ", "faili", "ng", " ", "example", "s", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "increase", "_", "[_", "increase", "_", ">_", "self_", "._", "tol_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "faili", "ng", " ", "H", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "H_", "[_", "increase", "_", ">_", "self_", "._", "tol_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "faili", "ng", " ", "Mu", "1", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "Mu", "1_", "[_", "increase", "_", ">_", "self_", "._", "tol_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "faili", "ng", " ", "V", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "X_", "[_", "increase", "_", ">_", "self_", "._", "tol_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "Exception_", "(_", "'", "after", " ", "mean", " ", "field", " ", "step", " ", "in", " ", "h", ",", " ", "kl", " ", "divergence", " ", "shou", "ld", " ", "decrease", ",", " ", "but", " ", "some", " ", "element", "s", " ", "increase", "d", " ", "by", " ", "as", " ", "muc", "h", " ", "as", " ", "'_", "+_", "str_", "(_", "mx_", ")_", "+_", "'", " ", "after", " ", "updat", "ing", " ", "h", "\\u'_", "+_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Incomplete URL substring sanitization
Parsely/serpextract/serpextract/serpextract.py
[ { "content": "def get_parser(referring_url):\n \"\"\"\n Utility function to find a parser for a referring URL if it is a SERP.\n\n :param referring_url: Suspected SERP URL.\n :type referring_url: ``str`` or :class:`urlparse.ParseResult`\n\n :returns: :class:`SearchEngineParser` object if one exists for URL,\n ``None`` otherwise.\n \"\"\"\n engines = _get_search_engines()\n url_parts = _unicode_urlparse(referring_url)\n if url_parts is None:\n return None\n\n query = _serp_query_string(url_parts)\n\n domain = url_parts.netloc\n path = url_parts.path\n lossy_domain = _get_lossy_domain(url_parts.netloc)\n engine_key = url_parts.netloc\n\n # Try to find a parser in the engines list. We go from most specific to\n # least specific order:\n # 1. <domain><path>\n # 2. <lossy_domain><path>\n # 3. <lossy_domain>\n # 4. <domain>\n # The final case has some special exceptions for things like Google custom\n # search engines, yahoo and yahoo images\n if u'{}{}'.format(domain, path) in engines:\n engine_key = u'{}{}'.format(domain, path)\n elif u'{}{}'.format(lossy_domain, path) in engines:\n engine_key = u'{}{}'.format(lossy_domain, path)\n elif lossy_domain in engines:\n engine_key = lossy_domain\n elif domain not in engines:\n if query[:14] == 'cx=partner-pub':\n # Google custom search engine\n engine_key = 'google.com/cse'\n elif url_parts.path[:28] == '/pemonitorhosted/ws/results/':\n # private-label search powered by InfoSpace Metasearch\n engine_key = 'wsdsold.infospace.com'\n elif '.images.search.yahoo.com' in url_parts.netloc:\n # Yahoo! Images\n engine_key = 'images.search.yahoo.com'\n elif '.search.yahoo.com' in url_parts.netloc:\n # Yahoo!\n engine_key = 'search.yahoo.com'\n else:\n return None\n\n return engines.get(engine_key)", "metadata": "root.get_parser", "header": "['module', '___EOS___']", "index": 485 } ]
[ { "span": "'.images.search.yahoo.com' in url_parts.netloc:", "start_line": 528, "start_column": 13, "end_line": 528, "end_column": 59 }, { "span": "'.search.yahoo.com' in url_parts.netloc:", "start_line": 531, "start_column": 13, "end_line": 531, "end_column": 52 } ]
[]
1
true
[ "[CLS]_", "Incomp", "lete", "_", "URL_", "substring", "_", "sani", "ti", "zation_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "parser_", "(_", "refer", "ring", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Utili", "ty", " ", "function", " ", "to", " ", "find", " ", "a", " ", "parser", " ", "for", " ", "a", " ", "refer", "ring", " ", "URL", " ", "if", " ", "it", " ", "is", " ", "a", " ", "SER", "P", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "refer", "ring", "\\u", "url", ":", " ", "Sus", "pect", "ed", " ", "SER", "P", " ", "URL", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "refer", "ring", "\\u", "url", ":", " ", " ", "``", "str", "``", " ", "or", " ", ":", "class", ":`", "urlpa", "rse", ".", "Pars", "e", "Result", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", ":", "class", ":`", "Sear", "ch", "Engine", "Parser", "`", " ", "object", " ", "if", " ", "one", " ", "exist", "s", " ", "for", " ", "URL", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "``", "Non", "e", "``", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engines_", "=_", "\\u", "get", "\\u", "search", "\\u", "engines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "\\u", "parts_", "=_", "\\u", "unicode", "\\u", "urlparse_", "(_", "refer", "ring", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "url", "\\u", "parts_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "\\u", "ser", "p", "\\u", "query", "\\u", "string_", "(_", "url", "\\u", "parts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "url", "\\u", "parts_", "._", "netloc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "url", "\\u", "parts_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loss", "y", "\\u", "domain_", "=_", "\\u", "get", "\\u", "loss", "y", "\\u", "domain_", "(_", "url", "\\u", "parts_", "._", "netloc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "key_", "=_", "url", "\\u", "parts_", "._", "netloc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "find", " ", "a", " ", "parser", " ", "in", " ", "the", " ", "engines", " ", "list", ".", " ", " ", "We", " ", "go", " ", "from", " ", "most", " ", "specific", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "leas", "t", " ", "specific", " ", "order", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "<", "domain", "><", "path", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "<", "loss", "y", "\\u", "domain", "><", "path", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", ".", " ", "<", "loss", "y", "\\u", "domain", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "4", ".", " ", "<", "domain", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "final", " ", "case", " ", "has", " ", "some", " ", "special", " ", "exception", "s", " ", "for", " ", "thing", "s", " ", "like", " ", "Goo", "gle", " ", "custom_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "search", " ", "engines", ",", " ", "ya", "hoo", " ", "and", " ", "ya", "hoo", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "u", "'{}{}", "'_", "._", "format_", "(_", "domain_", ",_", "path_", ")_", "in_", "engines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eng", "ine", "\\u", "key_", "=_", "u", "'{}{}", "'_", "._", "format_", "(_", "domain_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "u", "'{}{}", "'_", "._", "format_", "(_", "loss", "y", "\\u", "domain_", ",_", "path_", ")_", "in_", "engines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eng", "ine", "\\u", "key_", "=_", "u", "'{}{}", "'_", "._", "format_", "(_", "loss", "y", "\\u", "domain_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "loss", "y", "\\u", "domain_", "in_", "engines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eng", "ine", "\\u", "key_", "=_", "loss", "y", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "domain_", "not_", "in_", "engines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "query_", "[_", ":_", "14_", "]_", "==_", "'", "cx", "=", "part", "ner", "-", "pub", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Goo", "gle", " ", "custom", " ", "search", " ", "engine_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eng", "ine", "\\u", "key_", "=_", "'", "google", ".", "com", "/", "cse", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "url", "\\u", "parts_", "._", "path_", "[_", ":_", "28_", "]_", "==_", "'/", "pe", "monit", "or", "hoste", "d", "/", "ws", "/", "results", "/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "private", "-", "label", " ", "search", " ", "powered", " ", "by", " ", "Info", "Spac", "e", " ", "Meta", "search_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eng", "ine", "\\u", "key_", "=_", "'", "ws", "dso", "ld", ".", "infos", "pace", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'.", "images", ".", "search", ".", "ya", "hoo", ".", "com", "'_", "in_", "url", "\\u", "parts_", "._", "netloc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ya", "hoo", "!", " ", "Images_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eng", "ine", "\\u", "key_", "=_", "'", "images", ".", "search", ".", "ya", "hoo", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'.", "search", ".", "ya", "hoo", ".", "com", "'_", "in_", "url", "\\u", "parts_", "._", "netloc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ya", "hoo", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eng", "ine", "\\u", "key_", "=_", "'", "search", ".", "ya", "hoo", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "engines_", "._", "get_", "(_", "eng", "ine", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
denizalti/concoord/concoord/node.py
[ { "content": " def send(self, message, peer=None, group=None):\n if peer:\n connection = self.connectionpool.get_connection_by_peer(peer)\n if connection == None:\n if self.debug: self.logger.write(\"Connection Error\",\n \"Connection for %s cannot be found.\" % str(peer))\n return -1\n connection.send(message)\n return message[FLD_ID]\n elif group:\n ids = []\n for peer,liveness in group.iteritems():\n connection = self.connectionpool.get_connection_by_peer(peer)\n if connection == None:\n if self.debug: self.logger.write(\"Connection Error\",\n \"Connection for %s cannot be found.\" % str(peer))\n continue\n connection.send(message)\n ids.append(message[FLD_ID])\n message[FLD_ID] = assignuniqueid()\n return ids", "metadata": "root.Node.send", "header": "['class', 'Node', '(', ')', ':', '___EOS___']", "index": 483 } ]
[ { "span": "connection == None:", "start_line": 486, "start_column": 15, "end_line": 486, "end_column": 33 }, { "span": "connection == None:", "start_line": 496, "start_column": 19, "end_line": 496, "end_column": 37 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Node_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "self_", ",_", "message_", ",_", "peer_", "=_", "None_", ",_", "group_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "peer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "self_", "._", "connecti", "onp", "ool_", "._", "get", "\\u", "connecti", "on", "\\u", "by", "\\u", "peer_", "(_", "peer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "connection_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "debug_", ":_", "self_", "._", "logger_", "._", "write_", "(_", "\"", "Connect", "ion", " ", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Connect", "ion", " ", "for", " ", "%", "s", " ", "cann", "ot", " ", "be", " ", "found", ".\"_", "%_", "str_", "(_", "peer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "connection_", "._", "send_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "message_", "[_", "FL", "D", "\\u", "ID_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "group_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "peer_", ",_", "live", "ness_", "in_", "group_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "self_", "._", "connecti", "onp", "ool_", "._", "get", "\\u", "connecti", "on", "\\u", "by", "\\u", "peer_", "(_", "peer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "connection_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "debug_", ":_", "self_", "._", "logger_", "._", "write_", "(_", "\"", "Connect", "ion", " ", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Connect", "ion", " ", "for", " ", "%", "s", " ", "cann", "ot", " ", "be", " ", "found", ".\"_", "%_", "str_", "(_", "peer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "connection_", "._", "send_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "._", "append_", "(_", "message_", "[_", "FL", "D", "\\u", "ID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "[_", "FL", "D", "\\u", "ID_", "]_", "=_", "assign", "unique", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
RDFLib/rdfextras/test/test_sparql/test_sparql_graph_graph_pattern.py
[ { "content": "from rdflib.graph import ConjunctiveGraph\nfrom rdflib.term import URIRef, Literal\nfrom rdflib.namespace import RDFS\nfrom StringIO import StringIO\nimport unittest\n\ntestContent = \"\"\"\n@prefix foaf: <http://xmlns.com/foaf/0.1/> .\n<http://purl.org/net/chimezie/foaf#chime> \n foaf:name \"Chime\";\n a foaf:Person.\n<http://eikeon.com/> foaf:knows \n <http://purl.org/net/chimezie/foaf#chime>,<http://www.ivan-herman.net/>.\n<http://www.ivan-herman.net/> foaf:name \"Ivan\".\"\"\"\n \ndoc1 = URIRef(\"http://eikeon.com/\")\n\nQUERY = u\"\"\"\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?X\nWHERE { \n ?P a foaf:Person .\n ?X foaf:knows ?P .\n OPTIONAL { \n ?X foaf:knows ?OP .\n ?OP foaf:name \"Judas\" } \n FILTER (!bound(?OP)) }\"\"\"\n\n\nif __name__ == \"__main__\":\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestSparqlOPT_FILTER2(unittest.TestCase):", "metadata": "root.TestSparqlOPT_FILTER2", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def setUp(self):\n self.graph = ConjunctiveGraph()\n self.graph.load(StringIO(testContent), format='n3')", "metadata": "root.TestSparqlOPT_FILTER2.setUp", "header": "['class', 'TestSparqlOPT_FILTER2', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_OPT_FILTER(self):\n results = self.graph.query(QUERY,\n DEBUG=False)\n results = list(results)\n self.failUnless(\n results == [(doc1,)],\n \"expecting : %s . Got: %s\"%([(doc1,)],repr(results)))", "metadata": "root.TestSparqlOPT_FILTER2.test_OPT_FILTER", "header": "['class', 'TestSparqlOPT_FILTER2', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "from rdflib.term import URIRef, Literal", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 39 }, { "span": "from rdflib.namespace import RDFS", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "rdflib_", "._", "graph_", "import_", "Con", "jun", "ctive", "Graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rdflib_", "._", "term_", "import_", "URI", "Ref_", ",_", "Literal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rdflib_", "._", "namespace_", "import_", "RDF", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Content_", "=_", "\"\"\"", "\\", "10", ";", "@", "prefix", " ", "foa", "f", ":", " ", " ", "<", "http", "://", "xml", "ns", ".", "com", "/", "foa", "f", "/", "0.", "1", "/>", " ", ".", "\\", "10", ";<", "http", "://", "pur", "l", ".", "org", "/", "net", "/", "chi", "me", "zie", "/", "foa", "f", "#", "chi", "me", ">", " ", "\\", "10", ";", " ", " ", "foa", "f", ":", "name", " ", " ", " ", "\"", "Chi", "me", "\";", "\\", "10", ";", " ", " ", "a", " ", "foa", "f", ":", "Person", ".", "\\", "10", ";<", "http", "://", "ei", "ke", "on", ".", "com", "/>", " ", "foa", "f", ":", "knows", " ", "\\", "10", ";", " ", " ", "<", "http", "://", "pur", "l", ".", "org", "/", "net", "/", "chi", "me", "zie", "/", "foa", "f", "#", "chi", "me", ">", ",", "<", "http", "://", "www", ".", "iva", "n", "-", "herm", "an", ".", "net", "/>", ".", "\\", "10", ";<", "http", "://", "www", ".", "iva", "n", "-", "herm", "an", ".", "net", "/>", " ", "foa", "f", ":", "name", " ", "\"", "Iv", "an", "\".", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "1_", "=_", "URI", "Ref_", "(_", "\"", "http", "://", "ei", "ke", "on", ".", "com", "/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "QUERY_", "=_", "u", "\"\"\"", "\\", "10", ";", "PREF", "IX", " ", "foa", "f", ":", " ", " ", " ", "<", "http", "://", "xml", "ns", ".", "com", "/", "foa", "f", "/", "0.", "1", "/>", "\\", "10", ";", "SELECT", " ", "?", "X", "\\", "10", ";", "WHE", "RE", " ", "{", " ", "\\", "10", ";", " ", " ", " ", " ", "?", "P", " ", "a", " ", "foa", "f", ":", "Person", " ", ".", "\\", "10", ";", " ", " ", " ", " ", "?", "X", " ", "foa", "f", ":", "knows", " ", "?", "P", " ", ".", "\\", "10", ";", " ", " ", " ", " ", "OPTIONAL", " ", "{", " ", "\\", "10", ";", " ", " ", "?", "X", " ", "foa", "f", ":", "knows", " ", "?", "OP", " ", ".", "\\", "10", ";", " ", " ", "?", "OP", " ", "foa", "f", ":", "name", " ", "\"", "Jud", "as", "\"", " ", "}", " ", "\\", "10", ";", " ", " ", " ", " ", "FILTER", " ", "(!", "bound", "(?", "OP", "))", " ", "}\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Spar", "ql", "OPT", "\\u", "FILTER", "2_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Spar", "ql", "OPT", "\\u", "FILTER", "2_", "(_", "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_", "._", "graph_", "=_", "Con", "jun", "ctive", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "graph_", "._", "load_", "(_", "String", "IO_", "(_", "test", "Content_", ")_", ",_", "format_", "=_", "'", "n", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Spar", "ql", "OPT", "\\u", "FILTER", "2_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "OPT", "\\u", "FILTER_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "self_", "._", "graph_", "._", "query_", "(_", "QUERY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Unless_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "==_", "[_", "(_", "doc", "1_", ",_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "expect", "ing", " ", ":", " ", "%", "s", " ", ".", " ", " ", "Got", ":", " ", "%", "s", "\"_", "%_", "(_", "[_", "(_", "doc", "1_", ",_", ")_", "]_", ",_", "repr_", "(_", "results_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dimagi/commcare-hq/custom/_legacy/pact/dot_data.py
[ { "content": "import logging\nfrom django.conf import settings\nfrom pytz import timezone\nfrom datetime import datetime, timedelta, date\nfrom pact.enums import (\n CASE_ART_REGIMEN_PROP,\n CASE_NONART_REGIMEN_PROP,\n DAY_SLOTS_BY_TIME,\n DOT_ART,\n DOT_DAYS_INTERVAL,\n DOT_NONART,\n DOT_OBSERVATION_DIRECT,\n DOT_UNCHECKED_CELL,\n)\n\nfrom pact.models import CObservation\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 DOTDayDose(object):\n drug_class = None # DOT_ART, DOT_NONART\n total_doses = 0\n\n\n\n", "metadata": "root.DOTDayDose", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self, drug_class):\n self.drug_class = drug_class\n self.total_doses_hist = {} # debug tool\n self.dose_dict = {}", "metadata": "root.DOTDayDose.__init__", "header": "['class', 'DOTDayDose', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": " def has_obs(self, obs):\n if self.dose_dict.get(obs.dose_number, None) is None:\n return False\n else:\n return True", "metadata": "root.DOTDayDose.has_obs", "header": "['class', 'DOTDayDose', '(', 'object', ')', ':', '___EOS___']", "index": 27 }, { "content": " def add_obs(self, obs):\n if not self.has_obs(obs):\n self.dose_dict[obs.dose_number] = []\n self.dose_dict[obs.dose_number].append(obs)", "metadata": "root.DOTDayDose.add_obs", "header": "['class', 'DOTDayDose', '(', 'object', ')', ':', '___EOS___']", "index": 33 }, { "content": " def update_total_doses(self, obs):\n if self.total_doses < obs.total_doses:\n self.total_doses = obs.total_doses\n\n # debug, double check for weird data\n if 'obs.total_doses' not in self.total_doses_hist:\n self.total_doses_hist[obs.total_doses] = []\n self.total_doses_hist[obs.total_doses].append(obs)", "metadata": "root.DOTDayDose.update_total_doses", "header": "['class', 'DOTDayDose', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": "class DOTDay(object):\n nonart = None\n art = None\n\n\n\n\n", "metadata": "root.DOTDay", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def __init__(self):\n self.nonart = DOTDayDose(DOT_NONART)\n self.art = DOTDayDose(DOT_ART)", "metadata": "root.DOTDay.__init__", "header": "['class', 'DOTDay', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": " def sort_all_observations(self):\n for day_doses in [self.nonart, self.art]:\n dose_dict = day_doses.dose_dict\n for dose_num in dose_dict.keys():\n observations = dose_dict[dose_num]\n dose_dict[dose_num] = sort_observations(observations)", "metadata": "root.DOTDay.sort_all_observations", "header": "['class', 'DOTDay', '(', 'object', ')', ':', '___EOS___']", "index": 56 }, { "content": " def update_dosedata(self, obs):\n if obs.is_art:\n dot_day_dose = self.art\n else:\n dot_day_dose = self.nonart\n dot_day_dose.update_total_doses(obs)\n dot_day_dose.add_obs(obs)", "metadata": "root.DOTDay.update_dosedata", "header": "['class', 'DOTDay', '(', 'object', ')', ':', '___EOS___']", "index": 63 }, { "content": " @classmethod\n def merge_from_observations(cls, day_observations):\n \"\"\"\n Receive an array of CObservations and try to priority sort them\n and make a json-able array of ART and NON ART submissions\n for DOT calendar display.\n This is an intermediate, more semantically readable markup\n for preparing/merging data.\n This is not the final form that's transmitted to/from phones.\n \"\"\"\n dot_day = cls()\n\n for obs in day_observations:\n dot_day.update_dosedata(obs)\n dot_day.sort_all_observations()\n return dot_day", "metadata": "root.DOTDay.merge_from_observations", "header": "['class', 'DOTDay', '(', 'object', ')', ':', '___EOS___']", "index": 71 }, { "content": " def to_case_json(self, casedoc, regimen_labels):\n \"\"\"\n Return the json representation of a single days nonart/art data\n that is put back into the caseblock, sent to phone,\n sent back from phone\n\n This is the transmitted representation\n and the phone's representation of DOT data.\n \"\"\"\n\n def get_obs_for_dosenum(obs_list, dose_num, label):\n if len(obs_list) > 0:\n obs = obs_list[0]\n day_slot = label\n if obs.day_slot != '' and obs.day_slot is not None:\n day_slot = obs.day_slot\n if (obs.day_note is not None and len(obs.day_note) > 0\n and obs.day_note != \"[AddendumEntry]\"):\n day_note = obs.day_note\n else:\n day_note = ''\n\n return [obs.adherence, obs.method, day_note, day_slot]\n # one and done per array\n else:\n # return pristine unchecked\n return ['unchecked', 'pillbox', '', label]\n\n ret = []\n for ix, dose_data in enumerate([self.nonart, self.art]):\n drug_arr = []\n labels_arr = regimen_labels[ix]\n dose_nums = dose_data.dose_dict.keys()\n dose_nums.sort()\n\n for dose_num in dose_nums:\n if dose_num is not None:\n # for each dose num in the observed array of the drug type,\n # there maybe more than one observation\n obs_list = dose_data.dose_dict[dose_num]\n drug_arr.append(get_obs_for_dosenum(obs_list, dose_num, labels_arr[dose_num]))\n else:\n # just to get a sense of how widespread this problem is in sentry\n logging.error('A pact case had an empty dose number.')\n\n # don't fill because we're looking at what was submitted.\n if len(drug_arr) <= dose_data.total_doses:\n if dose_data.drug_class == DOT_NONART:\n max_doses = int(getattr(casedoc, 'nonartregimen', None) or 0)\n elif dose_data.drug_class == DOT_ART:\n max_doses = int(getattr(casedoc, 'artregimen', None) or 0)\n\n # hack, in cases where we have zero data, put in the current regimen delta count\n delta = max_doses - dose_data.total_doses\n for x in range(0, delta):\n drug_arr.append([\"unchecked\", \"pillbox\", '', labels_arr[x] if x < len(labels_arr) else -1])\n ret.append(drug_arr)\n return ret", "metadata": "root.DOTDay.to_case_json", "header": "['class', 'DOTDay', '(', 'object', ')', ':', '___EOS___']", "index": 88 }, { "content": "def filter_obs_for_day(this_date, observations):\n assert this_date.__class__ == date\n ret = filter(lambda x: x['observed_date'].date() == this_date, observations)\n\n return ret", "metadata": "root.filter_obs_for_day", "header": "['module', '___EOS___']", "index": 148 }, { "content": "def query_observations(case_id, start_date, end_date):\n \"\"\"\n Hit couch to get the CObservations for the given date range of the OBSERVED dates.\n These are the actual observation day cells in which they filled in DOT data.\n args: start_date and end_date as datetime objects\n \"\"\"\n startkey = [case_id, 'anchor_date', start_date.year, start_date.month, start_date.day]\n endkey = [case_id, 'anchor_date', end_date.year, end_date.month, end_date.day]\n observations = CObservation.view('pact/dots_observations',\n startkey=startkey, endkey=endkey).all()\n return observations", "metadata": "root.query_observations", "header": "['module', '___EOS___']", "index": 155 }, { "content": "def query_observations_singledoc(doc_id):\n \"\"\"\n Hit couch to get the CObservations for a single xform submission\n \"\"\"\n key = ['doc_id', doc_id]\n observations = CObservation.view('pact/dots_observations', key=key,\n classes={None: CObservation}).all()\n return observations", "metadata": "root.query_observations_singledoc", "header": "['module', '___EOS___']", "index": 168 }, { "content": "def cmp_observation(x, y):\n \"\"\"\n for a given COBservation, do the following.\n 1: If it's an addendum/reconciliation trumps all\n 2: If it's direct, and other is not direct, the direct wins\n 3: If both direct, do by earliest date\n 4: If neither direct, do by earliest encounter_date regardless of method.\n\n < -1\n = 0\n > 1\n\n Assumes that x and y have the same observation date (cell in the DOT json array)\n Encounter date is the date in which the date cell is observed.\n \"\"\"\n\n assert x.observed_date.date() == y.observed_date.date()\n x_is_reconciliation = getattr(x, 'is_reconciliation', None)\n y_is_reconciliation = getattr(y, 'is_reconciliation', None)\n # Reconciliation handling\n # reconciliations always win.\n if x_is_reconciliation and y_is_reconciliation:\n # sort by earlier date, so flip x,y\n return cmp(y.submitted_date, x.submitted_date)\n elif x_is_reconciliation and not y_is_reconciliation:\n # result: x > y\n return 1\n elif not x_is_reconciliation and y_is_reconciliation:\n # result: x < y\n return -1\n elif x.method == DOT_OBSERVATION_DIRECT and y.method == DOT_OBSERVATION_DIRECT:\n # Direct observations win next\n # sort by earlier date, so flip x,y\n return cmp(y.encounter_date, x.encounter_date)\n elif x.method == DOT_OBSERVATION_DIRECT and y.method != DOT_OBSERVATION_DIRECT:\n # result: x > y\n return 1\n elif x.method != DOT_OBSERVATION_DIRECT and y.method == DOT_OBSERVATION_DIRECT:\n # result: x < y\n return -1\n elif (x.adherence, x.method) == DOT_UNCHECKED_CELL and (y.adherence, y.method) != DOT_UNCHECKED_CELL:\n # unchecked should always lose\n return -1\n elif (x.adherence, x.method) != DOT_UNCHECKED_CELL and (y.adherence, y.method) == DOT_UNCHECKED_CELL:\n return 1\n else:\n return cmp(y.encounter_date, x.encounter_date)", "metadata": "root.cmp_observation", "header": "['module', '___EOS___']", "index": 178 }, { "content": "def sort_observations(observations):\n \"\"\"\n Method to sort observations to make sure that the \"winner\" is at index 0\n \"\"\"\n return sorted(observations, cmp=cmp_observation, reverse=True)", "metadata": "root.sort_observations", "header": "['module', '___EOS___']", "index": 227 }, { "content": "def get_dots_case_json(casedoc, anchor_date=None):\n \"\"\"\n Return JSON-ready array of the DOTS block for given patient.\n Pulling properties from PATIENT document.\n Patient document trumps casedoc in this use case.\n \"\"\"\n\n if anchor_date is None:\n anchor_date = datetime.now(tz=timezone(settings.TIME_ZONE))\n enddate = anchor_date\n ret = {\n 'regimens': [\n # non art is 0\n int(getattr(casedoc, CASE_NONART_REGIMEN_PROP, None) or 0),\n # art is 1\n int(getattr(casedoc, CASE_ART_REGIMEN_PROP, None) or 0),\n ],\n 'regimen_labels': [\n list(casedoc.nonart_labels),\n list(casedoc.art_labels)\n ],\n 'days': [],\n # dmyung - hack to have query_observations timezone\n # be relative specific to the eastern seaboard\n 'anchor': anchor_date.strftime(\"%d %b %Y\"),\n }\n\n observations = query_observations(\n casedoc._id, enddate-timedelta(days=DOT_DAYS_INTERVAL), enddate)\n for delta in range(DOT_DAYS_INTERVAL):\n obs_date = enddate - timedelta(days=delta)\n day_arr = filter_obs_for_day(obs_date.date(), observations)\n day_data = DOTDay.merge_from_observations(day_arr)\n ret['days'].append(day_data.to_case_json(casedoc, ret['regimen_labels']))\n\n ret['days'].reverse()\n return ret", "metadata": "root.get_dots_case_json", "header": "['module', '___EOS___']", "index": 234 } ]
[ { "span": "from pact.enums import (\n CASE_ART_REGIMEN_PROP,\n CASE_NONART_REGIMEN_PROP,\n DAY_SLOTS_BY_TIME,\n DOT_ART,\n DOT_DAYS_INTERVAL,\n DOT_NONART,\n DOT_OBSERVATION_DIRECT,\n DOT_UNCHECKED_CELL,\n)", "start_line": 4, "start_column": 0, "end_line": 13, "end_column": 1 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pytz_", "import_", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", ",_", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pac", "t_", "._", "enums_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "CASE", "\\u", "ART", "\\u", "REGI", "MEN", "\\u", "PROP", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CASE", "\\u", "NON", "ART", "\\u", "REGI", "MEN", "\\u", "PROP", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DAY", "\\u", "SLOT", "S", "\\u", "BY", "\\u", "TIME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DOT", "\\u", "ART", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DOT", "\\u", "DAY", "S", "\\u", "INTERVAL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DOT", "\\u", "NON", "ART", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DOT", "\\u", "OBS", "ERV", "ATION", "\\u", "DIRECT", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DOT", "\\u", "UNC", "HE", "CK", "ED", "\\u", "CELL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pac", "t_", "._", "models_", "import_", "CO", "bse", "rva", "tion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "DOT", "Day", "Dos", "e_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drug", "\\u", "class_", "=_", "None_", "#", " ", "DOT", "\\u", "ART", ",", " ", "DOT", "\\u", "NON", "ART", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "dose", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "DOT", "Day", "Dos", "e_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "drug", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "drug", "\\u", "class_", "=_", "drug", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "total", "\\u", "dose", "s", "\\u", "hist_", "=_", "{_", "}_", "#", " ", "debug", " ", "tool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dose", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DOT", "Day", "Dos", "e_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "obs_", "(_", "self_", ",_", "obs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "dose", "\\u", "dict_", "._", "get_", "(_", "obs_", "._", "dose", "\\u", "number_", ",_", "None_", ")_", "is_", "None_", ":_", "\\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_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DOT", "Day", "Dos", "e_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "obs_", "(_", "self_", ",_", "obs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "has", "\\u", "obs_", "(_", "obs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dose", "\\u", "dict_", "[_", "obs_", "._", "dose", "\\u", "number_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dose", "\\u", "dict_", "[_", "obs_", "._", "dose", "\\u", "number_", "]_", "._", "append_", "(_", "obs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DOT", "Day", "Dos", "e_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "total", "\\u", "dose", "s_", "(_", "self_", ",_", "obs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "total", "\\u", "dose", "s_", "<_", "obs_", "._", "total", "\\u", "dose", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "total", "\\u", "dose", "s_", "=_", "obs_", "._", "total", "\\u", "dose", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "debug", ",", " ", "double", " ", "check", " ", "for", " ", "weird", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "obs", ".", "total", "\\u", "dose", "s", "'_", "not_", "in_", "self_", "._", "total", "\\u", "dose", "s", "\\u", "hist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "total", "\\u", "dose", "s", "\\u", "hist_", "[_", "obs_", "._", "total", "\\u", "dose", "s_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "total", "\\u", "dose", "s", "\\u", "hist_", "[_", "obs_", "._", "total", "\\u", "dose", "s_", "]_", "._", "append_", "(_", "obs_", ")_", "\\u\\u\\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_", "DOT", "Day_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nona", "rt_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "art_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "DOT", "Day_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nona", "rt_", "=_", "DOT", "Day", "Dos", "e_", "(_", "DOT", "\\u", "NON", "ART", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "art_", "=_", "DOT", "Day", "Dos", "e_", "(_", "DOT", "\\u", "ART", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DOT", "Day_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sort", "\\u", "all", "\\u", "observations_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "day", "\\u", "dose", "s_", "in_", "[_", "self_", "._", "nona", "rt_", ",_", "self_", "._", "art_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dose", "\\u", "dict_", "=_", "day", "\\u", "dose", "s_", "._", "dose", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dose", "\\u", "num_", "in_", "dose", "\\u", "dict_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "observations_", "=_", "dose", "\\u", "dict_", "[_", "dose", "\\u", "num_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dose", "\\u", "dict_", "[_", "dose", "\\u", "num_", "]_", "=_", "sort", "\\u", "observations_", "(_", "observations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DOT", "Day_", "(_", "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_", "update", "\\u", "dose", "data_", "(_", "self_", ",_", "obs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obs_", "._", "is", "\\u", "art_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "\\u", "day", "\\u", "dose", "_", "=_", "self_", "._", "art_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "\\u", "day", "\\u", "dose", "_", "=_", "self_", "._", "nona", "rt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dot", "\\u", "day", "\\u", "dose", "_", "._", "update", "\\u", "total", "\\u", "dose", "s_", "(_", "obs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dot", "\\u", "day", "\\u", "dose", "_", "._", "add", "\\u", "obs_", "(_", "obs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DOT", "Day_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "from", "\\u", "observations_", "(_", "cls_", ",_", "day", "\\u", "observations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Receive", " ", "an", " ", "array", " ", "of", " ", "CO", "bse", "rva", "tion", "s", " ", "and", " ", "try", " ", "to", " ", "priorit", "y", " ", "sort", " ", "them", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "make", " ", "a", " ", "json", "-", "able", " ", "array", " ", "of", " ", "ART", " ", "and", " ", "NON", " ", "ART", " ", "subm", "ission", "s", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "DOT", " ", "calendar", " ", "display", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "an", " ", "intermediate", ",", " ", "more", " ", "sema", "ntic", "ally", " ", "reada", "ble", " ", "markup", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "prepar", "ing", "/", "mer", "ging", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "not", " ", "the", " ", "final", " ", "form", " ", "tha", "t", "'", "s", " ", "transmitte", "d", " ", "to", "/", "from", " ", "phone", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dot", "\\u", "day_", "=_", "cls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "obs_", "in_", "day", "\\u", "observations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "\\u", "day_", "._", "update", "\\u", "dose", "data_", "(_", "obs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dot", "\\u", "day_", "._", "sort", "\\u", "all", "\\u", "observations_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dot", "\\u", "day_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DOT", "Day_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "case", "\\u", "json_", "(_", "self_", ",_", "case", "doc_", ",_", "regi", "men", "\\u", "labels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "json", " ", "represent", "ation", " ", "of", " ", "a", " ", "single", " ", "day", "s", " ", "nona", "rt", "/", "art", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "is", " ", "put", " ", "back", " ", "int", "o", " ", "the", " ", "case", "block", ",", " ", "sent", " ", "to", " ", "phone", ",", "\\", "10", ";", " ", " ", " ", " ", "sent", " ", "back", " ", "from", " ", "phone", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "transmitte", "d", " ", "represent", "ation", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "the", " ", "phone", "'", "s", " ", "represent", "ation", " ", "of", " ", "DOT", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "obs", "\\u", "for", "\\u", "dose", "num_", "(_", "obs", "\\u", "list_", ",_", "dose", "\\u", "num_", ",_", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "obs", "\\u", "list_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obs_", "=_", "obs", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day", "\\u", "slot_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obs_", "._", "day", "\\u", "slot_", "!=_", "''_", "and_", "obs_", "._", "day", "\\u", "slot_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "day", "\\u", "slot_", "=_", "obs_", "._", "day", "\\u", "slot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "obs_", "._", "day", "\\u", "note_", "is_", "not_", "None_", "and_", "len_", "(_", "obs_", "._", "day", "\\u", "note_", ")_", ">_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "obs_", "._", "day", "\\u", "note_", "!=_", "\"[", "Add", "endu", "m", "Entr", "y", "]\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "day", "\\u", "note_", "=_", "obs_", "._", "day", "\\u", "note_", "\\u\\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", "\\u", "note_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "obs_", "._", "adh", "eren", "ce_", ",_", "obs_", "._", "method_", ",_", "day", "\\u", "note_", ",_", "day", "\\u", "slot_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "one", " ", "and", " ", "don", "e", " ", "per", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "pris", "tin", "e", " ", "uncheck", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "'", "uncheck", "ed", "'_", ",_", "'", "pill", "box", "'_", ",_", "''_", ",_", "label_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ix_", ",_", "dose", "\\u", "data_", "in_", "enumerate_", "(_", "[_", "self_", "._", "nona", "rt_", ",_", "self_", "._", "art_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drug", "\\u", "arr_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels", "\\u", "arr_", "=_", "regi", "men", "\\u", "labels_", "[_", "ix_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dose", "\\u", "nums_", "=_", "dose", "\\u", "data_", "._", "dose", "\\u", "dict_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dose", "\\u", "nums_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "dose", "\\u", "num_", "in_", "dose", "\\u", "nums_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dose", "\\u", "num_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "each", " ", "dose", " ", "num", " ", "in", " ", "the", " ", "observe", "d", " ", "array", " ", "of", " ", "the", " ", "drug", " ", "type", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "may", "be", " ", "more", " ", "than", " ", "one", " ", "observation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "obs", "\\u", "list_", "=_", "dose", "\\u", "data_", "._", "dose", "\\u", "dict_", "[_", "dose", "\\u", "num_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drug", "\\u", "arr_", "._", "append_", "(_", "get", "\\u", "obs", "\\u", "for", "\\u", "dose", "num_", "(_", "obs", "\\u", "list_", ",_", "dose", "\\u", "num_", ",_", "labels", "\\u", "arr_", "[_", "dose", "\\u", "num_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "just", " ", "to", " ", "get", " ", "a", " ", "sense", " ", "of", " ", "how", " ", "wide", "spread", " ", "this", " ", "problem", " ", "is", " ", "in", " ", "sentry", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logging_", "._", "error_", "(_", "'", "A", " ", "pac", "t", " ", "case", " ", "had", " ", "an", " ", "empty", " ", "dose", " ", "number", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "fill", " ", "bec", "aus", "e", " ", "we", "'", "re", " ", "look", "ing", " ", "at", " ", "what", " ", "was", " ", "submitted", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "drug", "\\u", "arr_", ")_", "<=_", "dose", "\\u", "data_", "._", "total", "\\u", "dose", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dose", "\\u", "data_", "._", "drug", "\\u", "class_", "==_", "DOT", "\\u", "NON", "ART", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "max", "\\u", "dose", "s_", "=_", "int_", "(_", "getattr_", "(_", "case", "doc_", ",_", "'", "nona", "rtr", "egi", "men", "'_", ",_", "None_", ")_", "or_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "dose", "\\u", "data_", "._", "drug", "\\u", "class_", "==_", "DOT", "\\u", "ART", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "max", "\\u", "dose", "s_", "=_", "int_", "(_", "getattr_", "(_", "case", "doc_", ",_", "'", "art", "regi", "men", "'_", ",_", "None_", ")_", "or_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hack", ",", " ", "in", " ", "case", "s", " ", "where", " ", "we", " ", "have", " ", "zero", " ", "data", ",", " ", "put", " ", "in", " ", "the", " ", "current", " ", "regi", "men", " ", "delta", " ", "count_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delta_", "=_", "max", "\\u", "dose", "s_", "-_", "dose", "\\u", "data_", "._", "total", "\\u", "dose", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "delta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "drug", "\\u", "arr_", "._", "append_", "(_", "[_", "\"", "uncheck", "ed", "\"_", ",_", "\"", "pill", "box", "\"_", ",_", "''_", ",_", "labels", "\\u", "arr_", "[_", "x_", "]_", "if_", "x_", "<_", "len_", "(_", "labels", "\\u", "arr_", ")_", "else_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "._", "append_", "(_", "drug", "\\u", "arr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "filter", "\\u", "obs", "\\u", "for", "\\u", "day_", "(_", "this", "\\u", "date_", ",_", "observations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "this", "\\u", "date_", "._", "\\u\\u", "class\\u\\u_", "==_", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "filter_", "(_", "lambda_", "x_", ":_", "x_", "[_", "'", "observe", "d\\u", "date", "'_", "]_", "._", "date_", "(_", ")_", "==_", "this", "\\u", "date_", ",_", "observations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "query", "\\u", "observations_", "(_", "case", "\\u", "id_", ",_", "start", "\\u", "date_", ",_", "end", "\\u", "date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hit", " ", "couch", " ", "to", " ", "get", " ", "the", " ", "CO", "bse", "rva", "tion", "s", " ", "for", " ", "the", " ", "give", "n", " ", "date", " ", "range", " ", "of", " ", "the", " ", "OBS", "ERVE", "D", " ", "dates", ".", "\\", "10", ";", " ", " ", " ", " ", "The", "se", " ", "are", " ", "the", " ", "actual", " ", "observa", "tion", " ", "day", " ", "cells", " ", "in", " ", "whi", "ch", " ", "the", "y", " ", "filled", " ", "in", " ", "DOT", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "start", "\\u", "date", " ", "and", " ", "end", "\\u", "date", " ", "as", " ", "datetime", " ", "object", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "key_", "=_", "[_", "case", "\\u", "id_", ",_", "'", "anchor", "\\u", "date", "'_", ",_", "start", "\\u", "date_", "._", "year_", ",_", "start", "\\u", "date_", "._", "month_", ",_", "start", "\\u", "date_", "._", "day_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "key_", "=_", "[_", "case", "\\u", "id_", ",_", "'", "anchor", "\\u", "date", "'_", ",_", "end", "\\u", "date_", "._", "year_", ",_", "end", "\\u", "date_", "._", "month_", ",_", "end", "\\u", "date_", "._", "day_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "observations_", "=_", "CO", "bse", "rva", "tion_", "._", "view_", "(_", "'", "pac", "t", "/", "dot", "s", "\\u", "observa", "tion", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "key_", "=_", "start", "key_", ",_", "end", "key_", "=_", "end", "key_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "observations_", "\\u\\u\\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_", "query", "\\u", "observa", "tion", "s", "\\u", "single", "doc_", "(_", "doc", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hit", " ", "couch", " ", "to", " ", "get", " ", "the", " ", "CO", "bse", "rva", "tion", "s", " ", "for", " ", "a", " ", "single", " ", "xform", " ", "subm", "ission", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "[_", "'", "doc", "\\u", "id", "'_", ",_", "doc", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "observations_", "=_", "CO", "bse", "rva", "tion_", "._", "view_", "(_", "'", "pac", "t", "/", "dot", "s", "\\u", "observa", "tion", "s", "'_", ",_", "key_", "=_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classes_", "=_", "{_", "None_", ":_", "CO", "bse", "rva", "tion_", "}_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "observations_", "\\u\\u\\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_", "cmp", "\\u", "observation_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "a", " ", "give", "n", " ", "CO", "Bs", "erv", "ation", ",", " ", "do", " ", "the", " ", "follow", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "1", ":", " ", "If", " ", "it", "'", "s", " ", "an", " ", "adde", "nd", "um", "/", "recon", "cil", "iation", " ", "tru", "mps", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "2", ":", " ", "If", " ", "it", "'", "s", " ", "direct", ",", " ", "and", " ", "other", " ", "is", " ", "not", " ", "direct", ",", " ", "the", " ", "direct", " ", "wins", "\\", "10", ";", " ", " ", " ", " ", "3", ":", " ", "If", " ", "bot", "h", " ", "direct", ",", " ", "do", " ", "by", " ", "earliest", " ", "date", "\\", "10", ";", " ", " ", " ", " ", "4", ":", " ", "If", " ", "nei", "ther", " ", "direct", ",", " ", "do", " ", "by", " ", "earliest", " ", "encounter", "\\u", "date", " ", "rega", "rd", "less", " ", "of", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "-1", "\\", "10", ";", " ", " ", " ", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Assume", "s", " ", "tha", "t", " ", "x", " ", "and", " ", "y", " ", "have", " ", "the", " ", "same", " ", "observa", "tion", " ", "date", " ", "(", "cell", " ", "in", " ", "the", " ", "DOT", " ", "json", " ", "array", ")", "\\", "10", ";", " ", " ", " ", " ", "Enco", "unter", " ", "date", " ", "is", " ", "the", " ", "date", " ", "in", " ", "whi", "ch", " ", "the", " ", "date", " ", "cell", " ", "is", " ", "observe", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "x_", "._", "observe", "d\\u", "date_", "._", "date_", "(_", ")_", "==_", "y_", "._", "observe", "d\\u", "date_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "is", "\\u", "recon", "cil", "iation", "_", "=_", "getattr_", "(_", "x_", ",_", "'", "is", "\\u", "recon", "cil", "iation", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "is", "\\u", "recon", "cil", "iation", "_", "=_", "getattr_", "(_", "y_", ",_", "'", "is", "\\u", "recon", "cil", "iation", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Recon", "cil", "iation", " ", "handling", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recon", "cil", "iation", "s", " ", "alw", "ay", "s", " ", "win", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x", "\\u", "is", "\\u", "recon", "cil", "iation", "_", "and_", "y", "\\u", "is", "\\u", "recon", "cil", "iation", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sort", " ", "by", " ", "ear", "lie", "r", " ", "date", ",", " ", "so", " ", "flip", " ", "x", ",", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cmp_", "(_", "y_", "._", "submitted", "\\u", "date_", ",_", "x_", "._", "submitted", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "is", "\\u", "recon", "cil", "iation", "_", "and_", "not_", "y", "\\u", "is", "\\u", "recon", "cil", "iation", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "result", ":", " ", "x", " ", ">", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "x", "\\u", "is", "\\u", "recon", "cil", "iation", "_", "and_", "y", "\\u", "is", "\\u", "recon", "cil", "iation", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "result", ":", " ", "x", " ", "<", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x_", "._", "method_", "==_", "DOT", "\\u", "OBS", "ERV", "ATION", "\\u", "DIRECT", "_", "and_", "y_", "._", "method_", "==_", "DOT", "\\u", "OBS", "ERV", "ATION", "\\u", "DIRECT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Direct", " ", "observa", "tion", "s", " ", "win", " ", "next_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sort", " ", "by", " ", "ear", "lie", "r", " ", "date", ",", " ", "so", " ", "flip", " ", "x", ",", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cmp_", "(_", "y_", "._", "encounter", "\\u", "date_", ",_", "x_", "._", "encounter", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x_", "._", "method_", "==_", "DOT", "\\u", "OBS", "ERV", "ATION", "\\u", "DIRECT", "_", "and_", "y_", "._", "method_", "!=_", "DOT", "\\u", "OBS", "ERV", "ATION", "\\u", "DIRECT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "result", ":", " ", "x", " ", ">", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x_", "._", "method_", "!=_", "DOT", "\\u", "OBS", "ERV", "ATION", "\\u", "DIRECT", "_", "and_", "y_", "._", "method_", "==_", "DOT", "\\u", "OBS", "ERV", "ATION", "\\u", "DIRECT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "result", ":", " ", "x", " ", "<", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "x_", "._", "adh", "eren", "ce_", ",_", "x_", "._", "method_", ")_", "==_", "DOT", "\\u", "UNC", "HE", "CK", "ED", "\\u", "CELL", "_", "and_", "(_", "y_", "._", "adh", "eren", "ce_", ",_", "y_", "._", "method_", ")_", "!=_", "DOT", "\\u", "UNC", "HE", "CK", "ED", "\\u", "CELL", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "uncheck", "ed", " ", "shou", "ld", " ", "alw", "ay", "s", " ", "lose", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "x_", "._", "adh", "eren", "ce_", ",_", "x_", "._", "method_", ")_", "!=_", "DOT", "\\u", "UNC", "HE", "CK", "ED", "\\u", "CELL", "_", "and_", "(_", "y_", "._", "adh", "eren", "ce_", ",_", "y_", "._", "method_", ")_", "==_", "DOT", "\\u", "UNC", "HE", "CK", "ED", "\\u", "CELL", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cmp_", "(_", "y_", "._", "encounter", "\\u", "date_", ",_", "x_", "._", "encounter", "\\u", "date_", ")_", "\\u\\u\\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_", "sort", "\\u", "observations_", "(_", "observations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Meth", "od", " ", "to", " ", "sort", " ", "observa", "tion", "s", " ", "to", " ", "make", " ", "sure", " ", "tha", "t", " ", "the", " ", "\"", "winner", "\"", " ", "is", " ", "at", " ", "index", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sorted_", "(_", "observations_", ",_", "cmp_", "=_", "cmp", "\\u", "observation_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "dot", "s", "\\u", "case", "\\u", "json_", "(_", "case", "doc_", ",_", "anchor", "\\u", "date_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "JSO", "N", "-", "read", "y", " ", "array", " ", "of", " ", "the", " ", "DOT", "S", " ", "block", " ", "for", " ", "give", "n", " ", "patien", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Pul", "ling", " ", "proper", "ties", " ", "from", " ", "PAT", "IENT", " ", "document", ".", "\\", "10", ";", " ", " ", " ", " ", "Pat", "ient", " ", "document", " ", "tru", "mps", " ", "case", "doc", " ", "in", " ", "this", " ", "use", " ", "case", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "anchor", "\\u", "date_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "anchor", "\\u", "date_", "=_", "datetime_", "._", "now_", "(_", "tz_", "=_", "timezone_", "(_", "settings_", "._", "TIME", "\\u", "ZONE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "enddate", "_", "=_", "anchor", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "regi", "mens", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", " ", "art", " ", "is", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "getattr_", "(_", "case", "doc_", ",_", "CASE", "\\u", "NON", "ART", "\\u", "REGI", "MEN", "\\u", "PROP", "_", ",_", "None_", ")_", "or_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "art", " ", "is", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "getattr_", "(_", "case", "doc_", ",_", "CASE", "\\u", "ART", "\\u", "REGI", "MEN", "\\u", "PROP", "_", ",_", "None_", ")_", "or_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "regi", "men", "\\u", "labels", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "(_", "case", "doc_", "._", "nona", "rt", "\\u", "labels_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "(_", "case", "doc_", "._", "art", "\\u", "labels_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "day", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dm", "yun", "g", " ", "-", " ", "hack", " ", "to", " ", "have", " ", "query", "\\u", "observa", "tion", "s", " ", "timezone_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "relative", " ", "specific", " ", "to", " ", "the", " ", "east", "ern", " ", "sea", "board_", "\\u\\u\\uNL\\u\\u\\u_", "'", "anchor", "'_", ":_", "anchor", "\\u", "date_", "._", "strftime_", "(_", "\"%", "d", " ", "%", "b", " ", "%", "Y", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "observations_", "=_", "query", "\\u", "observations_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "doc_", "._", "\\u", "id_", ",_", "enddate", "_", "-_", "timedelta_", "(_", "days_", "=_", "DOT", "\\u", "DAY", "S", "\\u", "INTERVAL_", ")_", ",_", "enddate", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "delta_", "in_", "range_", "(_", "DOT", "\\u", "DAY", "S", "\\u", "INTERVAL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obs", "\\u", "date_", "=_", "enddate", "_", "-_", "timedelta_", "(_", "days_", "=_", "delta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day", "\\u", "arr_", "=_", "filter", "\\u", "obs", "\\u", "for", "\\u", "day_", "(_", "obs", "\\u", "date_", "._", "date_", "(_", ")_", ",_", "observations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day", "\\u", "data_", "=_", "DOT", "Day_", "._", "merge", "\\u", "from", "\\u", "observations_", "(_", "day", "\\u", "arr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "day", "s", "'_", "]_", "._", "append_", "(_", "day", "\\u", "data_", "._", "to", "\\u", "case", "\\u", "json_", "(_", "case", "doc_", ",_", "ret_", "[_", "'", "regi", "men", "\\u", "labels", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "[_", "'", "day", "s", "'_", "]_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ret_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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Handlers for viewing performance counter data.\n\"\"\"\n\n__author__ = '[email protected] (Matt Tracy)'\n\nimport json\nimport os\nimport time\nimport logging\nfrom functools import partial\nfrom tornado import auth, template, web\n\nfrom viewfinder.backend.base import handler, counters\nfrom viewfinder.backend.base.dotdict import DotDict\nfrom viewfinder.backend.db import metric\nfrom viewfinder.backend.db.db_client import RangeOperator\nfrom viewfinder.backend.www.admin import admin\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CountersHandler(admin.AdminHandler):\n \"\"\"Handler which returns the counter admin page.\"\"\"", "metadata": "root.CountersHandler", "header": "['module', '___EOS___']", "index": 20 }, { "content": " @handler.authenticated()\n @handler.asynchronous(datastore=True)\n @admin.require_permission(level='root')\n def get(self):\n logging.info('Counters: %r' % counters.counters)\n t_dict = self.PermissionsTemplateDict()\n t_dict['page_title'] = 'Viewfinder Backend Counters'\n t_dict['data_src'] = 'counters_data'\n t_dict['default_interval'] = '1h'\n self.render(\"counters.html\", **t_dict)", "metadata": "root.CountersHandler.get", "header": "['class', 'CountersHandler', '(', 'admin', '.', 'AdminHandler', ')', ':', '___EOS___']", "index": 22 }, { "content": "class CountersDataHandler(admin.AdminHandler):\n \"\"\"Handler which responds to ajax queries for performance counter data.\"\"\"\n\n MAX_TICK_COUNT = 150\n \"\"\"Desired maximum number of data points to return for a single query.\"\"\"\n", "metadata": "root.CountersDataHandler", "header": "['module', '___EOS___']", "index": 34 }, { "content": " @handler.authenticated()\n @handler.asynchronous(datastore=True)\n @admin.require_permission(level='root')\n def get(self):\n \"\"\"Responds to a single request for performance counter data. Each request has two required\n parameters in the query string, 'start' and 'end', which specify the beginning and end of the\n time range to be queried. The times should be expressed as the number of seconds since the\n unix epoch.\n \"\"\"\n def _OnAggregation(aggregator):\n self.set_header('Content-Type', 'application/json; charset=UTF-8')\n self.write(json.dumps(aggregator, default=_SerializeAggregateMetrics))\n self.finish()\n\n start_time = float(self.get_argument('start'))\n end_time = float(self.get_argument('end'))\n\n # Select an appropriate interval resolution based on the requested time span.\n intervals = metric.METRIC_INTERVALS\n min_resolution = (end_time - start_time) / self.MAX_TICK_COUNT\n selected_interval = next((i for i in intervals if i.length > min_resolution), intervals[-1])\n group_key = metric.Metric.EncodeGroupKey(metric.DEFAULT_CLUSTER_NAME, selected_interval)\n logging.info('Query performance counters, range: %s - %s, resolution: %s'\n % (time.ctime(start_time), time.ctime(end_time), selected_interval.name))\n\n metric.AggregatedMetric.CreateAggregateForTimespan(self._client, group_key, start_time, end_time,\n counters.counters, _OnAggregation)", "metadata": "root.CountersDataHandler.get", "header": "['class', 'CountersDataHandler', '(', 'admin', '.', 'AdminHandler', ')', ':', '___EOS___']", "index": 40 }, { "content": "def _SerializeAggregateMetrics(obj):\n \"\"\"Utility method to serialize AggregateMetric and AggregatedCounter objects to JSON.\n This method is designed to be passed to json.dumps().\n \"\"\"\n if isinstance(obj, metric.AggregatedMetric):\n return {'start_time': obj.start_time,\n 'end_time': obj.end_time,\n 'group_key': obj.group_key,\n 'machines': list(obj.machines),\n 'data': obj.counter_data\n }\n elif isinstance(obj, metric.AggregatedMetric.AggregatedCounter):\n logging.info('description: %r' % obj.description)\n return {'description': obj.description,\n 'is_average': obj.is_average,\n 'machine_data': obj.machine_data,\n 'cluster_total': obj.cluster_total,\n 'cluster_avg': obj.cluster_avg\n }\n else:\n raise web.HTTPError(400, \"Expected instance of AggregatedMetric or AggregatedCounter, got %r\" % obj)", "metadata": "root._SerializeAggregateMetrics", "header": "['module', '___EOS___']", "index": 69 } ]
[ { "span": "import os", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 9 }, { "span": "from functools import partial", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 29 }, { "span": "from tornado import auth, template, web", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 39 }, { "span": "from viewfinder.backend.base.dotdict import DotDict", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 51 }, { "span": "from viewfinder.backend.db.db_client import RangeOperator", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 57 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Handle", "rs", " ", "for", " ", "viewin", "g", " ", "perform", "anc", "e", " ", "counter", " ", "data", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "matt", "@", "email", "scrub", "bed", ".", "com", " ", "(", "Matt", " ", "Trac", "y", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "import_", "auth_", ",_", "template_", ",_", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "import_", "handler_", ",_", "counters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "dot", "dict_", "import_", "Dot", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "import_", "metric_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "db", "\\u", "client_", "import_", "Range", "Operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "www", "_", "._", "admin_", "import_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Counter", "s", "Handler_", "(_", "admin_", "._", "Admi", "n", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", "r", " ", "whi", "ch", " ", "return", "s", " ", "the", " ", "counter", " ", "admin", " ", "page", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Counter", "s", "Handler_", "(_", "admin_", "._", "Admi", "n", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "handler_", "._", "authenticated_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "handler_", "._", "async", "hronous", "_", "(_", "datastore_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "admin_", "._", "require", "\\u", "permission_", "(_", "level_", "=_", "'", "root", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "Counter", "s", ":", " ", "%", "r", "'_", "%_", "counters_", "._", "counters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "dict_", "=_", "self_", "._", "Permi", "ssion", "s", "Templa", "te", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "dict_", "[_", "'", "page", "\\u", "title", "'_", "]_", "=_", "'", "View", "finde", "r", " ", "Back", "end", " ", "Counter", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "dict_", "[_", "'", "data\\u", "src", "'_", "]_", "=_", "'", "counter", "s", "\\u", "data", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "dict_", "[_", "'", "default", "\\u", "interval", "'_", "]_", "=_", "'", "1", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "render_", "(_", "\"", "counter", "s", ".", "html", "\"_", ",_", "**_", "t", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Counter", "s", "Data", "Handler_", "(_", "admin_", "._", "Admi", "n", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", "r", " ", "whi", "ch", " ", "respond", "s", " ", "to", " ", "aja", "x", " ", "querie", "s", " ", "for", " ", "perform", "anc", "e", " ", "counter", " ", "data", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "TICK", "\\u", "COUNT_", "=_", "150_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Des", "ired", " ", "maxim", "um", " ", "number", " ", "of", " ", "data", " ", "points", " ", "to", " ", "return", " ", "for", " ", "a", " ", "single", " ", "query", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Counter", "s", "Data", "Handler_", "(_", "admin_", "._", "Admi", "n", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "handler_", "._", "authenticated_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "handler_", "._", "async", "hronous", "_", "(_", "datastore_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "admin_", "._", "require", "\\u", "permission_", "(_", "level_", "=_", "'", "root", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Respo", "nd", "s", " ", "to", " ", "a", " ", "single", " ", "request", " ", "for", " ", "perform", "anc", "e", " ", "counter", " ", "data", ".", " ", " ", "Ea", "ch", " ", "request", " ", "has", " ", "two", " ", "require", "d", "\\", "10", ";", " ", " ", " ", " ", "parameter", "s", " ", "in", " ", "the", " ", "query", " ", "string", ",", " ", "'", "start", "'", " ", "and", " ", "'", "end", "',", " ", "whi", "ch", " ", "speci", "fy", " ", "the", " ", "beginn", "ing", " ", "and", " ", "end", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "time", " ", "range", " ", "to", " ", "be", " ", "queried", ".", " ", " ", "The", " ", "times", " ", "shou", "ld", " ", "be", " ", "express", "ed", " ", "as", " ", "the", " ", "number", " ", "of", " ", "second", "s", " ", "sinc", "e", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "unix", " ", "epoch", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "On", "Aggregation", "_", "(_", "aggregator", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "applica", "tion", "/", "json", ";", " ", "charset", "=", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "aggregator", "_", ",_", "default_", "=_", "\\u", "Seriali", "ze", "Aggregate", "Metrics_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "\\u", "time_", "=_", "float_", "(_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "start", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "time_", "=_", "float_", "(_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "end", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "an", " ", "appropr", "iate", " ", "interval", " ", "resolu", "tion", " ", "based", " ", "on", " ", "the", " ", "request", "ed", " ", "time", " ", "span", "._", "\\u\\u\\uNL\\u\\u\\u_", "intervals_", "=_", "metric_", "._", "METRIC", "\\u", "INTERVAL", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "resolution_", "=_", "(_", "end", "\\u", "time_", "-_", "start", "\\u", "time_", ")_", "/_", "self_", "._", "MAX", "\\u", "TICK", "\\u", "COUNT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selecte", "d\\u", "interval_", "=_", "next_", "(_", "(_", "i_", "for_", "i_", "in_", "intervals_", "if_", "i_", "._", "length_", ">_", "min", "\\u", "resolution_", ")_", ",_", "intervals_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "key_", "=_", "metric_", "._", "Metric_", "._", "Encode", "Group", "Key_", "(_", "metric_", "._", "DEF", "AUL", "T", "\\u", "CLUSTER", "\\u", "NAME_", ",_", "selecte", "d\\u", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Query", " ", "perform", "anc", "e", " ", "counter", "s", ",", " ", "range", ":", " ", "%", "s", " ", "-", " ", "%", "s", ",", " ", "resolu", "tion", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "time_", "._", "ctime_", "(_", "start", "\\u", "time_", ")_", ",_", "time_", "._", "ctime_", "(_", "end", "\\u", "time_", ")_", ",_", "selecte", "d\\u", "interval_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metric_", "._", "Aggregate", "d", "Metric_", "._", "Creat", "e", "Aggregate", "For", "Times", "pan_", "(_", "self_", "._", "\\u", "client_", ",_", "group", "\\u", "key_", ",_", "start", "\\u", "time_", ",_", "end", "\\u", "time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "counters_", "._", "counters_", ",_", "\\u", "On", "Aggregation", "_", ")_", "\\u\\u\\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", "Seriali", "ze", "Aggregate", "Metrics_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Utili", "ty", " ", "method", " ", "to", " ", "serialize", " ", "Aggregate", "Met", "ric", " ", "and", " ", "Aggregate", "d", "Counter", " ", "object", "s", " ", "to", " ", "JSO", "N", ".", "\\", "10", ";", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "design", "ed", " ", "to", " ", "be", " ", "pass", "ed", " ", "to", " ", "json", ".", "dump", "s", "()", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", ",_", "metric_", "._", "Aggregate", "d", "Metric_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "start", "\\u", "time", "'_", ":_", "obj_", "._", "start", "\\u", "time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "\\u", "time", "'_", ":_", "obj_", "._", "end", "\\u", "time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "\\u", "key", "'_", ":_", "obj_", "._", "group", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "machine", "s", "'_", ":_", "list_", "(_", "obj_", "._", "machines_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "obj_", "._", "counter", "\\u", "data_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "obj_", ",_", "metric_", "._", "Aggregate", "d", "Metric_", "._", "Aggregate", "d", "Counter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "description", ":", " ", "%", "r", "'_", "%_", "obj_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "description", "'_", ":_", "obj_", "._", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "averag", "e", "'_", ":_", "obj_", "._", "is", "\\u", "average_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "machine", "\\u", "data", "'_", ":_", "obj_", "._", "machine", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cluster", "\\u", "total", "'_", ":_", "obj_", "._", "cluster", "\\u", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cluster", "\\u", "avg", "'_", ":_", "obj_", "._", "cluster", "\\u", "avg_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "web_", "._", "HTTP", "Error_", "(_", "400_", ",_", "\"", "Expect", "ed", " ", "instance", " ", "of", " ", "Aggregate", "d", "Met", "ric", " ", "or", " ", "Aggregate", "d", "Counter", ",", " ", "got", " ", "%", "r", "\"_", "%_", "obj_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
codekoala/django-articles/articles/management/commands/convert_comments_to_disqus.py
[ { "content": " def import_comments(self, forum_id):\n print 'Importing into forum %s' % self.forum_id\n\n article_ct = ContentType.objects.get_for_model(Article)\n for comment in Comment.objects.filter(content_type=article_ct):\n article = comment.content_object\n thread_obj = self.get_value_from_api('thread_by_identifier', {'identifier': article.id, 'title': article.title, 'forum_api_key': self.forum_api_key}, method='POST')\n\n thread = thread_obj['thread']\n if thread_obj['created']:\n # set the URL for this thread for good measure\n self.get_value_from_api('update_thread', {\n 'forum_api_key': self.forum_api_key,\n 'thread_id': thread['id'],\n 'title': article.title,\n 'url': 'http://%s%s' % (Site.objects.get_current().domain, article.get_absolute_url()),\n }, method='POST')\n print 'Created new thread for %s' % article.title\n\n # create the comment on disqus\n comment_obj = self.get_value_from_api('create_post', {\n 'thread_id': thread['id'],\n 'message': comment.comment,\n 'author_name': comment.user_name,\n 'author_email': comment.user_email,\n 'forum_api_key': self.forum_api_key,\n 'created_at': comment.submit_date.strftime('%Y-%m-%dT%H:%M'),\n 'ip_address': comment.ip_address,\n 'author_url': comment.user_url,\n 'state': self.get_state(comment)\n }, method='POST')\n\n print 'Imported comment for %s by %s on %s' % (article, comment.user_name, comment.submit_date)", "metadata": "root.Command.import_comments", "header": "['class', 'Command', '(', 'NoArgsCommand', ')', ':', '___EOS___']", "index": 87 } ]
[ { "span": "comment_obj ", "start_line": 107, "start_column": 12, "end_line": 107, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Command_", "(_", "No", "Arg", "s", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "comments_", "(_", "self_", ",_", "forum", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Import", "ing", " ", "int", "o", " ", "forum", " ", "%", "s", "'_", "%_", "self_", "._", "forum", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "article", "\\u", "ct_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get", "\\u", "for", "\\u", "model_", "(_", "Article_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "comment_", "in_", "Comment_", "._", "objects_", "._", "filter_", "(_", "content", "\\u", "type_", "=_", "article", "\\u", "ct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "article_", "=_", "comment_", "._", "content", "\\u", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread", "\\u", "obj_", "=_", "self_", "._", "get", "\\u", "value", "\\u", "from", "\\u", "api_", "(_", "'", "thread", "\\u", "by", "\\u", "identifi", "er", "'_", ",_", "{_", "'", "identifi", "er", "'_", ":_", "article_", "._", "id_", ",_", "'", "title", "'_", ":_", "article_", "._", "title_", ",_", "'", "forum", "\\u", "api", "\\u", "key", "'_", ":_", "self_", "._", "forum", "\\u", "api", "\\u", "key_", "}_", ",_", "method_", "=_", "'", "POST", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thread_", "=_", "thread", "\\u", "obj_", "[_", "'", "thread", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thread", "\\u", "obj_", "[_", "'", "created", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "URL", " ", "for", " ", "this", " ", "thread", " ", "for", " ", "good", " ", "measure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "\\u", "value", "\\u", "from", "\\u", "api_", "(_", "'", "update", "\\u", "thread", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "forum", "\\u", "api", "\\u", "key", "'_", ":_", "self_", "._", "forum", "\\u", "api", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thread", "\\u", "id", "'_", ":_", "thread_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "article_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "%", "s", "%", "s", "'_", "%_", "(_", "Site_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", "._", "domain_", ",_", "article_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "method_", "=_", "'", "POST", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Creat", "ed", " ", "new", " ", "thread", " ", "for", " ", "%", "s", "'_", "%_", "article_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "comment", " ", "on", " ", "dis", "qu", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "comment", "\\u", "obj_", "=_", "self_", "._", "get", "\\u", "value", "\\u", "from", "\\u", "api_", "(_", "'", "create", "\\u", "post", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thread", "\\u", "id", "'_", ":_", "thread_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "comment_", "._", "comment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "\\u", "name", "'_", ":_", "comment_", "._", "user", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "\\u", "email", "'_", ":_", "comment_", "._", "user", "\\u", "email_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "forum", "\\u", "api", "\\u", "key", "'_", ":_", "self_", "._", "forum", "\\u", "api", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "comment_", "._", "submit", "\\u", "date_", "._", "strftime_", "(_", "'%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ip", "\\u", "address", "'_", ":_", "comment_", "._", "ip", "\\u", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "\\u", "url", "'_", ":_", "comment_", "._", "user", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "self_", "._", "get", "\\u", "state_", "(_", "comment_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "method_", "=_", "'", "POST", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Imported", " ", "comment", " ", "for", " ", "%", "s", " ", "by", " ", "%", "s", " ", "on", " ", "%", "s", "'_", "%_", "(_", "article_", ",_", "comment_", "._", "user", "\\u", "name_", ",_", "comment_", "._", "submit", "\\u", "date_", ")_", "\\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,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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 ]
Unused import
trevorstephens/gplearn/gplearn/skutils/testing.py
[ { "content": "\"\"\"Testing utilities.\"\"\"\n\n# Copyright (c) 2011, 2012\n# Authors: Pietro Berkes,\n# Andreas Muller\n# Mathieu Blondel\n# Olivier Grisel\n# Arnaud Joly\n# Denis Engemann\n# License: BSD 3 clause\nimport os\nimport inspect\nimport pkgutil\nimport warnings\nimport sys\nimport re\nimport platform\n\nimport scipy as sp\nimport scipy.io\nfrom functools import wraps\ntry:\n # Python 2\n from urllib2 import urlopen\n from urllib2 import HTTPError\nexcept ImportError:\n # Python 3+\n from urllib.request import urlopen\n from urllib.error import HTTPError\n\nimport gplearn\nfrom sklearn.base import BaseEstimator\n\n# Conveniently import all assertions in one place.\nfrom nose.tools import assert_equal\nfrom nose.tools import assert_not_equal\nfrom nose.tools import assert_true\nfrom nose.tools import assert_false\nfrom nose.tools import assert_raises\nfrom nose.tools import raises\nfrom nose import SkipTest\nfrom nose import with_setup\n\nfrom numpy.testing import assert_almost_equal\nfrom numpy.testing import assert_array_equal\nfrom numpy.testing import assert_array_almost_equal\nfrom numpy.testing import assert_array_less\nimport numpy as np\n\nfrom sklearn.base import (ClassifierMixin, RegressorMixin, TransformerMixin,\n ClusterMixin)\n\n__all__ = [\"assert_equal\", \"assert_not_equal\", \"assert_raises\",\n \"assert_raises_regexp\", \"raises\", \"with_setup\", \"assert_true\",\n \"assert_false\", \"assert_almost_equal\", \"assert_array_equal\",\n \"assert_array_almost_equal\", \"assert_array_less\",\n \"assert_less\", \"assert_less_equal\",\n \"assert_greater\", \"assert_greater_equal\"]\n\n\ntry:\n from nose.tools import assert_in, assert_not_in\nexcept ImportError:\n # Nose < 1.0.0\n\n\n\ntry:\n from nose.tools import assert_raises_regex\nexcept ImportError:\n # for Py 2.6\n\n# assert_raises_regexp is deprecated in Python 3.4 in favor of\n# assert_raises_regex but lets keep the bacward compat in scikit-learn with\n# the old name for now\nassert_raises_regexp = assert_raises_regex\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# To remove when we support numpy 1.7\n\n\n\n\n\n\n\n\ntry:\n from nose.tools import assert_less\nexcept ImportError:\n assert_less = _assert_less\n\ntry:\n from nose.tools import assert_greater\nexcept ImportError:\n assert_greater = _assert_greater\n\n\n\n\nif hasattr(np.testing, 'assert_allclose'):\n assert_allclose = np.testing.assert_allclose\nelse:\n assert_allclose = _assert_allclose\n\n\n\n\n\n\n\n\n\n\n\n\n# Meta estimators need another estimator to be instantiated.\nMETA_ESTIMATORS = [\"OneVsOneClassifier\",\n \"OutputCodeClassifier\", \"OneVsRestClassifier\", \"RFE\",\n \"RFECV\", \"BaseEnsemble\"]\n# estimators that there is no way to default-construct sensibly\nOTHER = [\"Pipeline\", \"FeatureUnion\", \"GridSearchCV\",\n \"RandomizedSearchCV\", \"StandardScaler\"]\n\n# some trange ones\nDONT_TEST = ['SparseCoder', 'EllipticEnvelope', 'DictVectorizer',\n 'LabelBinarizer', 'LabelEncoder',\n 'MultiLabelBinarizer', 'TfidfTransformer',\n 'TfidfVectorizer', 'IsotonicRegression',\n 'OneHotEncoder', 'RandomTreesEmbedding',\n 'FeatureHasher', 'DummyClassifier', 'DummyRegressor',\n 'TruncatedSVD', 'PolynomialFeatures',\n 'GaussianRandomProjectionHash', 'HashingVectorizer',\n 'CheckingClassifier', 'PatchExtractor', 'CountVectorizer',\n # GradientBoosting base estimators, maybe should\n # exclude them in another way\n 'ZeroEstimator', 'ScaledLogOddsEstimator',\n 'QuantileEstimator', 'MeanEstimator',\n 'LogOddsEstimator', 'PriorProbabilityEstimator',\n '_SigmoidCalibration']\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nwith_network = with_setup(check_skip_network)\nwith_travis = with_setup(check_skip_travis)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def assert_in(x, container):\n assert_true(x in container, msg=\"%r in %r\" % (x, container))", "metadata": "root.assert_in", "header": "['module', '___EOS___']", "index": 65 }, { "content": " def assert_not_in(x, container):\n assert_false(x in container, msg=\"%r in %r\" % (x, container))", "metadata": "root.assert_not_in", "header": "['module', '___EOS___']", "index": 68 }, { "content": " def assert_raises_regex(expected_exception, expected_regexp,\n callable_obj=None, *args, **kwargs):\n \"\"\"Helper function to check for message patterns in exceptions\"\"\"\n\n not_raised = False\n try:\n callable_obj(*args, **kwargs)\n not_raised = True\n except Exception as e:\n error_message = str(e)\n if not re.compile(expected_regexp).search(error_message):\n raise AssertionError(\"Error message should match pattern \"\n \"%r. %r does not.\" %\n (expected_regexp, error_message))\n if not_raised:\n raise AssertionError(\"Should have raised %r\" %\n expected_exception(expected_regexp))", "metadata": "root.assert_raises_regex", "header": "['module', '___EOS___']", "index": 75 }, { "content": "def _assert_less(a, b, msg=None):\n message = \"%r is not lower than %r\" % (a, b)\n if msg is not None:\n message += \": \" + msg\n assert a < b, message", "metadata": "root._assert_less", "header": "['module', '___EOS___']", "index": 99 }, { "content": "def _assert_greater(a, b, msg=None):\n message = \"%r is not greater than %r\" % (a, b)\n if msg is not None:\n message += \": \" + msg\n assert a > b, message", "metadata": "root._assert_greater", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def assert_less_equal(a, b, msg=None):\n message = \"%r is not lower than or equal to %r\" % (a, b)\n if msg is not None:\n message += \": \" + msg\n assert a <= b, message", "metadata": "root.assert_less_equal", "header": "['module', '___EOS___']", "index": 113 }, { "content": "def assert_greater_equal(a, b, msg=None):\n message = \"%r is not greater than or equal to %r\" % (a, b)\n if msg is not None:\n message += \": \" + msg\n assert a >= b, message", "metadata": "root.assert_greater_equal", "header": "['module', '___EOS___']", "index": 120 }, { "content": "def assert_warns(warning_class, func, *args, **kw):\n \"\"\"Test that a certain warning occurs.\n\n Parameters\n ----------\n warning_class : the warning class\n The class to test for, e.g. UserWarning.\n\n func : callable\n Calable object to trigger warnings.\n\n *args : the positional arguments to `func`.\n\n **kw : the keyword arguments to `func`\n\n Returns\n -------\n\n result : the return value of `func`\n\n \"\"\"\n\n # very important to avoid uncontrolled state propagation\n clean_warning_registry()\n with warnings.catch_warnings(record=True) as w:\n # Cause all warnings to always be triggered.\n warnings.simplefilter(\"always\")\n # Trigger a warning.\n result = func(*args, **kw)\n if hasattr(np, 'VisibleDeprecationWarning'):\n # Filter out numpy-specific warnings in numpy >= 1.9\n w = [e for e in w\n if e.category is not np.VisibleDeprecationWarning]\n\n # Verify some things\n if not len(w) > 0:\n raise AssertionError(\"No warning raised when calling %s\"\n % func.__name__)\n\n found = any(warning.category is warning_class for warning in w)\n if not found:\n raise AssertionError(\"%s did not give warning: %s( is %s)\"\n % (func.__name__, warning_class, w))\n return result", "metadata": "root.assert_warns", "header": "['module', '___EOS___']", "index": 127 }, { "content": "def assert_warns_message(warning_class, message, func, *args, **kw):\n # very important to avoid uncontrolled state propagation\n \"\"\"Test that a certain warning occurs and with a certain message.\n\n Parameters\n ----------\n warning_class : the warning class\n The class to test for, e.g. UserWarning.\n\n message : str | callable\n The entire message or a substring to test for. If callable,\n it takes a string as argument and will trigger an assertion error\n if it returns `False`.\n\n func : callable\n Calable object to trigger warnings.\n\n *args : the positional arguments to `func`.\n\n **kw : the keyword arguments to `func`.\n\n Returns\n -------\n\n result : the return value of `func`\n\n \"\"\"\n clean_warning_registry()\n with warnings.catch_warnings(record=True) as w:\n # Cause all warnings to always be triggered.\n warnings.simplefilter(\"always\")\n if hasattr(np, 'VisibleDeprecationWarning'):\n # Let's not catch the numpy internal DeprecationWarnings\n warnings.simplefilter('ignore', np.VisibleDeprecationWarning)\n # Trigger a warning.\n result = func(*args, **kw)\n # Verify some things\n if not len(w) > 0:\n raise AssertionError(\"No warning raised when calling %s\"\n % func.__name__)\n\n found = [warning.category is warning_class for warning in w]\n if not any(found):\n raise AssertionError(\"No warning raised for %s with class \"\n \"%s\"\n % (func.__name__, warning_class))\n\n message_found = False\n # Checks the message of all warnings belong to warning_class\n for index in [i for i, x in enumerate(found) if x]:\n # substring will match, the entire message with typo won't\n msg = w[index].message # For Python 3 compatibility\n msg = str(msg.args[0] if hasattr(msg, 'args') else msg)\n if callable(message): # add support for certain tests\n check_in_message = message\n else:\n check_in_message = lambda msg: message in msg\n\n if check_in_message(msg):\n message_found = True\n break\n\n if not message_found:\n raise AssertionError(\"Did not receive the message you expected \"\n \"('%s') for <%s>.\"\n % (message, func.__name__))\n\n return result", "metadata": "root.assert_warns_message", "header": "['module', '___EOS___']", "index": 173 }, { "content": "def assert_no_warnings(func, *args, **kw):\n # XXX: once we may depend on python >= 2.6, this can be replaced by the\n\n # warnings module context manager.\n # very important to avoid uncontrolled state propagation\n clean_warning_registry()\n with warnings.catch_warnings(record=True) as w:\n warnings.simplefilter('always')\n\n result = func(*args, **kw)\n if hasattr(np, 'VisibleDeprecationWarning'):\n # Filter out numpy-specific warnings in numpy >= 1.9\n w = [e for e in w\n if e.category is not np.VisibleDeprecationWarning]\n\n if len(w) > 0:\n raise AssertionError(\"Got warnings when calling %s: %s\"\n % (func.__name__, w))\n return result", "metadata": "root.assert_no_warnings", "header": "['module', '___EOS___']", "index": 244 }, { "content": "def ignore_warnings(obj=None):\n \"\"\" Context manager and decorator to ignore warnings\n\n Note. Using this (in both variants) will clear all warnings\n from all python modules loaded. In case you need to test\n cross-module-warning-logging this is not your tool of choice.\n\n Examples\n --------\n >>> with ignore_warnings():\n ... warnings.warn('buhuhuhu')\n\n >>> def nasty_warn():\n ... warnings.warn('buhuhuhu')\n ... print(42)\n\n >>> ignore_warnings(nasty_warn)()\n 42\n\n \"\"\"\n if callable(obj):\n return _ignore_warnings(obj)\n else:\n return _IgnoreWarnings()", "metadata": "root.ignore_warnings", "header": "['module', '___EOS___']", "index": 265 }, { "content": "def _ignore_warnings(fn):\n \"\"\"Decorator to catch and hide warnings without visual nesting\"\"\"\n @wraps(fn)\n def wrapper(*args, **kwargs):\n # very important to avoid uncontrolled state propagation\n clean_warning_registry()\n with warnings.catch_warnings(record=True) as w:\n warnings.simplefilter('always')\n return fn(*args, **kwargs)\n w[:] = []\n\n return wrapper", "metadata": "root._ignore_warnings", "header": "['module', '___EOS___']", "index": 291 }, { "content": "class _IgnoreWarnings(object):\n\n \"\"\"Improved and simplified Python warnings context manager\n\n Copied from Python 2.7.5 and modified as required.\n \"\"\"\n\n\n\n", "metadata": "root._IgnoreWarnings", "header": "['module', '___EOS___']", "index": 305 }, { "content": " def __init__(self):\n \"\"\"\n Parameters\n ==========\n category : warning class\n The category to filter. Defaults to Warning. If None,\n all categories will be muted.\n \"\"\"\n self._record = True\n self._module = sys.modules['warnings']\n self._entered = False\n self.log = []", "metadata": "root._IgnoreWarnings.__init__", "header": "['class', '_IgnoreWarnings', '(', 'object', ')', ':', '___EOS___']", "index": 312 }, { "content": " def __repr__(self):\n args = []\n if self._record:\n args.append(\"record=True\")\n if self._module is not sys.modules['warnings']:\n args.append(\"module=%r\" % self._module)\n name = type(self).__name__\n return \"%s(%s)\" % (name, \", \".join(args))", "metadata": "root._IgnoreWarnings.__repr__", "header": "['class', '_IgnoreWarnings', '(', 'object', ')', ':', '___EOS___']", "index": 325 }, { "content": " def __enter__(self):\n clean_warning_registry() # be safe and not propagate state + chaos\n warnings.simplefilter('always')\n if self._entered:\n raise RuntimeError(\"Cannot enter %r twice\" % self)\n self._entered = True\n self._filters = self._module.filters\n self._module.filters = self._filters[:]\n self._showwarning = self._module.showwarning\n if self._record:\n self.log = []\n\n def showwarning(*args, **kwargs):\n self.log.append(warnings.WarningMessage(*args, **kwargs))\n self._module.showwarning = showwarning\n return self.log\n else:\n return None", "metadata": "root._IgnoreWarnings.__enter__", "header": "['class', '_IgnoreWarnings', '(', 'object', ')', ':', '___EOS___']", "index": 334 }, { "content": " def __exit__(self, *exc_info):\n if not self._entered:\n raise RuntimeError(\"Cannot exit %r without entering first\" % self)\n self._module.filters = self._filters\n self._module.showwarning = self._showwarning\n self.log[:] = []\n clean_warning_registry() # be safe and not propagate state + chaos", "metadata": "root._IgnoreWarnings.__exit__", "header": "['class', '_IgnoreWarnings', '(', 'object', ')', ':', '___EOS___']", "index": 353 }, { "content": "def _assert_allclose(actual, desired, rtol=1e-7, atol=0,\n err_msg='', verbose=True):\n actual, desired = np.asanyarray(actual), np.asanyarray(desired)\n if np.allclose(actual, desired, rtol=rtol, atol=atol):\n return\n msg = ('Array not equal to tolerance rtol=%g, atol=%g: '\n 'actual %s, desired %s') % (rtol, atol, actual, desired)\n raise AssertionError(msg)", "metadata": "root._assert_allclose", "header": "['module', '___EOS___']", "index": 373 }, { "content": "def assert_raise_message(exception, message, function, *args, **kwargs):\n \"\"\"Helper function to test error messages in exceptions\"\"\"\n\n try:\n function(*args, **kwargs)\n raise AssertionError(\"Should have raised %r\" % exception(message))\n except exception as e:\n error_message = str(e)\n assert_in(message, error_message)", "metadata": "root.assert_raise_message", "header": "['module', '___EOS___']", "index": 389 }, { "content": "def fake_mldata(columns_dict, dataname, matfile, ordering=None):\n \"\"\"Create a fake mldata data set.\n\n Parameters\n ----------\n columns_dict : dict, keys=str, values=ndarray\n Contains data as columns_dict[column_name] = array of data.\n\n dataname : string\n Name of data set.\n\n matfile : string or file object\n The file name string or the file-like object of the output file.\n\n ordering : list, default None\n List of column_names, determines the ordering in the data set.\n\n Notes\n -----\n This function transposes all arrays, while fetch_mldata only transposes\n 'data', keep that into account in the tests.\n \"\"\"\n datasets = dict(columns_dict)\n\n # transpose all variables\n for name in datasets:\n datasets[name] = datasets[name].T\n\n if ordering is None:\n ordering = sorted(list(datasets.keys()))\n # NOTE: setting up this array is tricky, because of the way Matlab\n # re-packages 1D arrays\n datasets['mldata_descr_ordering'] = sp.empty((1, len(ordering)),\n dtype='object')\n for i, name in enumerate(ordering):\n datasets['mldata_descr_ordering'][0, i] = name\n\n scipy.io.savemat(matfile, datasets, oned_as='column')", "metadata": "root.fake_mldata", "header": "['module', '___EOS___']", "index": 400 }, { "content": "class mock_mldata_urlopen(object):\n\n", "metadata": "root.mock_mldata_urlopen", "header": "['module', '___EOS___']", "index": 440 }, { "content": " def __init__(self, mock_datasets):\n \"\"\"Object that mocks the urlopen function to fake requests to mldata.\n\n `mock_datasets` is a dictionary of {dataset_name: data_dict}, or\n {dataset_name: (data_dict, ordering).\n `data_dict` itself is a dictionary of {column_name: data_array},\n and `ordering` is a list of column_names to determine the ordering\n in the data set (see `fake_mldata` for details).\n\n When requesting a dataset with a name that is in mock_datasets,\n this object creates a fake dataset in a StringIO object and\n returns it. Otherwise, it raises an HTTPError.\n \"\"\"\n self.mock_datasets = mock_datasets", "metadata": "root.mock_mldata_urlopen.__init__", "header": "['class', 'mock_mldata_urlopen', '(', 'object', ')', ':', '___EOS___']", "index": 442 }, { "content": " def __call__(self, urlname):\n dataset_name = urlname.split('/')[-1]\n if dataset_name in self.mock_datasets:\n resource_name = '_' + dataset_name\n from io import BytesIO\n matfile = BytesIO()\n\n dataset = self.mock_datasets[dataset_name]\n ordering = None\n if isinstance(dataset, tuple):\n dataset, ordering = dataset\n fake_mldata(dataset, resource_name, matfile, ordering)\n\n matfile.seek(0)\n return matfile\n else:\n raise HTTPError(urlname, 404, dataset_name + \" is not available\",\n [], None)", "metadata": "root.mock_mldata_urlopen.__call__", "header": "['class', 'mock_mldata_urlopen', '(', 'object', ')', ':', '___EOS___']", "index": 457 }, { "content": "def install_mldata_mock(mock_datasets):\n # Lazy import to avoid mutually recursive imports\n from sklearn import datasets\n datasets.mldata.urlopen = mock_mldata_urlopen(mock_datasets)", "metadata": "root.install_mldata_mock", "header": "['module', '___EOS___']", "index": 477 }, { "content": "def uninstall_mldata_mock():\n # Lazy import to avoid mutually recursive imports\n from sklearn import datasets\n datasets.mldata.urlopen = urlopen", "metadata": "root.uninstall_mldata_mock", "header": "['module', '___EOS___']", "index": 483 }, { "content": "def all_estimators(include_meta_estimators=False,\n include_other=False, type_filter=None,\n include_dont_test=False):\n \"\"\"Get a list of all estimators from sklearn.\n\n This function crawls the module and gets all classes that inherit\n from BaseEstimator. Classes that are defined in test-modules are not\n included.\n By default meta_estimators such as GridSearchCV are also not included.\n\n Parameters\n ----------\n include_meta_estimators : boolean, default=False\n Whether to include meta-estimators that can be constructed using\n an estimator as their first argument. These are currently\n BaseEnsemble, OneVsOneClassifier, OutputCodeClassifier,\n OneVsRestClassifier, RFE, RFECV.\n\n include_other : boolean, default=False\n Wether to include meta-estimators that are somehow special and can\n not be default-constructed sensibly. These are currently\n Pipeline, FeatureUnion and GridSearchCV\n\n include_dont_test : boolean, default=False\n Whether to include \"special\" label estimator or test processors.\n\n type_filter : string, list of string, or None, default=None\n Which kind of estimators should be returned. If None, no filter is\n applied and all estimators are returned. Possible values are\n 'classifier', 'regressor', 'cluster' and 'transformer' to get\n estimators only of these specific types, or a list of these to\n get the estimators that fit at least one of the types.\n\n Returns\n -------\n estimators : list of tuples\n List of (name, class), where ``name`` is the class name as string\n and ``class`` is the actuall type of the class.\n \"\"\"\n def is_abstract(c):\n if not(hasattr(c, '__abstractmethods__')):\n return False\n if not len(c.__abstractmethods__):\n return False\n return True\n\n all_classes = []\n # get parent folder\n path = gplearn.__path__\n for importer, modname, ispkg in pkgutil.walk_packages(\n path=path, prefix='gplearn.', onerror=lambda x: None):\n if \".tests.\" in modname:\n continue\n module = __import__(modname, fromlist=\"dummy\")\n classes = inspect.getmembers(module, inspect.isclass)\n all_classes.extend(classes)\n\n all_classes = set(all_classes)\n\n estimators = [c for c in all_classes\n if (issubclass(c[1], BaseEstimator)\n and c[0] != 'BaseEstimator')]\n # get rid of abstract base classes\n estimators = [c for c in estimators if not is_abstract(c[1])]\n\n if not include_dont_test:\n estimators = [c for c in estimators if not c[0] in DONT_TEST]\n\n if not include_other:\n estimators = [c for c in estimators if not c[0] in OTHER]\n # possibly get rid of meta estimators\n if not include_meta_estimators:\n estimators = [c for c in estimators if not c[0] in META_ESTIMATORS]\n if type_filter is not None:\n if not isinstance(type_filter, list):\n type_filter = [type_filter]\n else:\n type_filter = list(type_filter) # copy\n filtered_estimators = []\n filters = {'classifier': ClassifierMixin,\n 'regressor': RegressorMixin,\n 'transformer': TransformerMixin,\n 'cluster': ClusterMixin}\n for name, mixin in filters.items():\n if name in type_filter:\n type_filter.remove(name)\n filtered_estimators.extend([est for est in estimators\n if issubclass(est[1], mixin)])\n estimators = filtered_estimators\n if type_filter:\n raise ValueError(\"Parameter type_filter must be 'classifier', \"\n \"'regressor', 'transformer', 'cluster' or None, got\"\n \" %s.\" % repr(type_filter))\n\n # drop duplicates, sort for reproducibility\n return sorted(set(estimators))", "metadata": "root.all_estimators", "header": "['module', '___EOS___']", "index": 515 }, { "content": "def set_random_state(estimator, random_state=0):\n if \"random_state\" in estimator.get_params().keys():\n estimator.set_params(random_state=random_state)", "metadata": "root.set_random_state", "header": "['module', '___EOS___']", "index": 613 }, { "content": "def if_matplotlib(func):\n \"\"\"Test decorator that skips test if matplotlib not installed. \"\"\"\n\n @wraps(func)\n def run_test(*args, **kwargs):\n try:\n import matplotlib\n matplotlib.use('Agg', warn=False)\n # this fails if no $DISPLAY specified\n matplotlib.pylab.figure()\n except:\n raise SkipTest('Matplotlib not available.')\n else:\n return func(*args, **kwargs)\n return run_test", "metadata": "root.if_matplotlib", "header": "['module', '___EOS___']", "index": 618 }, { "content": "def if_not_mac_os(versions=('10.7', '10.8', '10.9'),\n message='Multi-process bug in Mac OS X >= 10.7 '\n '(see issue #636)'):\n \"\"\"Test decorator that skips test if OS is Mac OS X and its\n major version is one of ``versions``.\n \"\"\"\n mac_version, _, _ = platform.mac_ver()\n skip = '.'.join(mac_version.split('.')[:2]) in versions\n\n def decorator(func):\n if skip:\n @wraps(func)\n def func(*args, **kwargs):\n raise SkipTest(message)\n return func\n return decorator", "metadata": "root.if_not_mac_os", "header": "['module', '___EOS___']", "index": 635 }, { "content": "def clean_warning_registry():\n \"\"\"Safe way to reset warnings \"\"\"\n warnings.resetwarnings()\n reg = \"__warningregistry__\"\n for mod_name, mod in list(sys.modules.items()):\n if 'six.moves' in mod_name:\n continue\n if hasattr(mod, reg):\n getattr(mod, reg).clear()", "metadata": "root.clean_warning_registry", "header": "['module', '___EOS___']", "index": 653 }, { "content": "def check_skip_network():\n if int(os.environ.get('SKLEARN_SKIP_NETWORK_TESTS', 0)):\n raise SkipTest(\"Text tutorial requires large dataset download\")", "metadata": "root.check_skip_network", "header": "['module', '___EOS___']", "index": 664 }, { "content": "def check_skip_travis():\n \"\"\"Skip test if being run on Travis.\"\"\"\n if os.environ.get('TRAVIS') == \"true\":\n raise SkipTest(\"This test needs to be skipped on Travis\")", "metadata": "root.check_skip_travis", "header": "['module', '___EOS___']", "index": 669 } ]
[ { "span": "from nose.tools import assert_in, assert_not_in", "start_line": 61, "start_column": 4, "end_line": 61, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Test", "ing", " ", "util", "iti", "es", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2011", ",", " ", "2012_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "Pie", "tro", " ", "Ber", "kes", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Andre", "as", " ", "Mul", "ler_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Math", "ie", "u", " ", "Blo", "nde", "l_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Oli", "vie", "r", " ", "Gri", "sel_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Arn", "aud", " ", "Jo", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Den", "is", " ", "Eng", "eman", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "BS", "D", " ", "3", " ", "clause_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pkg", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "scipy_", "as_", "sp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib2_", "import_", "urlopen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib2_", "import_", "HTTP", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "._", "request_", "import_", "urlopen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "error_", "import_", "HTTP", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "gpl", "earn", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "base_", "import_", "Base", "Estimator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Conve", "nie", "ntl", "y", " ", "import", " ", "all", " ", "assertion", "s", " ", "in", " ", "one", " ", "place", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "not", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "true_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "false_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "import_", "Ski", "p", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "import_", "with", "\\u", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "._", "testing_", "import_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "testing_", "import_", "assert", "\\u", "array", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "testing_", "import_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "testing_", "import_", "assert", "\\u", "array", "\\u", "less_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sklearn_", "._", "base_", "import_", "(_", "Classif", "ier", "Mixin_", ",_", "Regr", "esso", "r", "Mixin_", ",_", "Transform", "er", "Mixin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cluster", "Mixin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\"", "assert", "\\u", "equal", "\"_", ",_", "\"", "assert", "\\u", "not", "\\u", "equal", "\"_", ",_", "\"", "assert", "\\u", "raise", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "assert", "\\u", "raise", "s", "\\u", "regexp", "\"_", ",_", "\"", "raise", "s", "\"_", ",_", "\"", "with", "\\u", "setup", "\"_", ",_", "\"", "assert", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "assert", "\\u", "fal", "se", "\"_", ",_", "\"", "assert", "\\u", "alm", "ost", "\\u", "equal", "\"_", ",_", "\"", "assert", "\\u", "array", "\\u", "equal", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal", "\"_", ",_", "\"", "assert", "\\u", "array", "\\u", "less", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "assert", "\\u", "less", "\"_", ",_", "\"", "assert", "\\u", "less", "\\u", "equal", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "assert", "\\u", "great", "er", "\"_", ",_", "\"", "assert", "\\u", "great", "er", "\\u", "equal", "\"_", "]_", "\\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_", "nose_", "._", "tools_", "import_", "assert", "\\u", "in_", ",_", "assert", "\\u", "not", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "se", " ", "<", " ", "1.0", ".0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "raise", "s", "\\u", "regex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "Py", " ", "2.6", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "\\u", "raise", "s", "\\u", "regexp", " ", "is", " ", "depre", "cated", " ", "in", " ", "Pyth", "on", " ", "3.4", " ", "in", " ", "fav", "or", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "\\u", "raise", "s", "\\u", "regex", " ", "but", " ", "lets", " ", "keep", " ", "the", " ", "bac", "ward", " ", "compa", "t", " ", "in", " ", "scikit", "-", "learn", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "old", " ", "name", " ", "for", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "\\u", "raise", "s", "\\u", "regexp_", "=_", "assert", "\\u", "raise", "s", "\\u", "regex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "remove", " ", "whe", "n", " ", "we", " ", "support", " ", "nump", "y", " ", "1.7", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "less_", "\\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 ", " _", "assert", "\\u", "less_", "=_", "\\u", "assert", "\\u", "less_", "\\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_", "nose_", "._", "tools_", "import_", "assert", "\\u", "greater_", "\\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 ", " _", "assert", "\\u", "greater_", "=_", "\\u", "assert", "\\u", "greater_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "(_", "np_", "._", "testing_", ",_", "'", "assert", "\\u", "allc", "lose", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "allclose_", "=_", "np_", "._", "testing_", "._", "assert", "\\u", "allclose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "allclose_", "=_", "\\u", "assert", "\\u", "allclose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Meta", " ", "estimators", " ", "need", " ", "anot", "her", " ", "esti", "mat", "or", " ", "to", " ", "be", " ", "instantiate", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "MET", "A", "\\u", "EST", "IMA", "TOR", "S_", "=_", "[_", "\"", "One", "Vs", "One", "Classif", "ier", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Output", "Code", "Classif", "ier", "\"_", ",_", "\"", "One", "Vs", "Rest", "Classif", "ier", "\"_", ",_", "\"", "RF", "E", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "RF", "EC", "V", "\"_", ",_", "\"", "Base", "Ensemble", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "estimators", " ", "tha", "t", " ", "there", " ", "is", " ", "no", " ", "way", " ", "to", " ", "default", "-", "construct", " ", "sensi", "bly", "_", "\\u\\u\\uNL\\u\\u\\u_", "OTHER", "_", "=_", "[_", "\"", "Pipe", "line", "\"_", ",_", "\"", "Feature", "Uni", "on", "\"_", ",_", "\"", "Grid", "Sear", "ch", "CV", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Random", "ize", "d", "Sear", "ch", "CV", "\"_", ",_", "\"", "Standard", "Scaler", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "tran", "ge", " ", "ones_", "\\u\\u\\uNL\\u\\u\\u_", "DON", "T", "\\u", "TEST_", "=_", "[_", "'", "Spar", "se", "Coder", "'_", ",_", "'", "Ell", "ipti", "c", "Env", "elope", "'_", ",_", "'", "Dict", "Vector", "ize", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Label", "Bin", "ari", "zer", "'_", ",_", "'", "Label", "Encode", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Multi", "Label", "Bin", "ari", "zer", "'_", ",_", "'", "Tf", "idf", "Transform", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Tf", "idf", "Vector", "ize", "r", "'_", ",_", "'", "Iso", "toni", "c", "Regr", "ession", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "One", "Hot", "Encode", "r", "'_", ",_", "'", "Random", "Trees", "Embedding", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Feature", "Hasher", "'_", ",_", "'", "Du", "mm", "y", "Classif", "ier", "'_", ",_", "'", "Du", "mm", "y", "Regr", "esso", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Truncate", "d", "SV", "D", "'_", ",_", "'", "Polynomial", "Feature", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Gaussian", "Random", "Projection", "Hash", "'_", ",_", "'", "Hash", "ing", "Vector", "ize", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Check", "ing", "Classif", "ier", "'_", ",_", "'", "Pat", "ch", "Extract", "or", "'_", ",_", "'", "Count", "Vector", "ize", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grad", "ient", "Boost", "ing", " ", "base", " ", "estimators", ",", " ", "may", "be", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exclu", "de", " ", "them", " ", "in", " ", "anot", "her", " ", "way_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Zero", "Estimat", "or", "'_", ",_", "'", "Scaled", "Log", "Od", "ds", "Estimat", "or", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Quanti", "le", "Estimat", "or", "'_", ",_", "'", "Mea", "n", "Estimat", "or", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Log", "Od", "ds", "Estimat", "or", "'_", ",_", "'", "Prior", "Probabili", "ty", "Estimat", "or", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "Sigm", "oid", "Calibrat", "ion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "with", "\\u", "network_", "=_", "with", "\\u", "setup_", "(_", "check", "\\u", "skip", "\\u", "network_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "travis", "_", "=_", "with", "\\u", "setup_", "(_", "check", "\\u", "skip", "\\u", "travis", "_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "assert", "\\u", "in_", "(_", "x_", ",_", "container_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "true_", "(_", "x_", "in_", "container_", ",_", "msg_", "=_", "\"%", "r", " ", "in", " ", "%", "r", "\"_", "%_", "(_", "x_", ",_", "container_", ")_", ")_", "\\u\\u\\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", "not", "\\u", "in_", "(_", "x_", ",_", "container_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "false_", "(_", "x_", "in_", "container_", ",_", "msg_", "=_", "\"%", "r", " ", "in", " ", "%", "r", "\"_", "%_", "(_", "x_", ",_", "container_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "assert", "\\u", "raise", "s", "\\u", "regex_", "(_", "expected", "\\u", "exception_", ",_", "expected", "\\u", "regexp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callable\\u", "obj_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "function", " ", "to", " ", "check", " ", "for", " ", "message", " ", "pattern", "s", " ", "in", " ", "exception", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "not", "\\u", "raised_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callable\\u", "obj_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "\\u", "raised_", "=_", "True_", "\\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 ", " _", "error", "\\u", "message_", "=_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "re_", "._", "compile_", "(_", "expected", "\\u", "regexp_", ")_", "._", "search_", "(_", "error", "\\u", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Error", " ", "message", " ", "shou", "ld", " ", "match", " ", "pattern", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "r", ".", " ", "%", "r", " ", "doe", "s", " ", "not", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "expected", "\\u", "regexp_", ",_", "error", "\\u", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not", "\\u", "raised_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Sho", "ul", "d", " ", "have", " ", "raise", "d", " ", "%", "r", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "exception_", "(_", "expected", "\\u", "regexp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "assert", "\\u", "less_", "(_", "a_", ",_", "b_", ",_", "msg_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"%", "r", " ", "is", " ", "not", " ", "lower", " ", "than", " ", "%", "r", "\"_", "%_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "+=_", "\":", " ", "\"_", "+_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "a_", "<_", "b_", ",_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "assert", "\\u", "greater_", "(_", "a_", ",_", "b_", ",_", "msg_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"%", "r", " ", "is", " ", "not", " ", "great", "er", " ", "than", " ", "%", "r", "\"_", "%_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "+=_", "\":", " ", "\"_", "+_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "a_", ">_", "b_", ",_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "less", "\\u", "equal_", "(_", "a_", ",_", "b_", ",_", "msg_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"%", "r", " ", "is", " ", "not", " ", "lower", " ", "than", " ", "or", " ", "equal", " ", "to", " ", "%", "r", "\"_", "%_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "+=_", "\":", " ", "\"_", "+_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "a_", "<=_", "b_", ",_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "great", "er", "\\u", "equal_", "(_", "a_", ",_", "b_", ",_", "msg_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"%", "r", " ", "is", " ", "not", " ", "great", "er", " ", "than", " ", "or", " ", "equal", " ", "to", " ", "%", "r", "\"_", "%_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "+=_", "\":", " ", "\"_", "+_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "a_", ">=_", "b_", ",_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "warns", "_", "(_", "warn", "ing", "\\u", "class_", ",_", "func_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "a", " ", "cert", "ain", " ", "warn", "ing", " ", "occur", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "warn", "ing", "\\u", "class", " ", ":", " ", "the", " ", "warn", "ing", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "class", " ", "to", " ", "test", " ", "for", ",", " ", "e", ".", "g", ".", " ", "User", "Warn", "ing", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "func", " ", ":", " ", "calla", "ble", "\\", "10", ";", " ", " ", " ", " ", "Cal", "able", " ", "object", " ", "to", " ", "trigger", " ", "warn", "ings", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "args", " ", ":", " ", "the", " ", "positional", " ", "argu", "ment", "s", " ", "to", " ", "`", "func", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "kw", " ", ":", " ", "the", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "to", " ", "`", "func", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "result", " ", ":", " ", "the", " ", "return", " ", "value", " ", "of", " ", "`", "func", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "very", " ", "importa", "nt", " ", "to", " ", "avoid", " ", "uncon", "troll", "ed", " ", "state", " ", "propagat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "clean", "\\u", "warn", "ing", "\\u", "registry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", "record_", "=_", "True_", ")_", "as_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cause", " ", "all", " ", "warn", "ings", " ", "to", " ", "alw", "ay", "s", " ", "be", " ", "trigger", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "\"", "alw", "ay", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Trigger", " ", "a", " ", "warn", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "func_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "np_", ",_", "'", "Vis", "ibl", "e", "Dep", "reca", "tion", "Warn", "ing", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Filter", " ", "out", " ", "nump", "y", "-", "specific", " ", "warn", "ings", " ", "in", " ", "nump", "y", " ", ">=", " ", "1.9", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "=_", "[_", "e_", "for_", "e_", "in_", "w_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "e_", "._", "category_", "is_", "not_", "np_", "._", "Vis", "ibl", "e", "Dep", "reca", "tion", "Warning_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "some", " ", "things_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "w_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "No", " ", "warn", "ing", " ", "raise", "d", " ", "whe", "n", " ", "calling", " ", "%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "func_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "found_", "=_", "any_", "(_", "warning_", "._", "category_", "is_", "warn", "ing", "\\u", "class_", "for_", "warning_", "in_", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"%", "s", " ", "did", " ", "not", " ", "give", " ", "warn", "ing", ":", " ", "%", "s", "(", " ", "is", " ", "%", "s", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "func_", "._", "\\u\\u", "name\\u\\u_", ",_", "warn", "ing", "\\u", "class_", ",_", "w_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "warns", "\\u", "message_", "(_", "warn", "ing", "\\u", "class_", ",_", "message_", ",_", "func_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "very", " ", "importa", "nt", " ", "to", " ", "avoid", " ", "uncon", "troll", "ed", " ", "state", " ", "propagat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "a", " ", "cert", "ain", " ", "warn", "ing", " ", "occur", "s", " ", "and", " ", "with", " ", "a", " ", "cert", "ain", " ", "message", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "warn", "ing", "\\u", "class", " ", ":", " ", "the", " ", "warn", "ing", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "class", " ", "to", " ", "test", " ", "for", ",", " ", "e", ".", "g", ".", " ", "User", "Warn", "ing", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "message", " ", ":", " ", "str", " ", "|", " ", "calla", "ble", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "entire", " ", "message", " ", "or", " ", "a", " ", "substring", " ", "to", " ", " ", "test", " ", "for", ".", " ", "If", " ", "calla", "ble", ",", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "take", "s", " ", "a", " ", "string", " ", "as", " ", "argu", "ment", " ", "and", " ", "will", " ", "trigger", " ", "an", " ", "assertion", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "it", " ", "return", "s", " ", "`", "Fal", "se", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "func", " ", ":", " ", "calla", "ble", "\\", "10", ";", " ", " ", " ", " ", "Cal", "able", " ", "object", " ", "to", " ", "trigger", " ", "warn", "ings", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", "args", " ", ":", " ", "the", " ", "positional", " ", "argu", "ment", "s", " ", "to", " ", "`", "func", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "kw", " ", ":", " ", "the", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "to", " ", "`", "func", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "result", " ", ":", " ", "the", " ", "return", " ", "value", " ", "of", " ", "`", "func", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "\\u", "warn", "ing", "\\u", "registry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", "record_", "=_", "True_", ")_", "as_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cause", " ", "all", " ", "warn", "ings", " ", "to", " ", "alw", "ay", "s", " ", "be", " ", "trigger", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "\"", "alw", "ay", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "np_", ",_", "'", "Vis", "ibl", "e", "Dep", "reca", "tion", "Warn", "ing", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Let", "'", "s", " ", "not", " ", "catch", " ", "the", " ", "nump", "y", " ", "internal", " ", "Dep", "reca", "tion", "Warnings", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "'", "ignore", "'_", ",_", "np_", "._", "Vis", "ibl", "e", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Trigger", " ", "a", " ", "warn", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "func_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "some", " ", "things_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "len_", "(_", "w_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "No", " ", "warn", "ing", " ", "raise", "d", " ", "whe", "n", " ", "calling", " ", "%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "func_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "found_", "=_", "[_", "warning_", "._", "category_", "is_", "warn", "ing", "\\u", "class_", "for_", "warning_", "in_", "w_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "any_", "(_", "found_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "No", " ", "warn", "ing", " ", "raise", "d", " ", "for", " ", "%", "s", " ", "with", " ", "class", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "func_", "._", "\\u\\u", "name\\u\\u_", ",_", "warn", "ing", "\\u", "class_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message", "\\u", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", "s", " ", "the", " ", "message", " ", "of", " ", "all", " ", "warn", "ings", " ", "belo", "ng", " ", "to", " ", "warn", "ing", "\\u", "class_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "index_", "in_", "[_", "i_", "for_", "i_", ",_", "x_", "in_", "enumerate_", "(_", "found_", ")_", "if_", "x_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "substring", " ", "will", " ", "match", ",", " ", "the", " ", "entire", " ", "message", " ", "with", " ", "typo", " ", "won", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "w_", "[_", "index_", "]_", "._", "message_", "#", " ", "For", " ", "Pyth", "on", " ", "3", " ", "compatibility", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "str_", "(_", "msg_", "._", "args_", "[_", "0_", "]_", "if_", "hasattr_", "(_", "msg_", ",_", "'", "args", "'_", ")_", "else_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callable_", "(_", "message_", ")_", ":_", "#", " ", "add", " ", "support", " ", "for", " ", "cert", "ain", " ", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "in", "\\u", "message_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "in", "\\u", "message_", "=_", "lambda_", "msg_", ":_", "message_", "in_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "check", "\\u", "in", "\\u", "message_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message", "\\u", "found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "message", "\\u", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Di", "d", " ", "not", " ", "receive", " ", "the", " ", "message", " ", "you", " ", "expected", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "'%", "s", "')", " ", "for", " ", "<", "%", "s", ">.", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "message_", ",_", "func_", "._", "\\u\\u", "name\\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_", "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_", "assert", "\\u", "no", "\\u", "warnings_", "(_", "func_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "onc", "e", " ", "we", " ", "may", " ", "depend", " ", "on", " ", "python", " ", ">=", " ", "2.6", ",", " ", "this", " ", "can", " ", "be", " ", "replaced", " ", "by", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "warn", "ings", " ", "module", " ", "context", " ", "manage", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "very", " ", "importa", "nt", " ", "to", " ", "avoid", " ", "uncon", "troll", "ed", " ", "state", " ", "propagat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean", "\\u", "warn", "ing", "\\u", "registry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", "record_", "=_", "True_", ")_", "as_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "'", "alw", "ay", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "func_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "np_", ",_", "'", "Vis", "ibl", "e", "Dep", "reca", "tion", "Warn", "ing", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Filter", " ", "out", " ", "nump", "y", "-", "specific", " ", "warn", "ings", " ", "in", " ", "nump", "y", " ", ">=", " ", "1.9", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "=_", "[_", "e_", "for_", "e_", "in_", "w_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "e_", "._", "category_", "is_", "not_", "np_", "._", "Vis", "ibl", "e", "Dep", "reca", "tion", "Warning_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "w_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Got", " ", "warn", "ings", " ", "whe", "n", " ", "calling", " ", "%", "s", ":", " ", "%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "func_", "._", "\\u\\u", "name\\u\\u_", ",_", "w_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ignore", "\\u", "warnings_", "(_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Context", " ", "manage", "r", " ", "and", " ", "decorat", "or", " ", "to", " ", "ignore", " ", "warn", "ings", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ".", " ", "Us", "ing", " ", "this", " ", "(", "in", " ", "bot", "h", " ", "variant", "s", ")", " ", "will", " ", "clear", " ", "all", " ", "warn", "ings", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "all", " ", "python", " ", "module", "s", " ", "load", "ed", ".", " ", "In", " ", "case", " ", "you", " ", "need", " ", "to", " ", "test", "\\", "10", ";", " ", " ", " ", " ", "cross", "-", "module", "-", "warn", "ing", "-", "logg", "ing", " ", "this", " ", "is", " ", "not", " ", "your", " ", "tool", " ", "of", " ", "choice", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "with", " ", "ignore", "\\u", "warn", "ings", "():", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "warn", "ings", ".", "warn", "('", "bu", "hu", "hu", "hu", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "def", " ", "nas", "ty", "\\u", "warn", "():", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", "warn", "ings", ".", "warn", "('", "bu", "hu", "hu", "hu", "')", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", "print", "(", "4", "2", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "ignore", "\\u", "warn", "ings", "(", "nas", "ty", "\\u", "warn", ")()", "\\", "10", ";", " ", " ", " ", " ", "4", "2", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callable_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "ignore", "\\u", "warnings_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Ignor", "e", "Warnings", "_", "(_", ")_", "\\u\\u\\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", "ignore", "\\u", "warnings_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Decorat", "or", " ", "to", " ", "catch", " ", "and", " ", "hide", " ", "warn", "ings", " ", "with", "out", " ", "visu", "al", " ", "nesting", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "wraps_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "very", " ", "importa", "nt", " ", "to", " ", "avoid", " ", "uncon", "troll", "ed", " ", "state", " ", "propagat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean", "\\u", "warn", "ing", "\\u", "registry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", "record_", "=_", "True_", ")_", "as_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "'", "alw", "ay", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "[_", ":_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\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_", "\\u", "Ignor", "e", "Warnings", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Impro", "ved", " ", "and", " ", "simplified", " ", "Pyth", "on", " ", "warn", "ings", " ", "context", " ", "manage", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Copie", "d", " ", "from", " ", "Pyth", "on", " ", "2.7", ".5", " ", "and", " ", "modifi", "ed", " ", "as", " ", "require", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Ignor", "e", "Warnings", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", "\\", "10", ";", " ", " ", " ", " ", "category", " ", ":", " ", "warn", "ing", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "category", " ", "to", " ", "filter", ".", " ", "Default", "s", " ", "to", " ", "Warn", "ing", ".", " ", "If", " ", "Non", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "categor", "ies", " ", "will", " ", "be", " ", "muted", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "record_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "module_", "=_", "sys_", "._", "modules_", "[_", "'", "warn", "ings", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "enter", "ed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Ignor", "e", "Warnings", "_", "(_", "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 ", " _", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "record_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "append_", "(_", "\"", "record", "=", "Tru", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "module_", "is_", "not_", "sys_", "._", "modules_", "[_", "'", "warn", "ings", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "append_", "(_", "\"", "module", "=", "%", "r", "\"_", "%_", "self_", "._", "\\u", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "type_", "(_", "self_", ")_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "(%", "s", ")\"_", "%_", "(_", "name_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Ignor", "e", "Warnings", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean", "\\u", "warn", "ing", "\\u", "registry_", "(_", ")_", "#", " ", "be", " ", "safe", " ", "and", " ", "not", " ", "propagate", " ", "state", " ", "+", " ", "cha", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "simplefilter_", "(_", "'", "alw", "ay", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "enter", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Cann", "ot", " ", "enter", " ", "%", "r", " ", "twi", "ce", "\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "enter", "ed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "filters_", "=_", "self_", "._", "\\u", "module_", "._", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "module_", "._", "filters_", "=_", "self_", "._", "\\u", "filters_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "show", "warning_", "=_", "self_", "._", "\\u", "module_", "._", "show", "warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "record_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "show", "warning_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "append_", "(_", "warnings_", "._", "Warn", "ing", "Message_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "module_", "._", "show", "warning_", "=_", "show", "warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Ignor", "e", "Warnings", "_", "(_", "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", "exit\\u\\u_", "(_", "self_", ",_", "*_", "exc", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "enter", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Cann", "ot", " ", "exit", " ", "%", "r", " ", "with", "out", " ", "entering", " ", "first", "\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "module_", "._", "filters_", "=_", "self_", "._", "\\u", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "module_", "._", "show", "warning_", "=_", "self_", "._", "\\u", "show", "warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "[_", ":_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "\\u", "warn", "ing", "\\u", "registry_", "(_", ")_", "#", " ", "be", " ", "safe", " ", "and", " ", "not", " ", "propagate", " ", "state", " ", "+", " ", "cha", "os_", "\\u\\u\\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", "assert", "\\u", "allclose_", "(_", "actual_", ",_", "desired_", ",_", "rtol_", "=_", "1e-", "7_", ",_", "atol_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "msg_", "=_", "''_", ",_", "verbose_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "actual_", ",_", "desired_", "=_", "np_", "._", "asan", "yar", "ray_", "(_", "actual_", ")_", ",_", "np_", "._", "asan", "yar", "ray_", "(_", "desired_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "allclose_", "(_", "actual_", ",_", "desired_", ",_", "rtol_", "=_", "rtol_", ",_", "atol_", "=_", "atol_", ")_", ":_", "\\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_", "msg_", "=_", "(_", "'", "Array", " ", "not", " ", "equal", " ", "to", " ", "tolera", "nce", " ", "rto", "l", "=", "%", "g", ",", " ", "atol", "=", "%", "g", ":", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "actual", " ", "%", "s", ",", " ", "desi", "red", " ", "%", "s", "'_", ")_", "%_", "(_", "rtol_", ",_", "atol_", ",_", "actual_", ",_", "desired_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Assert", "ion", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "raise", "\\u", "message_", "(_", "exception_", ",_", "message_", ",_", "function_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "function", " ", "to", " ", "test", " ", "error", " ", "message", "s", " ", "in", " ", "exception", "s", "\"\"\"_", "\\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 ", " _", "function_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Sho", "ul", "d", " ", "have", " ", "raise", "d", " ", "%", "r", "\"_", "%_", "exception_", "(_", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "message_", "=_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "in_", "(_", "message_", ",_", "error", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fake", "\\u", "mld", "ata_", "(_", "column", "s", "\\u", "dict_", ",_", "datan", "ame_", ",_", "mat", "file_", ",_", "ordering_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "fake", " ", "mld", "ata", " ", "data", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "column", "s", "\\u", "dict", " ", ":", " ", "dict", ",", " ", "keys", "=", "str", ",", " ", "values", "=", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "Contain", "s", " ", "data", " ", "as", " ", "column", "s", "\\u", "dict", "[", "column", "\\u", "name", "]", " ", "=", " ", "array", " ", "of", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "datan", "ame", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "data", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "mat", "file", " ", ":", " ", "string", " ", "or", " ", "file", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "file", " ", "name", " ", "string", " ", "or", " ", "the", " ", "file", "-", "like", " ", "object", " ", "of", " ", "the", " ", "output", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "orderi", "ng", " ", ":", " ", "list", ",", " ", "default", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "column", "\\u", "names", ",", " ", "dete", "rmin", "es", " ", "the", " ", "orderi", "ng", " ", "in", " ", "the", " ", "data", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "transpose", "s", " ", "all", " ", "arrays", ",", " ", "whi", "le", " ", "fetch", "\\u", "mld", "ata", " ", "only", " ", "transpose", "s", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "',", " ", "keep", " ", "tha", "t", " ", "int", "o", " ", "account", " ", "in", " ", "the", " ", "tests", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datasets_", "=_", "dict_", "(_", "column", "s", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transpose", " ", "all", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "datasets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datasets_", "[_", "name_", "]_", "=_", "datasets_", "[_", "name_", "]_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ordering_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ordering_", "=_", "sorted_", "(_", "list_", "(_", "datasets_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "setti", "ng", " ", "up", " ", "this", " ", "array", " ", "is", " ", "trick", "y", ",", " ", "bec", "aus", "e", " ", "of", " ", "the", " ", "way", " ", "Mat", "lab_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "re", "-", "package", "s", " ", "1", "D", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "datasets_", "[_", "'", "mld", "ata", "\\u", "descr", "\\u", "orderi", "ng", "'_", "]_", "=_", "sp_", "._", "empty_", "(_", "(_", "1_", ",_", "len_", "(_", "ordering_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "'", "object", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "name_", "in_", "enumerate_", "(_", "ordering_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datasets_", "[_", "'", "mld", "ata", "\\u", "descr", "\\u", "orderi", "ng", "'_", "]_", "[_", "0_", ",_", "i_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scipy_", "._", "io_", "._", "save", "mat_", "(_", "mat", "file_", ",_", "datasets_", ",_", "oned", "\\u", "as_", "=_", "'", "column", "'_", ")_", "\\u\\u\\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_", "mock", "\\u", "mld", "ata", "\\u", "urlopen_", "(_", "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_", "mock", "\\u", "mld", "ata", "\\u", "urlopen_", "(_", "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_", ",_", "mock", "\\u", "datasets_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Object", " ", "tha", "t", " ", "mock", "s", " ", "the", " ", "urlo", "pen", " ", "function", " ", "to", " ", "fake", " ", "request", "s", " ", "to", " ", "mld", "ata", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "mock", "\\u", "dataset", "s", "`", " ", "is", " ", "a", " ", "dictionar", "y", " ", "of", " ", "{", "dataset", "\\u", "name", ":", " ", "data\\u", "dict", "},", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "{", "dataset", "\\u", "name", ":", " ", "(", "data\\u", "dict", ",", " ", "orderi", "ng", ").", "\\", "10", ";", " ", " ", " ", " ", "`", "data\\u", "dict", "`", " ", "its", "elf", " ", "is", " ", "a", " ", "dictionar", "y", " ", "of", " ", "{", "column", "\\u", "name", ":", " ", "data\\u", "array", "},", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "`", "orderi", "ng", "`", " ", "is", " ", "a", " ", "list", " ", "of", " ", "column", "\\u", "names", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "orderi", "ng", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "data", " ", "set", " ", "(", "see", " ", "`", "fake", "\\u", "mld", "ata", "`", " ", "for", " ", "deta", "il", "s", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "request", "ing", " ", "a", " ", "dataset", " ", "with", " ", "a", " ", "name", " ", "tha", "t", " ", "is", " ", "in", " ", "mock", "\\u", "dataset", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "object", " ", "create", "s", " ", "a", " ", "fake", " ", "dataset", " ", "in", " ", "a", " ", "String", "IO", " ", "object", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "it", ".", " ", "Ot", "her", "wis", "e", ",", " ", "it", " ", "raise", "s", " ", "an", " ", "HTTP", "Error", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "\\u", "datasets_", "=_", "mock", "\\u", "datasets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mock", "\\u", "mld", "ata", "\\u", "urlopen_", "(_", "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_", ",_", "url", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset", "\\u", "name_", "=_", "url", "name_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dataset", "\\u", "name_", "in_", "self_", "._", "mock", "\\u", "datasets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "name_", "=_", "'\\u'_", "+_", "dataset", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mat", "file_", "=_", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", "=_", "self_", "._", "mock", "\\u", "datasets_", "[_", "dataset", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "dataset_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", ",_", "ordering_", "=_", "dataset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fake", "\\u", "mld", "ata_", "(_", "dataset_", ",_", "resource", "\\u", "name_", ",_", "mat", "file_", ",_", "ordering_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mat", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mat", "file_", "\\u\\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_", "HTTP", "Error_", "(_", "url", "name_", ",_", "404_", ",_", "dataset", "\\u", "name_", "+_", "\"", " ", "is", " ", "not", " ", "avail", "able", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "]_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "install", "\\u", "mld", "ata", "\\u", "mock_", "(_", "mock", "\\u", "datasets_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "La", "zy", " ", "import", " ", "to", " ", "avoid", " ", "mutual", "ly", " ", "recurs", "ive", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sklearn_", "import_", "datasets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datasets_", "._", "mld", "ata_", "._", "urlopen_", "=_", "mock", "\\u", "mld", "ata", "\\u", "urlopen_", "(_", "mock", "\\u", "datasets_", ")_", "\\u\\u\\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_", "uninstall", "\\u", "mld", "ata", "\\u", "mock_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "La", "zy", " ", "import", " ", "to", " ", "avoid", " ", "mutual", "ly", " ", "recurs", "ive", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sklearn_", "import_", "datasets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datasets_", "._", "mld", "ata_", "._", "urlopen_", "=_", "urlopen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "all", "\\u", "estimators_", "(_", "include", "\\u", "meta", "\\u", "estimators_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "other_", "=_", "False_", ",_", "type", "\\u", "filter_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "don", "t", "\\u", "test_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "list", " ", "of", " ", "all", " ", "estimators", " ", "from", " ", "skl", "earn", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "crawl", "s", " ", "the", " ", "module", " ", "and", " ", "gets", " ", "all", " ", "classe", "s", " ", "tha", "t", " ", "inherit", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "Base", "Estimat", "or", ".", " ", "Class", "es", " ", "tha", "t", " ", "are", " ", "defin", "ed", " ", "in", " ", "test", "-", "module", "s", " ", "are", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "include", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", " ", "meta", "\\u", "estimators", " ", "suc", "h", " ", "as", " ", "Grid", "Sear", "ch", "CV", " ", "are", " ", "als", "o", " ", "not", " ", "include", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "include", "\\u", "meta", "\\u", "estimators", " ", ":", " ", "boolean", ",", " ", "default", "=", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "include", " ", "meta", "-", "estimators", " ", "tha", "t", " ", "can", " ", "be", " ", "construct", "ed", " ", "usi", "ng", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "esti", "mat", "or", " ", "as", " ", "thei", "r", " ", "first", " ", "argu", "ment", ".", " ", "The", "se", " ", "are", " ", "currentl", "y", "\\", "10", ";", " ", " ", " ", " ", "Base", "Ensemble", ",", " ", "One", "Vs", "One", "Classif", "ier", ",", " ", "Output", "Code", "Classif", "ier", ",", "\\", "10", ";", " ", " ", " ", " ", "One", "Vs", "Rest", "Classif", "ier", ",", " ", "RF", "E", ",", " ", "RF", "EC", "V", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "include", "\\u", "other", " ", ":", " ", "boolean", ",", " ", "default", "=", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "We", "ther", " ", "to", " ", "include", " ", "meta", "-", "estimators", " ", "tha", "t", " ", "are", " ", "some", "how", " ", "special", " ", "and", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "be", " ", "default", "-", "construct", "ed", " ", "sensi", "bly", ".", " ", "The", "se", " ", "are", " ", "currentl", "y", "\\", "10", ";", " ", " ", " ", " ", "Pipe", "line", ",", " ", "Feature", "Uni", "on", " ", "and", " ", "Grid", "Sear", "ch", "CV", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "include", "\\u", "don", "t", "\\u", "test", " ", ":", " ", "boolean", ",", " ", "default", "=", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "include", " ", "\"", "special", "\"", " ", "label", " ", "esti", "mat", "or", " ", "or", " ", "test", " ", "process", "ors", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "type", "\\u", "filter", " ", ":", " ", "string", ",", " ", "list", " ", "of", " ", "string", ",", " ", " ", "or", " ", "Non", "e", ",", " ", "default", "=", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Whi", "ch", " ", "kind", " ", "of", " ", "estimators", " ", "shou", "ld", " ", "be", " ", "return", "ed", ".", " ", "If", " ", "Non", "e", ",", " ", "no", " ", "filter", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "applied", " ", "and", " ", "all", " ", "estimators", " ", "are", " ", "return", "ed", ".", " ", " ", "Poss", "ibl", "e", " ", "values", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "'", "classif", "ier", "',", " ", "'", "regressor", "',", " ", "'", "cluster", "'", " ", "and", " ", "'", "transforme", "r", "'", " ", "to", " ", "get", "\\", "10", ";", " ", " ", " ", " ", "estimators", " ", "only", " ", "of", " ", "these", " ", "specific", " ", "types", ",", " ", "or", " ", "a", " ", "list", " ", "of", " ", "these", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "the", " ", "estimators", " ", "tha", "t", " ", "fit", " ", "at", " ", "leas", "t", " ", "one", " ", "of", " ", "the", " ", "types", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "estimators", " ", ":", " ", "list", " ", "of", " ", "tuple", "s", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "(", "name", ",", " ", "class", "),", " ", "where", " ", "``", "name", "``", " ", "is", " ", "the", " ", "class", " ", "name", " ", "as", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "``", "class", "``", " ", "is", " ", "the", " ", "actual", "l", " ", "type", " ", "of", " ", "the", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "is", "\\u", "abstract_", "(_", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "(_", "hasattr_", "(_", "c_", ",_", "'\\u", "\\u", "abstract", "method", "s", "\\u\\u'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "c_", "._", "\\u\\u", "abstract", "method", "s\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "classes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "parent", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "gpl", "earn", "_", "._", "\\u\\u", "path\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "importer_", ",_", "modname_", ",_", "isp", "kg_", "in_", "pkg", "util_", "._", "walk", "\\u", "packages_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "prefix_", "=_", "'", "gpl", "earn", ".'_", ",_", "oner", "ror_", "=_", "lambda_", "x_", ":_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\".", "tests", ".\"_", "in_", "modname_", ":_", "\\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_", "module_", "=_", "\\u\\u", "import\\u\\u_", "(_", "modname_", ",_", "froml", "ist_", "=_", "\"", "dummy", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "inspect_", "._", "getmember", "s_", "(_", "module_", ",_", "inspect_", "._", "iscl", "ass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "classes_", "._", "extend_", "(_", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "classes_", "=_", "set_", "(_", "all", "\\u", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "estimators_", "=_", "[_", "c_", "for_", "c_", "in_", "all", "\\u", "classes_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "issubclass_", "(_", "c_", "[_", "1_", "]_", ",_", "Base", "Estimator_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "c_", "[_", "0_", "]_", "!=_", "'", "Base", "Estimat", "or", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "rid", " ", "of", " ", "abstract", " ", "base", " ", "classes_", "\\u\\u\\uNL\\u\\u\\u_", "estimators_", "=_", "[_", "c_", "for_", "c_", "in_", "estimators_", "if_", "not_", "is", "\\u", "abstract_", "(_", "c_", "[_", "1_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "include", "\\u", "don", "t", "\\u", "test_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "estimators_", "=_", "[_", "c_", "for_", "c_", "in_", "estimators_", "if_", "not_", "c_", "[_", "0_", "]_", "in_", "DON", "T", "\\u", "TEST_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "include", "\\u", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "estimators_", "=_", "[_", "c_", "for_", "c_", "in_", "estimators_", "if_", "not_", "c_", "[_", "0_", "]_", "in_", "OTHER", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "possib", "ly", " ", "get", " ", "rid", " ", "of", " ", "meta", " ", "estimators_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "include", "\\u", "meta", "\\u", "estimators_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "estimators_", "=_", "[_", "c_", "for_", "c_", "in_", "estimators_", "if_", "not_", "c_", "[_", "0_", "]_", "in_", "MET", "A", "\\u", "EST", "IMA", "TOR", "S_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type", "\\u", "filter_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "type", "\\u", "filter_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type", "\\u", "filter_", "=_", "[_", "type", "\\u", "filter_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type", "\\u", "filter_", "=_", "list_", "(_", "type", "\\u", "filter_", ")_", "#", " ", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filter", "ed", "\\u", "estimators_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "{_", "'", "classif", "ier", "'_", ":_", "Classif", "ier", "Mixin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "regressor", "'_", ":_", "Regr", "esso", "r", "Mixin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "transforme", "r", "'_", ":_", "Transform", "er", "Mixin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cluster", "'_", ":_", "Cluster", "Mixin_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "mixin_", "in_", "filters_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "type", "\\u", "filter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type", "\\u", "filter_", "._", "remove_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "ed", "\\u", "estimators_", "._", "extend_", "(_", "[_", "est_", "for_", "est_", "in_", "estimators_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "issubclass_", "(_", "est_", "[_", "1_", "]_", ",_", "mixin_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "estimators_", "=_", "filter", "ed", "\\u", "estimators_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type", "\\u", "filter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Parameter", " ", "type", "\\u", "filter", " ", "must", " ", "be", " ", "'", "classif", "ier", "',", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "regressor", "',", " ", "'", "transforme", "r", "',", " ", "'", "cluster", "'", " ", "or", " ", "Non", "e", ",", " ", "got", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "%", "s", ".\"_", "%_", "repr_", "(_", "type", "\\u", "filter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "drop", " ", "duplicat", "es", ",", " ", "sort", " ", "for", " ", "repro", "duci", "bility_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sorted_", "(_", "set_", "(_", "estimators_", ")_", ")_", "\\u\\u\\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_", "set\\u", "random", "\\u", "state_", "(_", "estimator_", ",_", "random", "\\u", "state_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "random", "\\u", "state", "\"_", "in_", "estimator_", "._", "get", "\\u", "params_", "(_", ")_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "estimator_", "._", "set\\u", "params_", "(_", "random", "\\u", "state_", "=_", "random", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "if", "\\u", "matplotlib_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "decorat", "or", " ", "tha", "t", " ", "skips", " ", "test", " ", "if", " ", "mat", "plotlib", " ", "not", " ", "install", "ed", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "wraps_", "(_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "\\u", "test_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "matplotlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matplotlib_", "._", "use_", "(_", "'", "Agg", "'_", ",_", "warn_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "fail", "s", " ", "if", " ", "no", " ", "$", "DISPLAY", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "matplotlib_", "._", "pylab_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "'", "Mat", "plotlib", " ", "not", " ", "avail", "able", ".'_", ")_", "\\u\\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_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "run", "\\u", "test_", "\\u\\u\\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_", "if", "\\u", "not", "\\u", "mac", "\\u", "os_", "(_", "versions_", "=_", "(_", "'", "10.", "7", "'_", ",_", "'", "10.", "8", "'_", ",_", "'", "10.", "9", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "Multi", "-", "process", " ", "bug", " ", "in", " ", "Mac", " ", "OS", " ", "X", " ", ">=", " ", "10.", "7", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "see", " ", "issue", " ", "#", "636", ")'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "decorat", "or", " ", "tha", "t", " ", "skips", " ", "test", " ", "if", " ", "OS", " ", "is", " ", "Mac", " ", "OS", " ", "X", " ", "and", " ", "its", "\\", "10", ";", " ", " ", " ", " ", "major", " ", "version", " ", "is", " ", "one", " ", "of", " ", "``", "version", "s", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mac", "\\u", "version_", ",_", "\\u_", ",_", "\\u_", "=_", "platform_", "._", "mac", "\\u", "ver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip_", "=_", "'.'_", "._", "join_", "(_", "mac", "\\u", "version_", "._", "split_", "(_", "'.'_", ")_", "[_", ":_", "2_", "]_", ")_", "in_", "versions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "decorator_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "wraps_", "(_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "warn", "ing", "\\u", "registry_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Safe", " ", "way", " ", "to", " ", "reset", " ", "warn", "ings", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "reset", "warnings_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "=_", "\"\\u\\u", "warn", "ingr", "egistr", "y\\u\\u", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod", "\\u", "name_", ",_", "mod_", "in_", "list_", "(_", "sys_", "._", "modules_", "._", "items_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "si", "x", ".", "moves", "'_", "in_", "mod", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "mod_", ",_", "reg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getattr_", "(_", "mod_", ",_", "reg_", ")_", "._", "clear_", "(_", ")_", "\\u\\u\\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_", "check", "\\u", "skip", "\\u", "network_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "os_", "._", "environ_", "._", "get_", "(_", "'", "SK", "LEA", "RN", "\\u", "SKIP", "\\u", "NET", "WORK", "\\u", "TESTS", "'_", ",_", "0_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "\"", "Text", " ", "tutorial", " ", "require", "s", " ", "large", " ", "dataset", " ", "download", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "skip", "\\u", "travis", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ski", "p", " ", "test", " ", "if", " ", "bei", "ng", " ", "run", " ", "on", " ", "Tra", "vis", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "environ_", "._", "get_", "(_", "'", "TRAV", "IS", "'_", ")_", "==_", "\"", "true", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "\"", "Thi", "s", " ", "test", " ", "need", "s", " ", "to", " ", "be", " ", "skip", "ped", " ", "on", " ", "Tra", "vis", "\"_", ")_", "\\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,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
gkno/gkno_launcher/src/gkno/fileOperations.py
[ { "content": "def readConfigurationFile(filename, allowTermination = True):\n try: jsonData = open(filename)\n except:\n # TODO ERROR\n if allowTermination: print('ERROR - failed to open json file - ' + str(filename)); exit(0)\n else: return False\n\n try: data = json.load(jsonData)\n except:\n if allowTermination:\n exc_type, exc_value, exc_traceback = sys.exc_info()\n print('ERROR - failed to extract json information - ' + str(filename))\n print(exc_type, exc_value, exc_traceback)\n exit(0)\n else: return False\n\n return data", "metadata": "root.readConfigurationFile", "header": "['module', '___EOS___']", "index": 14 } ]
[ { "span": "except:", "start_line": 16, "start_column": 2, "end_line": 16, "end_column": 9 }, { "span": "except:", "start_line": 22, "start_column": 2, "end_line": 22, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "Configura", "tion", "File_", "(_", "filename_", ",_", "allow", "Terminati", "on_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "json", "Data_", "=_", "open_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "ERROR_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "allow", "Terminati", "on_", ":_", "print_", "(_", "'", "ERROR", " ", "-", " ", "fail", "ed", " ", "to", " ", "open", " ", "json", " ", "file", " ", "-", " ", "'_", "+_", "str_", "(_", "filename_", ")_", ")_", ";_", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "data_", "=_", "json_", "._", "load_", "(_", "json", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "allow", "Terminati", "on_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "traceback_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "ERROR", " ", "-", " ", "fail", "ed", " ", "to", " ", "extract", " ", "json", " ", "informati", "on", " ", "-", " ", "'_", "+_", "str_", "(_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "traceback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
openelections/openelections-core/openelex/us/ms/datasource.py
[ { "content": " def _build_metadata(self, year, elections):\n meta = []\n year_int = int(year)\n for election in elections:\n if 'special' in election['slug']:\n results = [x for x in self._url_paths() if x['date'] == election['start_date'] and x['special'] == True]\n for result in results:\n generated_filename = result['path']\n if result['county']:\n ocd_id = 'ocd-division/country:us/state:ms/county:' + result['county'].replace(' ','_').lower()\n else:\n ocd_id = 'ocd-division/country:us/state:ms'\n meta.append({\n \"generated_filename\": generated_filename,\n \"raw_url\": result['url'],\n \"pre_processed_url\": build_raw_github_url(self.state, str(year), result['path']),\n \"ocd_id\": ocd_id,\n \"name\": 'Mississippi',\n \"election\": election['slug']\n })\n else:\n # primary, general and runoff statewide elections have 1 or 2 files per county\n # some general runoffs will have smaller numbers of files\n results = [x for x in self._url_paths() if x['date'] == election['start_date'] and x['special'] == False]\n for result in results:\n county = [c for c in self._jurisdictions() if c['county'] == result['county']][0]\n generated_filename = self._generate_county_filename(election['start_date'], result)\n meta.append({\n \"generated_filename\": generated_filename,\n \"raw_url\": result['url'],\n \"pre_processed_url\": build_raw_github_url(self.state, str(year), result['path']),\n \"ocd_id\": county['ocd_id'],\n \"name\": result['county'],\n \"election\": election['slug']\n })\n return meta", "metadata": "root.Datasource._build_metadata", "header": "['class', 'Datasource', '(', 'BaseDatasource', ')', ':', '___NEWLINE___', '___NL___', '# PUBLIC INTERFACE', '___NL___', '___EOS___']", "index": 49 } ]
[ { "span": "year_int ", "start_line": 51, "start_column": 8, "end_line": 51, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "build", "\\u", "metadata_", "(_", "self_", ",_", "year_", ",_", "election", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "year", "\\u", "int_", "=_", "int_", "(_", "year_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "election_", "in_", "election", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "special", "'_", "in_", "election_", "[_", "'", "slug", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "x_", "for_", "x_", "in_", "self_", "._", "\\u", "url", "\\u", "paths_", "(_", ")_", "if_", "x_", "[_", "'", "date", "'_", "]_", "==_", "election_", "[_", "'", "start", "\\u", "date", "'_", "]_", "and_", "x_", "[_", "'", "special", "'_", "]_", "==_", "True_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "generat", "ed", "\\u", "filename_", "=_", "result_", "[_", "'", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "[_", "'", "county", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "oc", "d\\u", "id_", "=_", "'", "oc", "d", "-", "divisi", "on", "/", "countr", "y", ":", "us", "/", "state", ":", "ms", "/", "county", ":'_", "+_", "result_", "[_", "'", "county", "'_", "]_", "._", "replace_", "(_", "'", " ", "'_", ",_", "'\\u'_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "oc", "d\\u", "id_", "=_", "'", "oc", "d", "-", "divisi", "on", "/", "countr", "y", ":", "us", "/", "state", ":", "ms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meta_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "generat", "ed", "\\u", "filename", "\"_", ":_", "generat", "ed", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "raw", "\\u", "url", "\"_", ":_", "result_", "[_", "'", "url", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pre", "\\u", "process", "ed", "\\u", "url", "\"_", ":_", "build", "\\u", "raw", "\\u", "git", "hub", "\\u", "url_", "(_", "self_", "._", "state_", ",_", "str_", "(_", "year_", ")_", ",_", "result_", "[_", "'", "path", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "oc", "d\\u", "id", "\"_", ":_", "oc", "d\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "'", "Miss", "iss", "ipp", "i", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "election", "\"_", ":_", "election_", "[_", "'", "slug", "'_", "]_", "\\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_", "#", " ", "primary", ",", " ", "genera", "l", " ", "and", " ", "run", "off", " ", "state", "wide", " ", "election", "s", " ", "have", " ", "1", " ", "or", " ", "2", " ", "files", " ", "per", " ", "county", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "genera", "l", " ", "run", "offs", " ", "will", " ", "have", " ", "small", "er", " ", "numbers", " ", "of", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "x_", "for_", "x_", "in_", "self_", "._", "\\u", "url", "\\u", "paths_", "(_", ")_", "if_", "x_", "[_", "'", "date", "'_", "]_", "==_", "election_", "[_", "'", "start", "\\u", "date", "'_", "]_", "and_", "x_", "[_", "'", "special", "'_", "]_", "==_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "county", "_", "=_", "[_", "c_", "for_", "c_", "in_", "self_", "._", "\\u", "jur", "isdi", "ctions", "_", "(_", ")_", "if_", "c_", "[_", "'", "county", "'_", "]_", "==_", "result_", "[_", "'", "county", "'_", "]_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generat", "ed", "\\u", "filename_", "=_", "self_", "._", "\\u", "generat", "e\\u", "county", "\\u", "filename_", "(_", "election_", "[_", "'", "start", "\\u", "date", "'_", "]_", ",_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "generat", "ed", "\\u", "filename", "\"_", ":_", "generat", "ed", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "raw", "\\u", "url", "\"_", ":_", "result_", "[_", "'", "url", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pre", "\\u", "process", "ed", "\\u", "url", "\"_", ":_", "build", "\\u", "raw", "\\u", "git", "hub", "\\u", "url_", "(_", "self_", "._", "state_", ",_", "str_", "(_", "year_", ")_", ",_", "result_", "[_", "'", "path", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "oc", "d\\u", "id", "\"_", ":_", "county", "_", "[_", "'", "oc", "d\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "result_", "[_", "'", "county", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "election", "\"_", ":_", "election_", "[_", "'", "slug", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "meta_", "\\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, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
pgiri/asyncoro/examples/pipe_csum.py
[ { "content": "def custom_feeder(input, coro=None):\n def write_proc(fin, pipe, coro=None):\n while True:\n data = yield os.read(fin.fileno(), 8*1024)\n if not data:\n break\n n = yield pipe.write(data, full=True)\n assert n == len(data)\n fin.close()\n pipe.stdin.close()\n\n def read_proc(pipe, coro=None):\n # output from sha1sum is small, so read until EOF\n data = yield pipe.stdout.read()\n pipe.stdout.close()\n raise StopIteration(data)\n\n if platform.system() == 'Windows':\n # asyncfile.Popen must be used instead of subprocess.Popen\n pipe = asyncoro.asyncfile.Popen([r'\\cygwin64\\bin\\sha1sum.exe'],\n stdin=subprocess.PIPE, stdout=subprocess.PIPE)\n else:\n pipe = subprocess.Popen(['sha1sum'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)\n\n async_pipe = asyncoro.asyncfile.AsyncPipe(pipe)\n reader = asyncoro.Coro(read_proc, async_pipe)\n writer = asyncoro.Coro(write_proc, open(input), async_pipe)\n stdout = yield reader.finish()\n print(' feeder sha1sum: %s' % stdout)", "metadata": "root.custom_feeder", "header": "['module', '___EOS___']", "index": 25 } ]
[ { "span": "writer ", "start_line": 51, "start_column": 4, "end_line": 51, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "custom", "\\u", "feeder", "_", "(_", "input_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "write", "\\u", "proc_", "(_", "fin_", ",_", "pipe_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\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 ", " _", "data_", "=_", "yield_", "os_", "._", "read_", "(_", "fin_", "._", "fileno_", "(_", ")_", ",_", "8_", "*_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "=_", "yield_", "pipe_", "._", "write_", "(_", "data_", ",_", "full_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n_", "==_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fin_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pipe_", "._", "stdin_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "proc_", "(_", "pipe_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "output", " ", "from", " ", "sha1", "sum", " ", "is", " ", "small", ",", " ", "so", " ", "read", " ", "unti", "l", " ", "EOF_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "yield_", "pipe_", "._", "stdout_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pipe_", "._", "stdout_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Window", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "async", "file", ".", "Pop", "en", " ", "must", " ", "be", " ", "used", " ", "inst", "ead", " ", "of", " ", "subproc", "ess", ".", "Popen_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pipe_", "=_", "async", "oro", "_", "._", "async", "file_", "._", "Popen_", "(_", "[_", "r", "'\\\\", "cyg", "win", "64", "\\\\", "bin", "\\\\", "sha1", "sum", ".", "exe", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pipe_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'", "sha1", "sum", "'_", "]_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "async", "\\u", "pipe_", "=_", "async", "oro", "_", "._", "async", "file_", "._", "Async", "Pipe_", "(_", "pipe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reader_", "=_", "async", "oro", "_", "._", "Cor", "o_", "(_", "read", "\\u", "proc_", ",_", "async", "\\u", "pipe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "=_", "async", "oro", "_", "._", "Cor", "o_", "(_", "write", "\\u", "proc_", ",_", "open_", "(_", "input_", ")_", ",_", "async", "\\u", "pipe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", "=_", "yield_", "reader_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "feeder", " ", "sha1", "sum", ":", " ", "%", "s", "'_", "%_", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
hgascon/pulsar/pulsar/core/sippy/SipHeader.py
[ { "content": " def __init__(self, s = None, name = None, body = None, bodys = None, fixname = False):\n if s != None:\n name, bodys = [x.strip() for x in s.split(':', 1)]\n if name != None:\n self.name = name.lower()\n if body == None:\n try:\n try:\n body = hf_types[self.name](bodys)\n except KeyError:\n body = SipGenericHF(bodys, name)\n except ESipHeaderCSV, einst:\n einst.name = self.name\n raise einst\n self.body = body\n # If no name is provided use canonic name from the body-specific\n # class.\n if self.name == None or fixname:\n self.name = body.hf_names[0]", "metadata": "root.SipHeader.__init__", "header": "['class', 'SipHeader', '(', 'object', ')', ':', '___EOS___']", "index": 68 } ]
[ { "span": "body == None:", "start_line": 73, "start_column": 11, "end_line": 73, "end_column": 23 }, { "span": "self.name == None ", "start_line": 85, "start_column": 11, "end_line": 85, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Si", "p", "Header_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "s_", "=_", "None_", ",_", "name_", "=_", "None_", ",_", "body_", "=_", "None_", ",_", "body", "s_", "=_", "None_", ",_", "fix", "name_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "body", "s_", "=_", "[_", "x_", "._", "strip_", "(_", ")_", "for_", "x_", "in_", "s_", "._", "split_", "(_", "':'_", ",_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "body_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "body_", "=_", "hf", "\\u", "types_", "[_", "self_", "._", "name_", "]_", "(_", "body", "s_", ")_", "\\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 ", " ", "_", "body_", "=_", "Si", "p", "Gene", "ric", "HF", "_", "(_", "body", "s_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ES", "ip", "Head", "er", "CSV_", ",_", "ein", "st_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ein", "st_", "._", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "ein", "st_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "body_", "=_", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "name", " ", "is", " ", "provided", " ", "use", " ", "canon", "ic", " ", "name", " ", "from", " ", "the", " ", "body", "-", "specific_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "name_", "==_", "None_", "or_", "fix", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "body_", "._", "hf", "\\u", "names_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
treeio/treeio/treeio/core/api/doc.py
[ { "content": " @property\n def display_name(self):\n name = self.handler.__name__.replace('Handler', '')\n try:\n pattern = re.compile('([A-Z][A-Z][a-z])|([a-z][A-Z])')\n name = pattern.sub(\n lambda m: m.group()[:1] + \" \" + m.group()[1:], name)\n except:\n pass\n return name", "metadata": "root.HandlerDocumentation.display_name", "header": "['class', 'HandlerDocumentation', '(', 'object', ')', ':', '___EOS___']", "index": 190 }, { "content": " def get_resource_uri_template(self):\n \"\"\"\n URI template processor.\n\n See http://bitworking.org/projects/URI-Templates/\n \"\"\"\n try:\n resource_uri = self.handler.resource_uri()\n\n components = [None, [], {}]\n\n for i, value in enumerate(resource_uri):\n components[i] = value\n\n lookup_view, args, kwargs = components\n lookup_view = get_callable(lookup_view, True)\n\n possibilities = get_resolver(\n 'treeio.core.api.urls').reverse_dict.getlist(lookup_view)\n\n for possibility, pattern in possibilities:\n for result, params in possibility:\n if args:\n if len(args) != len(params):\n continue\n return _convert(result, params)\n else:\n if set(kwargs.keys()) != set(params):\n continue\n return _convert(result, params)\n\n except:\n return None", "metadata": "root.HandlerDocumentation.get_resource_uri_template", "header": "['class', 'HandlerDocumentation', '(', 'object', ')', ':', '___EOS___']", "index": 205 }, { "content": " def get_resource_uri_index(self):\n \"\"\"\n INDEX URI template processor.\n \"\"\"\n try:\n resource_uri = self.handler.resource_uri()\n\n components = [None, [], {}]\n\n for i, value in enumerate(resource_uri):\n components[i] = value\n\n lookup_view, args, kwargs = components\n # else this url will be in get_resource_uri_template\n if args or kwargs:\n lookup_view = get_callable(lookup_view, True)\n\n possibilities = get_resolver(\n 'treeio.core.api.urls').reverse_dict.getlist(lookup_view)\n\n for possibility, pattern in possibilities:\n for result, params in possibility:\n if not params:\n return _convert(result)\n except:\n return None", "metadata": "root.HandlerDocumentation.get_resource_uri_index", "header": "['class', 'HandlerDocumentation', '(', 'object', ')', ':', '___EOS___']", "index": 239 } ]
[ { "span": "except:", "start_line": 197, "start_column": 8, "end_line": 197, "end_column": 15 }, { "span": "except:", "start_line": 236, "start_column": 8, "end_line": 236, "end_column": 15 }, { "span": "except:", "start_line": 263, "start_column": 8, "end_line": 263, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Handle", "r", "Document", "ation_", "(_", "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_", "display", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "handler_", "._", "\\u\\u", "name\\u\\u_", "._", "replace_", "(_", "'", "Handle", "r", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern_", "=_", "re_", "._", "compile_", "(_", "'(", "[", "A", "-", "Z", "][", "A", "-", "Z", "][", "a", "-", "z", "])", "|(", "[", "a", "-", "z", "][", "A", "-", "Z", "])'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "pattern_", "._", "sub_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "m_", ":_", "m_", "._", "group_", "(_", ")_", "[_", ":_", "1_", "]_", "+_", "\"", " ", "\"_", "+_", "m_", "._", "group_", "(_", ")_", "[_", "1_", ":_", "]_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Handle", "r", "Document", "ation_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "resource", "\\u", "uri", "\\u", "template_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "URI", " ", "template", " ", "process", "or", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "http", "://", "bit", "working", ".", "org", "/", "project", "s", "/", "URI", "-", "Templa", "tes", "/", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "uri_", "=_", "self_", "._", "handler_", "._", "resource", "\\u", "uri_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "components_", "=_", "[_", "None_", ",_", "[_", "]_", ",_", "{_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "value_", "in_", "enumerate_", "(_", "resource", "\\u", "uri_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "components_", "[_", "i_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "look", "up", "\\u", "view_", ",_", "args_", ",_", "kwargs_", "=_", "components_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "look", "up", "\\u", "view_", "=_", "get", "\\u", "callable_", "(_", "look", "up", "\\u", "view_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "possibilit", "ies_", "=_", "get", "\\u", "resolver_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "core", ".", "api", ".", "urls", "'_", ")_", "._", "reverse", "\\u", "dict_", "._", "getlist_", "(_", "look", "up", "\\u", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "possibilit", "y_", ",_", "pattern_", "in_", "possibilit", "ies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "result_", ",_", "params_", "in_", "possibilit", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "len_", "(_", "args_", ")_", "!=_", "len_", "(_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "convert_", "(_", "result_", ",_", "params_", ")_", "\\u\\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_", "set_", "(_", "kwargs_", "._", "keys_", "(_", ")_", ")_", "!=_", "set_", "(_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "convert_", "(_", "result_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Handle", "r", "Document", "ation_", "(_", "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_", "get", "\\u", "resource", "\\u", "uri", "\\u", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "INDE", "X", " ", "URI", " ", "template", " ", "process", "or", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "uri_", "=_", "self_", "._", "handler_", "._", "resource", "\\u", "uri_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "components_", "=_", "[_", "None_", ",_", "[_", "]_", ",_", "{_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "value_", "in_", "enumerate_", "(_", "resource", "\\u", "uri_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "components_", "[_", "i_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "look", "up", "\\u", "view_", ",_", "args_", ",_", "kwargs_", "=_", "components_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "else", " ", "this", " ", "url", " ", "will", " ", "be", " ", "in", " ", "get", "\\u", "resource", "\\u", "uri", "\\u", "template_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "or_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "look", "up", "\\u", "view_", "=_", "get", "\\u", "callable_", "(_", "look", "up", "\\u", "view_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "possibilit", "ies_", "=_", "get", "\\u", "resolver_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "core", ".", "api", ".", "urls", "'_", ")_", "._", "reverse", "\\u", "dict_", "._", "getlist_", "(_", "look", "up", "\\u", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "possibilit", "y_", ",_", "pattern_", "in_", "possibilit", "ies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "result_", ",_", "params_", "in_", "possibilit", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u", "convert_", "(_", "result_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
apache/libcloud/libcloud/test/compute/test_rackspace.py
[ { "content": " def test_error_is_thrown_on_accessing_old_constant(self):\n for provider in DEPRECATED_RACKSPACE_PROVIDERS:\n try:\n get_driver(provider)\n except Exception:\n e = sys.exc_info()[1]\n self.assertTrue(str(e).find('has been removed') != -1)\n else:\n self.fail('Exception was not thrown')", "metadata": "root.RackspaceusFirstGenUsTests.test_error_is_thrown_on_accessing_old_constant", "header": "['class', 'RackspaceusFirstGenUsTests', '(', 'OpenStack_1_0_Tests', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_list_sizes_pricing(self):\n sizes = self.driver.list_sizes()\n\n for size in sizes:\n self.assertTrue(size.price > 0)", "metadata": "root.RackspaceusFirstGenUsTests.test_list_sizes_pricing", "header": "['class', 'RackspaceusFirstGenUsTests', '(', 'OpenStack_1_0_Tests', ')', ':', '___EOS___']", "index": 57 }, { "content": " def test_list_sizes_pricing(self):\n sizes = self.driver.list_sizes()\n\n for size in sizes:\n self.assertTrue(size.price > 0)", "metadata": "root.RackspaceusFirstGenUkTests.test_list_sizes_pricing", "header": "['class', 'RackspaceusFirstGenUkTests', '(', 'OpenStack_1_0_Tests', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_list_sizes_pricing(self):\n sizes = self.driver.list_sizes()\n\n for size in sizes:\n if size.ram > 256:\n self.assertTrue(size.price > 0)", "metadata": "root.BaseRackspaceNovaTestCase.test_list_sizes_pricing", "header": "['class', 'BaseRackspaceNovaTestCase', '(', 'object', ')', ':', '___EOS___']", "index": 148 } ]
[ { "span": "self.assertTrue(str(e).find('has been removed') != -1)", "start_line": 53, "start_column": 16, "end_line": 53, "end_column": 70 }, { "span": "self.assertTrue(size.price > 0)", "start_line": 61, "start_column": 12, "end_line": 61, "end_column": 43 }, { "span": "self.assertTrue(size.price > 0)", "start_line": 77, "start_column": 12, "end_line": 77, "end_column": 43 }, { "span": "self.assertTrue(size.price > 0)", "start_line": 153, "start_column": 16, "end_line": 153, "end_column": 47 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Rack", "space", "us", "Fi", "rst", "Gen", "Us", "Tests_", "(_", "Open", "Stack", "\\u", "1", "\\u", "0", "\\u", "Tests_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "error", "\\u", "is", "\\u", "throw", "n", "\\u", "on", "\\u", "accessi", "ng", "\\u", "old", "\\u", "constant_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "provider_", "in_", "DEP", "RECA", "TED", "\\u", "RACK", "SPACE", "\\u", "PROVIDERS_", ":_", "\\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 ", " _", "get", "\\u", "driver_", "(_", "provider_", ")_", "\\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 ", " _", "e_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "str_", "(_", "e_", ")_", "._", "find_", "(_", "'", "has", " ", "bee", "n", " ", "remove", "d", "'_", ")_", "!=_", "-_", "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 ", " _", "self_", "._", "fail_", "(_", "'", "Except", "ion", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rack", "space", "us", "Fi", "rst", "Gen", "Us", "Tests_", "(_", "Open", "Stack", "\\u", "1", "\\u", "0", "\\u", "Tests_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "size", "s", "\\u", "pricing", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sizes_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "sizes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "size_", "in_", "sizes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "size_", "._", "price_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rack", "space", "us", "Fi", "rst", "Gen", "Uk", "Tests_", "(_", "Open", "Stack", "\\u", "1", "\\u", "0", "\\u", "Tests_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "size", "s", "\\u", "pricing", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sizes_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "sizes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "size_", "in_", "sizes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "size_", "._", "price_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Rack", "space", "Nov", "a", "Test", "Case_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "size", "s", "\\u", "pricing", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sizes_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "sizes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "size_", "in_", "sizes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "size_", "._", "ram_", ">_", "256_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "size_", "._", "price_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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atch/app-turbo/turbo/conf.py
[ { "content": "from __future__ import absolute_import, division, print_function, with_statement\n\nfrom copy import deepcopy\n\n\n\n\napp_config = AppConfig()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ObjectDict(dict):\n \"\"\"Makes a dictionary behave like an object, with attribute-style access.\n \"\"\"", "metadata": "root.ObjectDict", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def __getattr__(self, name):\n try:\n return self[name]\n except KeyError:\n raise AttributeError(name)\n\n def __setattr__(self, name, value):\n self[name] = value", "metadata": "root.ObjectDict.__getattr__", "header": "['class', 'ObjectDict', '(', 'dict', ')', ':', '___EOS___']", "index": 7 }, { "content": "class AppConfig(object):\n \n _cookie_session_config = ObjectDict(\n name='session_id',\n cookie_domain=None,\n cookie_path='/',\n cookie_expires=86400, # cookie expired 24 hours in seconds\n secure = True,\n secret_key='fLjUfxqXtfNoIldA0A0J', # generate session id,\n timeout=86400, # session timeout 24 hours in seconds\n )\n\n _store_config = ObjectDict(\n diskpath='/tmp/session',\n )\n\n", "metadata": "root.AppConfig", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self):\n self.app_name = ''\n self.urls = []\n self.error_handler = None\n self.app_setting = {}\n self.web_application_setting = {}\n self.project_name = None\n self.session_config = self._cookie_session_config\n self.store_config = self._store_config", "metadata": "root.AppConfig.__init__", "header": "['class', 'AppConfig', '(', 'object', ')', ':', '___EOS___']", "index": 33 }, { "content": " @property\n def log_level(self):\n import logging\n level = self.app_setting.get('log', {}).get('log_level')\n if level is None:\n return logging.INFO\n\n return level", "metadata": "root.AppConfig.log_level", "header": "['class', 'AppConfig', '(', 'object', ')', ':', '___EOS___']", "index": 43 } ]
[ { "span": "from copy import deepcopy", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", ",_", "with", "\\u", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "config_", "=_", "App", "Config_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Object", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", "s", " ", "a", " ", "dictionar", "y", " ", "behave", " ", "like", " ", "an", " ", "object", ",", " ", "with", " ", "attribute", "-", "style", " ", "access", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Object", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Attribute", "Error_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setattr\\u\\u_", "(_", "self_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "[_", "name_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "App", "Config_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "cookie", "\\u", "session", "\\u", "config_", "=_", "Object", "Dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "session", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cookie", "\\u", "domain_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cookie", "\\u", "path_", "=_", "'/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cookie", "\\u", "expires_", "=_", "86400_", ",_", "#", " ", "cookie", " ", "expir", "ed", " ", " ", "24", " ", "hour", "s", " ", "in", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "secure_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "secret", "\\u", "key_", "=_", "'", "f", "Lj", "Uf", "xq", "Xt", "f", "No", "Il", "d", "A0", "A0", "J", "'_", ",_", "#", " ", "generat", "e", " ", "session", " ", "id", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timeout_", "=_", "86400_", ",_", "#", " ", "session", " ", "timeo", "ut", " ", "24", " ", "hour", "s", " ", "in", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "store", "\\u", "config_", "=_", "Object", "Dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "path_", "=_", "'/", "tmp", "/", "session", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\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_", "App", "Config_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "urls_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "\\u", "handler_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "setting_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "web", "\\u", "applica", "tion", "\\u", "setting_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "project", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "\\u", "config_", "=_", "self_", "._", "\\u", "cookie", "\\u", "session", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "store", "\\u", "config_", "=_", "self_", "._", "\\u", "store", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Config_", "(_", "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_", "log", "\\u", "level_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level_", "=_", "self_", "._", "app", "\\u", "setting_", "._", "get_", "(_", "'", "log", "'_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "'", "log", "\\u", "level", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "logging_", "._", "INFO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "level_", "\\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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
log0/higgs_boson/cleaned_model.py
[ { "content": "\"\"\"\nCode: https://github.com/log0/higgs_boson\nAuthor: Eric Chio \"log0\" <ckieric [dot] gmail [dot] com>\nDate: 2014/09/15\n\nDescription:\nRank 23 solution to the Kaggle Higgs Boson Machine Learning Challenge.\nExtensive documentation is inline.\n\nCompetition: https://www.kaggle.com/c/higgs-boson\nCopyrights 2014, Eric Chio.\nBSD license, 3 clauses.\n\"\"\"\n\nimport csv\nimport math\nimport os\nimport random\n\nimport numpy as np\nfrom sklearn.cross_validation import *\nfrom sklearn.decomposition import *\nfrom sklearn.ensemble import *\nfrom sklearn.feature_selection import *\nfrom sklearn.grid_search import *\nfrom sklearn.linear_model import *\nfrom sklearn.metrics import *\nfrom sklearn.preprocessing import *\nfrom sklearn.pipeline import *\nfrom sklearn.svm import *\nfrom sklearn.tree import *\n\n#########################################################################\n# Metrics \n#########################################################################\n\n\n\n#########################################################################\n# Models \n#########################################################################\n\n\n#########################################################################\n# Feature preprocessing\n#########################################################################\n\n\n#########################################################################\n# Training run\n#########################################################################\n\n\n#########################################################################\n# Submission generation\n#########################################################################\n\n\nif __name__ == '__main__':\n # Fix CPU affinity caused by Numpy.\n # http://stackoverflow.com/questions/15639779/what-determines-whether-different-python-processes-are-assigned-to-the-same-or-d\n os.system('taskset -p 0xffffffff %d' % os.getpid())\n\n # It is important to pick the right seed! Reduce randomness wherever\n # possible. Especially in a CV loop, so your solutions are more\n # comparable.\n seed = 512\n random.seed(seed)\n\n # Load training data. Point this to your training data.\n print 'Loading training data.'\n data = np.loadtxt('../data/training.csv', \\\n delimiter=',', \\\n skiprows=1, \\\n converters={32: lambda x:int(x=='s'.encode('utf-8'))})\n\n X = data[:,1:31]\n Y = data[:,32]\n W = data[:,31]\n\n # Work on test data and generate submission. Point this to your\n # testing data.\n print 'Loading testing data.'\n test_data = np.loadtxt('../data/test.csv', \\\n delimiter=',', \\\n skiprows=1)\n\n ids_test = test_data[:,0]\n X_test = test_data[:,1:31]\n W = data[:,31]\n\n # Train model now. \n Y_test_pred, thresholded_Y_test_pred = train_and_predict(X, W, Y, X_test)\n\n # Write submission file now.\n write_submission_file(ids_test, Y_test_pred, thresholded_Y_test_pred)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "W ", "start_line": 204, "start_column": 4, "end_line": 204, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Code", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "log", "0", "/", "hi", "gg", "s", "\\u", "bos", "on", "\\", "10", ";", "Author", ":", " ", "Eri", "c", " ", "Chi", "o", " ", "\"", "log", "0", "\"", " ", "<", "ck", "ier", "ic", " ", "[", "dot", "]", " ", "gma", "il", " ", "[", "dot", "]", " ", "com", ">", "\\", "10", ";", "Date", ":", " ", "2014", "/", "09", "/", "15", "\\", "10", ";", "\\", "10", ";", "Descripti", "on", ":", "\\", "10", ";", "Rank", " ", "23", " ", "solut", "ion", " ", "to", " ", "the", " ", "Ka", "ggle", " ", "Hig", "gs", " ", "Bo", "son", " ", "Machine", " ", "Learn", "ing", " ", "Chall", "enge", ".", "\\", "10", ";", "Ext", "ensi", "ve", " ", "documentation", " ", "is", " ", "inline", ".", "\\", "10", ";", "\\", "10", ";", "Compet", "ition", ":", " ", "https", "://", "www", ".", "ka", "ggle", ".", "com", "/", "c", "/", "hi", "gg", "s", "-", "bos", "on", "\\", "10", ";", "Copy", "rights", " ", "2014", ",", " ", "Eri", "c", " ", "Chi", "o", ".", "\\", "10", ";", "BS", "D", " ", "license", ",", " ", "3", " ", "clause", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "cross", "\\u", "validation_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "decomposition", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "ensemble_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "feature", "\\u", "selection_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "grid", "\\u", "search_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "linear", "\\u", "model_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "metrics_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "preprocessing_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "pipeline_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "svm_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "tree_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Met", "ric", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Model", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Feature", " ", "preprocessing_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Train", "ing", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Subm", "ission", " ", "generation_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fix", " ", "CPU", " ", "affinity", " ", "caus", "ed", " ", "by", " ", "Num", "py", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "156", "397", "7", "9", "/", "what", "-", "dete", "rmin", "es", "-", "whe", "ther", "-", "different", "-", "python", "-", "process", "es", "-", "are", "-", "assign", "ed", "-", "to", "-", "the", "-", "same", "-", "or", "-", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "'", "task", "set", " ", "-", "p", " ", "0xfff", "fffff", " ", "%", "d", "'_", "%_", "os_", "._", "getpid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "is", " ", "importa", "nt", " ", "to", " ", "pick", " ", "the", " ", "right", " ", "seed", "!", " ", "Reduce", " ", "random", "ness", " ", "where", "ver_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "possib", "le", ".", " ", "Espe", "cia", "ll", "y", " ", "in", " ", "a", " ", "CV", " ", "loop", ",", " ", "so", " ", "your", " ", "solut", "ion", "s", " ", "are", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compara", "ble", "._", "\\u\\u\\uNL\\u\\u\\u_", "seed_", "=_", "512_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "seed_", "(_", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "train", "ing", " ", "data", ".", " ", "Point", " ", "this", " ", "to", " ", "your", " ", "train", "ing", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Load", "ing", " ", "train", "ing", " ", "data", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "np_", "._", "loadtxt_", "(_", "'../", "data", "/", "train", "ing", ".", "csv", "'_", ",_", "delimiter_", "=_", "','_", ",_", "skiprows", "_", "=_", "1_", ",_", "converters_", "=_", "{_", "32_", ":_", "lambda_", "x_", ":_", "int_", "(_", "x_", "==_", "'", "s", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "data_", "[_", ":_", ",_", "1_", ":_", "31_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "data_", "[_", ":_", ",_", "32_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "data_", "[_", ":_", ",_", "31_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Work", " ", "on", " ", "test", " ", "data", " ", "and", " ", "generat", "e", " ", "subm", "ission", ".", " ", "Point", " ", "this", " ", "to", " ", "your", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "testi", "ng", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Load", "ing", " ", "testi", "ng", " ", "data", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "data_", "=_", "np_", "._", "loadtxt_", "(_", "'../", "data", "/", "test", ".", "csv", "'_", ",_", "delimiter_", "=_", "','_", ",_", "skiprows", "_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ids", "\\u", "test_", "=_", "test\\u", "data_", "[_", ":_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X", "\\u", "test_", "=_", "test\\u", "data_", "[_", ":_", ",_", "1_", ":_", "31_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "data_", "[_", ":_", ",_", "31_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Train", " ", "model", " ", "now", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "Y", "\\u", "test\\u", "pred_", ",_", "threshol", "ded", "\\u", "Y", "\\u", "test\\u", "pred_", "=_", "train", "\\u", "and", "\\u", "predict_", "(_", "X_", ",_", "W_", ",_", "Y_", ",_", "X", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Write", " ", "subm", "ission", " ", "file", " ", "now", "._", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "subm", "ission", "\\u", "file_", "(_", "ids", "\\u", "test_", ",_", "Y", "\\u", "test\\u", "pred_", ",_", "threshol", "ded", "\\u", "Y", "\\u", "test\\u", "pred_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
wrr/wwwhisper/wwwhisper_auth/models.py
[ { "content": "# wwwhisper - web access control.\n# Copyright (C) 2012-2015 Jan Wrobel <[email protected]>\n\n\"\"\"Data model for the site access control rules.\n\nEach site has users, locations (paths) and permissions - rules that\ndefine which user can access which locations. Sites are\nisolated. Users and locations are associated with a single site and\nare used only for this site. Site has also aliases: urls that can be\nused to access the site, only requests from these urls are allowed.\n\nProvides methods that map to REST operations that can be performed on\nusers, locations and permissions resources. Allows to retrieve\nexternally visible attributes of these resources, the attributes are\nreturned as a resource representation by REST methods.\n\nResources are identified by an externally visible UUIDs. Standard\nprimary key ids are not used for external identification purposes,\nbecause those ids can be reused after object is deleted.\n\nMakes sure entered emails and paths are valid.\n\"\"\"\n\nfrom django.contrib.auth.models import AbstractBaseUser\nfrom django.db import connection\nfrom django.db import models\nfrom django.db import transaction\nfrom django.forms import ValidationError\nfrom django.utils import timezone\n\nfrom functools import wraps\nfrom wwwhisper_auth import url_utils\nfrom wwwhisper_auth import email_re\n\nimport logging\nimport random\nimport re\nimport threading\nimport uuid as uuidgen\n\nlogger = logging.getLogger(__name__)\n\n\n\n# Id used when wwwhisper servers just a single site.\nSINGLE_SITE_ID = 'theone'\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 LimitExceeded(Exception):\n pass", "metadata": "root.LimitExceeded", "header": "['module', '___EOS___']", "index": 42 }, { "content": "class ValidatedModel(models.Model):\n \"\"\"Base class for all model classes.\n\n Makes sure all constraints are preserved before changed data is\n saved.\n \"\"\"\n\n class Meta:\n \"\"\"Disables creation of a DB table for ValidatedModel.\"\"\"\n abstract = True\n # Needed because models are used from signal handlers, before\n # the application is loaded.\n app_label = 'wwwhisper_auth'\n", "metadata": "root.ValidatedModel", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def save(self, *args, **kwargs):\n self.full_clean()\n return super(ValidatedModel, self).save(*args, **kwargs)", "metadata": "root.ValidatedModel.save", "header": "['class', 'ValidatedModel', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 59 }, { "content": "class Site(ValidatedModel):\n \"\"\"A site to which access is protected.\n\n Site has locations, users and aliases.\n\n Attributes:\n site_id: Can be a domain or any other string.\n\n mod_id: Changed after any modification of site-related data (not\n only Site itself but also site's locations, permissions or\n users). Allows to determine when Django processes need to\n update cached data.\n \"\"\"\n site_id = models.TextField(primary_key=True, db_index=True, editable=False)\n mod_id = models.IntegerField(default=0)\n\n # Default values for texts on a login page (used when custom texts\n # are set to empty values).\n _default_skin = {\n 'title': 'wwwhisper: Web Access Control',\n 'header': 'Protected site',\n 'message': 'Access to this site is restricted. ' + \\\n 'Please sign in with your email:',\n }\n\n title = models.CharField(max_length=80, blank=True)\n header = models.CharField(max_length=100, blank=True)\n message = models.CharField(max_length=500, blank=True)\n branding = models.BooleanField(default=True)\n\n aliases_limit = None\n users_limit = None\n locations_limit = None\n\n\n\n\n\n\n", "metadata": "root.Site", "header": "['module', '___EOS___']", "index": 66 }, { "content": " def __init__(self, *args, **kwargs):\n super(Site, self).__init__(*args, **kwargs)\n # Synchronizes mod id that can be read by a cache updating\n # thread.\n self.mod_id_lock = threading.Lock()", "metadata": "root.Site.__init__", "header": "['class', 'Site', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 100 }, { "content": " def heavy_init(self):\n \"\"\"Creates collections of all site-related data.\n\n This is a resource intensive operation that retrieves all site\n related data from the database. It is only performed if the site\n was modified since it was last retrieved.\n \"\"\"\n self.locations = LocationsCollection(self)\n self.users = UsersCollection(self)\n self.aliases = AliasesCollection(self)", "metadata": "root.Site.heavy_init", "header": "['class', 'Site', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 106 }, { "content": " def site_modified(self):\n \"\"\"Increases the site modification id.\n\n This causes the site to be refreshed in web processes caches.\n \"\"\"\n cursor = connection.cursor()\n cursor.execute(\n 'UPDATE wwwhisper_auth_site '\n 'SET mod_id = mod_id + 1 WHERE site_id = %s', [self.site_id])\n cursor.close()\n mod_id = self.mod_id_from_db()\n with self.mod_id_lock:\n self.mod_id = mod_id", "metadata": "root.Site.site_modified", "header": "['class', 'Site', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 117 }, { "content": " def skin(self):\n \"\"\"Dictionary with settings that configure the site's login page.\"\"\"\n # Dict comprehensions not used to support python 2.6.\n result = dict([(attr, getattr(self, attr) or self._default_skin[attr])\n for attr in self._default_skin.iterkeys()])\n result['branding'] = self.branding\n return result", "metadata": "root.Site.skin", "header": "['class', 'Site', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 131 }, { "content": " def update_skin(self, title, header, message, branding):\n for attr in self._default_skin.iterkeys():\n arg = locals()[attr].strip()\n if arg == self._default_skin[attr]:\n arg = ''\n setattr(self, attr, arg)\n self.branding = branding\n self.save()\n self.site_modified()", "metadata": "root.Site.update_skin", "header": "['class', 'Site', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 139 }, { "content": " def get_mod_id_ts(self):\n \"\"\"This method can be safely invoked by a non main thread\"\"\"\n with self.mod_id_lock:\n return self.mod_id", "metadata": "root.Site.get_mod_id_ts", "header": "['class', 'Site', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 149 }, { "content": " def mod_id_from_db(self):\n \"\"\"Retrieves from the DB a current modification identifier for the site.\n\n Returns None if the site no longer exists in the DB.\n \"\"\"\n cursor = connection.cursor()\n cursor.execute(\n 'SELECT mod_id FROM wwwhisper_auth_site WHERE site_id = %s',\n [self.site_id])\n row = cursor.fetchone()\n cursor.close()\n if row is None:\n return None\n return row[0]", "metadata": "root.Site.mod_id_from_db", "header": "['class', 'Site', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 154 }, { "content": "def modify_site(decorated_method):\n \"\"\"Must decorate all methods that change data associated with the site.\n\n Makes sure site is marked as modified and other Django processes\n will retrieve new data from the DB instead of using cached data.\n \"\"\"\n\n @wraps(decorated_method)\n def wrapper(self, *args, **kwargs):\n result = decorated_method(self, *args, **kwargs)\n # If no exception.\n self.site.site_modified()\n return result\n return wrapper", "metadata": "root.modify_site", "header": "['module', '___EOS___']", "index": 169 }, { "content": "class SitesCollection(object):\n\n", "metadata": "root.SitesCollection", "header": "['module', '___EOS___']", "index": 185 }, { "content": " def create_item(self, site_id, **kwargs):\n \"\"\"Creates a new Site object.\n\n Args:\n site_id: A domain or other id of the created site.\n Raises:\n ValidationError if a site with a given id already exists.\n \"\"\"\n site = Site.objects.create(site_id=site_id, **kwargs)\n site.heavy_init()\n return site", "metadata": "root.SitesCollection.create_item", "header": "['class', 'SitesCollection', '(', 'object', ')', ':', '___EOS___']", "index": 186 }, { "content": " def find_item(self, site_id):\n site = _find(Site, site_id=site_id)\n if site is not None:\n site.heavy_init()\n return site", "metadata": "root.SitesCollection.find_item", "header": "['class', 'SitesCollection', '(', 'object', ')', ':', '___EOS___']", "index": 198 }, { "content": " def delete_item(self, site_id):\n site = self.find_item(site_id)\n if site is None:\n return False\n # Users, Locations and Permissions have foreign key to the Site\n # and are deleted automatically.\n site.delete()\n return True", "metadata": "root.SitesCollection.delete_item", "header": "['class', 'SitesCollection', '(', 'object', ')', ':', '___EOS___']", "index": 204 }, { "content": "class User(AbstractBaseUser):\n class Meta:\n app_label = 'wwwhisper_auth'\n\n # Site to which the user belongs.\n site = models.ForeignKey(Site, related_name='+')\n\n # Externally visible UUID of the user. Allows to identify a REST\n # resource representing the user.\n uuid = models.CharField(max_length=36, db_index=True,\n editable=False, unique=True)\n email = models.EmailField(db_index=True)\n\n USERNAME_FIELD = 'uuid'\n REQUIRED_FIELDS = ['email', 'site']\n\n", "metadata": "root.User", "header": "['module', '___EOS___']", "index": 213 }, { "content": " def attributes_dict(self, site_url):\n \"\"\"Returns externally visible attributes of the user resource.\"\"\"\n return _add_common_attributes(self, site_url, {'email': self.email})", "metadata": "root.User.attributes_dict", "header": "['class', 'User', '(', 'AbstractBaseUser', ')', ':', '___EOS___']", "index": 229 }, { "content": " @models.permalink\n def get_absolute_url(self):\n return ('wwwhisper_user', (), {'uuid' : self.uuid})", "metadata": "root.User.get_absolute_url", "header": "['class', 'User', '(', 'AbstractBaseUser', ')', ':', '___EOS___']", "index": 233 }, { "content": "class Location(ValidatedModel):\n \"\"\"A location for which access control rules are defined.\n\n Location is uniquely identified by its canonical path. All access\n control rules defined for a location apply also to sub-paths,\n unless a more specific location exists. In such case the more\n specific location takes precedence over the more generic one.\n\n For example, if a location with a path /pub is defined and a user\n [email protected] is granted access to this location, the user can\n access /pub and all sub path of /pub. But if a location with a\n path /pub/beer is added, and the user [email protected] is not\n granted access to this location, the user won't be able to access\n /pub/beer and all its sub-paths.\n\n Attributes:\n site: Site to which the location belongs.\n path: Canonical path of the location.\n uuid: Externally visible UUID of the location, allows to identify a REST\n resource representing the location.\n\n open_access: can be:\n disabled ('n') - only explicitly allowed users can access a location;\n enabled ('y') - everyone can access a location, no login is required;\n enabled with authentication ('a') - everyone can access a location\n but login is required.\n \"\"\"\n OPEN_ACCESS_CHOICES = (\n ('n', 'no open access'),\n ('y', 'open access'),\n ('a', 'open access, login required'),\n )\n site = models.ForeignKey(Site, related_name='+')\n path = models.TextField(db_index=True)\n uuid = models.CharField(max_length=36, db_index=True,\n editable=False, unique=True)\n open_access = models.CharField(max_length=2, choices=OPEN_ACCESS_CHOICES,\n default='n')\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Location", "header": "['module', '___EOS___']", "index": 237 }, { "content": " def __init__(self, *args, **kwargs):\n super(Location, self).__init__(*args, **kwargs)", "metadata": "root.Location.__init__", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 276 }, { "content": " def permissions(self):\n # Does not run a query to get permissions if not needed.\n return self.site.locations.get_permissions(self.id)", "metadata": "root.Location.permissions", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 279 }, { "content": " def __unicode__(self):\n return \"%s\" % (self.path)", "metadata": "root.Location.__unicode__", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 283 }, { "content": " @models.permalink\n def get_absolute_url(self):\n \"\"\"Constructs URL of the location resource.\"\"\"\n return ('wwwhisper_location', (), {'uuid' : self.uuid})", "metadata": "root.Location.get_absolute_url", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 286 }, { "content": " @modify_site\n def grant_open_access(self, require_login):\n \"\"\"Allows open access to the location.\"\"\"\n if require_login:\n self.open_access = 'a'\n else:\n self.open_access = 'y'\n self.save()", "metadata": "root.Location.grant_open_access", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 291 }, { "content": " def open_access_granted(self):\n return self.open_access in ('y', 'a')", "metadata": "root.Location.open_access_granted", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 300 }, { "content": " def open_access_requires_login(self):\n return self.open_access == 'a'", "metadata": "root.Location.open_access_requires_login", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 303 }, { "content": " @modify_site\n def revoke_open_access(self):\n \"\"\"Disables open access to the location.\"\"\"\n self.open_access = 'n'\n self.save()", "metadata": "root.Location.revoke_open_access", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 306 }, { "content": " def can_access(self, user):\n \"\"\"Determines if a user can access the location.\n\n Returns:\n True if the user is granted permission to access the\n location or it the location is open.\n \"\"\"\n # Sanity check (this should normally be ensured by the caller).\n if user.site_id != self.site_id:\n return False\n return (self.open_access_granted()\n or self.permissions().get(user.id) != None)", "metadata": "root.Location.can_access", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 312 }, { "content": " @modify_site\n def grant_access(self, user_uuid):\n \"\"\"Grants access to the location to a given user.\n\n Args:\n user_uuid: string UUID of a user.\n\n Returns:\n (new Permission object, True) if access to the location was\n successfully granted.\n (existing Permission object, False) if user already had\n granted access to the location.\n\n Raises:\n LookupError: A site to which location belongs has no user\n with a given UUID.\n \"\"\"\n user = self.site.users.find_item(uuid=user_uuid)\n if user is None:\n raise LookupError('User not found')\n permission = self.permissions().get(user.id)\n created = False\n if permission is None:\n created = True\n permission = Permission.objects.create(\n http_location_id=self.id, user_id=user.id, site_id=self.site_id)\n return (permission, created)", "metadata": "root.Location.grant_access", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 325 }, { "content": " @modify_site\n def revoke_access(self, user_uuid):\n \"\"\"Revokes access to the location from a given user.\n\n Args:\n user_uuid: string UUID of a user.\n\n Raises:\n LookupError: Site has no user with a given UUID or the\n user can not access the location.\n \"\"\"\n permission = self.get_permission(user_uuid)\n permission.delete()", "metadata": "root.Location.revoke_access", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 353 }, { "content": " def get_permission(self, user_uuid):\n \"\"\"Gets Permission object for a given user.\n\n Args:\n user_uuid: string UUID of a user.\n\n Raises:\n LookupError: No user with a given UUID or the user can not\n access the location.\n \"\"\"\n user = self.site.users.find_item(uuid=user_uuid)\n if user is None:\n raise LookupError('User not found.')\n permission = self.permissions().get(user.id)\n if permission is None:\n raise LookupError('User can not access location.')\n return permission", "metadata": "root.Location.get_permission", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 367 }, { "content": " def allowed_users(self):\n \"\"\"\"Returns a list of users that can access the location.\"\"\"\n # The code could access permission.user like this:\n # [perm.user for perm in self.permissions().itervalues()]\n # but this involves a single DB query per allowed user, going\n # through cached site.users involves no queries.\n return [self.site.users.find_item_by_pk(user_id)\n for user_id in self.permissions().iterkeys()]", "metadata": "root.Location.allowed_users", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 385 }, { "content": " def attributes_dict(self, site_url):\n \"\"\"Returns externally visible attributes of the location resource.\"\"\"\n result = {\n 'path': self.path,\n 'allowedUsers': [\n user.attributes_dict(site_url) for user in self.allowed_users()\n ],\n }\n if self.open_access_granted():\n result['openAccess'] = {\n 'requireLogin' : self.open_access_requires_login()\n }\n return _add_common_attributes(self, site_url, result)", "metadata": "root.Location.attributes_dict", "header": "['class', 'Location', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 394 }, { "content": "class Permission(ValidatedModel):\n \"\"\"Connects a location with a user that can access the location.\n\n Attributes:\n http_location: The location to which the Permission object gives access.\n user: The user that is given access to the location.\n \"\"\"\n\n http_location = models.ForeignKey(Location, related_name='+')\n site = models.ForeignKey(Site, related_name='+')\n user = models.ForeignKey(User, related_name='+')\n\n\n", "metadata": "root.Permission", "header": "['module', '___EOS___']", "index": 408 }, { "content": " def __unicode__(self):\n return \"%s, %s\" % (self.http_location, self.user.email)", "metadata": "root.Permission.__unicode__", "header": "['class', 'Permission', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 420 }, { "content": " @models.permalink\n def get_absolute_url(self):\n \"\"\"Constructs URL of the permission resource.\"\"\"\n return ('wwwhisper_allowed_user', (),\n {'location_uuid' : self.http_location.uuid,\n 'user_uuid': self.user.uuid})", "metadata": "root.Permission.get_absolute_url", "header": "['class', 'Permission', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 423 }, { "content": " def attributes_dict(self, site_url):\n \"\"\"Returns externally visible attributes of the permission resource.\"\"\"\n return _add_common_attributes(\n self, site_url, {'user': self.user.attributes_dict(site_url)})", "metadata": "root.Permission.attributes_dict", "header": "['class', 'Permission', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 430 }, { "content": "class Alias(ValidatedModel):\n \"\"\"One of urls that can be used to access the site.\n\n Attributes:\n site: Site to which the alias belongs.\n url: Has form http(s)://domain[:port], default ports (80 for http,\n 443 for https) are always stripped.\n uuid: Externally visible UUID of the alias.\n \"\"\"\n\n site = models.ForeignKey(Site, related_name='+')\n url = models.TextField(db_index=True)\n uuid = models.CharField(max_length=36, db_index=True,\n editable=False, unique=True)\n force_ssl = models.BooleanField(default=False)\n\n\n", "metadata": "root.Alias", "header": "['module', '___EOS___']", "index": 435 }, { "content": " @models.permalink\n def get_absolute_url(self):\n return ('wwwhisper_alias', (), {'uuid' : self.uuid})", "metadata": "root.Alias.get_absolute_url", "header": "['class', 'Alias', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 452 }, { "content": " def attributes_dict(self, site_url):\n return _add_common_attributes(self, site_url, {'url': self.url})", "metadata": "root.Alias.attributes_dict", "header": "['class', 'Alias', '(', 'ValidatedModel', ')', ':', '___EOS___']", "index": 456 }, { "content": "class Collection(object):\n \"\"\"A common base class for managing a collection of resources.\n\n All resources in a collection belong to a common site and only\n this site can manipulate the resouces.\n\n Resources in the collection are of the same type and need to be\n identified by an UUID.\n\n Attributes (Need to be defined in subclasses):\n item_name: Name of a resource stored in the collection.\n model_class: Class that manages storage of resources.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Collection", "header": "['module', '___EOS___']", "index": 460 }, { "content": " def __init__(self, site):\n self.site = site\n self.update_cache()", "metadata": "root.Collection.__init__", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 474 }, { "content": " def update_cache(self):\n self._cached_items_dict = {}\n self._cached_items_list = []\n for item in self.model_class.objects.filter(site_id=self.site.site_id):\n self._cached_items_dict[item.id] = item\n self._cached_items_list.append(item)\n # Use already retrieved site, do not retrieve it again.\n item.site = self.site\n self.cache_mod_id = self.site.mod_id", "metadata": "root.Collection.update_cache", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 478 }, { "content": " def is_cache_obsolete(self):\n return self.site.mod_id != self.cache_mod_id", "metadata": "root.Collection.is_cache_obsolete", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 488 }, { "content": " def all(self):\n if self.is_cache_obsolete():\n self.update_cache()\n return self._cached_items_list", "metadata": "root.Collection.all", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 491 }, { "content": " def all_dict(self):\n if self.is_cache_obsolete():\n self.update_cache()\n return self._cached_items_dict", "metadata": "root.Collection.all_dict", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 496 }, { "content": " def count(self):\n return len(self.all())", "metadata": "root.Collection.count", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 501 }, { "content": " def get_unique(self, filter_fun):\n \"\"\"Finds a unique item that satisfies a given filter.\n\n Returns:\n The item or None if not found.\n \"\"\"\n result = filter(filter_fun, self.all())\n count = len(result)\n assert count <= 1\n if count == 0:\n return None\n return result[0]", "metadata": "root.Collection.get_unique", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 504 }, { "content": " def find_item(self, uuid):\n return self.get_unique(lambda item: item.uuid == uuid)", "metadata": "root.Collection.find_item", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 517 }, { "content": " def find_item_by_pk(self, pk):\n return self.all_dict().get(pk, None)", "metadata": "root.Collection.find_item_by_pk", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 520 }, { "content": " @modify_site\n def delete_item(self, uuid):\n \"\"\"Deletes an item with a given UUID.\n\n Returns:\n True if the item existed and was deleted, False if not found.\n \"\"\"\n item = self.find_item(uuid)\n if item is None:\n return False\n item.delete()\n return True", "metadata": "root.Collection.delete_item", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 523 }, { "content": " def _do_create_item(self, *args, **kwargs):\n \"\"\"Only to be called by subclasses.\"\"\"\n item = self.model_class.objects.create(\n site=self.site, uuid=str(uuidgen.uuid4()), **kwargs)\n item.site = self.site\n return item", "metadata": "root.Collection._do_create_item", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 536 }, { "content": "class UsersCollection(Collection):\n \"\"\"Collection of users resources.\"\"\"\n\n item_name = 'user'\n model_class = User\n\n", "metadata": "root.UsersCollection", "header": "['module', '___EOS___']", "index": 543 }, { "content": " @modify_site\n def create_item(self, email):\n \"\"\"Creates a new User object for the site.\n\n There may be two different users with the same email but for\n different sites.\n\n Raises:\n ValidationError if the email is invalid or if a site\n already has a user with such email.\n LimitExceeded if the site defines a maximum number of\n users and adding a new one would exceed this number.\n \"\"\"\n users_limit = self.site.users_limit\n if (users_limit is not None and self.count() >= users_limit):\n raise LimitExceeded('Users limit exceeded')\n\n encoded_email = _encode_email(email)\n if encoded_email is None:\n raise ValidationError('Invalid email format.')\n if self.find_item_by_email(encoded_email) is not None:\n raise ValidationError('User already exists.')\n # Django 1.8 correctly sets last_login field to NULL for newly\n # created users. Earlier Django versions set this field to\n # date_joined and had a 'not NULL' constraint on the\n # field. For compatibility with old databases, old behavior is\n # preserved, last_login is initally set to a date when user is\n # created.\n return self._do_create_item(email=encoded_email,\n last_login=timezone.now())", "metadata": "root.UsersCollection.create_item", "header": "['class', 'UsersCollection', '(', 'Collection', ')', ':', '___EOS___']", "index": 549 }, { "content": " def find_item_by_email(self, email):\n encoded_email = _encode_email(email)\n if encoded_email is None:\n return None\n return self.get_unique(lambda user: user.email == encoded_email)", "metadata": "root.UsersCollection.find_item_by_email", "header": "['class', 'UsersCollection', '(', 'Collection', ')', ':', '___EOS___']", "index": 580 }, { "content": "class LocationsCollection(Collection):\n \"\"\"Collection of locations resources.\"\"\"\n\n # Can be safely risen to whatever value is needed.\n PATH_LEN_LIMIT = 300\n\n # TODO: These should rather also be all caps.\n item_name = 'location'\n model_class = Location\n\n\n\n\n\n", "metadata": "root.LocationsCollection", "header": "['module', '___EOS___']", "index": 586 }, { "content": " def update_cache(self):\n super(LocationsCollection, self).update_cache()\n # Retrieves permissions for all locations of the site with a\n # single query.\n self._cached_permissions = {}\n for p in Permission.objects.filter(site=self.site):\n self._cached_permissions.setdefault(\n p.http_location_id, {})[p.user_id] = p", "metadata": "root.LocationsCollection.update_cache", "header": "['class', 'LocationsCollection', '(', 'Collection', ')', ':', '___EOS___']", "index": 596 }, { "content": " def get_permissions(self, location_id):\n \"\"\"Returns permissions for a given location of the site.\"\"\"\n if self.is_cache_obsolete():\n self.update_cache()\n return self._cached_permissions.get(location_id, {})", "metadata": "root.LocationsCollection.get_permissions", "header": "['class', 'LocationsCollection', '(', 'Collection', ')', ':', '___EOS___']", "index": 605 }, { "content": " @modify_site\n def create_item(self, path):\n \"\"\"Creates a new Location object for the site.\n\n The location path should be canonical and should not contain\n parts that are not used for access control (query, fragment,\n parameters). Location should not contain non-ascii characters.\n\n Raises:\n ValidationError if the path is invalid or if a site\n already has a location with such path.\n LimitExceeded if the site defines a maximum number of\n locations and adding a new one would exceed this number.\n \"\"\"\n\n locations_limit = self.site.locations_limit\n if (locations_limit is not None and self.count() >= locations_limit):\n raise LimitExceeded('Locations limit exceeded')\n\n if not url_utils.is_canonical(path):\n raise ValidationError(\n 'Path should be absolute and normalized (starting with / '\\\n 'without /../ or /./ or //).')\n if len(path) > self.PATH_LEN_LIMIT:\n raise ValidationError('Path too long')\n if url_utils.contains_fragment(path):\n raise ValidationError(\n \"Path should not contain fragment ('#' part).\")\n if url_utils.contains_query(path):\n raise ValidationError(\n \"Path should not contain query ('?' part).\")\n if url_utils.contains_params(path):\n raise ValidationError(\n \"Path should not contain parameters (';' part).\")\n try:\n path.encode('ascii')\n except UnicodeError:\n raise ValidationError(\n 'Path should contain only ascii characters.')\n\n if self.get_unique(lambda item: item.path == path) is not None:\n raise ValidationError('Location already exists.')\n\n return self._do_create_item(path=path)", "metadata": "root.LocationsCollection.create_item", "header": "['class', 'LocationsCollection', '(', 'Collection', ')', ':', '___EOS___']", "index": 611 }, { "content": " def find_location(self, canonical_path):\n \"\"\"Finds a location that defines access to a given path on the site.\n\n Args:\n canonical_path: The path for which matching location is searched.\n\n Returns:\n The most specific location with path matching a given path or None\n if no matching location exists.\n \"\"\"\n canonical_path_len = len(canonical_path)\n longest_matched_location = None\n longest_matched_location_len = -1\n\n for location in self.all():\n probed_path = location.path\n probed_path_len = len(probed_path)\n trailing_slash_index = None\n if probed_path[probed_path_len - 1] == '/':\n trailing_slash_index = probed_path_len - 1\n else:\n trailing_slash_index = probed_path_len\n\n if (canonical_path.startswith(probed_path) and\n probed_path_len > longest_matched_location_len and\n (probed_path_len == canonical_path_len or\n canonical_path[trailing_slash_index] == '/')) :\n longest_matched_location_len = probed_path_len\n longest_matched_location = location\n return longest_matched_location", "metadata": "root.LocationsCollection.find_location", "header": "['class', 'LocationsCollection', '(', 'Collection', ')', ':', '___EOS___']", "index": 657 }, { "content": " def has_open_location_with_login(self):\n for location in self.all():\n if (location.open_access_granted() and\n location.open_access_requires_login()):\n return True\n return False", "metadata": "root.LocationsCollection.has_open_location_with_login", "header": "['class', 'LocationsCollection', '(', 'Collection', ')', ':', '___EOS___']", "index": 688 }, { "content": " def has_open_location(self):\n for location in self.all():\n if location.open_access_granted():\n return True\n return False", "metadata": "root.LocationsCollection.has_open_location", "header": "['class', 'LocationsCollection', '(', 'Collection', ')', ':', '___EOS___']", "index": 694 }, { "content": "class AliasesCollection(Collection):\n item_name = 'alias'\n model_class = Alias\n # RFC 1035\n ALIAS_LEN_LIMIT = 8 + 253 + 6\n\n", "metadata": "root.AliasesCollection", "header": "['module', '___EOS___']", "index": 700 }, { "content": " @modify_site\n def create_item(self, url):\n aliases_limit = self.site.aliases_limit\n if (aliases_limit is not None and self.count() >= aliases_limit):\n raise LimitExceeded('Aliases limit exceeded')\n if len(url) > self.ALIAS_LEN_LIMIT:\n raise ValidationError('Url too long')\n\n url = url.strip().lower()\n (valid, error) = url_utils.validate_site_url(url)\n if not valid:\n raise ValidationError('Invalid url: ' + error)\n url = url_utils.remove_default_port(url)\n if self.find_item_by_url(url):\n raise ValidationError('Alias with this url already exists')\n return self._do_create_item(url=url)", "metadata": "root.AliasesCollection.create_item", "header": "['class', 'AliasesCollection', '(', 'Collection', ')', ':', '___EOS___']", "index": 706 }, { "content": " def find_item_by_url(self, url):\n return self.get_unique(lambda item: item.url == url)", "metadata": "root.AliasesCollection.find_item_by_url", "header": "['class', 'AliasesCollection', '(', 'Collection', ')', ':', '___EOS___']", "index": 723 }, { "content": "def _uuid2urn(uuid):\n return 'urn:uuid:' + uuid", "metadata": "root._uuid2urn", "header": "['module', '___EOS___']", "index": 726 }, { "content": "def _add_common_attributes(item, site_url, attributes_dict):\n \"\"\"Inserts common attributes of an item to a given dict.\n\n Attributes that are common for different resource types are a\n 'self' link and an 'id' field.\n \"\"\"\n attributes_dict['self'] = site_url + item.get_absolute_url()\n if hasattr(item, 'uuid'):\n attributes_dict['id'] = _uuid2urn(item.uuid)\n return attributes_dict", "metadata": "root._add_common_attributes", "header": "['module', '___EOS___']", "index": 729 }, { "content": "def _find(model_class, **kwargs):\n \"\"\"Finds a single item satisfying a given expression.\n\n Args:\n model_class: Model that manages stored items.\n **kwargs: Filtering expression, at most one element can satisfy it.\n Returns:\n An item that satisfies expression or None.\n \"\"\"\n items = [item for item in model_class.objects.filter(**kwargs)]\n count = len(items)\n assert count <= 1\n if count == 0:\n return None\n return items[0]", "metadata": "root._find", "header": "['module', '___EOS___']", "index": 740 }, { "content": "def _encode_email(email):\n \"\"\"Encodes and validates email address.\n\n Email is converted to a lower case not to require emails to be added\n to the access control list with the same capitalization that the\n user signs-in with.\n \"\"\"\n encoded_email = email.lower()\n if not is_email_valid(encoded_email):\n return None\n return encoded_email", "metadata": "root._encode_email", "header": "['module', '___EOS___']", "index": 756 }, { "content": "def is_email_valid(email):\n return re.match(email_re.EMAIL_VALIDATION_RE, email)", "metadata": "root.is_email_valid", "header": "['module', '___EOS___']", "index": 768 } ]
[ { "span": "from django.db import transaction", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 33 }, { "span": "import random", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "www", "his", "per", " ", "-", " ", "web", " ", "access", " ", "control", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2012", "-", "201", "5", " ", "Jan", " ", "Wro", "bel", " ", "<", "jan", "@", "mixed", "bit", ".", "org", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Data", " ", "model", " ", "for", " ", "the", " ", "site", " ", "access", " ", "control", " ", "rule", "s", ".", "\\", "10", ";", "\\", "10", ";", "Ea", "ch", " ", "site", " ", "has", " ", "users", ",", " ", "location", "s", " ", "(", "path", "s", ")", " ", "and", " ", "permissi", "ons", " ", "-", " ", "rule", "s", " ", "tha", "t", "\\", "10", ";", "defin", "e", " ", "whi", "ch", " ", "user", " ", "can", " ", "access", " ", "whi", "ch", " ", "location", "s", ".", " ", "Site", "s", " ", "are", "\\", "10", ";", "isolated", ".", " ", "User", "s", " ", "and", " ", "location", "s", " ", "are", " ", "associate", "d", " ", "with", " ", "a", " ", "single", " ", "site", " ", "and", "\\", "10", ";", "are", " ", "used", " ", "only", " ", "for", " ", "this", " ", "site", ".", " ", "Site", " ", "has", " ", "als", "o", " ", "alias", "es", ":", " ", "urls", " ", "tha", "t", " ", "can", " ", "be", "\\", "10", ";", "used", " ", "to", " ", "access", " ", "the", " ", "site", ",", " ", "only", " ", "request", "s", " ", "from", " ", "these", " ", "urls", " ", "are", " ", "allow", "ed", ".", "\\", "10", ";", "\\", "10", ";", "Prov", "ides", " ", "method", "s", " ", "tha", "t", " ", "map", " ", "to", " ", "REST", " ", "operati", "ons", " ", "tha", "t", " ", "can", " ", "be", " ", "perform", "ed", " ", "on", "\\", "10", ";", "users", ",", " ", "location", "s", " ", "and", " ", "permissi", "ons", " ", "resource", "s", ".", " ", "All", "ow", "s", " ", "to", " ", "retrieve", "\\", "10", ";", "external", "ly", " ", "visi", "ble", " ", "attribute", "s", " ", "of", " ", "these", " ", "resource", "s", ",", " ", "the", " ", "attribute", "s", " ", "are", "\\", "10", ";", "return", "ed", " ", "as", " ", "a", " ", "resource", " ", "represent", "ation", " ", "by", " ", "REST", " ", "method", "s", ".", "\\", "10", ";", "\\", "10", ";", "Reso", "urc", "es", " ", "are", " ", "identifi", "ed", " ", "by", " ", "an", " ", "external", "ly", " ", "visi", "ble", " ", "UU", "ID", "s", ".", " ", "Standard", "\\", "10", ";", "primary", " ", "key", " ", "ids", " ", "are", " ", "not", " ", "used", " ", "for", " ", "external", " ", "identifica", "tion", " ", "purpose", "s", ",", "\\", "10", ";", "bec", "aus", "e", " ", "tho", "se", " ", "ids", " ", "can", " ", "be", " ", "reus", "ed", " ", "after", " ", "object", " ", "is", " ", "delete", "d", ".", "\\", "10", ";", "\\", "10", ";", "Make", "s", " ", "sure", " ", "enter", "ed", " ", "email", "s", " ", "and", " ", "path", "s", " ", "are", " ", "valid", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "Abstract", "Base", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "import_", "Validat", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functools_", "import_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "www", "his", "per", "\\u", "auth_", "import_", "url", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "www", "his", "per", "\\u", "auth_", "import_", "email", "\\u", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "as_", "uuid", "gen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Id", " ", "used", " ", "whe", "n", " ", "www", "his", "per", " ", "server", "s", " ", "just", " ", "a", " ", "single", " ", "site", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SINGLE", "\\u", "SITE", "\\u", "ID_", "=_", "'", "theo", "ne", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Limit", "Exce", "eded", "_", "(_", "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_", "class_", "Validate", "d", "Model_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "all", " ", "model", " ", "classe", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Make", "s", " ", "sure", " ", "all", " ", "constraint", "s", " ", "are", " ", "preserved", " ", "bef", "ore", " ", "change", "d", " ", "data", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "saved", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Disa", "bles", " ", "creati", "on", " ", "of", " ", "a", " ", "DB", " ", "table", " ", "for", " ", "Validate", "d", "Model", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abstract_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Needed", " ", "bec", "aus", "e", " ", "model", "s", " ", "are", " ", "used", " ", "from", " ", "signal", " ", "handler", "s", ",", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "applica", "tion", " ", "is", " ", "load", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "www", "his", "per", "\\u", "auth", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Validate", "d", "Model_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "full", "\\u", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Validate", "d", "Model_", ",_", "self_", ")_", "._", "save_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Site_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "site", " ", "to", " ", "whi", "ch", " ", "access", " ", "is", " ", "protect", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Site", " ", "has", " ", "location", "s", ",", " ", "users", " ", "and", " ", "alias", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", "site", "\\u", "id", ":", " ", "Can", " ", "be", " ", "a", " ", "domain", " ", "or", " ", "any", " ", "other", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "mod", "\\u", "id", ":", " ", "Change", "d", " ", "after", " ", "any", " ", "modification", " ", "of", " ", "site", "-", "relate", "d", " ", "data", " ", "(", "not", "\\", "10", ";", " ", " ", " ", " ", " ", "only", " ", "Site", " ", "its", "elf", " ", "but", " ", "als", "o", " ", "site", "'", "s", " ", "location", "s", ",", " ", "permissi", "ons", " ", "or", "\\", "10", ";", " ", " ", " ", " ", " ", "users", ").", " ", "All", "ow", "s", " ", "to", " ", "dete", "rmin", "e", " ", "whe", "n", " ", "Dj", "ang", "o", " ", "process", "es", " ", "need", " ", "to", "\\", "10", ";", " ", " ", " ", " ", " ", "update", " ", "cache", "d", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site", "\\u", "id_", "=_", "models_", "._", "Text", "Field_", "(_", "primary", "\\u", "key_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "\\u", "id_", "=_", "models_", "._", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "values", " ", "for", " ", "texts", " ", "on", " ", "a", " ", "login", " ", "page", " ", "(", "used", " ", "whe", "n", " ", "custom", " ", "texts_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "set", " ", "to", " ", "empty", " ", "values", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "default", "\\u", "skin_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "'", "www", "his", "per", ":", " ", "Web", " ", "Access", " ", "Control", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "'_", ":_", "'", "Protect", "ed", " ", "site", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "'", "Access", " ", "to", " ", "this", " ", "site", " ", "is", " ", "restrict", "ed", ".", " ", "'_", "+_", "'", "Ple", "ase", " ", "sign", " ", "in", " ", "with", " ", "your", " ", "email", ":'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "80_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "500_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "brandi", "ng_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alias", "es", "\\u", "limit_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users", "\\u", "limit_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location", "s", "\\u", "limit_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Site_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Site_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Synchronize", "s", " ", "mod", " ", "id", " ", "tha", "t", " ", "can", " ", "be", " ", "read", " ", "by", " ", "a", " ", "cache", " ", "updat", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thread", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mod", "\\u", "id", "\\u", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "heav", "y", "\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "collection", "s", " ", "of", " ", "all", " ", "site", "-", "relate", "d", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "resource", " ", "inten", "sive", " ", "operati", "on", " ", "tha", "t", " ", "retrieve", "s", " ", "all", " ", "site", "\\", "10", ";", " ", " ", " ", " ", "relate", "d", " ", "data", " ", "from", " ", "the", " ", "databa", "se", ".", " ", "It", " ", "is", " ", "only", " ", "perform", "ed", " ", "if", " ", "the", " ", "site", "\\", "10", ";", " ", " ", " ", " ", "was", " ", "modifi", "ed", " ", "sinc", "e", " ", "it", " ", "was", " ", "last", " ", "retrieved", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "locations_", "=_", "Locat", "ion", "s", "Collection_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "=_", "User", "s", "Collection_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aliases_", "=_", "Aliase", "s", "Collection_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "site", "\\u", "modified_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Increase", "s", " ", "the", " ", "site", " ", "modification", " ", "id", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "caus", "es", " ", "the", " ", "site", " ", "to", " ", "be", " ", "refreshe", "d", " ", "in", " ", "web", " ", "process", "es", " ", "cache", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "=_", "connection_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "UPDATE", " ", "www", "his", "per", "\\u", "auth", "\\u", "site", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SET", " ", "mod", "\\u", "id", " ", "=", " ", "mod", "\\u", "id", " ", "+", " ", "1", " ", "WHE", "RE", " ", "site", "\\u", "id", " ", "=", " ", "%", "s", "'_", ",_", "[_", "self_", "._", "site", "\\u", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "\\u", "id_", "=_", "self_", "._", "mod", "\\u", "id", "\\u", "from", "\\u", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "mod", "\\u", "id", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mod", "\\u", "id_", "=_", "mod", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\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_", "skin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Dict", "ionar", "y", " ", "with", " ", "settings", " ", "tha", "t", " ", "configur", "e", " ", "the", " ", "site", "'", "s", " ", "login", " ", "page", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dict", " ", "compre", "hens", "ion", "s", " ", "not", " ", "used", " ", "to", " ", "support", " ", "python", " ", "2.6", "._", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "dict_", "(_", "[_", "(_", "attr_", ",_", "getattr_", "(_", "self_", ",_", "attr_", ")_", "or_", "self_", "._", "\\u", "default", "\\u", "skin_", "[_", "attr_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "attr_", "in_", "self_", "._", "\\u", "default", "\\u", "skin_", "._", "iterkeys_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "brandi", "ng", "'_", "]_", "=_", "self_", "._", "brandi", "ng_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "skin_", "(_", "self_", ",_", "title_", ",_", "header_", ",_", "message_", ",_", "brandi", "ng_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "attr_", "in_", "self_", "._", "\\u", "default", "\\u", "skin_", "._", "iterkeys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg_", "=_", "locals_", "(_", ")_", "[_", "attr_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arg_", "==_", "self_", "._", "\\u", "default", "\\u", "skin_", "[_", "attr_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "attr_", ",_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "brandi", "ng_", "=_", "brandi", "ng_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "site", "\\u", "modified_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "mod", "\\u", "id", "\\u", "ts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "method", " ", "can", " ", "be", " ", "safe", "ly", " ", "invoke", "d", " ", "by", " ", "a", " ", "non", " ", "main", " ", "thread", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "mod", "\\u", "id", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "mod", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\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_", "mod", "\\u", "id", "\\u", "from", "\\u", "db_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", "s", " ", "from", " ", "the", " ", "DB", " ", "a", " ", "current", " ", "modification", " ", "identifi", "er", " ", "for", " ", "the", " ", "site", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Non", "e", " ", "if", " ", "the", " ", "site", " ", "no", " ", "long", "er", " ", "exist", "s", " ", "in", " ", "the", " ", "DB", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "=_", "connection_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SELECT", " ", "mod", "\\u", "id", " ", "FROM", " ", "www", "his", "per", "\\u", "auth", "\\u", "site", " ", "WHE", "RE", " ", "site", "\\u", "id", " ", "=", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "site", "\\u", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", "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_", "return_", "row_", "[_", "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_", "def_", "modif", "y", "\\u", "site_", "(_", "decorated", "\\u", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mus", "t", " ", "decorate", " ", "all", " ", "method", "s", " ", "tha", "t", " ", "change", " ", "data", " ", "associate", "d", " ", "with", " ", "the", " ", "site", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Make", "s", " ", "sure", " ", "site", " ", "is", " ", "marked", " ", "as", " ", "modifi", "ed", " ", "and", " ", "other", " ", "Dj", "ang", "o", " ", "process", "es", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "retrieve", " ", "new", " ", "data", " ", "from", " ", "the", " ", "DB", " ", "inst", "ead", " ", "of", " ", "usi", "ng", " ", "cache", "d", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "wraps_", "(_", "decorated", "\\u", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "decorated", "\\u", "method_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "exception", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "site_", "._", "site", "\\u", "modified_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\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_", "Site", "s", "Collection_", "(_", "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_", "Site", "s", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "create", "\\u", "item_", "(_", "self_", ",_", "site", "\\u", "id_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "new", " ", "Site", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", "site", "\\u", "id", ":", " ", "A", " ", "domain", " ", "or", " ", "other", " ", "id", " ", "of", " ", "the", " ", "created", " ", "site", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", "Validat", "ion", "Error", " ", "if", " ", "a", " ", "site", " ", "with", " ", "a", " ", "give", "n", " ", "id", " ", "alr", "ead", "y", " ", "exist", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "Site_", "._", "objects_", "._", "create_", "(_", "site", "\\u", "id_", "=_", "site", "\\u", "id_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "._", "heav", "y", "\\u", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "s", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "item_", "(_", "self_", ",_", "site", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site_", "=_", "\\u", "find_", "(_", "Site_", ",_", "site", "\\u", "id_", "=_", "site", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "site_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site_", "._", "heav", "y", "\\u", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "s", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "item_", "(_", "self_", ",_", "site", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site_", "=_", "self_", "._", "find", "\\u", "item_", "(_", "site", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "site_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "User", "s", ",", " ", "Locat", "ion", "s", " ", "and", " ", "Permi", "ssion", "s", " ", "have", " ", "foreign", " ", "key", " ", "to", " ", "the", " ", "Site_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "are", " ", "delete", "d", " ", "automati", "call", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "site_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User_", "(_", "Abstract", "Base", "User_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "'", "www", "his", "per", "\\u", "auth", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Site", " ", "to", " ", "whi", "ch", " ", "the", " ", "user", " ", "belo", "ngs", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "site_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Site_", ",_", "relate", "d\\u", "name_", "=_", "'+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exter", "nal", "ly", " ", "visi", "ble", " ", "UU", "ID", " ", "of", " ", "the", " ", "user", ".", " ", "All", "ow", "s", " ", "to", " ", "identify", " ", "a", " ", "REST", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "resource", " ", "represent", "ing", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "uuid_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "36_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "editable_", "=_", "False_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "models_", "._", "Ema", "il", "Field_", "(_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "USER", "NAME", "\\u", "FIELD_", "=_", "'", "uuid", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REQUIRE", "D", "\\u", "FIELDS_", "=_", "[_", "'", "email", "'_", ",_", "'", "site", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "Abstract", "Base", "User_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "attribute", "s", "\\u", "dict_", "(_", "self_", ",_", "site", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "external", "ly", " ", "visi", "ble", " ", "attribute", "s", " ", "of", " ", "the", " ", "user", " ", "resource", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "add", "\\u", "common", "\\u", "attributes_", "(_", "self_", ",_", "site", "\\u", "url_", ",_", "{_", "'", "email", "'_", ":_", "self_", "._", "email_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "Abstract", "Base", "User_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "models_", "._", "permalink", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "www", "his", "per", "\\u", "user", "'_", ",_", "(_", ")_", ",_", "{_", "'", "uuid", "'_", ":_", "self_", "._", "uuid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "location", " ", "for", " ", "whi", "ch", " ", "access", " ", "control", " ", "rule", "s", " ", "are", " ", "defin", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", " ", "is", " ", "unique", "ly", " ", "identifi", "ed", " ", "by", " ", "its", " ", "canonical", " ", "path", ".", " ", "All", " ", "access", "\\", "10", ";", " ", " ", " ", " ", "control", " ", "rule", "s", " ", "defin", "ed", " ", "for", " ", "a", " ", "location", " ", "appl", "y", " ", "als", "o", " ", "to", " ", "sub", "-", "path", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "unl", "ess", " ", "a", " ", "more", " ", "specific", " ", "location", " ", "exist", "s", ".", " ", "In", " ", "suc", "h", " ", "case", " ", "the", " ", "more", "\\", "10", ";", " ", " ", " ", " ", "specific", " ", "location", " ", "take", "s", " ", "preceden", "ce", " ", "over", " ", "the", " ", "more", " ", "gener", "ic", " ", "one", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "if", " ", "a", " ", "location", " ", "with", " ", "a", " ", "path", " ", "/", "pub", " ", "is", " ", "defin", "ed", " ", "and", " ", "a", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "foo", "@", "example", ".", "com", " ", "is", " ", "grant", "ed", " ", "access", " ", "to", " ", "this", " ", "location", ",", " ", "the", " ", "user", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "access", " ", "/", "pub", " ", "and", " ", "all", " ", "sub", " ", "path", " ", "of", " ", "/", "pub", ".", " ", "Bu", "t", " ", "if", " ", "a", " ", "location", " ", "with", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "path", " ", "/", "pub", "/", "beer", " ", "is", " ", "adde", "d", ",", " ", "and", " ", "the", " ", "user", " ", "foo", "@", "example", ".", "com", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "grant", "ed", " ", "access", " ", "to", " ", "this", " ", "location", ",", " ", "the", " ", "user", " ", "won", "'", "t", " ", "be", " ", "able", " ", "to", " ", "access", "\\", "10", ";", " ", " ", " ", " ", "/", "pub", "/", "beer", " ", "and", " ", "all", " ", "its", " ", "sub", "-", "path", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", "site", ":", " ", "Site", " ", "to", " ", "whi", "ch", " ", "the", " ", "location", " ", "belo", "ngs", ".", "\\", "10", ";", " ", " ", "path", ":", " ", "Canonical", " ", "path", " ", "of", " ", "the", " ", "location", ".", "\\", "10", ";", " ", " ", "uuid", ":", " ", "Exter", "nal", "ly", " ", "visi", "ble", " ", "UU", "ID", " ", "of", " ", "the", " ", "location", ",", " ", "allow", "s", " ", "to", " ", "identify", " ", "a", " ", "REST", "\\", "10", ";", " ", " ", "resource", " ", "represent", "ing", " ", "the", " ", "location", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "open", "\\u", "access", ":", " ", "can", " ", "be", ":", "\\", "10", ";", " ", " ", " ", " ", "disable", "d", " ", "('", "n", "')", " ", "-", " ", "only", " ", "explicit", "ly", " ", "allow", "ed", " ", "users", " ", "can", " ", "access", " ", "a", " ", "location", ";", "\\", "10", ";", " ", " ", " ", " ", "enable", "d", " ", "('", "y", "')", " ", "-", " ", "everyone", " ", "can", " ", "access", " ", "a", " ", "location", ",", " ", "no", " ", "login", " ", "is", " ", "require", "d", ";", "\\", "10", ";", " ", " ", " ", " ", "enable", "d", " ", "with", " ", "authenticat", "ion", " ", "('", "a", "')", " ", "-", " ", "everyone", " ", "can", " ", "access", " ", "a", " ", "location", "\\", "10", ";", " ", " ", "but", " ", "login", " ", "is", " ", "require", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OPEN", "\\u", "ACCESS", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "n", "'_", ",_", "'", "no", " ", "open", " ", "access", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y", "'_", ",_", "'", "open", " ", "access", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "a", "'_", ",_", "'", "open", " ", "access", ",", " ", "login", " ", "require", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Site_", ",_", "relate", "d\\u", "name_", "=_", "'+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "models_", "._", "Text", "Field_", "(_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uuid_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "36_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "editable_", "=_", "False_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open", "\\u", "access_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "2_", ",_", "choices_", "=_", "OPEN", "\\u", "ACCESS", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Location_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "permissions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", "es", " ", "not", " ", "run", " ", "a", " ", "query", " ", "to", " ", "get", " ", "permissi", "ons", " ", "if", " ", "not", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "site_", "._", "locations_", "._", "get", "\\u", "permissions_", "(_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", "\"_", "%_", "(_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "models_", "._", "permalink", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", "s", " ", "URL", " ", "of", " ", "the", " ", "location", " ", "resource", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "'", "www", "his", "per", "\\u", "location", "'_", ",_", "(_", ")_", ",_", "{_", "'", "uuid", "'_", ":_", "self_", "._", "uuid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "modif", "y", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "grant", "\\u", "open", "\\u", "access_", "(_", "self_", ",_", "require", "\\u", "login_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "All", "ow", "s", " ", "open", " ", "access", " ", "to", " ", "the", " ", "location", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "require", "\\u", "login_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "open", "\\u", "access_", "=_", "'", "a", "'_", "\\u\\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_", "._", "open", "\\u", "access_", "=_", "'", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "\\u", "access", "\\u", "grant", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "open", "\\u", "access_", "in_", "(_", "'", "y", "'_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "\\u", "access", "\\u", "require", "s", "\\u", "login_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "open", "\\u", "access_", "==_", "'", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "modif", "y", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "revoke", "\\u", "open", "\\u", "access_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Disa", "bles", " ", "open", " ", "access", " ", "to", " ", "the", " ", "location", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "open", "\\u", "access_", "=_", "'", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "can", "\\u", "access_", "(_", "self_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Det", "erm", "ine", "s", " ", "if", " ", "a", " ", "user", " ", "can", " ", "access", " ", "the", " ", "location", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", " ", "if", " ", "the", " ", "user", " ", "is", " ", "grant", "ed", " ", "permissi", "on", " ", "to", " ", "access", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "location", " ", "or", " ", "it", " ", "the", " ", "location", " ", "is", " ", "open", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "check", " ", "(", "this", " ", "shou", "ld", " ", "normal", "ly", " ", "be", " ", "ensure", "d", " ", "by", " ", "the", " ", "caller", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", "._", "site", "\\u", "id_", "!=_", "self_", "._", "site", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "self_", "._", "open", "\\u", "access", "\\u", "grant", "ed_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "self_", "._", "permissions_", "(_", ")_", "._", "get_", "(_", "user_", "._", "id_", ")_", "!=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "modif", "y", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "grant", "\\u", "access_", "(_", "self_", ",_", "user", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Grant", "s", " ", "access", " ", "to", " ", "the", " ", "location", " ", "to", " ", "a", " ", "give", "n", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "\\u", "uuid", ":", " ", "string", " ", "UU", "ID", " ", "of", " ", "a", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "(", "new", " ", "Permi", "ssion", " ", "object", ",", " ", "Tru", "e", ")", " ", "if", " ", "access", " ", "to", " ", "the", " ", "location", " ", "was", "\\", "10", ";", " ", " ", " ", " ", "success", "full", "y", " ", "grant", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "exist", "ing", " ", "Permi", "ssion", " ", "object", ",", " ", "Fal", "se", ")", " ", "if", " ", "user", " ", "alr", "ead", "y", " ", "had", "\\", "10", ";", " ", " ", " ", " ", "grant", "ed", " ", "access", " ", "to", " ", "the", " ", "location", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Look", "up", "Error", ":", " ", "A", " ", "site", " ", "to", " ", "whi", "ch", " ", "location", " ", "belo", "ngs", " ", "has", " ", "no", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "a", " ", "give", "n", " ", "UU", "ID", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "self_", "._", "site_", "._", "users_", "._", "find", "\\u", "item_", "(_", "uuid_", "=_", "user", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Look", "up", "Error_", "(_", "'", "User", " ", "not", " ", "found", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "permission_", "=_", "self_", "._", "permissions_", "(_", ")_", "._", "get_", "(_", "user_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "permission_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "created_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "=_", "Permission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "http", "\\u", "location", "\\u", "id_", "=_", "self_", "._", "id_", ",_", "user", "\\u", "id_", "=_", "user_", "._", "id_", ",_", "site", "\\u", "id_", "=_", "self_", "._", "site", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "permission_", ",_", "created_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "modif", "y", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "revoke", "\\u", "access_", "(_", "self_", ",_", "user", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Revo", "kes", " ", "access", " ", "to", " ", "the", " ", "location", " ", "from", " ", "a", " ", "give", "n", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "\\u", "uuid", ":", " ", "string", " ", "UU", "ID", " ", "of", " ", "a", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Look", "up", "Error", ":", " ", "Site", " ", "has", " ", "no", " ", "user", " ", "with", " ", "a", " ", "give", "n", " ", "UU", "ID", " ", "or", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "user", " ", "can", " ", "not", " ", "access", " ", "the", " ", "location", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "=_", "self_", "._", "get", "\\u", "permission_", "(_", "user", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "permission_", "(_", "self_", ",_", "user", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", "s", " ", "Permi", "ssion", " ", "object", " ", "for", " ", "a", " ", "give", "n", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "\\u", "uuid", ":", " ", "string", " ", "UU", "ID", " ", "of", " ", "a", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Look", "up", "Error", ":", " ", "No", " ", "user", " ", "with", " ", "a", " ", "give", "n", " ", "UU", "ID", " ", "or", " ", "the", " ", "user", " ", "can", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "access", " ", "the", " ", "location", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "self_", "._", "site_", "._", "users_", "._", "find", "\\u", "item_", "(_", "uuid_", "=_", "user", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Look", "up", "Error_", "(_", "'", "User", " ", "not", " ", "found", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "permission_", "=_", "self_", "._", "permissions_", "(_", ")_", "._", "get_", "(_", "user_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "permission_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Look", "up", "Error_", "(_", "'", "User", " ", "can", " ", "not", " ", "access", " ", "location", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "allow", "ed", "\\u", "users_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\"", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "users", " ", "tha", "t", " ", "can", " ", "access", " ", "the", " ", "location", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "code", " ", "coul", "d", " ", "access", " ", "permissi", "on", ".", "user", " ", "like", " ", "this", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", "perm", ".", "user", " ", "for", " ", "perm", " ", "in", " ", "self", ".", "permissi", "ons", "()", ".", "iter", "values", "()]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "this", " ", "involv", "es", " ", "a", " ", "single", " ", "DB", " ", "query", " ", "per", " ", "allow", "ed", " ", "user", ",", " ", "goi", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "through", " ", "cache", "d", " ", "site", ".", "users", " ", "involv", "es", " ", "no", " ", "querie", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "self_", "._", "site_", "._", "users_", "._", "find", "\\u", "item", "\\u", "by", "\\u", "pk_", "(_", "user", "\\u", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user", "\\u", "id_", "in_", "self_", "._", "permissions_", "(_", ")_", "._", "iterkeys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "attribute", "s", "\\u", "dict_", "(_", "self_", ",_", "site", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "external", "ly", " ", "visi", "ble", " ", "attribute", "s", " ", "of", " ", "the", " ", "location", " ", "resource", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "self_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "ed", "User", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "._", "attribute", "s", "\\u", "dict_", "(_", "site", "\\u", "url_", ")_", "for_", "user_", "in_", "self_", "._", "allow", "ed", "\\u", "users_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "open", "\\u", "access", "\\u", "grant", "ed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "open", "Access", "'_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "Logi", "n", "'_", ":_", "self_", "._", "open", "\\u", "access", "\\u", "require", "s", "\\u", "login_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "add", "\\u", "common", "\\u", "attributes_", "(_", "self_", ",_", "site", "\\u", "url_", ",_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Permission_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Connect", "s", " ", "a", " ", "location", " ", "with", " ", "a", " ", "user", " ", "tha", "t", " ", "can", " ", "access", " ", "the", " ", "location", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "http", "\\u", "location", ":", " ", "The", " ", "location", " ", "to", " ", "whi", "ch", " ", "the", " ", "Permi", "ssion", " ", "object", " ", "give", "s", " ", "access", ".", "\\", "10", ";", " ", " ", " ", " ", "user", ":", " ", "The", " ", "user", " ", "tha", "t", " ", "is", " ", "give", "n", " ", "access", " ", "to", " ", "the", " ", "location", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "http", "\\u", "location_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Location_", ",_", "relate", "d\\u", "name_", "=_", "'+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Site_", ",_", "relate", "d\\u", "name_", "=_", "'+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "User_", ",_", "relate", "d\\u", "name_", "=_", "'+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Permission_", "(_", "Validate", "d", "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_", "\"%", "s", ",", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "http", "\\u", "location_", ",_", "self_", "._", "user_", "._", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Permission_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "models_", "._", "permalink", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", "s", " ", "URL", " ", "of", " ", "the", " ", "permissi", "on", " ", "resource", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "'", "www", "his", "per", "\\u", "allow", "ed", "\\u", "user", "'_", ",_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "location", "\\u", "uuid", "'_", ":_", "self_", "._", "http", "\\u", "location_", "._", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "uuid", "'_", ":_", "self_", "._", "user_", "._", "uuid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Permission_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "attribute", "s", "\\u", "dict_", "(_", "self_", ",_", "site", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "external", "ly", " ", "visi", "ble", " ", "attribute", "s", " ", "of", " ", "the", " ", "permissi", "on", " ", "resource", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "add", "\\u", "common", "\\u", "attributes_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "site", "\\u", "url_", ",_", "{_", "'", "user", "'_", ":_", "self_", "._", "user_", "._", "attribute", "s", "\\u", "dict_", "(_", "site", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Alias_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "One", " ", "of", " ", "urls", " ", "tha", "t", " ", "can", " ", "be", " ", "used", " ", "to", " ", "access", " ", "the", " ", "site", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", "site", ":", " ", "Site", " ", "to", " ", "whi", "ch", " ", "the", " ", "alias", " ", "belo", "ngs", ".", "\\", "10", ";", " ", " ", "url", ":", " ", "Has", " ", "form", " ", "http", "(", "s", "):", "//", "domain", "[:", "port", "],", " ", "default", " ", "port", "s", " ", "(", "80", " ", "for", " ", "http", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "443", " ", "for", " ", "https", ")", " ", "are", " ", "alw", "ay", "s", " ", "strip", "ped", ".", "\\", "10", ";", " ", " ", "uuid", ":", " ", "Exter", "nal", "ly", " ", "visi", "ble", " ", "UU", "ID", " ", "of", " ", "the", " ", "alias", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Site_", ",_", "relate", "d\\u", "name_", "=_", "'+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "models_", "._", "Text", "Field_", "(_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uuid_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "36_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "editable_", "=_", "False_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "force", "\\u", "ssl_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Alias_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "models_", "._", "permalink", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "www", "his", "per", "\\u", "alias", "'_", ",_", "(_", ")_", ",_", "{_", "'", "uuid", "'_", ":_", "self_", "._", "uuid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Alias_", "(_", "Validate", "d", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "attribute", "s", "\\u", "dict_", "(_", "self_", ",_", "site", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "add", "\\u", "common", "\\u", "attributes_", "(_", "self_", ",_", "site", "\\u", "url_", ",_", "{_", "'", "url", "'_", ":_", "self_", "._", "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_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "common", " ", "base", " ", "class", " ", "for", " ", "mana", "ging", " ", "a", " ", "collection", " ", "of", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "resource", "s", " ", "in", " ", "a", " ", "collection", " ", "belo", "ng", " ", "to", " ", "a", " ", "common", " ", "site", " ", "and", " ", "only", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "site", " ", "can", " ", "manipulate", " ", "the", " ", "reso", "uce", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reso", "urc", "es", " ", "in", " ", "the", " ", "collection", " ", "are", " ", "of", " ", "the", " ", "same", " ", "type", " ", "and", " ", "need", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "identifi", "ed", " ", "by", " ", "an", " ", "UU", "ID", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", " ", "(", "Ne", "ed", " ", "to", " ", "be", " ", "defin", "ed", " ", "in", " ", "subclasses", "):", "\\", "10", ";", " ", " ", " ", " ", "item", "\\u", "name", ":", " ", "Name", " ", "of", " ", "a", " ", "resource", " ", "store", "d", " ", "in", " ", "the", " ", "collection", ".", "\\", "10", ";", " ", " ", " ", " ", "model", "\\u", "class", ":", " ", "Class", " ", "tha", "t", " ", "manage", "s", " ", "storage", " ", "of", " ", "resource", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "site_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "site_", "=_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "cache_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "cache", "d\\u", "items", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cache", "d\\u", "items", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "self_", "._", "model", "\\u", "class_", "._", "objects_", "._", "filter_", "(_", "site", "\\u", "id_", "=_", "self_", "._", "site_", "._", "site", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "cache", "d\\u", "items", "\\u", "dict_", "[_", "item_", "._", "id_", "]_", "=_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cache", "d\\u", "items", "\\u", "list_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "alr", "ead", "y", " ", "retrieved", " ", "site", ",", " ", "do", " ", "not", " ", "retrieve", " ", "it", " ", "again", "._", "\\u\\u\\uNL\\u\\u\\u_", "item_", "._", "site_", "=_", "self_", "._", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cache", "\\u", "mod", "\\u", "id_", "=_", "self_", "._", "site_", "._", "mod", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "cache", "\\u", "obsolete", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "site_", "._", "mod", "\\u", "id_", "!=_", "self_", "._", "cache", "\\u", "mod", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "\\u", "cache", "\\u", "obsolete", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "cache", "d\\u", "items", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "all", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "\\u", "cache", "\\u", "obsolete", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "cache", "d\\u", "items", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "unique_", "(_", "self_", ",_", "filter", "\\u", "fun_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "ds", " ", "a", " ", "unique", " ", "item", " ", "tha", "t", " ", "satisf", "ies", " ", "a", " ", "give", "n", " ", "filter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", "The", " ", "item", " ", "or", " ", "Non", "e", " ", "if", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "filter_", "(_", "filter", "\\u", "fun_", ",_", "self_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "len_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "count_", "<=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "count_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "item_", "(_", "self_", ",_", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "unique_", "(_", "lambda_", "item_", ":_", "item_", "._", "uuid_", "==_", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "item", "\\u", "by", "\\u", "pk_", "(_", "self_", ",_", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "all", "\\u", "dict_", "(_", ")_", "._", "get_", "(_", "pk_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "modif", "y", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "item_", "(_", "self_", ",_", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", "s", " ", "an", " ", "item", " ", "with", " ", "a", " ", "give", "n", " ", "UU", "ID", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", "Tru", "e", " ", "if", " ", "the", " ", "item", " ", "existed", " ", "and", " ", "was", " ", "delete", "d", ",", " ", "Fal", "se", " ", "if", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "=_", "self_", "._", "find", "\\u", "item_", "(_", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", "is_", "None_", ":_", "\\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_", "item_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "do", "\\u", "create", "\\u", "item_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "On", "ly", " ", "to", " ", "be", " ", "call", "ed", " ", "by", " ", "subclasses", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "=_", "self_", "._", "model", "\\u", "class_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "self_", "._", "site_", ",_", "uuid_", "=_", "str_", "(_", "uuid", "gen_", "._", "uuid4_", "(_", ")_", ")_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "site_", "=_", "self_", "._", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collecti", "on", " ", "of", " ", "users", " ", "resource", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "name_", "=_", "'", "user", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "class_", "=_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "User", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "modif", "y", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "\\u", "item_", "(_", "self_", ",_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "new", " ", "User", " ", "object", " ", "for", " ", "the", " ", "site", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "may", " ", "be", " ", "two", " ", "different", " ", "users", " ", "with", " ", "the", " ", "same", " ", "email", " ", "but", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "different", " ", "sites", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Validat", "ion", "Error", " ", "if", " ", "the", " ", "email", " ", "is", " ", "invalid", " ", "or", " ", "if", " ", "a", " ", "site", "\\", "10", ";", " ", " ", " ", " ", "alr", "ead", "y", " ", "has", " ", "a", " ", "user", " ", "with", " ", "suc", "h", " ", "email", ".", "\\", "10", ";", " ", " ", " ", " ", "Limit", "Exce", "eded", " ", "if", " ", "the", " ", "site", " ", "defin", "es", " ", "a", " ", "maxim", "um", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "users", " ", "and", " ", "addin", "g", " ", "a", " ", "new", " ", "one", " ", "wou", "ld", " ", "exceed", " ", "this", " ", "number", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users", "\\u", "limit_", "=_", "self_", "._", "site_", "._", "users", "\\u", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "users", "\\u", "limit_", "is_", "not_", "None_", "and_", "self_", "._", "count_", "(_", ")_", ">=_", "users", "\\u", "limit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Limit", "Exce", "eded", "_", "(_", "'", "User", "s", " ", "limit", " ", "exceed", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "encode", "d\\u", "email_", "=_", "\\u", "encode", "\\u", "email_", "(_", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "encode", "d\\u", "email_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "email", " ", "format", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "find", "\\u", "item", "\\u", "by", "\\u", "email_", "(_", "encode", "d\\u", "email_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "User", " ", "alr", "ead", "y", " ", "exist", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dj", "ang", "o", " ", "1.8", " ", "correct", "ly", " ", "sets", " ", "last", "\\u", "login", " ", "field", " ", "to", " ", "NULL", " ", "for", " ", "newl", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "created", " ", "users", ".", " ", "Earl", "ier", " ", "Dj", "ang", "o", " ", "version", "s", " ", "set", " ", "this", " ", "field", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "date", "\\u", "joine", "d", " ", "and", " ", "had", " ", "a", " ", "'", "not", " ", "NULL", "'", " ", "constraint", " ", "on", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "field", ".", " ", "For", " ", "compatibility", " ", "with", " ", "old", " ", "databa", "ses", ",", " ", "old", " ", "behavior", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "preserved", ",", " ", "last", "\\u", "login", " ", "is", " ", "init", "ally", " ", "set", " ", "to", " ", "a", " ", "date", " ", "whe", "n", " ", "user", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "created", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "do", "\\u", "create", "\\u", "item_", "(_", "email_", "=_", "encode", "d\\u", "email_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "login_", "=_", "timezone_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "item", "\\u", "by", "\\u", "email_", "(_", "self_", ",_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encode", "d\\u", "email_", "=_", "\\u", "encode", "\\u", "email_", "(_", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "encode", "d\\u", "email_", "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_", "return_", "self_", "._", "get", "\\u", "unique_", "(_", "lambda_", "user_", ":_", "user_", "._", "email_", "==_", "encode", "d\\u", "email_", ")_", "\\u\\u\\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_", "Locat", "ion", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collecti", "on", " ", "of", " ", "location", "s", " ", "resource", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Can", " ", "be", " ", "safe", "ly", " ", "rise", "n", " ", "to", " ", "what", "ever", " ", "value", " ", "is", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "PATH", "\\u", "LEN", "\\u", "LIMIT_", "=_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "The", "se", " ", "shou", "ld", " ", "rat", "her", " ", "als", "o", " ", "be", " ", "all", " ", "caps", "._", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "name_", "=_", "'", "location", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "class_", "=_", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "update", "\\u", "cache_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Locat", "ion", "s", "Collection_", ",_", "self_", ")_", "._", "update", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Retrieve", "s", " ", "permissi", "ons", " ", "for", " ", "all", " ", "location", "s", " ", "of", " ", "the", " ", "site", " ", "with", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "single", " ", "query", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "cache", "d\\u", "permissions_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "Permission_", "._", "objects_", "._", "filter_", "(_", "site_", "=_", "self_", "._", "site_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "cache", "d\\u", "permissions_", "._", "setdefault_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "http", "\\u", "location", "\\u", "id_", ",_", "{_", "}_", ")_", "[_", "p_", "._", "user", "\\u", "id_", "]_", "=_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\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", "permissions_", "(_", "self_", ",_", "location", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "permissi", "ons", " ", "for", " ", "a", " ", "give", "n", " ", "location", " ", "of", " ", "the", " ", "site", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "cache", "\\u", "obsolete", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "cache", "d\\u", "permissions_", "._", "get_", "(_", "location", "\\u", "id_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "modif", "y", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "\\u", "item_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "new", " ", "Locat", "ion", " ", "object", " ", "for", " ", "the", " ", "site", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "location", " ", "path", " ", "shou", "ld", " ", "be", " ", "canonical", " ", "and", " ", "shou", "ld", " ", "not", " ", "contain", "\\", "10", ";", " ", " ", " ", " ", "part", "s", " ", "tha", "t", " ", "are", " ", "not", " ", "used", " ", "for", " ", "access", " ", "control", " ", "(", "query", ",", " ", "fragment", ",", "\\", "10", ";", " ", " ", " ", " ", "parameter", "s", ").", " ", "Locat", "ion", " ", "shou", "ld", " ", "not", " ", "contain", " ", "non", "-", "ascii", " ", "character", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Validat", "ion", "Error", " ", "if", " ", "the", " ", "path", " ", "is", " ", "invalid", " ", "or", " ", "if", " ", "a", " ", "site", "\\", "10", ";", " ", " ", " ", " ", "alr", "ead", "y", " ", "has", " ", "a", " ", "location", " ", "with", " ", "suc", "h", " ", "path", ".", "\\", "10", ";", " ", " ", " ", " ", "Limit", "Exce", "eded", " ", "if", " ", "the", " ", "site", " ", "defin", "es", " ", "a", " ", "maxim", "um", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "location", "s", " ", "and", " ", "addin", "g", " ", "a", " ", "new", " ", "one", " ", "wou", "ld", " ", "exceed", " ", "this", " ", "number", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "location", "s", "\\u", "limit_", "=_", "self_", "._", "site_", "._", "location", "s", "\\u", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "location", "s", "\\u", "limit_", "is_", "not_", "None_", "and_", "self_", "._", "count_", "(_", ")_", ">=_", "location", "s", "\\u", "limit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Limit", "Exce", "eded", "_", "(_", "'", "Locat", "ion", "s", " ", "limit", " ", "exceed", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "url", "\\u", "utils_", "._", "is", "\\u", "canonical", "_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Path", " ", "shou", "ld", " ", "be", " ", "abs", "olute", " ", "and", " ", "normali", "zed", " ", "(", "startin", "g", " ", "with", " ", "/", " ", "'_", "'", "with", "out", " ", "/../", " ", "or", " ", "/.", "/", " ", "or", " ", "//", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "path_", ")_", ">_", "self_", "._", "PATH", "\\u", "LEN", "\\u", "LIMIT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Path", " ", "too", " ", "long", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "url", "\\u", "utils_", "._", "contain", "s", "\\u", "fragment_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Path", " ", "shou", "ld", " ", "not", " ", "contain", " ", "fragment", " ", "('", "#'", " ", "part", ").\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "url", "\\u", "utils_", "._", "contain", "s", "\\u", "query_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Path", " ", "shou", "ld", " ", "not", " ", "contain", " ", "query", " ", "('", "?'", " ", "part", ").\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "url", "\\u", "utils_", "._", "contain", "s", "\\u", "params_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Path", " ", "shou", "ld", " ", "not", " ", "contain", " ", "parameter", "s", " ", "('", ";'", " ", "part", ").\"_", ")_", "\\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 ", " _", "path_", "._", "encode_", "(_", "'", "ascii", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Path", " ", "shou", "ld", " ", "contain", " ", "only", " ", "ascii", " ", "character", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "get", "\\u", "unique_", "(_", "lambda_", "item_", ":_", "item_", "._", "path_", "==_", "path_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Locat", "ion", " ", "alr", "ead", "y", " ", "exist", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "do", "\\u", "create", "\\u", "item_", "(_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "location_", "(_", "self_", ",_", "canonical", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "ds", " ", "a", " ", "location", " ", "tha", "t", " ", "defin", "es", " ", "access", " ", "to", " ", "a", " ", "give", "n", " ", "path", " ", "on", " ", "the", " ", "site", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "canonical", "\\u", "path", ":", " ", "The", " ", "path", " ", "for", " ", "whi", "ch", " ", "matchi", "ng", " ", "location", " ", "is", " ", "searche", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "most", " ", "specific", " ", "location", " ", "with", " ", "path", " ", "matchi", "ng", " ", "a", " ", "give", "n", " ", "path", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "no", " ", "matchi", "ng", " ", "location", " ", "exist", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canonical", "\\u", "path", "\\u", "len_", "=_", "len_", "(_", "canonical", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "est", "\\u", "matche", "d\\u", "location_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "est", "\\u", "matche", "d\\u", "location", "\\u", "len_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "location_", "in_", "self_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prob", "ed", "\\u", "path_", "=_", "location_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob", "ed", "\\u", "path", "\\u", "len_", "=_", "len_", "(_", "prob", "ed", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trail", "ing", "\\u", "slash", "\\u", "index_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prob", "ed", "\\u", "path_", "[_", "prob", "ed", "\\u", "path", "\\u", "len_", "-_", "1_", "]_", "==_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trail", "ing", "\\u", "slash", "\\u", "index_", "=_", "prob", "ed", "\\u", "path", "\\u", "len_", "-_", "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 ", " _", "trail", "ing", "\\u", "slash", "\\u", "index_", "=_", "prob", "ed", "\\u", "path", "\\u", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "canonical", "\\u", "path_", "._", "startswith_", "(_", "prob", "ed", "\\u", "path_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "prob", "ed", "\\u", "path", "\\u", "len_", ">_", "long", "est", "\\u", "matche", "d\\u", "location", "\\u", "len_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "prob", "ed", "\\u", "path", "\\u", "len_", "==_", "canonical", "\\u", "path", "\\u", "len_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "canonical", "\\u", "path_", "[_", "trail", "ing", "\\u", "slash", "\\u", "index_", "]_", "==_", "'/'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long", "est", "\\u", "matche", "d\\u", "location", "\\u", "len_", "=_", "prob", "ed", "\\u", "path", "\\u", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "est", "\\u", "matche", "d\\u", "location_", "=_", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "long", "est", "\\u", "matche", "d\\u", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "open", "\\u", "location", "\\u", "with", "\\u", "login_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "location_", "in_", "self_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "location_", "._", "open", "\\u", "access", "\\u", "grant", "ed_", "(_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "location_", "._", "open", "\\u", "access", "\\u", "require", "s", "\\u", "login_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "open", "\\u", "location_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "location_", "in_", "self_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "location_", "._", "open", "\\u", "access", "\\u", "grant", "ed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Aliase", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item", "\\u", "name_", "=_", "'", "alias", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "class_", "=_", "Alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "RF", "C", " ", "103", "5_", "\\u\\u\\uNL\\u\\u\\u_", "ALIAS", "\\u", "LEN", "\\u", "LIMIT_", "=_", "8_", "+_", "253_", "+_", "6_", "\\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_", "Aliase", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "modif", "y", "\\u", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "\\u", "item_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alias", "es", "\\u", "limit_", "=_", "self_", "._", "site_", "._", "alias", "es", "\\u", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "alias", "es", "\\u", "limit_", "is_", "not_", "None_", "and_", "self_", "._", "count_", "(_", ")_", ">=_", "alias", "es", "\\u", "limit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Limit", "Exce", "eded", "_", "(_", "'", "Aliase", "s", " ", "limit", " ", "exceed", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "url_", ")_", ">_", "self_", "._", "ALIAS", "\\u", "LEN", "\\u", "LIMIT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Ur", "l", " ", "too", " ", "long", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "url_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "valid_", ",_", "error_", ")_", "=_", "url", "\\u", "utils_", "._", "validat", "e\\u", "site", "\\u", "url_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "url", ":", " ", "'_", "+_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "url", "\\u", "utils_", "._", "remove", "\\u", "default", "\\u", "port_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "find", "\\u", "item", "\\u", "by", "\\u", "url_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Ali", "as", " ", "with", " ", "this", " ", "url", " ", "alr", "ead", "y", " ", "exist", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "do", "\\u", "create", "\\u", "item_", "(_", "url_", "=_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aliase", "s", "Collection_", "(_", "Collection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "item", "\\u", "by", "\\u", "url_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "unique_", "(_", "lambda_", "item_", ":_", "item_", "._", "url_", "==_", "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_", "def_", "\\u", "uuid", "2u", "rn_", "(_", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "urn", ":", "uuid", ":'_", "+_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "add", "\\u", "common", "\\u", "attributes_", "(_", "item_", ",_", "site", "\\u", "url_", ",_", "attribute", "s", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Insert", "s", " ", "common", " ", "attribute", "s", " ", "of", " ", "an", " ", "item", " ", "to", " ", "a", " ", "give", "n", " ", "dict", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", " ", "tha", "t", " ", "are", " ", "common", " ", "for", " ", "different", " ", "resource", " ", "types", " ", "are", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "'", "self", "'", " ", "link", " ", "and", " ", "an", " ", "'", "id", "'", " ", "field", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attribute", "s", "\\u", "dict_", "[_", "'", "self", "'_", "]_", "=_", "site", "\\u", "url_", "+_", "item_", "._", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "item_", ",_", "'", "uuid", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attribute", "s", "\\u", "dict_", "[_", "'", "id", "'_", "]_", "=_", "\\u", "uuid", "2u", "rn_", "(_", "item_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "attribute", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find_", "(_", "model", "\\u", "class_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "ds", " ", "a", " ", "single", " ", "item", " ", "satisfy", "ing", " ", "a", " ", "give", "n", " ", "express", "ion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "model", "\\u", "class", ":", " ", "Model", " ", "tha", "t", " ", "manage", "s", " ", "store", "d", " ", "items", ".", "\\", "10", ";", " ", " ", " ", " ", "**", "kwarg", "s", ":", " ", "Filtering", " ", "express", "ion", ",", " ", "at", " ", "most", " ", "one", " ", "element", " ", "can", " ", "satisfy", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "item", " ", "tha", "t", " ", "satisf", "ies", " ", "express", "ion", " ", "or", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "=_", "[_", "item_", "for_", "item_", "in_", "model", "\\u", "class_", "._", "objects_", "._", "filter_", "(_", "**_", "kwargs_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "len_", "(_", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "count_", "<=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "count_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "items_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "encode", "\\u", "email_", "(_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Encode", "s", " ", "and", " ", "validates", " ", "email", " ", "address", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ema", "il", " ", "is", " ", "convert", "ed", " ", "to", " ", "a", " ", "lower", " ", "case", " ", "not", " ", "to", " ", "require", " ", "email", "s", " ", "to", " ", "be", " ", "adde", "d", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "access", " ", "control", " ", "list", " ", "with", " ", "the", " ", "same", " ", "capitaliz", "ation", " ", "tha", "t", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "user", " ", "signs", "-", "in", " ", "with", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encode", "d\\u", "email_", "=_", "email_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "email", "\\u", "valid_", "(_", "encode", "d\\u", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "encode", "d\\u", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
NotImplemented is not an Exception
PaulMcMillan/tasa/tasa/cli.py
[ { "content": "def log():\n parser = _get_argparser()\n parser.description = 'Follow logs from a running tasa system.'\n args = parser.parse_args()\n raise NotImplemented()", "metadata": "root.log", "header": "['module', '___EOS___']", "index": 95 } ]
[ { "span": "NotImplemented(", "start_line": 99, "start_column": 10, "end_line": 99, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Not", "Implemented_", "is_", "not_", "an_", "Exception_", "[SEP]_", "module_", "\\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_", "log_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "\\u", "get", "\\u", "argparser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "description_", "=_", "'", "Follow", " ", "logs", " ", "from", " ", "a", " ", "runn", "ing", " ", "tas", "a", " ", "system", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Implemented_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2 ]
Unused import
ganeti/ganeti/test/py/ganeti.utils.io_unittest-runasroot.py
[ { "content": "#!/usr/bin/python\n#\n\n# Copyright (C) 2006, 2007, 2010, 2011 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\"\"\"Script for testing ganeti.utils.io (tests that require root access)\"\"\"\n\nimport os\nimport tempfile\nimport shutil\nimport errno\nimport grp\nimport pwd\nimport stat\n\nfrom ganeti import constants\nfrom ganeti import utils\nfrom ganeti import compat\nfrom ganeti import errors\n\nimport testutils\n\n\n\n\n\nif __name__ == \"__main__\":\n testutils.GanetiTestProgram()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestWriteFile(testutils.GanetiTestCase):\n\n\n\n\n", "metadata": "root.TestWriteFile", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def setUp(self):\n testutils.GanetiTestCase.setUp(self)\n self.tmpdir = None\n self.tfile = tempfile.NamedTemporaryFile()\n self.did_pre = False\n self.did_post = False\n self.did_write = False", "metadata": "root.TestWriteFile.setUp", "header": "['class', 'TestWriteFile', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def tearDown(self):\n testutils.GanetiTestCase.tearDown(self)\n if self.tmpdir:\n shutil.rmtree(self.tmpdir)", "metadata": "root.TestWriteFile.tearDown", "header": "['class', 'TestWriteFile', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 57 }, { "content": " def testFileUid(self):\n self.tmpdir = tempfile.mkdtemp()\n target = utils.PathJoin(self.tmpdir, \"target\")\n tuid = os.geteuid() + 1\n utils.WriteFile(target, data=\"data\", uid=tuid + 1)\n self.assertFileUid(target, tuid + 1)\n utils.WriteFile(target, data=\"data\", uid=tuid)\n self.assertFileUid(target, tuid)\n utils.WriteFile(target, data=\"data\", uid=tuid + 1,\n keep_perms=utils.KP_IF_EXISTS)\n self.assertFileUid(target, tuid)\n utils.WriteFile(target, data=\"data\", keep_perms=utils.KP_ALWAYS)\n self.assertFileUid(target, tuid)", "metadata": "root.TestWriteFile.testFileUid", "header": "['class', 'TestWriteFile', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def testNewFileUid(self):\n self.tmpdir = tempfile.mkdtemp()\n target = utils.PathJoin(self.tmpdir, \"target\")\n tuid = os.geteuid() + 1\n utils.WriteFile(target, data=\"data\", uid=tuid,\n keep_perms=utils.KP_IF_EXISTS)\n self.assertFileUid(target, tuid)", "metadata": "root.TestWriteFile.testNewFileUid", "header": "['class', 'TestWriteFile', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 76 }, { "content": " def testFileGid(self):\n self.tmpdir = tempfile.mkdtemp()\n target = utils.PathJoin(self.tmpdir, \"target\")\n tgid = os.getegid() + 1\n utils.WriteFile(target, data=\"data\", gid=tgid + 1)\n self.assertFileGid(target, tgid + 1)\n utils.WriteFile(target, data=\"data\", gid=tgid)\n self.assertFileGid(target, tgid)\n utils.WriteFile(target, data=\"data\", gid=tgid + 1,\n keep_perms=utils.KP_IF_EXISTS)\n self.assertFileGid(target, tgid)\n utils.WriteFile(target, data=\"data\", keep_perms=utils.KP_ALWAYS)\n self.assertFileGid(target, tgid)", "metadata": "root.TestWriteFile.testFileGid", "header": "['class', 'TestWriteFile', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 84 }, { "content": " def testNewFileGid(self):\n self.tmpdir = tempfile.mkdtemp()\n target = utils.PathJoin(self.tmpdir, \"target\")\n tgid = os.getegid() + 1\n utils.WriteFile(target, data=\"data\", gid=tgid,\n keep_perms=utils.KP_IF_EXISTS)\n self.assertFileGid(target, tgid)", "metadata": "root.TestWriteFile.testNewFileGid", "header": "['class', 'TestWriteFile', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": "class TestCanRead(testutils.GanetiTestCase):\n\n\n", "metadata": "root.TestCanRead", "header": "['module', '___EOS___']", "index": 106 }, { "content": " def setUp(self):\n testutils.GanetiTestCase.setUp(self)\n self.tmpdir = tempfile.mkdtemp()\n self.confdUid = pwd.getpwnam(constants.CONFD_USER).pw_uid\n self.masterdUid = pwd.getpwnam(constants.MASTERD_USER).pw_uid\n self.masterdGid = grp.getgrnam(constants.MASTERD_GROUP).gr_gid", "metadata": "root.TestCanRead.setUp", "header": "['class', 'TestCanRead', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 107 }, { "content": " def tearDown(self):\n testutils.GanetiTestCase.tearDown(self)\n if self.tmpdir:\n shutil.rmtree(self.tmpdir)", "metadata": "root.TestCanRead.tearDown", "header": "['class', 'TestCanRead', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 114 }, { "content": " def testUserCanRead(self):\n target = utils.PathJoin(self.tmpdir, \"target1\")\n f=open(target, \"w\")\n f.close()\n utils.EnforcePermission(target, 0400, uid=self.confdUid,\n gid=self.masterdGid)\n self.assertTrue(utils.CanRead(constants.CONFD_USER, target))\n if constants.CONFD_USER != constants.MASTERD_USER:\n self.assertFalse(utils.CanRead(constants.MASTERD_USER, target))", "metadata": "root.TestCanRead.testUserCanRead", "header": "['class', 'TestCanRead', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 119 }, { "content": " def testGroupCanRead(self):\n target = utils.PathJoin(self.tmpdir, \"target2\")\n f=open(target, \"w\")\n f.close()\n utils.EnforcePermission(target, 0040, uid=self.confdUid,\n gid=self.masterdGid)\n self.assertFalse(utils.CanRead(constants.CONFD_USER, target))\n if constants.CONFD_USER != constants.MASTERD_USER:\n self.assertTrue(utils.CanRead(constants.MASTERD_USER, target))\n\n utils.EnforcePermission(target, 0040, uid=self.masterdUid+1,\n gid=self.masterdGid)\n self.assertTrue(utils.CanRead(constants.MASTERD_USER, target))", "metadata": "root.TestCanRead.testGroupCanRead", "header": "['class', 'TestCanRead', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 129 } ]
[ { "span": "import errno", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 12 }, { "span": "import stat", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 11 }, { "span": "from ganeti import compat", "start_line": 42, "start_column": 0, "end_line": 42, "end_column": 25 }, { "span": "from ganeti import errors", "start_line": 43, "start_column": 0, "end_line": 43, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", ",", " ", "2007", ",", " ", "2010", ",", " ", "2011", " ", "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_", "\"\"\"", "Script", " ", "for", " ", "testi", "ng", " ", "gane", "ti", ".", "util", "s", ".", "io", " ", "(", "tests", " ", "tha", "t", " ", "require", " ", "root", " ", "access", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "grp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pwd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gane", "ti_", "import_", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "compat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "testutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\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 ", " _", "testutils_", "._", "Gan", "eti", "Test", "Program_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Write", "File_", "(_", "testutils_", "._", "Gan", "eti", "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_", "[SEP]_", "class_", "Test", "Write", "File_", "(_", "testutils_", "._", "Gan", "eti", "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 ", " _", "testutils_", "._", "Gan", "eti", "Test", "Case_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tmpdir_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tfile_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "did", "\\u", "pre_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "did", "\\u", "post_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "did", "\\u", "write_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Write", "File_", "(_", "testutils_", "._", "Gan", "eti", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testutils_", "._", "Gan", "eti", "Test", "Case_", "._", "tear", "Down_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tmpdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "self_", "._", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Write", "File_", "(_", "testutils_", "._", "Gan", "eti", "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", "File", "Ui", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tmpdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "utils_", "._", "Path", "Join_", "(_", "self_", "._", "tmpdir_", ",_", "\"", "target", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tui", "d_", "=_", "os_", "._", "gete", "uid_", "(_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Write", "File_", "(_", "target_", ",_", "data_", "=_", "\"", "data", "\"_", ",_", "uid_", "=_", "tui", "d_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "File", "Ui", "d_", "(_", "target_", ",_", "tui", "d_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Write", "File_", "(_", "target_", ",_", "data_", "=_", "\"", "data", "\"_", ",_", "uid_", "=_", "tui", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "File", "Ui", "d_", "(_", "target_", ",_", "tui", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Write", "File_", "(_", "target_", ",_", "data_", "=_", "\"", "data", "\"_", ",_", "uid_", "=_", "tui", "d_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "perms_", "=_", "utils_", "._", "KP", "\\u", "IF", "\\u", "EXIST", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "File", "Ui", "d_", "(_", "target_", ",_", "tui", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Write", "File_", "(_", "target_", ",_", "data_", "=_", "\"", "data", "\"_", ",_", "keep", "\\u", "perms_", "=_", "utils_", "._", "KP", "\\u", "ALWAYS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "File", "Ui", "d_", "(_", "target_", ",_", "tui", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Write", "File_", "(_", "testutils_", "._", "Gan", "eti", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "New", "File", "Ui", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tmpdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "utils_", "._", "Path", "Join_", "(_", "self_", "._", "tmpdir_", ",_", "\"", "target", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tui", "d_", "=_", "os_", "._", "gete", "uid_", "(_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Write", "File_", "(_", "target_", ",_", "data_", "=_", "\"", "data", "\"_", ",_", "uid_", "=_", "tui", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "perms_", "=_", "utils_", "._", "KP", "\\u", "IF", "\\u", "EXIST", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "File", "Ui", "d_", "(_", "target_", ",_", "tui", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Write", "File_", "(_", "testutils_", "._", "Gan", "eti", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "File", "Gi", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tmpdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "utils_", "._", "Path", "Join_", "(_", "self_", "._", "tmpdir_", ",_", "\"", "target", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tg", "id_", "=_", "os_", "._", "gete", "gid_", "(_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Write", "File_", "(_", "target_", ",_", "data_", "=_", "\"", "data", "\"_", ",_", "gid_", "=_", "tg", "id_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "File", "Gi", "d_", "(_", "target_", ",_", "tg", "id_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Write", "File_", "(_", "target_", ",_", "data_", "=_", "\"", "data", "\"_", ",_", "gid_", "=_", "tg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "File", "Gi", "d_", "(_", "target_", ",_", "tg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Write", "File_", "(_", "target_", ",_", "data_", "=_", "\"", "data", "\"_", ",_", "gid_", "=_", "tg", "id_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "perms_", "=_", "utils_", "._", "KP", "\\u", "IF", "\\u", "EXIST", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "File", "Gi", "d_", "(_", "target_", ",_", "tg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Write", "File_", "(_", "target_", ",_", "data_", "=_", "\"", "data", "\"_", ",_", "keep", "\\u", "perms_", "=_", "utils_", "._", "KP", "\\u", "ALWAYS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "File", "Gi", "d_", "(_", "target_", ",_", "tg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Write", "File_", "(_", "testutils_", "._", "Gan", "eti", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "New", "File", "Gi", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tmpdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "utils_", "._", "Path", "Join_", "(_", "self_", "._", "tmpdir_", ",_", "\"", "target", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tg", "id_", "=_", "os_", "._", "gete", "gid_", "(_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Write", "File_", "(_", "target_", ",_", "data_", "=_", "\"", "data", "\"_", ",_", "gid_", "=_", "tg", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "perms_", "=_", "utils_", "._", "KP", "\\u", "IF", "\\u", "EXIST", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "File", "Gi", "d_", "(_", "target_", ",_", "tg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Can", "Read_", "(_", "testutils_", "._", "Gan", "eti", "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_", "[SEP]_", "class_", "Test", "Can", "Read_", "(_", "testutils_", "._", "Gan", "eti", "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 ", " _", "testutils_", "._", "Gan", "eti", "Test", "Case_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tmpdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "confd", "Ui", "d_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "constants_", "._", "CONF", "D", "\\u", "USER_", ")_", "._", "pw", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "master", "d", "Ui", "d_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "constants_", "._", "MASTER", "D", "\\u", "USER_", ")_", "._", "pw", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "master", "d", "Gi", "d_", "=_", "grp_", "._", "getg", "rnam", "_", "(_", "constants_", "._", "MASTER", "D", "\\u", "GROUP_", ")_", "._", "gr", "\\u", "gid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Can", "Read_", "(_", "testutils_", "._", "Gan", "eti", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testutils_", "._", "Gan", "eti", "Test", "Case_", "._", "tear", "Down_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tmpdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "self_", "._", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Can", "Read_", "(_", "testutils_", "._", "Gan", "eti", "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", "User", "Can", "Read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "utils_", "._", "Path", "Join_", "(_", "self_", "._", "tmpdir_", ",_", "\"", "target", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "target_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Enf", "orce", "Permission_", "(_", "target_", ",_", "0_", "400_", ",_", "uid_", "=_", "self_", "._", "confd", "Ui", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gid_", "=_", "self_", "._", "master", "d", "Gi", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "utils_", "._", "Can", "Read_", "(_", "constants_", "._", "CONF", "D", "\\u", "USER_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "constants_", "._", "CONF", "D", "\\u", "USER_", "!=_", "constants_", "._", "MASTER", "D", "\\u", "USER_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "utils_", "._", "Can", "Read_", "(_", "constants_", "._", "MASTER", "D", "\\u", "USER_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Can", "Read_", "(_", "testutils_", "._", "Gan", "eti", "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", "Group", "Can", "Read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "utils_", "._", "Path", "Join_", "(_", "self_", "._", "tmpdir_", ",_", "\"", "target", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "target_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Enf", "orce", "Permission_", "(_", "target_", ",_", "00_", "40_", ",_", "uid_", "=_", "self_", "._", "confd", "Ui", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gid_", "=_", "self_", "._", "master", "d", "Gi", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "utils_", "._", "Can", "Read_", "(_", "constants_", "._", "CONF", "D", "\\u", "USER_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "constants_", "._", "CONF", "D", "\\u", "USER_", "!=_", "constants_", "._", "MASTER", "D", "\\u", "USER_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "utils_", "._", "Can", "Read_", "(_", "constants_", "._", "MASTER", "D", "\\u", "USER_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "utils_", "._", "Enf", "orce", "Permission_", "(_", "target_", ",_", "00_", "40_", ",_", "uid_", "=_", "self_", "._", "master", "d", "Ui", "d_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gid_", "=_", "self_", "._", "master", "d", "Gi", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "utils_", "._", "Can", "Read_", "(_", "constants_", "._", "MASTER", "D", "\\u", "USER_", ",_", "target_", ")_", ")_", "\\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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ebu/radiodns-plugit/RadioDns-PlugIt/radioepg/actions.py
[ { "content": "# -*- coding: utf-8 -*-\n\n# Utils\nfrom plugit.utils import action, only_orga_member_user, only_orga_admin_user, PlugItRedirect, json_only, PlugItSendFile, addressInNetwork, no_template\n\nfrom models import db, Station, Channel, Show, Ecc, LogEntry, Schedule, GenericServiceFollowingEntry, PictureForEPG\n\nimport urlparse\n\nimport os\nimport sys\nimport time\n\nfrom werkzeug import secure_filename\nfrom flask import abort\n\nfrom PIL import Image\nimport imghdr\n\nimport config\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": "def stations_lists(orga):\n list = {}\n list_json = []\n\n for elem in Station.query.filter_by(orga=orga).order_by(Station.name).all():\n list_json.append(elem.json)\n list[elem.id] = elem\n\n return (list_json, list)", "metadata": "root.stations_lists", "header": "['module', '___EOS___']", "index": 22 }, { "content": "@action(route=\"/radioepg/shows/\", template=\"radioepg/shows/home.html\")\n@only_orga_member_user()\ndef radioepg_shows_home(request):\n \"\"\"Show the list of shows.\"\"\"\n\n (stations_json, stations) = stations_lists(int(request.args.get('ebuio_orgapk')))\n\n if not stations_json:\n return {'nostations': True}\n\n current_station_id = int(request.args.get('station_id', stations_json[0]['id']))\n current_station = stations[current_station_id]\n\n list = []\n\n for elem in current_station.shows.order_by(Show.medium_name).all():\n list.append(elem.json)\n\n saved = request.args.get('saved') == 'yes'\n deleted = request.args.get('deleted') == 'yes'\n\n return {'list': list, 'saved': saved, 'deleted': deleted, 'current_station_id': current_station_id, 'current_station': current_station.json, 'stations': stations_json}", "metadata": "root.radioepg_shows_home", "header": "['module', '___EOS___']", "index": 33 }, { "content": "@action(route=\"/radioepg/shows/edit/<id>\", template=\"radioepg/shows/edit.html\", methods=['POST', 'GET'])\n@only_orga_admin_user()\ndef radioepg_shows_edit(request, id):\n \"\"\"Edit a show.\"\"\"\n\n station_id = request.args.get('station_id')\n\n object = None\n errors = []\n\n if id != '-':\n object = Show.query.filter_by(orga=int(request.args.get('ebuio_orgapk') or request.form.get('ebuio_orgapk')), id=int(id)).first()\n\n if request.method == 'POST':\n\n if not object:\n object = Show(int(request.form.get('ebuio_orgapk')))\n object.station_id = station_id\n\n object.medium_name = request.form.get('medium_name')\n object.long_name = request.form.get('long_name')\n object.description = request.form.get('description')\n object.color = request.form.get('color')\n\n # Check errors\n if object.medium_name == '':\n errors.append(\"Please set a medium name\")\n\n if object.long_name == '':\n errors.append(\"Please set a long name\")\n\n if object.description == '':\n errors.append(\"Please set a description\")\n\n if object.color == '':\n errors.append(\"Please set a color\")\n\n # If no errors, save\n if not errors:\n if not object.id:\n db.session.add(object)\n\n db.session.commit()\n\n return PlugItRedirect('radioepg/shows/?saved=yes')\n\n if object:\n object = object.json\n\n colors = [('Red', '#e41a1c'), ('Blue', '#377eb8'), ('Green', '#4daf4a'), ('Magenta', '#984ea3'), ('Orange', '#ff7f00'), ('Yellow', '#ffff33'), ('Brown', '#a65628'), ('Pink', '#f781bf'), ('Gray', '#999999')]\n return {'object': object, 'colors': colors, 'errors': errors, 'current_station_id': station_id }", "metadata": "root.radioepg_shows_edit", "header": "['module', '___EOS___']", "index": 57 }, { "content": "@action(route=\"/radioepg/shows/delete/<id>\")\n@json_only()\n@only_orga_admin_user()\ndef radioepg_shows_delete(request, id):\n \"\"\"Delete a show.\"\"\"\n\n object = Show.query.filter_by(orga=int(request.args.get('ebuio_orgapk')), id=int(id)).first()\n\n db.session.delete(object)\n db.session.commit()\n\n station_id = request.args.get('station_id')\n\n return PlugItRedirect('radioepg/shows/?deleted=yes&station_id=' + station_id)", "metadata": "root.radioepg_shows_delete", "header": "['module', '___EOS___']", "index": 110 }, { "content": "@action(route=\"/radioepg/schedule/\", template=\"radioepg/schedule/home.html\")\n@only_orga_member_user()\ndef radioepg_schedule_home(request):\n \"\"\"Show the schedule.\"\"\"\n\n (stations_json, stations) = stations_lists(int(request.args.get('ebuio_orgapk')))\n\n if not stations_json:\n return {'nostations': True}\n\n current_station_id = int(request.args.get('station_id', stations_json[0]['id']))\n current_station = stations[current_station_id]\n\n list = []\n\n for elem in current_station.shows.order_by(Show.medium_name).all():\n list.append(elem.json)\n\n return {'shows': list, 'current_station_id': current_station_id, 'current_station': current_station.json, 'stations': stations_json}", "metadata": "root.radioepg_schedule_home", "header": "['module', '___EOS___']", "index": 126 }, { "content": "@action(route=\"/radioepg/schedule/<id>/events\")\n@json_only()\n@only_orga_member_user()\ndef radioepg_schedule_get_events(request, id):\n \"\"\"Show events of a station\"\"\"\n\n object = Station.query.filter_by(orga=int(request.args.get('ebuio_orgapk')), id=int(id)).first()\n\n start_date = int(request.args.get('start'))\n\n list = []\n\n for sche in object.schedules.all():\n list.append(dict(id=sche.id, title=sche.show.medium_name, start=start_date+sche.seconds_from_base, end=start_date+sche.\n seconds_from_base+sche.length*60, allDay=False, color=sche.show.color, textColor='#000'))\n\n return {'list': list}", "metadata": "root.radioepg_schedule_get_events", "header": "['module', '___EOS___']", "index": 147 }, { "content": "@action(route=\"/radioepg/schedule/<id>/create/\")\n@json_only()\n@only_orga_admin_user()\ndef radioepg_schedule_add_events(request, id):\n \"\"\"Add a new event in a station schdule\"\"\"\n\n station = Station.query.filter_by(orga=int(request.args.get('ebuio_orgapk')), id=int(id)).first()\n show = Show.query.filter_by(station_id=station.id, id=int(request.args.get('showPk'))).first()\n\n (hour, minutes) = request.args.get('start').split(':')\n\n sche = Schedule()\n sche.show_id = show.id\n sche.station_id = station.id\n sche.day = request.args.get('timeday')\n sche.start_hour = hour\n sche.start_minute = minutes\n sche.length = 60\n\n db.session.add(sche)\n db.session.commit()\n\n return {}", "metadata": "root.radioepg_schedule_add_events", "header": "['module', '___EOS___']", "index": 166 }, { "content": "@action(route=\"/radioepg/schedule/<id>/resize/\")\n@json_only()\n@only_orga_admin_user()\ndef radioepg_schedule_resize_events(request, id):\n \"\"\"Resize an event\"\"\"\n\n station = Station.query.filter_by(orga=int(request.args.get('ebuio_orgapk')), id=int(id)).first()\n schedule = Schedule.query.filter_by(station_id=station.id, id=int(request.args.get('progPk'))).first()\n\n schedule.length += int(request.args.get('deltaMinutes'))\n db.session.commit()\n\n return {}", "metadata": "root.radioepg_schedule_resize_events", "header": "['module', '___EOS___']", "index": 191 }, { "content": "@action(route=\"/radioepg/schedule/<id>/move/\")\n@json_only()\n@only_orga_admin_user()\ndef radioepg_schedule_move_events(request, id):\n \"\"\"Move an event\"\"\"\n\n station = Station.query.filter_by(orga=int(request.args.get('ebuio_orgapk')), id=int(id)).first()\n schedule = Schedule.query.filter_by(station_id=station.id, id=int(request.args.get('progPk'))).first()\n\n (schedule.start_hour, schedule.start_minute) = request.args.get('newStart').split(':')\n schedule.day += int(request.args.get('deltaDay'))\n db.session.commit()\n\n return {}", "metadata": "root.radioepg_schedule_move_events", "header": "['module', '___EOS___']", "index": 206 }, { "content": "@action(route=\"/radioepg/schedule/<id>/delete/\")\n@json_only()\n@only_orga_admin_user()\ndef radioepg_schedule_delete_events(request, id):\n \"\"\"Delete an event\"\"\"\n\n station = Station.query.filter_by(orga=int(request.args.get('ebuio_orgapk')), id=int(id)).first()\n schedule = Schedule.query.filter_by(station_id=station.id, id=int(request.args.get('progPk'))).first()\n\n db.session.delete(schedule)\n db.session.commit()\n\n return {}", "metadata": "root.radioepg_schedule_delete_events", "header": "['module', '___EOS___']", "index": 222 }, { "content": "@action(route=\"/radioepg/schedule/<id>/xml\", template='radioepg/schedule/xml.html')\n@only_orga_member_user()\n@no_template()\ndef radioepg_schedule_xml(request, id):\n \"\"\"Display Schedule as XML\"\"\"\n\n station = Station.query.filter_by(orga=int(request.args.get('ebuio_orgapk')), id=int(id)).first()\n\n import datetime, time\n\n time_format = '%Y%m%dT%H%M%S'\n\n today = datetime.date.today()\n start_date = datetime.datetime.combine(today - datetime.timedelta(days=today.weekday()), datetime.time())\n end_date = start_date + datetime.timedelta(days=6, hours=23, minutes=59, seconds=59)\n\n list = []\n\n for elem in station.schedules.all():\n elem.start_date = start_date\n list.append(elem.json)\n\n return {'schedules': list, 'start_time': start_date.strftime(time_format), 'end_time': end_date.strftime(time_format)}", "metadata": "root.radioepg_schedule_xml", "header": "['module', '___EOS___']", "index": 237 }, { "content": "@action(route=\"/radioepg/servicefollowing/\", template=\"radioepg/servicefollowing/home.html\")\n@only_orga_member_user()\ndef radioepg_sf_home(request):\n \"\"\"Show the list to manage service following.\"\"\"\n\n (stations_json, stations) = stations_lists(int(request.args.get('ebuio_orgapk')))\n\n if not stations_json:\n return {'nostations': True}\n\n current_station_id = int(request.args.get('station_id', stations_json[0]['id']))\n current_station = stations[current_station_id]\n\n # Build list of entries\n list = []\n\n # Channels\n for elem in current_station.channels.order_by(Channel.name).all():\n list.append(elem.servicefollowingentry.json)\n\n # Custom entries\n for elem in current_station.servicefollowingentries.order_by(GenericServiceFollowingEntry.channel_uri).all():\n list.append(elem.json)\n\n return {'list': list, 'current_station_id': current_station_id, 'current_station': current_station.json, 'stations': stations_json}", "metadata": "root.radioepg_sf_home", "header": "['module', '___EOS___']", "index": 262 }, { "content": "@action(route=\"/radioepg/servicefollowing/edit/<id>\", template=\"radioepg/servicefollowing/edit.html\", methods=['POST', 'GET'])\n@only_orga_admin_user()\ndef radioepg_servicefollowing_edit(request, id):\n \"\"\"Edit a servicefollowing entry.\"\"\"\n\n station_id = request.args.get('station_id')\n\n if not station_id:\n return None\n\n object = None\n errors = []\n\n if id != '-':\n object = GenericServiceFollowingEntry.query.filter_by(id=int(id)).first()\n\n # Check rights\n if object.type == 'ip':\n station_to_test = object.station\n else:\n station_to_test = object.channel.station\n\n if station_to_test.id != int(station_id) or not station_to_test.orga == int(request.args.get('ebuio_orgapk') or request.form.get('ebuio_orgapk')):\n object = None\n\n if request.method == 'POST':\n\n if not object:\n object = GenericServiceFollowingEntry()\n object.station_id = station_id\n\n object.cost = request.form.get('cost')\n object.offset = request.form.get('offset')\n object.mime_type = request.form.get('mime_type')\n\n if object.type == 'ip':\n object.channel_uri = request.form.get('channel_uri')\n\n # Check errors\n if object.type == 'ip' and object.channel_uri == '':\n errors.append(\"You have to set the channel\")\n\n # If no errors, save\n if not errors:\n if not object.id:\n db.session.add(object)\n\n db.session.commit()\n\n return PlugItRedirect('radioepg/servicefollowing/?saved=yes')\n\n if object:\n object = object.json\n\n dab_mime_types = [('audio/mpeg', 'DAB'), ('audio/aacp', 'DAB+')]\n\n return {'object': object, 'dab_mime_types': dab_mime_types, 'errors': errors, 'current_station_id': station_id}", "metadata": "root.radioepg_servicefollowing_edit", "header": "['module', '___EOS___']", "index": 289 }, { "content": "@action(route=\"/radioepg/servicefollowing/delete/<id>\")\n@json_only()\n@only_orga_admin_user()\ndef radioepg_servicefollowing_delete(request, id):\n \"\"\"Delete a servicefollowing entry.\"\"\"\n\n object = GenericServiceFollowingEntry.query.filter_by(id=int(id)).first()\n\n station_id = request.args.get('station_id')\n\n if not station_id:\n return None\n\n # Check rights before delete\n if object.type == 'ip':\n if object.station.id == int(station_id):\n if object.station.orga == int(request.args.get('ebuio_orgapk') or request.form.get('ebuio_orgapk')):\n db.session.delete(object)\n db.session.commit()\n\n return PlugItRedirect('radioepg/servicefollowing/?deleted=yes&station_id=' + station_id)", "metadata": "root.radioepg_servicefollowing_delete", "header": "['module', '___EOS___']", "index": 348 }, { "content": "@action(route=\"/radioepg/servicefollowing/turn/<mode>/<id>\")\n@json_only()\n@only_orga_admin_user()\ndef radioepg_servicefollowing_trun(request, mode, id):\n \"\"\"Turn on or off a servicefollowing entry.\"\"\"\n\n object = GenericServiceFollowingEntry.query.filter_by(id=int(id)).first()\n\n station_id = request.args.get('station_id')\n\n if not station_id:\n return None\n\n if object.type == 'ip':\n station_to_test = object.station\n else:\n station_to_test = object.channel.station\n\n # Check rights before change\n if station_to_test.id == int(station_id):\n if station_to_test.orga == int(request.args.get('ebuio_orgapk') or request.form.get('ebuio_orgapk')):\n object.active = mode == 'on'\n db.session.commit()\n\n return PlugItRedirect('radioepg/servicefollowing/?turned=' + mode + '&station_id=' + station_id)", "metadata": "root.radioepg_servicefollowing_trun", "header": "['module', '___EOS___']", "index": 371 }, { "content": "@action(route=\"/radioepg/gallery/\", template=\"radioepg/gallery/home.html\")\n@only_orga_member_user()\ndef radioep_gallery_home(request):\n \"\"\"Show the list of pictures.\"\"\"\n\n list = []\n\n for elem in PictureForEPG.query.filter_by(orga = int(request.args.get('ebuio_orgapk'))).order_by(PictureForEPG.name).all():\n list.append(elem.json)\n\n saved = request.args.get('saved') == 'yes'\n deleted = request.args.get('deleted') == 'yes'\n\n return {'list': list, 'saved': saved, 'deleted': deleted}", "metadata": "root.radioep_gallery_home", "header": "['module', '___EOS___']", "index": 398 }, { "content": "@action(route=\"/radioepg/gallery/edit/<id>\", template=\"radioepg/gallery/edit.html\", methods=['POST', 'GET'])\n@only_orga_admin_user()\ndef radioep_gallery_edit(request, id):\n \"\"\"Edit a channel.\"\"\"\n\n object = None\n errors = []\n\n if id != '-':\n object = PictureForEPG.query.filter_by(orga=int(request.args.get('ebuio_orgapk') or request.form.get('ebuio_orgapk')), id=int(id)).first()\n\n if request.method == 'POST':\n\n if not object:\n object = PictureForEPG(int(request.form.get('ebuio_orgapk')))\n\n object.name = request.form.get('name')\n object.radiotext = request.form.get('radiotext')\n object.radiolink = request.form.get('radiolink')\n\n def add_unique_postfix(fn):\n \"\"\"__source__ = 'http://code.activestate.com/recipes/577200-make-unique-file-name/'\"\"\"\n if not os.path.exists(fn):\n return fn\n\n path, name = os.path.split(fn)\n name, ext = os.path.splitext(name)\n\n make_fn = lambda i: os.path.join(path, '%s(%d)%s' % (name, i, ext))\n\n for i in xrange(2, sys.maxint):\n uni_fn = make_fn(i)\n if not os.path.exists(uni_fn):\n return uni_fn\n\n return None\n\n file = request.files['file']\n if file:\n filename = secure_filename(file.filename)\n full_path = add_unique_postfix('media/uploads/radioepg/gallery/' + filename)\n file.save(full_path)\n if object.filename:\n try:\n os.unlink(object.filename)\n except:\n pass\n object.filename = full_path\n\n # Check errors\n if object.name == '':\n errors.append(\"Please set a name\")\n\n if object.filename == '' or object.filename is None:\n errors.append(\"Please upload an image\")\n else:\n\n if imghdr.what(object.filename) not in ['jpeg', 'png']:\n errors.append(\"Image is not an png or jpeg image\")\n os.unlink(object.filename)\n object.filename = None\n\n # If no errors, save\n if not errors:\n\n if not object.id:\n db.session.add(object)\n else:\n import glob\n for f in glob.glob('media/uploads/radioepg/cache/*_L%s.png' % (object.id,)):\n os.unlink(f)\n\n db.session.commit()\n\n return PlugItRedirect('radioepg/gallery/?saved=yes')\n\n if object:\n object = object.json\n\n return {'object': object, 'errors': errors}", "metadata": "root.radioep_gallery_edit", "header": "['module', '___EOS___']", "index": 414 }, { "content": "@action(route=\"/radioepg/gallery/delete/<id>\")\n@json_only()\n@only_orga_admin_user()\ndef radioep_gallery_delete(request, id):\n \"\"\"Delete a picture.\"\"\"\n\n object = PictureForEPG.query.filter_by(orga=int(request.args.get('ebuio_orgapk')), id=int(id)).first()\n\n os.unlink(object.filename)\n\n import glob\n for f in glob.glob('media/uploads/radioepg/cache/*_L%s.png' % (object.id,)):\n os.unlink(f)\n\n db.session.delete(object)\n db.session.commit()\n\n return PlugItRedirect('radioepg/gallery/?deleted=yes')", "metadata": "root.radioep_gallery_delete", "header": "['module', '___EOS___']", "index": 496 }, { "content": "@action(route=\"/radioepg/logos/\", template=\"radioepg/logos/logos.html\")\n@only_orga_member_user()\ndef radioepg_logos_home(request):\n \"\"\"Show the list of stations to edit current logo.\"\"\"\n\n list = []\n\n for elem in Station.query.filter(Station.orga==int(request.args.get('ebuio_orgapk'))).order_by(Station.name).all():\n list.append(elem.json)\n\n pictures = []\n\n for elem in PictureForEPG.query.filter_by(orga=int(request.args.get('ebuio_orgapk'))).order_by(PictureForEPG.name).all():\n pictures.append(elem.json)\n\n return {'list': list, 'pictures': pictures}", "metadata": "root.radioepg_logos_home", "header": "['module', '___EOS___']", "index": 516 }, { "content": "@action(route=\"/radioepg/logos/set/<id>/<pictureid>\")\n@only_orga_admin_user()\n@json_only()\ndef radioepg_logos_set(request, id, pictureid):\n \"\"\"Set a default value for a station\"\"\"\n\n object = Station.query.filter(Station.id == int(id), Station.orga==int(request.args.get('ebuio_orgapk'))).first()\n\n picture = PictureForEPG.query.filter_by(orga=int(request.args.get('ebuio_orgapk')), id=int(pictureid)).first()\n\n if picture:\n object.epg_picture_id = picture.id\n else:\n object.epg_picture_id = None\n\n db.session.commit()\n\n return {}", "metadata": "root.radioepg_logos_set", "header": "['module', '___EOS___']", "index": 534 } ]
[ { "span": "from plugit.utils import action, only_orga_member_user, only_orga_admin_user, PlugItRedirect, json_only, PlugItSendFile, addressInNetwork, no_template", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 150 }, { "span": "from models import db, Station, Channel, Show, Ecc, LogEntry, Schedule, GenericServiceFollowingEntry, PictureForEPG", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 115 }, { "span": "import urlparse", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 15 }, { "span": "import time", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 11 }, { "span": "from flask import abort", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 23 }, { "span": "from PIL import Image", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 21 }, { "span": "import config", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Utils_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "plug", "it_", "._", "utils_", "import_", "action_", ",_", "only", "\\u", "orga", "\\u", "member", "\\u", "user_", ",_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", ",_", "Plug", "It", "Redirect_", ",_", "json", "\\u", "only_", ",_", "Plug", "It", "Sen", "d", "File_", ",_", "address", "In", "Network_", ",_", "no", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "models_", "import_", "db_", ",_", "Station_", ",_", "Channel_", ",_", "Show_", ",_", "Ec", "c_", ",_", "Log", "Entry_", ",_", "Schedule_", ",_", "Gene", "ric", "Service", "Follow", "ing", "Entry_", ",_", "Picture", "For", "EPG", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "werkzeug_", "import_", "secure", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "img", "hdr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "station", "s", "\\u", "lists_", "(_", "orga", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "json_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "elem_", "in_", "Station_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "orga", "_", ")_", "._", "order", "\\u", "by_", "(_", "Station_", "._", "name_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "json_", "._", "append_", "(_", "elem_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list_", "[_", "elem_", "._", "id_", "]_", "=_", "elem_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "list", "\\u", "json_", ",_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "show", "s", "/\"_", ",_", "template_", "=_", "\"", "radio", "epg", "/", "show", "s", "/", "home", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "member", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "show", "s", "\\u", "home_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "the", " ", "list", " ", "of", " ", "show", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "station", "s", "\\u", "json_", ",_", "stations_", ")_", "=_", "station", "s", "\\u", "lists_", "(_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "station", "s", "\\u", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "nost", "ation", "s", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "station", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "station", "\\u", "id", "'_", ",_", "station", "s", "\\u", "json_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "station_", "=_", "stations_", "[_", "current", "\\u", "station", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "elem_", "in_", "current", "\\u", "station_", "._", "shows_", "._", "order", "\\u", "by_", "(_", "Show_", "._", "medium", "\\u", "name_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "._", "append_", "(_", "elem_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "saved", "'_", ")_", "==_", "'", "ye", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deleted_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "delete", "d", "'_", ")_", "==_", "'", "ye", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "list", "'_", ":_", "list_", ",_", "'", "saved", "'_", ":_", "saved_", ",_", "'", "delete", "d", "'_", ":_", "deleted_", ",_", "'", "current", "\\u", "station", "\\u", "id", "'_", ":_", "current", "\\u", "station", "\\u", "id_", ",_", "'", "current", "\\u", "station", "'_", ":_", "current", "\\u", "station_", "._", "json_", ",_", "'", "station", "s", "'_", ":_", "station", "s", "\\u", "json_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "show", "s", "/", "edit", "/", "<", "id", ">\"_", ",_", "template_", "=_", "\"", "radio", "epg", "/", "show", "s", "/", "edit", ".", "html", "\"_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", ",_", "'", "GET", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "show", "s", "\\u", "edit_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Edit", " ", "a", " ", "show", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "station", "\\u", "id_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "station", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "id_", "!=_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Show_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", "or_", "request_", "._", "form_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "object_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Show_", "(_", "int_", "(_", "request_", "._", "form_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "._", "station", "\\u", "id_", "=_", "station", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object_", "._", "medium", "\\u", "name_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "medium", "\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "._", "long", "\\u", "name_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "long", "\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "._", "description_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "description", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "._", "color_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "color", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "object_", "._", "medium", "\\u", "name_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "Ple", "ase", " ", "set", " ", "a", " ", "medium", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", "._", "long", "\\u", "name_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "Ple", "ase", " ", "set", " ", "a", " ", "long", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", "._", "description_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "Ple", "ase", " ", "set", " ", "a", " ", "description", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", "._", "color_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "Ple", "ase", " ", "set", " ", "a", " ", "color", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "error", "s", ",", " ", "save_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "object_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "session_", "._", "add_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Plug", "It", "Redirect_", "(_", "'", "radio", "epg", "/", "show", "s", "/?", "saved", "=", "ye", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "object_", "._", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "colors_", "=_", "[_", "(_", "'", "Red", "'_", ",_", "'#", "e4", "1a", "1c", "'_", ")_", ",_", "(_", "'", "Blue", "'_", ",_", "'#", "377", "eb", "8", "'_", ")_", ",_", "(_", "'", "Green", "'_", ",_", "'#", "4d", "af", "4a", "'_", ")_", ",_", "(_", "'", "Mag", "enta", "'_", ",_", "'#", "984", "ea", "3", "'_", ")_", ",_", "(_", "'", "Ora", "nge", "'_", ",_", "'#", "ff", "7f", "00", "'_", ")_", ",_", "(_", "'", "Ye", "llow", "'_", ",_", "'#", "fff", "f3", "3", "'_", ")_", ",_", "(_", "'", "Brown", "'_", ",_", "'#", "a6", "562", "8", "'_", ")_", ",_", "(_", "'", "Pin", "k", "'_", ",_", "'#", "f7", "8", "1b", "f", "'_", ")_", ",_", "(_", "'", "Gra", "y", "'_", ",_", "'#", "999999", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "object", "'_", ":_", "object_", ",_", "'", "colors", "'_", ":_", "colors_", ",_", "'", "error", "s", "'_", ":_", "errors_", ",_", "'", "current", "\\u", "station", "\\u", "id", "'_", ":_", "station", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "show", "s", "/", "delete", "/", "<", "id", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "json", "\\u", "only_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "show", "s", "\\u", "delete_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "a", " ", "show", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object_", "=_", "Show_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "session_", "._", "delete_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "station", "\\u", "id_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "station", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Plug", "It", "Redirect_", "(_", "'", "radio", "epg", "/", "show", "s", "/?", "delete", "d", "=", "ye", "s", "&", "station", "\\u", "id", "='_", "+_", "station", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "schedule", "/\"_", ",_", "template_", "=_", "\"", "radio", "epg", "/", "schedule", "/", "home", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "member", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "schedule", "\\u", "home_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "the", " ", "schedule", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "station", "s", "\\u", "json_", ",_", "stations_", ")_", "=_", "station", "s", "\\u", "lists_", "(_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "station", "s", "\\u", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "nost", "ation", "s", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "station", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "station", "\\u", "id", "'_", ",_", "station", "s", "\\u", "json_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "station_", "=_", "stations_", "[_", "current", "\\u", "station", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "elem_", "in_", "current", "\\u", "station_", "._", "shows_", "._", "order", "\\u", "by_", "(_", "Show_", "._", "medium", "\\u", "name_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "._", "append_", "(_", "elem_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "show", "s", "'_", ":_", "list_", ",_", "'", "current", "\\u", "station", "\\u", "id", "'_", ":_", "current", "\\u", "station", "\\u", "id_", ",_", "'", "current", "\\u", "station", "'_", ":_", "current", "\\u", "station_", "._", "json_", ",_", "'", "station", "s", "'_", ":_", "station", "s", "\\u", "json_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "schedule", "/", "<", "id", ">/", "events", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "json", "\\u", "only_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "member", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "schedule", "\\u", "get", "\\u", "events_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "events", " ", "of", " ", "a", " ", "station", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object_", "=_", "Station_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "start", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "sche", "_", "in_", "object_", "._", "schedules", "_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "._", "append_", "(_", "dict_", "(_", "id_", "=_", "sche", "_", "._", "id_", ",_", "title_", "=_", "sche", "_", "._", "show_", "._", "medium", "\\u", "name_", ",_", "start_", "=_", "start", "\\u", "date_", "+_", "sche", "_", "._", "second", "s", "\\u", "from", "\\u", "base_", ",_", "end_", "=_", "start", "\\u", "date_", "+_", "sche", "_", "._", "\\u\\u\\uNL\\u\\u\\u_", "second", "s", "\\u", "from", "\\u", "base_", "+_", "sche", "_", "._", "length_", "*_", "60_", ",_", "all", "Day_", "=_", "False_", ",_", "color_", "=_", "sche", "_", "._", "show_", "._", "color_", ",_", "text", "Color_", "=_", "'#", "000", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "list", "'_", ":_", "list_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "schedule", "/", "<", "id", ">/", "create", "/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "json", "\\u", "only_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "schedule", "\\u", "add", "\\u", "events_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "a", " ", "new", " ", "event", " ", "in", " ", "a", " ", "station", " ", "sch", "dul", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "station_", "=_", "Station_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show_", "=_", "Show_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "station", "\\u", "id_", "=_", "station_", "._", "id_", ",_", "id_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "show", "Pk", "'_", ")_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "hour_", ",_", "minutes_", ")_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "start", "'_", ")_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sche", "_", "=_", "Schedule_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sche", "_", "._", "show", "\\u", "id_", "=_", "show_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sche", "_", "._", "station", "\\u", "id_", "=_", "station_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sche", "_", "._", "day_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "timed", "ay", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sche", "_", "._", "start", "\\u", "hour_", "=_", "hour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sche", "_", "._", "start", "\\u", "minute_", "=_", "minutes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sche", "_", "._", "length_", "=_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "session_", "._", "add_", "(_", "sche", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "schedule", "/", "<", "id", ">/", "resiz", "e", "/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "json", "\\u", "only_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "schedule", "\\u", "resiz", "e\\u", "events_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Resize", " ", "an", " ", "event", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "station_", "=_", "Station_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "Schedule_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "station", "\\u", "id_", "=_", "station_", "._", "id_", ",_", "id_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "prog", "Pk", "'_", ")_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "schedule_", "._", "length_", "+=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "delta", "Minute", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "schedule", "/", "<", "id", ">/", "move", "/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "json", "\\u", "only_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "schedule", "\\u", "move", "\\u", "events_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Move", " ", "an", " ", "event", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "station_", "=_", "Station_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "Schedule_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "station", "\\u", "id_", "=_", "station_", "._", "id_", ",_", "id_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "prog", "Pk", "'_", ")_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "schedule_", "._", "start", "\\u", "hour_", ",_", "schedule_", "._", "start", "\\u", "minute_", ")_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "new", "Start", "'_", ")_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "day_", "+=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "delta", "Day", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "schedule", "/", "<", "id", ">/", "delete", "/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "json", "\\u", "only_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "schedule", "\\u", "delete", "\\u", "events_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "an", " ", "event", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "station_", "=_", "Station_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "Schedule_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "station", "\\u", "id_", "=_", "station_", "._", "id_", ",_", "id_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "prog", "Pk", "'_", ")_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "session_", "._", "delete_", "(_", "schedule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "schedule", "/", "<", "id", ">/", "xml", "\"_", ",_", "template_", "=_", "'", "radio", "epg", "/", "schedule", "/", "xml", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "member", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "no", "\\u", "template_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "schedule", "\\u", "xml_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Display", " ", "Schedule", " ", "as", " ", "XML", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "station_", "=_", "Station_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "format_", "=_", "'%", "Y", "%", "m", "%", "d", "T", "%", "H", "%", "M", "%", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "today_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "date_", "=_", "datetime_", "._", "datetime_", "._", "combine_", "(_", "today_", "-_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "today_", "._", "weekday_", "(_", ")_", ")_", ",_", "datetime_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "date_", "=_", "start", "\\u", "date_", "+_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "6_", ",_", "hours_", "=_", "23_", ",_", "minutes_", "=_", "59_", ",_", "seconds_", "=_", "59_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "elem_", "in_", "station_", "._", "schedules", "_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elem_", "._", "start", "\\u", "date_", "=_", "start", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list_", "._", "append_", "(_", "elem_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "schedules", "'_", ":_", "list_", ",_", "'", "start", "\\u", "time", "'_", ":_", "start", "\\u", "date_", "._", "strftime_", "(_", "time", "\\u", "format_", ")_", ",_", "'", "end", "\\u", "time", "'_", ":_", "end", "\\u", "date_", "._", "strftime_", "(_", "time", "\\u", "format_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "service", "follow", "ing", "/\"_", ",_", "template_", "=_", "\"", "radio", "epg", "/", "service", "follow", "ing", "/", "home", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "member", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "sf", "\\u", "home_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "the", " ", "list", " ", "to", " ", "manage", " ", "service", " ", "follow", "ing", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "station", "s", "\\u", "json_", ",_", "stations_", ")_", "=_", "station", "s", "\\u", "lists_", "(_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "station", "s", "\\u", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "nost", "ation", "s", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "station", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "station", "\\u", "id", "'_", ",_", "station", "s", "\\u", "json_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "station_", "=_", "stations_", "[_", "current", "\\u", "station", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "list", " ", "of", " ", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Channels_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "elem_", "in_", "current", "\\u", "station_", "._", "channels_", "._", "order", "\\u", "by_", "(_", "Channel_", "._", "name_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "._", "append_", "(_", "elem_", "._", "service", "follow", "inge", "ntry_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "elem_", "in_", "current", "\\u", "station_", "._", "service", "follow", "inge", "ntri", "es_", "._", "order", "\\u", "by_", "(_", "Gene", "ric", "Service", "Follow", "ing", "Entry_", "._", "channel", "\\u", "uri_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "._", "append_", "(_", "elem_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "list", "'_", ":_", "list_", ",_", "'", "current", "\\u", "station", "\\u", "id", "'_", ":_", "current", "\\u", "station", "\\u", "id_", ",_", "'", "current", "\\u", "station", "'_", ":_", "current", "\\u", "station_", "._", "json_", ",_", "'", "station", "s", "'_", ":_", "station", "s", "\\u", "json_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "service", "follow", "ing", "/", "edit", "/", "<", "id", ">\"_", ",_", "template_", "=_", "\"", "radio", "epg", "/", "service", "follow", "ing", "/", "edit", ".", "html", "\"_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", ",_", "'", "GET", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "service", "follow", "ing", "\\u", "edit_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Edit", " ", "a", " ", "service", "follow", "ing", " ", "entry", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "station", "\\u", "id_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "station", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "station", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "id_", "!=_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Gene", "ric", "Service", "Follow", "ing", "Entry_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "object_", "._", "type_", "==_", "'", "ip", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "station", "\\u", "to", "\\u", "test_", "=_", "object_", "._", "station_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "station", "\\u", "to", "\\u", "test_", "=_", "object_", "._", "channel_", "._", "station_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "station", "\\u", "to", "\\u", "test_", "._", "id_", "!=_", "int_", "(_", "station", "\\u", "id_", ")_", "or_", "not_", "station", "\\u", "to", "\\u", "test_", "._", "orga", "_", "==_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", "or_", "request_", "._", "form_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "object_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Gene", "ric", "Service", "Follow", "ing", "Entry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "._", "station", "\\u", "id_", "=_", "station", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object_", "._", "cost_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "cost", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "._", "offset_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "offset", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "._", "mime", "\\u", "type_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "mime", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "object_", "._", "type_", "==_", "'", "ip", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "._", "channel", "\\u", "uri_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "channel", "\\u", "uri", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", "._", "type_", "==_", "'", "ip", "'_", "and_", "object_", "._", "channel", "\\u", "uri_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "You", " ", "have", " ", "to", " ", "set", " ", "the", " ", "channel", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "error", "s", ",", " ", "save_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "object_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "session_", "._", "add_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Plug", "It", "Redirect_", "(_", "'", "radio", "epg", "/", "service", "follow", "ing", "/?", "saved", "=", "ye", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "object_", "._", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dab", "\\u", "mime", "\\u", "types_", "=_", "[_", "(_", "'", "audio", "/", "mpeg", "'_", ",_", "'", "DA", "B", "'_", ")_", ",_", "(_", "'", "audio", "/", "aac", "p", "'_", ",_", "'", "DA", "B", "+'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "object", "'_", ":_", "object_", ",_", "'", "dab", "\\u", "mime", "\\u", "types", "'_", ":_", "dab", "\\u", "mime", "\\u", "types_", ",_", "'", "error", "s", "'_", ":_", "errors_", ",_", "'", "current", "\\u", "station", "\\u", "id", "'_", ":_", "station", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "service", "follow", "ing", "/", "delete", "/", "<", "id", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "json", "\\u", "only_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "service", "follow", "ing", "\\u", "delete_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "a", " ", "service", "follow", "ing", " ", "entry", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object_", "=_", "Gene", "ric", "Service", "Follow", "ing", "Entry_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "station", "\\u", "id_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "station", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "station", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "rights", " ", "bef", "ore", " ", "delete_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", "._", "type_", "==_", "'", "ip", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "object_", "._", "station_", "._", "id_", "==_", "int_", "(_", "station", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "object_", "._", "station_", "._", "orga", "_", "==_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", "or_", "request_", "._", "form_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "session_", "._", "delete_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Plug", "It", "Redirect_", "(_", "'", "radio", "epg", "/", "service", "follow", "ing", "/?", "delete", "d", "=", "ye", "s", "&", "station", "\\u", "id", "='_", "+_", "station", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "service", "follow", "ing", "/", "turn", "/", "<", "mode", ">/", "<", "id", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "json", "\\u", "only_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "service", "follow", "ing", "\\u", "tru", "n_", "(_", "request_", ",_", "mode_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Turn", " ", "on", " ", "or", " ", "off", " ", "a", " ", "service", "follow", "ing", " ", "entry", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object_", "=_", "Gene", "ric", "Service", "Follow", "ing", "Entry_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "station", "\\u", "id_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "station", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "station", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", "._", "type_", "==_", "'", "ip", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "station", "\\u", "to", "\\u", "test_", "=_", "object_", "._", "station_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "station", "\\u", "to", "\\u", "test_", "=_", "object_", "._", "channel_", "._", "station_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "rights", " ", "bef", "ore", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "station", "\\u", "to", "\\u", "test_", "._", "id_", "==_", "int_", "(_", "station", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "station", "\\u", "to", "\\u", "test_", "._", "orga", "_", "==_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", "or_", "request_", "._", "form_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "._", "active_", "=_", "mode_", "==_", "'", "on", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\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_", "Plug", "It", "Redirect_", "(_", "'", "radio", "epg", "/", "service", "follow", "ing", "/?", "turn", "ed", "='_", "+_", "mode_", "+_", "'&", "station", "\\u", "id", "='_", "+_", "station", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "gallery", "/\"_", ",_", "template_", "=_", "\"", "radio", "epg", "/", "gallery", "/", "home", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "member", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "ep", "\\u", "gallery", "\\u", "home_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "the", " ", "list", " ", "of", " ", "pictures", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "elem_", "in_", "Picture", "For", "EPG", "_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "._", "order", "\\u", "by_", "(_", "Picture", "For", "EPG", "_", "._", "name_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "._", "append_", "(_", "elem_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "saved", "'_", ")_", "==_", "'", "ye", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deleted_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "delete", "d", "'_", ")_", "==_", "'", "ye", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "list", "'_", ":_", "list_", ",_", "'", "saved", "'_", ":_", "saved_", ",_", "'", "delete", "d", "'_", ":_", "deleted_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "gallery", "/", "edit", "/", "<", "id", ">\"_", ",_", "template_", "=_", "\"", "radio", "epg", "/", "gallery", "/", "edit", ".", "html", "\"_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", ",_", "'", "GET", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "ep", "\\u", "gallery", "\\u", "edit_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Edit", " ", "a", " ", "channel", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "id_", "!=_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Picture", "For", "EPG", "_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", "or_", "request_", "._", "form_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "object_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Picture", "For", "EPG", "_", "(_", "int_", "(_", "request_", "._", "form_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object_", "._", "name_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "._", "radio", "text_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "radio", "text", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "._", "radio", "link_", "=_", "request_", "._", "form_", "._", "get_", "(_", "'", "radio", "link", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "\\u", "unique", "\\u", "postfix_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\u\\u", "source", "\\u\\u", " ", "=", " ", "'", "http", "://", "code", ".", "active", "state", ".", "com", "/", "recip", "es", "/", "577", "200", "-", "make", "-", "unique", "-", "file", "-", "name", "/'", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", ",_", "name_", "=_", "os_", "._", "path_", "._", "split_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", ",_", "ext_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "fn_", "=_", "lambda_", "i_", ":_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'%", "s", "(%", "d", ")%", "s", "'_", "%_", "(_", "name_", ",_", "i_", ",_", "ext_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "2_", ",_", "sys_", "._", "maxint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uni", "\\u", "fn_", "=_", "make", "\\u", "fn_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "uni", "\\u", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "uni", "\\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_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file_", "=_", "request_", "._", "files_", "[_", "'", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "secure", "\\u", "filename_", "(_", "file_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "path_", "=_", "add", "\\u", "unique", "\\u", "postfix_", "(_", "'", "media", "/", "uploads", "/", "radio", "epg", "/", "gallery", "/'_", "+_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "save_", "(_", "full", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "object_", "._", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "unlink_", "(_", "object_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object_", "._", "filename_", "=_", "full", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", "._", "name_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "Ple", "ase", " ", "set", " ", "a", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", "._", "filename_", "==_", "''_", "or_", "object_", "._", "filename_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "Ple", "ase", " ", "upload", " ", "an", " ", "image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "img", "hdr_", "._", "what_", "(_", "object_", "._", "filename_", ")_", "not_", "in_", "[_", "'", "jpeg", "'_", ",_", "'", "png", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "Image", " ", "is", " ", "not", " ", "an", " ", "png", " ", "or", " ", "jpeg", " ", "image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "object_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "._", "filename_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "error", "s", ",", " ", "save_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "object_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "session_", "._", "add_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "glob_", "._", "glob_", "(_", "'", "media", "/", "uploads", "/", "radio", "epg", "/", "cache", "/*", "\\u", "L", "%", "s", ".", "png", "'_", "%_", "(_", "object_", "._", "id_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "unlink_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Plug", "It", "Redirect_", "(_", "'", "radio", "epg", "/", "gallery", "/?", "saved", "=", "ye", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "object_", "._", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "object", "'_", ":_", "object_", ",_", "'", "error", "s", "'_", ":_", "errors_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "gallery", "/", "delete", "/", "<", "id", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "json", "\\u", "only_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "ep", "\\u", "gallery", "\\u", "delete_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "a", " ", "pic", "ture", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object_", "=_", "Picture", "For", "EPG", "_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "object_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "glob_", "._", "glob_", "(_", "'", "media", "/", "uploads", "/", "radio", "epg", "/", "cache", "/*", "\\u", "L", "%", "s", ".", "png", "'_", "%_", "(_", "object_", "._", "id_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "unlink_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "session_", "._", "delete_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Plug", "It", "Redirect_", "(_", "'", "radio", "epg", "/", "gallery", "/?", "delete", "d", "=", "ye", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "logo", "s", "/\"_", ",_", "template_", "=_", "\"", "radio", "epg", "/", "logo", "s", "/", "logo", "s", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "member", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "logo", "s", "\\u", "home_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "the", " ", "list", " ", "of", " ", "station", "s", " ", "to", " ", "edit", " ", "current", " ", "logo", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "elem_", "in_", "Station_", "._", "query_", "._", "filter_", "(_", "Station_", "._", "orga", "_", "==_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "._", "order", "\\u", "by_", "(_", "Station_", "._", "name_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list_", "._", "append_", "(_", "elem_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pictures", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "elem_", "in_", "Picture", "For", "EPG", "_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "._", "order", "\\u", "by_", "(_", "Picture", "For", "EPG", "_", "._", "name_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pictures", "_", "._", "append_", "(_", "elem_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "list", "'_", ":_", "list_", ",_", "'", "pictures", "'_", ":_", "pictures", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "radio", "epg", "/", "logo", "s", "/", "set", "/", "<", "id", ">/", "<", "pic", "ture", "id", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "json", "\\u", "only_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radio", "epg", "\\u", "logo", "s", "\\u", "set_", "(_", "request_", ",_", "id_", ",_", "pic", "ture", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "a", " ", "default", " ", "value", " ", "for", " ", "a", " ", "station", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object_", "=_", "Station_", "._", "query_", "._", "filter_", "(_", "Station_", "._", "id_", "==_", "int_", "(_", "id_", ")_", ",_", "Station_", "._", "orga", "_", "==_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "picture_", "=_", "Picture", "For", "EPG", "_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ",_", "id_", "=_", "int_", "(_", "pic", "ture", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "picture_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "._", "epg", "\\u", "pic", "ture", "\\u", "id_", "=_", "picture_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "._", "epg", "\\u", "pic", "ture", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "}_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
moraes/tipfy/tests/gae_sharded_counter_test.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\n Tests for tipfy.appengine.sharded_counter\n\"\"\"\nfrom datetime import datetime, timedelta\nimport unittest\n\nfrom google.appengine.api import memcache\nfrom google.appengine.ext import db\n\nfrom tipfy import Request, RequestHandler, Tipfy\nfrom tipfy.app import local\nfrom tipfy.appengine.sharded_counter import Counter\n\nimport test_utils\n\n\n\n\nif __name__ == '__main__':\n test_utils.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCounter(test_utils.BaseTestCase):\n\n", "metadata": "root.TestCounter", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def setUp(self):\n app = Tipfy()\n local.request = Request.from_values()\n local.request.app = app\n test_utils.BaseTestCase.setUp(self)", "metadata": "root.TestCounter.setUp", "header": "['class', 'TestCounter', '(', 'test_utils', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 18 }, { "content": " def test_counter(self):\n # Build a new counter that uses the unique key name 'hits'.\n hits = Counter('hits')\n\n self.assertEqual(hits.count, 0)\n\n # Increment by 1.\n hits.increment()\n # Increment by 10.\n hits.increment(10)\n # Decrement by 3.\n hits.increment(-3)\n # This is the current count.\n self.assertEqual(hits.count, 8)\n\n # Forces fetching a non-cached count of all shards.\n self.assertEqual(hits.get_count(nocache=True), 8)\n\n # Set the counter to an arbitrary value.\n hits.count = 6\n\n self.assertEqual(hits.get_count(nocache=True), 6)", "metadata": "root.TestCounter.test_counter", "header": "['class', 'TestCounter', '(', 'test_utils', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 24 }, { "content": " def test_cache(self):\n # Build a new counter that uses the unique key name 'hits'.\n hits = Counter('hits')\n\n self.assertEqual(hits.count, 0)\n\n # Increment by 1.\n hits.increment()\n # Increment by 10.\n hits.increment(10)\n # Decrement by 3.\n hits.increment(-3)\n # This is the current count.\n self.assertEqual(hits.count, 8)\n\n # Forces fetching a non-cached count of all shards.\n self.assertEqual(hits.get_count(nocache=True), 8)\n\n # Set the counter to an arbitrary value.\n hits.delete()\n\n self.assertEqual(hits.get_count(), 8)\n self.assertEqual(hits.get_count(nocache=True), 0)\n\n hits.memcached.delete_count()\n\n self.assertEqual(hits.get_count(), 0)", "metadata": "root.TestCounter.test_cache", "header": "['class', 'TestCounter', '(', 'test_utils', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 47 } ]
[ { "span": "import unittest", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 15 }, { "span": "from google.appengine.api import memcache", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 41 }, { "span": "from google.appengine.ext import db", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 35 }, { "span": "from tipfy import Request, RequestHandler, Tipfy", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "tip", "fy", ".", "appengine", ".", "shard", "ed", "\\u", "counter", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "memcache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tip", "fy_", "import_", "Request_", ",_", "Request", "Handler_", ",_", "Tip", "fy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tip", "fy_", "._", "app_", "import_", "local_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tip", "fy_", "._", "appengine_", "._", "shard", "ed", "\\u", "counter_", "import_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "test\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "test\\u", "utils_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Counter_", "(_", "test\\u", "utils_", "._", "Base", "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_", "[SEP]_", "class_", "Test", "Counter_", "(_", "test\\u", "utils_", "._", "Base", "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 ", " _", "app_", "=_", "Tip", "fy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "._", "request_", "=_", "Request_", "._", "from", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "._", "request_", "._", "app_", "=_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "utils_", "._", "Base", "Test", "Case_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Counter_", "(_", "test\\u", "utils_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "counter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Build", " ", "a", " ", "new", " ", "counter", " ", "tha", "t", " ", "use", "s", " ", "the", " ", "unique", " ", "key", " ", "name", " ", "'", "hits", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hits_", "=_", "Counter_", "(_", "'", "hits", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hits_", "._", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Increment", " ", "by", " ", "1._", "\\u\\u\\uNL\\u\\u\\u_", "hits_", "._", "increment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Increment", " ", "by", " ", "10._", "\\u\\u\\uNL\\u\\u\\u_", "hits_", "._", "increment_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Decre", "ment", " ", "by", " ", "3._", "\\u\\u\\uNL\\u\\u\\u_", "hits_", "._", "increment_", "(_", "-_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "current", " ", "count", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hits_", "._", "count_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Force", "s", " ", "fetch", "ing", " ", "a", " ", "non", "-", "cache", "d", " ", "count", " ", "of", " ", "all", " ", "shard", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hits_", "._", "get", "\\u", "count_", "(_", "noca", "che_", "=_", "True_", ")_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "counter", " ", "to", " ", "an", " ", "arbitra", "ry", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "hits_", "._", "count_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hits_", "._", "get", "\\u", "count_", "(_", "noca", "che_", "=_", "True_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Counter_", "(_", "test\\u", "utils_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cache_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Build", " ", "a", " ", "new", " ", "counter", " ", "tha", "t", " ", "use", "s", " ", "the", " ", "unique", " ", "key", " ", "name", " ", "'", "hits", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hits_", "=_", "Counter_", "(_", "'", "hits", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hits_", "._", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Increment", " ", "by", " ", "1._", "\\u\\u\\uNL\\u\\u\\u_", "hits_", "._", "increment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Increment", " ", "by", " ", "10._", "\\u\\u\\uNL\\u\\u\\u_", "hits_", "._", "increment_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Decre", "ment", " ", "by", " ", "3._", "\\u\\u\\uNL\\u\\u\\u_", "hits_", "._", "increment_", "(_", "-_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "current", " ", "count", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hits_", "._", "count_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Force", "s", " ", "fetch", "ing", " ", "a", " ", "non", "-", "cache", "d", " ", "count", " ", "of", " ", "all", " ", "shard", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hits_", "._", "get", "\\u", "count_", "(_", "noca", "che_", "=_", "True_", ")_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "counter", " ", "to", " ", "an", " ", "arbitra", "ry", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "hits_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hits_", "._", "get", "\\u", "count_", "(_", ")_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hits_", "._", "get", "\\u", "count_", "(_", "noca", "che_", "=_", "True_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hits_", "._", "memcached", "_", "._", "delete", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hits_", "._", "get", "\\u", "count_", "(_", ")_", ",_", "0_", ")_", "\\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, 0, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 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 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
OpenMDAO/OpenMDAO/openmdao/solvers/newton.py
[ { "content": " def solve(self, params, unknowns, resids, system, metadata=None):\n \"\"\" Solves the system using a Netwon's Method.\n\n Args\n ----\n params : `VecWrapper`\n `VecWrapper` containing parameters. (p)\n\n unknowns : `VecWrapper`\n `VecWrapper` containing outputs and states. (u)\n\n resids : `VecWrapper`\n `VecWrapper` containing residuals. (r)\n\n system : `System`\n Parent `System` object.\n\n metadata : dict, optional\n Dictionary containing execution metadata (e.g. iteration coordinate).\n \"\"\"\n\n atol = self.options['atol']\n rtol = self.options['rtol']\n maxiter = self.options['maxiter']\n alpha = self.options['alpha']\n\n # Metadata setup\n self.iter_count = 0\n local_meta = create_local_meta(metadata, system.pathname)\n system.ln_solver.local_meta = local_meta\n update_local_meta(local_meta, (self.iter_count, 0))\n\n # Perform an initial run to propagate srcs to targets.\n system.children_solve_nonlinear(local_meta)\n system.apply_nonlinear(params, unknowns, resids)\n\n f_norm = resids.norm()\n f_norm0 = f_norm\n\n if self.options['iprint'] > 0:\n self.print_norm(self.print_name, system.pathname, 0, f_norm,\n f_norm0)\n\n arg = system.drmat[None]\n result = system.dumat[None]\n\n while self.iter_count < maxiter and f_norm > atol and \\\n f_norm/f_norm0 > rtol:\n\n # Linearize Model with partial derivatives\n system._sys_linearize(params, unknowns, resids, total_derivs=False)\n\n # Calculate direction to take step\n arg.vec[:] = -resids.vec\n with system._dircontext:\n system.solve_linear(system.dumat, system.drmat,\n [None], mode='fwd', solver=self.ln_solver)\n\n # Step in that direction,\n self.iter_count += 1\n f_norm = self.line_search.solve(params, unknowns, resids, system,\n self, alpha, f_norm0, metadata)\n\n # Need to make sure the whole workflow is executed at the final\n # point, not just evaluated.\n #self.iter_count += 1\n #update_local_meta(local_meta, (self.iter_count, 0))\n #system.children_solve_nonlinear(local_meta)\n\n if self.iter_count >= maxiter or isnan(f_norm):\n msg = 'FAILED to converge after %d iterations' % self.iter_count\n fail = True\n else:\n fail = False\n\n if self.options['iprint'] > 0:\n\n if not fail:\n msg = 'converged'\n\n self.print_norm(self.print_name, system.pathname, self.iter_count,\n f_norm, f_norm0, msg=msg)\n\n if fail and self.options['err_on_maxiter']:\n raise AnalysisError(\"Solve in '%s': Newton %s\" % (system.pathname,\n msg))", "metadata": "root.Newton.solve", "header": "['class', 'Newton', '(', 'NonLinearSolver', ')', ':', '___EOS___']", "index": 77 } ]
[ { "span": "result ", "start_line": 121, "start_column": 8, "end_line": 121, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "New", "ton_", "(_", "Non", "Linea", "r", "Solver_", ")_", ":_", "\\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_", "solve_", "(_", "self_", ",_", "params_", ",_", "unknown", "s_", ",_", "resid", "s_", ",_", "system_", ",_", "metadata_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Solve", "s", " ", "the", " ", "system", " ", "usi", "ng", " ", "a", " ", "Net", "won", "'", "s", " ", "Meth", "od", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", "\\", "10", ";", " ", " ", " ", " ", "----", "\\", "10", ";", " ", " ", " ", " ", "params", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "parameter", "s", ".", " ", "(", "p", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "unknown", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "output", "s", " ", "and", " ", "state", "s", ".", " ", "(", "u", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "resid", "s", " ", ":", " ", "`", "Vec", "Wrapper", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "Vec", "Wrapper", "`", " ", "contain", "ing", " ", "residu", "als", ".", " ", "(", "r", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "system", " ", ":", " ", "`", "System", "`", "\\", "10", ";", " ", " ", " ", " ", "Parent", " ", "`", "System", "`", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "metadata", " ", ":", " ", "dict", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Dict", "ionar", "y", " ", "contain", "ing", " ", "executi", "on", " ", "metadata", " ", "(", "e", ".", "g", ".", " ", "iterati", "on", " ", "coordinate", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "atol_", "=_", "self_", "._", "options_", "[_", "'", "atol", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rtol_", "=_", "self_", "._", "options_", "[_", "'", "rto", "l", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxiter_", "=_", "self_", "._", "options_", "[_", "'", "maxi", "ter", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "=_", "self_", "._", "options_", "[_", "'", "alpha", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Meta", "data", " ", "setup_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "iter", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "meta_", "=_", "create", "\\u", "local", "\\u", "meta_", "(_", "metadata_", ",_", "system_", "._", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system_", "._", "ln", "\\u", "solver_", "._", "local", "\\u", "meta_", "=_", "local", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "local", "\\u", "meta_", "(_", "local", "\\u", "meta_", ",_", "(_", "self_", "._", "iter", "\\u", "count_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Perform", " ", "an", " ", "initial", " ", "run", " ", "to", " ", "propagate", " ", "srcs", " ", "to", " ", "target", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "system_", "._", "child", "ren", "\\u", "solve", "\\u", "nonlinear", "_", "(_", "local", "\\u", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system_", "._", "appl", "y", "\\u", "nonlinear", "_", "(_", "params_", ",_", "unknown", "s_", ",_", "resid", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f", "\\u", "norm_", "=_", "resid", "s_", "._", "norm_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "norm", "0_", "=_", "f", "\\u", "norm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "options_", "[_", "'", "ipr", "int", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "print", "\\u", "norm_", "(_", "self_", "._", "print", "\\u", "name_", ",_", "system_", "._", "pathname_", ",_", "0_", ",_", "f", "\\u", "norm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f", "\\u", "norm", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arg_", "=_", "system_", "._", "dr", "mat_", "[_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "system_", "._", "dum", "at_", "[_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "self_", "._", "iter", "\\u", "count_", "<_", "maxiter_", "and_", "f", "\\u", "norm_", ">_", "atol_", "and_", "f", "\\u", "norm_", "/_", "f", "\\u", "norm", "0_", ">_", "rtol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Linea", "rize", " ", "Model", " ", "with", " ", "partial", " ", "derivatives", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "._", "\\u", "sys", "\\u", "linear", "ize_", "(_", "params_", ",_", "unknown", "s_", ",_", "resid", "s_", ",_", "total", "\\u", "deriv", "s_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "direction", " ", "to", " ", "take", " ", "step_", "\\u\\u\\uNL\\u\\u\\u_", "arg_", "._", "vec_", "[_", ":_", "]_", "=_", "-_", "resid", "s_", "._", "vec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "system_", "._", "\\u", "dir", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "system_", "._", "solve", "\\u", "linear_", "(_", "system_", "._", "dum", "at_", ",_", "system_", "._", "dr", "mat_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "None_", "]_", ",_", "mode_", "=_", "'", "fw", "d", "'_", ",_", "solver_", "=_", "self_", "._", "ln", "\\u", "solver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Step", " ", "in", " ", "tha", "t", " ", "direction", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "iter", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "norm_", "=_", "self_", "._", "line", "\\u", "search_", "._", "solve_", "(_", "params_", ",_", "unknown", "s_", ",_", "resid", "s_", ",_", "system_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "alpha_", ",_", "f", "\\u", "norm", "0_", ",_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "make", " ", "sure", " ", "the", " ", "whole", " ", "workf", "low", " ", "is", " ", "executed", " ", "at", " ", "the", " ", "final_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "point", ",", " ", "not", " ", "just", " ", "evaluate", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "iter", "\\u", "count", " ", "+=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "update", "\\u", "local", "\\u", "meta", "(", "local", "\\u", "meta", ",", " ", "(", "self", ".", "iter", "\\u", "count", ",", " ", "0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "system", ".", "child", "ren", "\\u", "solve", "\\u", "nonlinear", "(", "local", "\\u", "meta", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "iter", "\\u", "count_", ">=_", "maxiter_", "or_", "isnan_", "(_", "f", "\\u", "norm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "FAIL", "ED", " ", "to", " ", "converg", "e", " ", "after", " ", "%", "d", " ", "iterati", "ons", "'_", "%_", "self_", "._", "iter", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail_", "=_", "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 ", " _", "fail_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "options_", "[_", "'", "ipr", "int", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "fail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "converged", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "print", "\\u", "norm_", "(_", "self_", "._", "print", "\\u", "name_", ",_", "system_", "._", "pathname_", ",_", "self_", "._", "iter", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f", "\\u", "norm_", ",_", "f", "\\u", "norm", "0_", ",_", "msg_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fail_", "and_", "self_", "._", "options_", "[_", "'", "err", "\\u", "on", "\\u", "maxi", "ter", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Analy", "sis", "Error_", "(_", "\"", "Solve", " ", "in", " ", "'%", "s", "':", " ", "New", "ton", " ", "%", "s", "\"_", "%_", "(_", "system_", "._", "pathname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", ")_", ")_", "\\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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-qt/opentumblrqt/opentumblr-qt-client.py
[ { "content": " def __init__(self,parent=None):\n super(Main_widget, self).__init__(parent)\n self.setupUi() \n #Conectar eventos\n self.connect(self.bt_login, QtCore.SIGNAL('clicked()'),self.OnAuthTumblr) \n self.rememberme.setCheckState(QtCore.Qt.Unchecked) \n \n if(QtCore.QFile().exists(QtCore.QDir().homePath() + '/.opentumblr')):\n file = open(QtCore.QDir().homePath() + '/.opentumblr','r')\n self.le_mail.setText(file.readline()) \n self.le_url.setText(file.readline())", "metadata": "root.Cliente_Opentumblr.__init__", "header": "['class', 'Cliente_Opentumblr', '(', 'Main_widget', ')', ':', '___EOS___']", "index": 18 } ]
[ { "span": "super(Main_widget, self).", "start_line": 19, "start_column": 8, "end_line": 19, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Client", "e\\u", "Open", "tum", "bl", "r_", "(_", "Main", "\\u", "widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Main", "\\u", "widget_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "Ui_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Cone", "cta", "r", " ", "evento", "s_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "connect_", "(_", "self_", "._", "bt", "\\u", "login_", ",_", "Qt", "Core_", "._", "SIGNAL_", "(_", "'", "click", "ed", "()'_", ")_", ",_", "self_", "._", "On", "Auth", "Tu", "mbl", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "remember", "me_", "._", "set", "Check", "State_", "(_", "Qt", "Core_", "._", "Qt_", "._", "Unc", "heck", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "Qt", "Core_", "._", "QF", "ile_", "(_", ")_", "._", "exists_", "(_", "Qt", "Core_", "._", "QD", "ir_", "(_", ")_", "._", "home", "Path_", "(_", ")_", "+_", "'/.", "opent", "umb", "lr", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "open_", "(_", "Qt", "Core_", "._", "QD", "ir_", "(_", ")_", "._", "home", "Path_", "(_", ")_", "+_", "'/.", "opent", "umb", "lr", "'_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "le", "\\u", "mail_", "._", "set", "Text_", "(_", "file_", "._", "readline_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "le", "\\u", "url_", "._", "set", "Text_", "(_", "file_", "._", "readline_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
amolenaar/roles/example.py
[ { "content": "\"\"\"\nClassic roles example, using the roles module.\n\nBased on the DCI PoC of David Byers and Serge Beaumont\n(see: http://groups.google.com/group/object-composition/files)\n\"\"\"\n\nfrom roles import RoleType, clone\nfrom roles.context import context\n\n\n\n\n\n\n\n\n\n\nsrc = Account(1000)\ndst = Account(0)\n\nt = TransferMoney(src, dst)\nt.perform_transfer(100)\n\nprint src, src.balance\nassert src.balance == 900\nprint dst, dst.balance\nassert dst.balance == 100\n\n\n# vim:sw=4:et:ai\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Account(object):\n\n\n", "metadata": "root.Account", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self, amount):\n print \"Creating a new account with balance of \" + str(amount)\n self.balance = amount\n super(Account, self).__init__()", "metadata": "root.Account.__init__", "header": "['class', 'Account', '(', 'object', ')', ':', '___EOS___']", "index": 14 }, { "content": " def withdraw(self, amount):\n print \"Withdraw \" + str(amount) + \" from \" + str(self)\n self.balance -= amount", "metadata": "root.Account.withdraw", "header": "['class', 'Account', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": " def deposit(self, amount):\n print \"Deposit \" + str(amount) + \" in \" + str(self)\n self.balance += amount", "metadata": "root.Account.deposit", "header": "['class', 'Account', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": "class MoneySource(object):\n __metaclass__ = RoleType\n", "metadata": "root.MoneySource", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def transfer(self, amount):\n if self.balance >= amount:\n self.withdraw(amount)\n context.sink.receive(amount)", "metadata": "root.MoneySource.transfer", "header": "['class', 'MoneySource', '(', 'object', ')', ':', '___EOS___']", "index": 31 }, { "content": "class MoneySink(object):\n __metaclass__ = RoleType\n", "metadata": "root.MoneySink", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def receive(self, amount):\n self.deposit(amount)", "metadata": "root.MoneySink.receive", "header": "['class', 'MoneySink', '(', 'object', ')', ':', '___EOS___']", "index": 39 }, { "content": "class TransferMoney(object):\n\n", "metadata": "root.TransferMoney", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def __init__(self, source, sink):\n self.source = source\n self.sink = sink\n self.transfer_context = context(self,\n source=MoneySource,\n sink=MoneySink)", "metadata": "root.TransferMoney.__init__", "header": "['class', 'TransferMoney', '(', 'object', ')', ':', '___EOS___']", "index": 45 }, { "content": " def perform_transfer(self, amount):\n with self.transfer_context as ctx:\n ctx.source.transfer(amount)\n\n print \"We can still access the original attributes\", self.sink.balance\n print \"Is it still an Account?\", isinstance(self.sink, Account)\n assert isinstance(self.sink, Account)\n print \"Object equality?\", dst == self.sink", "metadata": "root.TransferMoney.perform_transfer", "header": "['class', 'TransferMoney', '(', 'object', ')', ':', '___EOS___']", "index": 52 } ]
[ { "span": "from roles import RoleType, clone", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Classic", " ", "role", "s", " ", "example", ",", " ", "usi", "ng", " ", "the", " ", "role", "s", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", "Base", "d", " ", "on", " ", "the", " ", "DC", "I", " ", "Po", "C", " ", "of", " ", "Dav", "id", " ", "By", "ers", " ", "and", " ", "Ser", "ge", " ", "Bea", "um", "ont", "\\", "10", ";", "(", "see", ":", " ", "http", "://", "group", "s", ".", "google", ".", "com", "/", "group", "/", "object", "-", "composition", "/", "files", ")", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "roles_", "import_", "Ro", "le", "Type_", ",_", "clone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "roles_", "._", "context_", "import_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "src_", "=_", "Account_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst_", "=_", "Account_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "Transfer", "Mone", "y_", "(_", "src_", ",_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "perform", "\\u", "transfer_", "(_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "src_", ",_", "src_", "._", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "src_", "._", "balance_", "==_", "900_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "dst_", ",_", "dst_", "._", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dst_", "._", "balance_", "==_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "sw", "=", "4", ":", "et", ":", "ai_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Account_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Account_", "(_", "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_", ",_", "amount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Creat", "ing", " ", "a", " ", "new", " ", "account", " ", "with", " ", "balance", " ", "of", " ", "\"_", "+_", "str_", "(_", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "balance_", "=_", "amount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Account_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Account_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "withdraw", "_", "(_", "self_", ",_", "amount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "With", "draw", " ", "\"_", "+_", "str_", "(_", "amount_", ")_", "+_", "\"", " ", "from", " ", "\"_", "+_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "balance_", "-=_", "amount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Account_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deposit_", "(_", "self_", ",_", "amount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Deposit", " ", "\"_", "+_", "str_", "(_", "amount_", ")_", "+_", "\"", " ", "in", " ", "\"_", "+_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "balance_", "+=_", "amount_", "\\u\\u\\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_", "Mone", "y", "Source_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "metaclass\\u\\u_", "=_", "Ro", "le", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mone", "y", "Source_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transfer_", "(_", "self_", ",_", "amount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "balance_", ">=_", "amount_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "withdraw", "_", "(_", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "sink_", "._", "receive_", "(_", "amount_", ")_", "\\u\\u\\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_", "Mone", "y", "Sink_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "metaclass\\u\\u_", "=_", "Ro", "le", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mone", "y", "Sink_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "receive_", "(_", "self_", ",_", "amount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "deposit_", "(_", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Transfer", "Mone", "y_", "(_", "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_", "Transfer", "Mone", "y_", "(_", "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_", ",_", "source_", ",_", "sink_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "source_", "=_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink_", "=_", "sink_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transfer", "\\u", "context_", "=_", "context_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "Mone", "y", "Source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sink_", "=_", "Mone", "y", "Sink_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Transfer", "Mone", "y_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform", "\\u", "transfer_", "(_", "self_", ",_", "amount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "transfer", "\\u", "context_", "as_", "ctx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "source_", "._", "transfer_", "(_", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "We", " ", "can", " ", "still", " ", "access", " ", "the", " ", "original", " ", "attribute", "s", "\"_", ",_", "self_", "._", "sink_", "._", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Is", " ", "it", " ", "still", " ", "an", " ", "Account", "?\"_", ",_", "isinstance_", "(_", "self_", "._", "sink_", ",_", "Account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "self_", "._", "sink_", ",_", "Account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Object", " ", "equality", "?\"_", ",_", "dst_", "==_", "self_", "._", "sink_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
azoft-dev-team/imagrium/env/Lib/logging/config.py
[ { "content": "# Copyright 2001-2010 by Vinay Sajip. All Rights Reserved.\n#\n# Permission to use, copy, modify, and distribute this software and its\n# documentation for any purpose and without fee is hereby granted,\n# provided that the above copyright notice appear in all copies and that\n# both that copyright notice and this permission notice appear in\n# supporting documentation, and that the name of Vinay Sajip\n# not be used in advertising or publicity pertaining to distribution\n# of the software without specific, written prior permission.\n# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\n# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL\n# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\n# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER\n# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\n# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n\"\"\"\nConfiguration functions for the logging package for Python. The core package\nis based on PEP 282 and comments thereto in comp.lang.python, and influenced\nby Apache's log4j system.\n\nCopyright (C) 2001-2010 Vinay Sajip. All Rights Reserved.\n\nTo use, simply 'import logging' and log away!\n\"\"\"\n\nimport sys, logging, logging.handlers, socket, struct, os, traceback, re\nimport types, cStringIO\n\ntry:\n import thread\n import threading\nexcept ImportError:\n thread = None\n\nfrom SocketServer import ThreadingTCPServer, StreamRequestHandler\n\n\nDEFAULT_LOGGING_CONFIG_PORT = 9030\n\nif sys.platform == \"win32\":\n RESET_ERROR = 10054 #WSAECONNRESET\nelse:\n RESET_ERROR = 104 #ECONNRESET\n\n#\n# The following code implements a socket listener for on-the-fly\n# reconfiguration of logging.\n#\n# _listener holds the server object doing the listening\n_listener = None\n\n\n\n\n\n\n\n\n\n\n\n\n\nIDENTIFIER = re.compile('^[a-z_][a-z0-9_]*$', re.I)\n\n\n\n\n# The ConvertingXXX classes are wrappers around standard Python containers,\n# and they serve to convert any suitable values in the container. The\n# conversion converts base dicts, lists and tuples to their wrapped\n# equivalents, whereas strings which match a conversion format are converted\n# appropriately.\n#\n# Each wrapper should have a configurator attribute holding the actual\n# configurator to use for conversion.\n\n\n\n\n\n\ndictConfigClass = DictConfigurator\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def fileConfig(fname, defaults=None, disable_existing_loggers=True):\n \"\"\"\n Read the logging configuration from a ConfigParser-format file.\n\n This can be called several times from an application, allowing an end user\n the ability to select from various pre-canned configurations (if the\n developer provides a mechanism to present the choices and load the chosen\n configuration).\n \"\"\"\n import ConfigParser\n\n cp = ConfigParser.ConfigParser(defaults)\n if hasattr(fname, 'readline'):\n cp.readfp(fname)\n else:\n cp.read(fname)\n\n formatters = _create_formatters(cp)\n\n # critical section\n logging._acquireLock()\n try:\n logging._handlers.clear()\n del logging._handlerList[:]\n # Handlers add themselves to logging._handlers\n handlers = _install_handlers(cp, formatters)\n _install_loggers(cp, handlers, disable_existing_loggers)\n finally:\n logging._releaseLock()", "metadata": "root.fileConfig", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def _resolve(name):\n \"\"\"Resolve a dotted name to a global object.\"\"\"\n name = name.split('.')\n used = name.pop(0)\n found = __import__(used)\n for n in name:\n used = used + '.' + n\n try:\n found = getattr(found, n)\n except AttributeError:\n __import__(used)\n found = getattr(found, n)\n return found", "metadata": "root._resolve", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def _strip_spaces(alist):\n return map(lambda x: x.strip(), alist)", "metadata": "root._strip_spaces", "header": "['module', '___EOS___']", "index": 97 }, { "content": "def _encoded(s):\n return s if isinstance(s, str) else s.encode('utf-8')", "metadata": "root._encoded", "header": "['module', '___EOS___']", "index": 100 }, { "content": "def _create_formatters(cp):\n \"\"\"Create and return formatters\"\"\"\n flist = cp.get(\"formatters\", \"keys\")\n if not len(flist):\n return {}\n flist = flist.split(\",\")\n flist = _strip_spaces(flist)\n formatters = {}\n for form in flist:\n sectname = \"formatter_%s\" % form\n opts = cp.options(sectname)\n if \"format\" in opts:\n fs = cp.get(sectname, \"format\", 1)\n else:\n fs = None\n if \"datefmt\" in opts:\n dfs = cp.get(sectname, \"datefmt\", 1)\n else:\n dfs = None\n c = logging.Formatter\n if \"class\" in opts:\n class_name = cp.get(sectname, \"class\")\n if class_name:\n c = _resolve(class_name)\n f = c(fs, dfs)\n formatters[form] = f\n return formatters", "metadata": "root._create_formatters", "header": "['module', '___EOS___']", "index": 103 }, { "content": "def _install_handlers(cp, formatters):\n \"\"\"Install and return handlers\"\"\"\n hlist = cp.get(\"handlers\", \"keys\")\n if not len(hlist):\n return {}\n hlist = hlist.split(\",\")\n hlist = _strip_spaces(hlist)\n handlers = {}\n fixups = [] #for inter-handler references\n for hand in hlist:\n sectname = \"handler_%s\" % hand\n klass = cp.get(sectname, \"class\")\n opts = cp.options(sectname)\n if \"formatter\" in opts:\n fmt = cp.get(sectname, \"formatter\")\n else:\n fmt = \"\"\n try:\n klass = eval(klass, vars(logging))\n except (AttributeError, NameError):\n klass = _resolve(klass)\n args = cp.get(sectname, \"args\")\n args = eval(args, vars(logging))\n h = klass(*args)\n if \"level\" in opts:\n level = cp.get(sectname, \"level\")\n h.setLevel(logging._levelNames[level])\n if len(fmt):\n h.setFormatter(formatters[fmt])\n if issubclass(klass, logging.handlers.MemoryHandler):\n if \"target\" in opts:\n target = cp.get(sectname,\"target\")\n else:\n target = \"\"\n if len(target): #the target handler may not be loaded yet, so keep for later...\n fixups.append((h, target))\n handlers[hand] = h\n #now all handlers are loaded, fixup inter-handler references...\n for h, t in fixups:\n h.setTarget(handlers[t])\n return handlers", "metadata": "root._install_handlers", "header": "['module', '___EOS___']", "index": 132 }, { "content": "def _install_loggers(cp, handlers, disable_existing_loggers):\n \"\"\"Create and install loggers\"\"\"\n\n # configure the root first\n llist = cp.get(\"loggers\", \"keys\")\n llist = llist.split(\",\")\n llist = list(map(lambda x: x.strip(), llist))\n llist.remove(\"root\")\n sectname = \"logger_root\"\n root = logging.root\n log = root\n opts = cp.options(sectname)\n if \"level\" in opts:\n level = cp.get(sectname, \"level\")\n log.setLevel(logging._levelNames[level])\n for h in root.handlers[:]:\n root.removeHandler(h)\n hlist = cp.get(sectname, \"handlers\")\n if len(hlist):\n hlist = hlist.split(\",\")\n hlist = _strip_spaces(hlist)\n for hand in hlist:\n log.addHandler(handlers[hand])\n\n #and now the others...\n #we don't want to lose the existing loggers,\n #since other threads may have pointers to them.\n #existing is set to contain all existing loggers,\n #and as we go through the new configuration we\n #remove any which are configured. At the end,\n #what's left in existing is the set of loggers\n #which were in the previous configuration but\n #which are not in the new configuration.\n existing = list(root.manager.loggerDict.keys())\n #The list needs to be sorted so that we can\n #avoid disabling child loggers of explicitly\n #named loggers. With a sorted list it is easier\n #to find the child loggers.\n existing.sort()\n #We'll keep the list of existing loggers\n #which are children of named loggers here...\n child_loggers = []\n #now set up the new ones...\n for log in llist:\n sectname = \"logger_%s\" % log\n qn = cp.get(sectname, \"qualname\")\n opts = cp.options(sectname)\n if \"propagate\" in opts:\n propagate = cp.getint(sectname, \"propagate\")\n else:\n propagate = 1\n logger = logging.getLogger(qn)\n if qn in existing:\n i = existing.index(qn) + 1 # start with the entry after qn\n prefixed = qn + \".\"\n pflen = len(prefixed)\n num_existing = len(existing)\n while i < num_existing:\n if existing[i][:pflen] == prefixed:\n child_loggers.append(existing[i])\n i += 1\n existing.remove(qn)\n if \"level\" in opts:\n level = cp.get(sectname, \"level\")\n logger.setLevel(logging._levelNames[level])\n for h in logger.handlers[:]:\n logger.removeHandler(h)\n logger.propagate = propagate\n logger.disabled = 0\n hlist = cp.get(sectname, \"handlers\")\n if len(hlist):\n hlist = hlist.split(\",\")\n hlist = _strip_spaces(hlist)\n for hand in hlist:\n logger.addHandler(handlers[hand])\n\n #Disable any old loggers. There's no point deleting\n #them as other threads may continue to hold references\n #and by disabling them, you stop them doing any logging.\n #However, don't disable children of named loggers, as that's\n #probably not what was intended by the user.\n for log in existing:\n logger = root.manager.loggerDict[log]\n if log in child_loggers:\n logger.level = logging.NOTSET\n logger.handlers = []\n logger.propagate = 1\n elif disable_existing_loggers:\n logger.disabled = 1", "metadata": "root._install_loggers", "header": "['module', '___EOS___']", "index": 175 }, { "content": "def valid_ident(s):\n m = IDENTIFIER.match(s)\n if not m:\n raise ValueError('Not a valid Python identifier: %r' % s)\n return True", "metadata": "root.valid_ident", "header": "['module', '___EOS___']", "index": 270 }, { "content": "class ConvertingDict(dict):\n \"\"\"A converting dictionary wrapper.\"\"\"\n\n\n", "metadata": "root.ConvertingDict", "header": "['module', '___EOS___']", "index": 286 }, { "content": " def __getitem__(self, key):\n value = dict.__getitem__(self, key)\n result = self.configurator.convert(value)\n #If the converted value is different, save for next time\n if value is not result:\n self[key] = result\n if type(result) in (ConvertingDict, ConvertingList,\n ConvertingTuple):\n result.parent = self\n result.key = key\n return result", "metadata": "root.ConvertingDict.__getitem__", "header": "['class', 'ConvertingDict', '(', 'dict', ')', ':', '___EOS___']", "index": 289 }, { "content": " def get(self, key, default=None):\n value = dict.get(self, key, default)\n result = self.configurator.convert(value)\n #If the converted value is different, save for next time\n if value is not result:\n self[key] = result\n if type(result) in (ConvertingDict, ConvertingList,\n ConvertingTuple):\n result.parent = self\n result.key = key\n return result", "metadata": "root.ConvertingDict.get", "header": "['class', 'ConvertingDict', '(', 'dict', ')', ':', '___EOS___']", "index": 301 }, { "content": " def pop(self, key, default=None):\n value = dict.pop(self, key, default)\n result = self.configurator.convert(value)\n if value is not result:\n if type(result) in (ConvertingDict, ConvertingList,\n ConvertingTuple):\n result.parent = self\n result.key = key\n return result", "metadata": "root.ConvertingDict.pop", "header": "['class', 'ConvertingDict', '(', 'dict', ')', ':', '___EOS___']", "index": 313 }, { "content": "class ConvertingList(list):\n \"\"\"A converting list wrapper.\"\"\"\n", "metadata": "root.ConvertingList", "header": "['module', '___EOS___']", "index": 323 }, { "content": " def __getitem__(self, key):\n value = list.__getitem__(self, key)\n result = self.configurator.convert(value)\n #If the converted value is different, save for next time\n if value is not result:\n self[key] = result\n if type(result) in (ConvertingDict, ConvertingList,\n ConvertingTuple):\n result.parent = self\n result.key = key\n return result", "metadata": "root.ConvertingList.__getitem__", "header": "['class', 'ConvertingList', '(', 'list', ')', ':', '___EOS___']", "index": 325 }, { "content": " def pop(self, idx=-1):\n value = list.pop(self, idx)\n result = self.configurator.convert(value)\n if value is not result:\n if type(result) in (ConvertingDict, ConvertingList,\n ConvertingTuple):\n result.parent = self\n return result", "metadata": "root.ConvertingList.pop", "header": "['class', 'ConvertingList', '(', 'list', ')', ':', '___EOS___']", "index": 337 }, { "content": "class ConvertingTuple(tuple):\n \"\"\"A converting tuple wrapper.\"\"\"", "metadata": "root.ConvertingTuple", "header": "['module', '___EOS___']", "index": 346 }, { "content": " def __getitem__(self, key):\n value = tuple.__getitem__(self, key)\n result = self.configurator.convert(value)\n if value is not result:\n if type(result) in (ConvertingDict, ConvertingList,\n ConvertingTuple):\n result.parent = self\n result.key = key\n return result", "metadata": "root.ConvertingTuple.__getitem__", "header": "['class', 'ConvertingTuple', '(', 'tuple', ')', ':', '___EOS___']", "index": 348 }, { "content": "class BaseConfigurator(object):\n \"\"\"\n The configurator base class which defines some useful defaults.\n \"\"\"\n\n CONVERT_PATTERN = re.compile(r'^(?P<prefix>[a-z]+)://(?P<suffix>.*)$')\n\n WORD_PATTERN = re.compile(r'^\\s*(\\w+)\\s*')\n DOT_PATTERN = re.compile(r'^\\.\\s*(\\w+)\\s*')\n INDEX_PATTERN = re.compile(r'^\\[\\s*(\\w+)\\s*\\]\\s*')\n DIGIT_PATTERN = re.compile(r'^\\d+$')\n\n value_converters = {\n 'ext' : 'ext_convert',\n 'cfg' : 'cfg_convert',\n }\n\n # We might want to use a different one, e.g. importlib\n importer = __import__\n\n\n\n\n\n\n", "metadata": "root.BaseConfigurator", "header": "['module', '___EOS___']", "index": 358 }, { "content": " def __init__(self, config):\n self.config = ConvertingDict(config)\n self.config.configurator = self", "metadata": "root.BaseConfigurator.__init__", "header": "['class', 'BaseConfigurator', '(', 'object', ')', ':', '___EOS___']", "index": 378 }, { "content": " def resolve(self, s):\n \"\"\"\n Resolve strings to objects using standard import and attribute\n syntax.\n \"\"\"\n name = s.split('.')\n used = name.pop(0)\n try:\n found = self.importer(used)\n for frag in name:\n used += '.' + frag\n try:\n found = getattr(found, frag)\n except AttributeError:\n self.importer(used)\n found = getattr(found, frag)\n return found\n except ImportError:\n e, tb = sys.exc_info()[1:]\n v = ValueError('Cannot resolve %r: %s' % (s, e))\n v.__cause__, v.__traceback__ = e, tb\n raise v", "metadata": "root.BaseConfigurator.resolve", "header": "['class', 'BaseConfigurator', '(', 'object', ')', ':', '___EOS___']", "index": 382 }, { "content": " def ext_convert(self, value):\n \"\"\"Default converter for the ext:// protocol.\"\"\"\n return self.resolve(value)", "metadata": "root.BaseConfigurator.ext_convert", "header": "['class', 'BaseConfigurator', '(', 'object', ')', ':', '___EOS___']", "index": 405 }, { "content": " def cfg_convert(self, value):\n \"\"\"Default converter for the cfg:// protocol.\"\"\"\n rest = value\n m = self.WORD_PATTERN.match(rest)\n if m is None:\n raise ValueError(\"Unable to convert %r\" % value)\n else:\n rest = rest[m.end():]\n d = self.config[m.groups()[0]]\n #print d, rest\n while rest:\n m = self.DOT_PATTERN.match(rest)\n if m:\n d = d[m.groups()[0]]\n else:\n m = self.INDEX_PATTERN.match(rest)\n if m:\n idx = m.groups()[0]\n if not self.DIGIT_PATTERN.match(idx):\n d = d[idx]\n else:\n try:\n n = int(idx) # try as number first (most likely)\n d = d[n]\n except TypeError:\n d = d[idx]\n if m:\n rest = rest[m.end():]\n else:\n raise ValueError('Unable to convert '\n '%r at %r' % (value, rest))\n #rest should be empty\n return d", "metadata": "root.BaseConfigurator.cfg_convert", "header": "['class', 'BaseConfigurator', '(', 'object', ')', ':', '___EOS___']", "index": 409 }, { "content": " def convert(self, value):\n \"\"\"\n Convert values to an appropriate type. dicts, lists and tuples are\n replaced by their converting alternatives. Strings are checked to\n see if they have a conversion format and are converted if they do.\n \"\"\"\n if not isinstance(value, ConvertingDict) and isinstance(value, dict):\n value = ConvertingDict(value)\n value.configurator = self\n elif not isinstance(value, ConvertingList) and isinstance(value, list):\n value = ConvertingList(value)\n value.configurator = self\n elif not isinstance(value, ConvertingTuple) and\\\n isinstance(value, tuple):\n value = ConvertingTuple(value)\n value.configurator = self\n elif isinstance(value, basestring): # str for py3k\n m = self.CONVERT_PATTERN.match(value)\n if m:\n d = m.groupdict()\n prefix = d['prefix']\n converter = self.value_converters.get(prefix, None)\n if converter:\n suffix = d['suffix']\n converter = getattr(self, converter)\n value = converter(suffix)\n return value", "metadata": "root.BaseConfigurator.convert", "header": "['class', 'BaseConfigurator', '(', 'object', ')', ':', '___EOS___']", "index": 443 }, { "content": " def configure_custom(self, config):\n \"\"\"Configure an object with a user-supplied factory.\"\"\"\n c = config.pop('()')\n if not hasattr(c, '__call__') and hasattr(types, 'ClassType') and type(c) != types.ClassType:\n c = self.resolve(c)\n props = config.pop('.', None)\n # Check for valid identifiers\n kwargs = dict([(k, config[k]) for k in config if valid_ident(k)])\n result = c(**kwargs)\n if props:\n for name, value in props.items():\n setattr(result, name, value)\n return result", "metadata": "root.BaseConfigurator.configure_custom", "header": "['class', 'BaseConfigurator', '(', 'object', ')', ':', '___EOS___']", "index": 471 }, { "content": " def as_tuple(self, value):\n \"\"\"Utility function which converts lists to tuples.\"\"\"\n if isinstance(value, list):\n value = tuple(value)\n return value", "metadata": "root.BaseConfigurator.as_tuple", "header": "['class', 'BaseConfigurator', '(', 'object', ')', ':', '___EOS___']", "index": 485 }, { "content": "class DictConfigurator(BaseConfigurator):\n \"\"\"\n Configure logging using a dictionary-like object to describe the\n configuration.\n \"\"\"\n\n\n\n\n\n\n\n\n", "metadata": "root.DictConfigurator", "header": "['module', '___EOS___']", "index": 491 }, { "content": " def configure(self):\n \"\"\"Do the configuration.\"\"\"\n\n config = self.config\n if 'version' not in config:\n raise ValueError(\"dictionary doesn't specify a version\")\n if config['version'] != 1:\n raise ValueError(\"Unsupported version: %s\" % config['version'])\n incremental = config.pop('incremental', False)\n EMPTY_DICT = {}\n logging._acquireLock()\n try:\n if incremental:\n handlers = config.get('handlers', EMPTY_DICT)\n for name in handlers:\n if name not in logging._handlers:\n raise ValueError('No handler found with '\n 'name %r' % name)\n else:\n try:\n handler = logging._handlers[name]\n handler_config = handlers[name]\n level = handler_config.get('level', None)\n if level:\n handler.setLevel(logging._checkLevel(level))\n except StandardError, e:\n raise ValueError('Unable to configure handler '\n '%r: %s' % (name, e))\n loggers = config.get('loggers', EMPTY_DICT)\n for name in loggers:\n try:\n self.configure_logger(name, loggers[name], True)\n except StandardError, e:\n raise ValueError('Unable to configure logger '\n '%r: %s' % (name, e))\n root = config.get('root', None)\n if root:\n try:\n self.configure_root(root, True)\n except StandardError, e:\n raise ValueError('Unable to configure root '\n 'logger: %s' % e)\n else:\n disable_existing = config.pop('disable_existing_loggers', True)\n\n logging._handlers.clear()\n del logging._handlerList[:]\n\n # Do formatters first - they don't refer to anything else\n formatters = config.get('formatters', EMPTY_DICT)\n for name in formatters:\n try:\n formatters[name] = self.configure_formatter(\n formatters[name])\n except StandardError, e:\n raise ValueError('Unable to configure '\n 'formatter %r: %s' % (name, e))\n # Next, do filters - they don't refer to anything else, either\n filters = config.get('filters', EMPTY_DICT)\n for name in filters:\n try:\n filters[name] = self.configure_filter(filters[name])\n except StandardError, e:\n raise ValueError('Unable to configure '\n 'filter %r: %s' % (name, e))\n\n # Next, do handlers - they refer to formatters and filters\n # As handlers can refer to other handlers, sort the keys\n # to allow a deterministic order of configuration\n handlers = config.get('handlers', EMPTY_DICT)\n for name in sorted(handlers):\n try:\n handler = self.configure_handler(handlers[name])\n handler.name = name\n handlers[name] = handler\n except StandardError, e:\n raise ValueError('Unable to configure handler '\n '%r: %s' % (name, e))\n # Next, do loggers - they refer to handlers and filters\n\n #we don't want to lose the existing loggers,\n #since other threads may have pointers to them.\n #existing is set to contain all existing loggers,\n #and as we go through the new configuration we\n #remove any which are configured. At the end,\n #what's left in existing is the set of loggers\n #which were in the previous configuration but\n #which are not in the new configuration.\n root = logging.root\n existing = root.manager.loggerDict.keys()\n #The list needs to be sorted so that we can\n #avoid disabling child loggers of explicitly\n #named loggers. With a sorted list it is easier\n #to find the child loggers.\n existing.sort()\n #We'll keep the list of existing loggers\n #which are children of named loggers here...\n child_loggers = []\n #now set up the new ones...\n loggers = config.get('loggers', EMPTY_DICT)\n for name in loggers:\n name = _encoded(name)\n if name in existing:\n i = existing.index(name)\n prefixed = name + \".\"\n pflen = len(prefixed)\n num_existing = len(existing)\n i = i + 1 # look at the entry after name\n while (i < num_existing) and\\\n (existing[i][:pflen] == prefixed):\n child_loggers.append(existing[i])\n i = i + 1\n existing.remove(name)\n try:\n self.configure_logger(name, loggers[name])\n except StandardError, e:\n raise ValueError('Unable to configure logger '\n '%r: %s' % (name, e))\n\n #Disable any old loggers. There's no point deleting\n #them as other threads may continue to hold references\n #and by disabling them, you stop them doing any logging.\n #However, don't disable children of named loggers, as that's\n #probably not what was intended by the user.\n for log in existing:\n logger = root.manager.loggerDict[log]\n if log in child_loggers:\n logger.level = logging.NOTSET\n logger.handlers = []\n logger.propagate = True\n elif disable_existing:\n logger.disabled = True\n\n # And finally, do the root logger\n root = config.get('root', None)\n if root:\n try:\n self.configure_root(root)\n except StandardError, e:\n raise ValueError('Unable to configure root '\n 'logger: %s' % e)\n finally:\n logging._releaseLock()", "metadata": "root.DictConfigurator.configure", "header": "['class', 'DictConfigurator', '(', 'BaseConfigurator', ')', ':', '___EOS___']", "index": 497 }, { "content": " def configure_formatter(self, config):\n \"\"\"Configure a formatter from a dictionary.\"\"\"\n if '()' in config:\n factory = config['()'] # for use in exception handler\n try:\n result = self.configure_custom(config)\n except TypeError, te:\n if \"'format'\" not in str(te):\n raise\n #Name of parameter changed from fmt to format.\n #Retry with old name.\n #This is so that code can be used with older Python versions\n #(e.g. by Django)\n config['fmt'] = config.pop('format')\n config['()'] = factory\n result = self.configure_custom(config)\n else:\n fmt = config.get('format', None)\n dfmt = config.get('datefmt', None)\n result = logging.Formatter(fmt, dfmt)\n return result", "metadata": "root.DictConfigurator.configure_formatter", "header": "['class', 'DictConfigurator', '(', 'BaseConfigurator', ')', ':', '___EOS___']", "index": 641 }, { "content": " def configure_filter(self, config):\n \"\"\"Configure a filter from a dictionary.\"\"\"\n if '()' in config:\n result = self.configure_custom(config)\n else:\n name = config.get('name', '')\n result = logging.Filter(name)\n return result", "metadata": "root.DictConfigurator.configure_filter", "header": "['class', 'DictConfigurator', '(', 'BaseConfigurator', ')', ':', '___EOS___']", "index": 663 }, { "content": " def add_filters(self, filterer, filters):\n \"\"\"Add filters to a filterer from a list of names.\"\"\"\n for f in filters:\n try:\n filterer.addFilter(self.config['filters'][f])\n except StandardError, e:\n raise ValueError('Unable to add filter %r: %s' % (f, e))", "metadata": "root.DictConfigurator.add_filters", "header": "['class', 'DictConfigurator', '(', 'BaseConfigurator', ')', ':', '___EOS___']", "index": 672 }, { "content": " def configure_handler(self, config):\n \"\"\"Configure a handler from a dictionary.\"\"\"\n formatter = config.pop('formatter', None)\n if formatter:\n try:\n formatter = self.config['formatters'][formatter]\n except StandardError, e:\n raise ValueError('Unable to set formatter '\n '%r: %s' % (formatter, e))\n level = config.pop('level', None)\n filters = config.pop('filters', None)\n if '()' in config:\n c = config.pop('()')\n if not hasattr(c, '__call__') and hasattr(types, 'ClassType') and type(c) != types.ClassType:\n c = self.resolve(c)\n factory = c\n else:\n klass = self.resolve(config.pop('class'))\n #Special case for handler which refers to another handler\n if issubclass(klass, logging.handlers.MemoryHandler) and\\\n 'target' in config:\n try:\n config['target'] = self.config['handlers'][config['target']]\n except StandardError, e:\n raise ValueError('Unable to set target handler '\n '%r: %s' % (config['target'], e))\n elif issubclass(klass, logging.handlers.SMTPHandler) and\\\n 'mailhost' in config:\n config['mailhost'] = self.as_tuple(config['mailhost'])\n elif issubclass(klass, logging.handlers.SysLogHandler) and\\\n 'address' in config:\n config['address'] = self.as_tuple(config['address'])\n factory = klass\n kwargs = dict([(k, config[k]) for k in config if valid_ident(k)])\n try:\n result = factory(**kwargs)\n except TypeError, te:\n if \"'stream'\" not in str(te):\n raise\n #The argument name changed from strm to stream\n #Retry with old name.\n #This is so that code can be used with older Python versions\n #(e.g. by Django)\n kwargs['strm'] = kwargs.pop('stream')\n result = factory(**kwargs)\n if formatter:\n result.setFormatter(formatter)\n if level is not None:\n result.setLevel(logging._checkLevel(level))\n if filters:\n self.add_filters(result, filters)\n return result", "metadata": "root.DictConfigurator.configure_handler", "header": "['class', 'DictConfigurator', '(', 'BaseConfigurator', ')', ':', '___EOS___']", "index": 680 }, { "content": " def add_handlers(self, logger, handlers):\n \"\"\"Add handlers to a logger from a list of names.\"\"\"\n for h in handlers:\n try:\n logger.addHandler(self.config['handlers'][h])\n except StandardError, e:\n raise ValueError('Unable to add handler %r: %s' % (h, e))", "metadata": "root.DictConfigurator.add_handlers", "header": "['class', 'DictConfigurator', '(', 'BaseConfigurator', ')', ':', '___EOS___']", "index": 733 }, { "content": " def common_logger_config(self, logger, config, incremental=False):\n \"\"\"\n Perform configuration which is common to root and non-root loggers.\n \"\"\"\n level = config.get('level', None)\n if level is not None:\n logger.setLevel(logging._checkLevel(level))\n if not incremental:\n #Remove any existing handlers\n for h in logger.handlers[:]:\n logger.removeHandler(h)\n handlers = config.get('handlers', None)\n if handlers:\n self.add_handlers(logger, handlers)\n filters = config.get('filters', None)\n if filters:\n self.add_filters(logger, filters)", "metadata": "root.DictConfigurator.common_logger_config", "header": "['class', 'DictConfigurator', '(', 'BaseConfigurator', ')', ':', '___EOS___']", "index": 741 }, { "content": " def configure_logger(self, name, config, incremental=False):\n \"\"\"Configure a non-root logger from a dictionary.\"\"\"\n logger = logging.getLogger(name)\n self.common_logger_config(logger, config, incremental)\n propagate = config.get('propagate', None)\n if propagate is not None:\n logger.propagate = propagate", "metadata": "root.DictConfigurator.configure_logger", "header": "['class', 'DictConfigurator', '(', 'BaseConfigurator', ')', ':', '___EOS___']", "index": 759 }, { "content": " def configure_root(self, config, incremental=False):\n \"\"\"Configure a root logger from a dictionary.\"\"\"\n root = logging.getLogger()\n self.common_logger_config(root, config, incremental)", "metadata": "root.DictConfigurator.configure_root", "header": "['class', 'DictConfigurator', '(', 'BaseConfigurator', ')', ':', '___EOS___']", "index": 767 }, { "content": "def dictConfig(config):\n \"\"\"Configure logging using a dictionary.\"\"\"\n dictConfigClass(config).configure()", "metadata": "root.dictConfig", "header": "['module', '___EOS___']", "index": 774 }, { "content": "def listen(port=DEFAULT_LOGGING_CONFIG_PORT):\n \"\"\"\n Start up a socket server on the specified port, and listen for new\n configurations.\n\n These will be sent as a file suitable for processing by fileConfig().\n Returns a Thread object on which you can call start() to start the server,\n and which you can join() when appropriate. To stop the server, call\n stopListening().\n \"\"\"\n if not thread:\n raise NotImplementedError(\"listen() needs threading to work\")\n\n class ConfigStreamHandler(StreamRequestHandler):\n \"\"\"\n Handler for a logging configuration request.\n\n It expects a completely new logging configuration and uses fileConfig\n to install it.\n \"\"\"\n def handle(self):\n \"\"\"\n Handle a request.\n\n Each request is expected to be a 4-byte length, packed using\n struct.pack(\">L\", n), followed by the config file.\n Uses fileConfig() to do the grunt work.\n \"\"\"\n import tempfile\n try:\n conn = self.connection\n chunk = conn.recv(4)\n if len(chunk) == 4:\n slen = struct.unpack(\">L\", chunk)[0]\n chunk = self.connection.recv(slen)\n while len(chunk) < slen:\n chunk = chunk + conn.recv(slen - len(chunk))\n try:\n import json\n d =json.loads(chunk)\n assert isinstance(d, dict)\n dictConfig(d)\n except:\n #Apply new configuration.\n\n file = cStringIO.StringIO(chunk)\n try:\n fileConfig(file)\n except (KeyboardInterrupt, SystemExit):\n raise\n except:\n traceback.print_exc()\n if self.server.ready:\n self.server.ready.set()\n except socket.error, e:\n if not isinstance(e.args, tuple):\n raise\n else:\n errcode = e.args[0]\n if errcode != RESET_ERROR:\n raise\n\n class ConfigSocketReceiver(ThreadingTCPServer):\n \"\"\"\n A simple TCP socket-based logging config receiver.\n \"\"\"\n\n allow_reuse_address = 1\n\n def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,\n handler=None, ready=None):\n ThreadingTCPServer.__init__(self, (host, port), handler)\n logging._acquireLock()\n self.abort = 0\n logging._releaseLock()\n self.timeout = 1\n self.ready = ready\n\n def serve_until_stopped(self):\n if sys.platform.startswith('java'):\n from select import cpython_compatible_select as select\n else:\n from select import select\n abort = 0\n while not abort:\n rd, wr, ex = select([self.socket.fileno()],\n [], [],\n self.timeout)\n if rd:\n self.handle_request()\n logging._acquireLock()\n abort = self.abort\n logging._releaseLock()\n self.socket.close()\n\n class Server(threading.Thread):\n\n def __init__(self, rcvr, hdlr, port):\n super(Server, self).__init__()\n self.rcvr = rcvr\n self.hdlr = hdlr\n self.port = port\n self.ready = threading.Event()\n\n def run(self):\n server = self.rcvr(port=self.port, handler=self.hdlr,\n ready=self.ready)\n if self.port == 0:\n self.port = server.server_address[1]\n self.ready.set()\n global _listener\n logging._acquireLock()\n _listener = server\n logging._releaseLock()\n server.serve_until_stopped()\n\n return Server(ConfigSocketReceiver, ConfigStreamHandler, port)", "metadata": "root.listen", "header": "['module', '___EOS___']", "index": 779 }, { "content": "def stopListening():\n \"\"\"\n Stop the listening server which was created with a call to listen().\n \"\"\"\n global _listener\n logging._acquireLock()\n try:\n if _listener:\n _listener.abort = 1\n _listener = None\n finally:\n logging._releaseLock()", "metadata": "root.stopListening", "header": "['module', '___EOS___']", "index": 897 } ]
[ { "span": "import sys, logging, logging.handlers, socket, struct, os, traceback, re", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 72 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "200", "1", "-", "2010", " ", "by", " ", "Vin", "ay", " ", "Sa", "ji", "p", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "and", " ", "distribute", " ", "this", " ", "software", " ", "and", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "for", " ", "any", " ", "purpose", " ", "and", " ", "with", "out", " ", "fe", "e", " ", "is", " ", "here", "by", " ", "grant", "ed", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "provided", " ", "tha", "t", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "appear", " ", "in", " ", "all", " ", "copie", "s", " ", "and", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bot", "h", " ", "tha", "t", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "appear", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "support", "ing", " ", "documentation", ",", " ", "and", " ", "tha", "t", " ", "the", " ", "name", " ", "of", " ", "Vin", "ay", " ", "Sa", "ji", "p_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "be", " ", "used", " ", "in", " ", "adver", "tis", "ing", " ", "or", " ", "public", "it", "y", " ", "pert", "ain", "ing", " ", "to", " ", "distribution_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "software", " ", "with", "out", " ", "specific", ",", " ", "writt", "en", " ", "prior", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "VI", "NA", "Y", " ", "SA", "JI", "P", " ", "DISC", "LAI", "MS", " ", "ALL", " ", "WAR", "RAN", "TIES", " ", "WITH", " ", "REG", "ARD", " ", "TO", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ALL", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "VI", "NA", "Y", " ", "SA", "JI", "P", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "SPECIAL", ",", " ", "INDI", "RECT", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ANY", " ", "DA", "MAGE", "S", " ", "WH", "ATS", "OE", "VER", " ", "RESU", "LT", "ING", " ", "FROM", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", " ", "OR", " ", "PROF", "IT", "S", ",", " ", "WHE", "THER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", " ", "TOR", "TIO", "US", " ", "ACTI", "ON", ",", " ", "ARI", "SIN", "G", " ", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "USE", " ", "OR", " ", "PERF", "ORM", "ANCE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Configura", "tion", " ", "function", "s", " ", "for", " ", "the", " ", "logg", "ing", " ", "package", " ", "for", " ", "Pyth", "on", ".", " ", "The", " ", "core", " ", "package", "\\", "10", ";", "is", " ", "based", " ", "on", " ", "PE", "P", " ", "282", " ", "and", " ", "comment", "s", " ", "there", "to", " ", "in", " ", "comp", ".", "lang", ".", "python", ",", " ", "and", " ", "influence", "d", "\\", "10", ";", "by", " ", "Ap", "ache", "'", "s", " ", "log", "4j", " ", "system", ".", "\\", "10", ";", "\\", "10", ";", "Copy", "right", " ", "(", "C", ")", " ", "200", "1", "-", "2010", " ", "Vin", "ay", " ", "Sa", "ji", "p", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", ".", "\\", "10", ";", "\\", "10", ";", "To", " ", "use", ",", " ", "simp", "ly", " ", "'", "import", " ", "logg", "ing", "'", " ", "and", " ", "log", " ", "awa", "y", "!", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "logging_", ",_", "logging_", "._", "handlers_", ",_", "socket_", ",_", "struct_", ",_", "os_", ",_", "traceback_", ",_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", ",_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\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 ", " _", "thread_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "Sock", "et", "Server_", "import_", "Thread", "ing", "TC", "PS", "erver_", ",_", "Stream", "Request", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "LOGGING", "\\u", "CONFIG", "\\u", "PORT_", "=_", "903", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "RESE", "T", "\\u", "ERROR_", "=_", "1005", "4_", "#", "WS", "AE", "CONN", "RESET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "RESE", "T", "\\u", "ERROR_", "=_", "104_", "#", "ECO", "NN", "RESET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "The", " ", "follow", "ing", " ", "code", " ", "implement", "s", " ", "a", " ", "socket", " ", "listen", "er", " ", "for", " ", "on", "-", "the", "-", "fly", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "reconfigur", "ation", " ", "of", " ", "logg", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\\u", "listen", "er", " ", "hold", "s", " ", "the", " ", "server", " ", "object", " ", "doi", "ng", " ", "the", " ", "listen", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "listener_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "IDENTIFIER_", "=_", "re_", "._", "compile_", "(_", "'", "^", "[", "a", "-", "z", "\\u]", "[", "a", "-", "z", "0", "-", "9", "\\u]*", "$'_", ",_", "re_", "._", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", " ", "Converti", "ng", "XX", "X", " ", "classe", "s", " ", "are", " ", "wrapp", "ers", " ", "aro", "und", " ", "standard", " ", "Pyth", "on", " ", "container", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", "y", " ", "serve", " ", "to", " ", "convert", " ", "any", " ", "suit", "able", " ", "values", " ", "in", " ", "the", " ", "container", ".", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "conve", "rsi", "on", " ", "convert", "s", " ", "base", " ", "dict", "s", ",", " ", "lists", " ", "and", " ", "tuple", "s", " ", "to", " ", "thei", "r", " ", "wrapped_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "equivalent", "s", ",", " ", "where", "as", " ", "string", "s", " ", "whi", "ch", " ", "match", " ", "a", " ", "conve", "rsi", "on", " ", "format", " ", "are", " ", "converted_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appropr", "iate", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ea", "ch", " ", "wrapp", "er", " ", "shou", "ld", " ", "have", " ", "a", " ", "configurator", " ", "attribute", " ", "holding", " ", "the", " ", "actual_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "configurator", " ", "to", " ", "use", " ", "for", " ", "conve", "rsi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dict", "Config", "Class_", "=_", "Dict", "Configurator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "file", "Config_", "(_", "fname_", ",_", "defaults_", "=_", "None_", ",_", "disable", "\\u", "exist", "ing", "\\u", "loggers_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Read", " ", "the", " ", "logg", "ing", " ", "configura", "tion", " ", "from", " ", "a", " ", "Config", "Parser", "-", "format", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "call", "ed", " ", "sever", "al", " ", "times", " ", "from", " ", "an", " ", "applica", "tion", ",", " ", "allow", "ing", " ", "an", " ", "end", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "abilit", "y", " ", "to", " ", "select", " ", "from", " ", "vari", "ous", " ", "pre", "-", "cann", "ed", " ", "configura", "tion", "s", " ", "(", "if", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "developer", " ", "provide", "s", " ", "a", " ", "mechanism", " ", "to", " ", "presen", "t", " ", "the", " ", "choice", "s", " ", "and", " ", "load", " ", "the", " ", "chosen", "\\", "10", ";", " ", " ", " ", " ", "configura", "tion", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cp_", "=_", "Config", "Parser_", "._", "Config", "Parser_", "(_", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "fname_", ",_", "'", "readline", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cp_", "._", "readf", "p_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cp_", "._", "read_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "formatters_", "=_", "\\u", "create", "\\u", "formatters_", "(_", "cp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "critic", "al", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "\\u", "handlers_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "logging_", "._", "\\u", "handler", "List_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", "rs", " ", "add", " ", "them", "sel", "ves", " ", "to", " ", "logg", "ing", ".\\u", "handlers_", "\\u\\u\\uNL\\u\\u\\u_", "handlers_", "=_", "\\u", "install", "\\u", "handlers_", "(_", "cp_", ",_", "formatters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "install", "\\u", "loggers_", "(_", "cp_", ",_", "handlers_", ",_", "disable", "\\u", "exist", "ing", "\\u", "loggers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "resolve_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Resolv", "e", " ", "a", " ", "dot", "ted", " ", "name", " ", "to", " ", "a", " ", "global", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "name_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used_", "=_", "name_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "\\u\\u", "import\\u\\u_", "(_", "used_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "used_", "=_", "used_", "+_", "'.'_", "+_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "getattr_", "(_", "found_", ",_", "n_", ")_", "\\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 ", " _", "\\u\\u", "import\\u\\u_", "(_", "used_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "getattr_", "(_", "found_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "found_", "\\u\\u\\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", "strip", "\\u", "spaces_", "(_", "alist_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "map_", "(_", "lambda_", "x_", ":_", "x_", "._", "strip_", "(_", ")_", ",_", "alist_", ")_", "\\u\\u\\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", "encoded_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "if_", "isinstance_", "(_", "s_", ",_", "str_", ")_", "else_", "s_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\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", "create", "\\u", "formatters_", "(_", "cp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "and", " ", "return", " ", "formatter", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flist_", "=_", "cp_", "._", "get_", "(_", "\"", "formatter", "s", "\"_", ",_", "\"", "keys", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "len_", "(_", "flist_", ")_", ":_", "\\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_", "flist_", "=_", "flist_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flist_", "=_", "\\u", "strip", "\\u", "spaces_", "(_", "flist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formatters_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "form_", "in_", "flist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sect", "name_", "=_", "\"", "formatter", "\\u", "%", "s", "\"_", "%_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "cp_", "._", "options_", "(_", "sect", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "format", "\"_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fs_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "format", "\"_", ",_", "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 ", " _", "fs_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "datef", "mt", "\"_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dfs_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "datef", "mt", "\"_", ",_", "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 ", " _", "dfs_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "logging_", "._", "Formatter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "class", "\"_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class", "\\u", "name_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "class", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "\\u", "resolve_", "(_", "class", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "c_", "(_", "fs_", ",_", "dfs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formatters_", "[_", "form_", "]_", "=_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "formatters_", "\\u\\u\\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", "install", "\\u", "handlers_", "(_", "cp_", ",_", "formatters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Install", " ", "and", " ", "return", " ", "handler", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hli", "st_", "=_", "cp_", "._", "get_", "(_", "\"", "handler", "s", "\"_", ",_", "\"", "keys", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "len_", "(_", "hli", "st_", ")_", ":_", "\\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_", "hli", "st_", "=_", "hli", "st_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hli", "st_", "=_", "\\u", "strip", "\\u", "spaces_", "(_", "hli", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handlers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fixup", "s_", "=_", "[_", "]_", "#", "for", " ", "inter", "-", "handler", " ", "references_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "hand_", "in_", "hli", "st_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sect", "name_", "=_", "\"", "handler", "\\u", "%", "s", "\"_", "%_", "hand_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "klass_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "cp_", "._", "options_", "(_", "sect", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "formatter", "\"_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "formatter", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "=_", "\"\"_", "\\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 ", " _", "klass_", "=_", "eval_", "(_", "klass_", ",_", "vars_", "(_", "logging_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Attribute", "Error_", ",_", "Name", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "klass_", "=_", "\\u", "resolve_", "(_", "klass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "args", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "eval_", "(_", "args_", ",_", "vars_", "(_", "logging_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "klass_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "level", "\"_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "level", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "set", "Level_", "(_", "logging_", "._", "\\u", "level", "Names_", "[_", "level_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "fmt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "._", "set", "Formatter_", "(_", "formatters_", "[_", "fmt_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "issubclass_", "(_", "klass_", ",_", "logging_", "._", "handlers_", "._", "Memo", "ry", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "target", "\"_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "target", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "target_", ")_", ":_", "#", "the", " ", "target", " ", "handler", " ", "may", " ", "not", " ", "be", " ", "load", "ed", " ", "ye", "t", ",", " ", "so", " ", "keep", " ", "for", " ", "late", "r", "..._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fixup", "s_", "._", "append_", "(_", "(_", "h_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "handlers_", "[_", "hand_", "]_", "=_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "now", " ", "all", " ", "handler", "s", " ", "are", " ", "load", "ed", ",", " ", "fixup", " ", "inter", "-", "handler", " ", "reference", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "h_", ",_", "t_", "in_", "fixup", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "._", "set", "Target_", "(_", "handlers_", "[_", "t_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "handlers_", "\\u\\u\\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", "install", "\\u", "loggers_", "(_", "cp_", ",_", "handlers_", ",_", "disable", "\\u", "exist", "ing", "\\u", "loggers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "and", " ", "install", " ", "logg", "ers", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "configur", "e", " ", "the", " ", "root", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "lli", "st_", "=_", "cp_", "._", "get_", "(_", "\"", "logg", "ers", "\"_", ",_", "\"", "keys", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lli", "st_", "=_", "lli", "st_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lli", "st_", "=_", "list_", "(_", "map_", "(_", "lambda_", "x_", ":_", "x_", "._", "strip_", "(_", ")_", ",_", "lli", "st_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lli", "st_", "._", "remove_", "(_", "\"", "root", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sect", "name_", "=_", "\"", "logg", "er", "\\u", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "logging_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "=_", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "cp_", "._", "options_", "(_", "sect", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "level", "\"_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "level", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "set", "Level_", "(_", "logging_", "._", "\\u", "level", "Names_", "[_", "level_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "h_", "in_", "root_", "._", "handlers_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "._", "remove", "Handler_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hli", "st_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "handler", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "hli", "st_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hli", "st_", "=_", "hli", "st_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hli", "st_", "=_", "\\u", "strip", "\\u", "spaces_", "(_", "hli", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "hand_", "in_", "hli", "st_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "add", "Handler_", "(_", "handlers_", "[_", "hand_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "and", " ", "now", " ", "the", " ", "other", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "lose", " ", "the", " ", "exist", "ing", " ", "logg", "ers", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sinc", "e", " ", "other", " ", "thread", "s", " ", "may", " ", "have", " ", "pointers", " ", "to", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "exist", "ing", " ", "is", " ", "set", " ", "to", " ", "contain", " ", "all", " ", "exist", "ing", " ", "logg", "ers", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "and", " ", "as", " ", "we", " ", "go", " ", "through", " ", "the", " ", "new", " ", "configura", "tion", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "remove", " ", "any", " ", "whi", "ch", " ", "are", " ", "configur", "ed", ".", " ", "At", " ", "the", " ", "end", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "what", "'", "s", " ", "left", " ", "in", " ", "exist", "ing", " ", "is", " ", "the", " ", "set", " ", "of", " ", "loggers_", "\\u\\u\\uNL\\u\\u\\u_", "#", "whi", "ch", " ", "wer", "e", " ", "in", " ", "the", " ", "previ", "ous", " ", "configura", "tion", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "whi", "ch", " ", "are", " ", "not", " ", "in", " ", "the", " ", "new", " ", "configura", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "existing_", "=_", "list_", "(_", "root_", "._", "manager_", "._", "logg", "er", "Dict_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "The", " ", "list", " ", "need", "s", " ", "to", " ", "be", " ", "sorte", "d", " ", "so", " ", "tha", "t", " ", "we", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", "avoid", " ", "disa", "blin", "g", " ", "child", " ", "logg", "ers", " ", "of", " ", "explicit", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", "named", " ", "logg", "ers", ".", " ", "With", " ", "a", " ", "sorte", "d", " ", "list", " ", "it", " ", "is", " ", "easi", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", "to", " ", "find", " ", "the", " ", "child", " ", "logg", "ers", "._", "\\u\\u\\uNL\\u\\u\\u_", "existing_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "We", "'", "ll", " ", "keep", " ", "the", " ", "list", " ", "of", " ", "exist", "ing", " ", "loggers_", "\\u\\u\\uNL\\u\\u\\u_", "#", "whi", "ch", " ", "are", " ", "child", "ren", " ", "of", " ", "named", " ", "logg", "ers", " ", "here", "..._", "\\u\\u\\uNL\\u\\u\\u_", "child", "\\u", "loggers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "now", " ", "set", " ", "up", " ", "the", " ", "new", " ", "ones", "..._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "log_", "in_", "lli", "st_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sect", "name_", "=_", "\"", "logg", "er", "\\u", "%", "s", "\"_", "%_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qn_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "qualn", "ame", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "cp_", "._", "options_", "(_", "sect", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "propagate", "\"_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "propagate_", "=_", "cp_", "._", "getint_", "(_", "sect", "name_", ",_", "\"", "propagate", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "propagate_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "qn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "qn_", "in_", "existing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "existing_", "._", "index_", "(_", "qn_", ")_", "+_", "1_", "#", " ", "start", " ", "with", " ", "the", " ", "entry", " ", "after", " ", "qn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefixed", "_", "=_", "qn_", "+_", "\".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pf", "len_", "=_", "len_", "(_", "prefixed", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "existing_", "=_", "len_", "(_", "existing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "num", "\\u", "existing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "existing_", "[_", "i_", "]_", "[_", ":_", "pf", "len_", "]_", "==_", "prefixed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "child", "\\u", "loggers_", "._", "append_", "(_", "existing_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "existing_", "._", "remove_", "(_", "qn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "level", "\"_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "level", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "\\u", "level", "Names_", "[_", "level_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "h_", "in_", "logger_", "._", "handlers_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "remove", "Handler_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "propagate_", "=_", "propagate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "disabled_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hli", "st_", "=_", "cp_", "._", "get_", "(_", "sect", "name_", ",_", "\"", "handler", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "hli", "st_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hli", "st_", "=_", "hli", "st_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hli", "st_", "=_", "\\u", "strip", "\\u", "spaces_", "(_", "hli", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "hand_", "in_", "hli", "st_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "add", "Handler_", "(_", "handlers_", "[_", "hand_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Disa", "ble", " ", "any", " ", "old", " ", "logg", "ers", ".", " ", "There", "'", "s", " ", "no", " ", "point", " ", "delet", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", "them", " ", "as", " ", "other", " ", "thread", "s", " ", "may", " ", "continue", " ", "to", " ", "hold", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "#", "and", " ", "by", " ", "disa", "blin", "g", " ", "them", ",", " ", "you", " ", "stop", " ", "them", " ", "doi", "ng", " ", "any", " ", "logg", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "Ho", "we", "ver", ",", " ", "don", "'", "t", " ", "disable", " ", "child", "ren", " ", "of", " ", "named", " ", "logg", "ers", ",", " ", "as", " ", "tha", "t", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", "probab", "ly", " ", "not", " ", "what", " ", "was", " ", "inten", "ded", " ", "by", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "log_", "in_", "existing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "root_", "._", "manager_", "._", "logg", "er", "Dict_", "[_", "log_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "log_", "in_", "child", "\\u", "loggers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "level_", "=_", "logging_", "._", "NOT", "SET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "handlers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "propagate_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "disable", "\\u", "exist", "ing", "\\u", "loggers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "disabled_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "valid", "\\u", "ident_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "IDENTIFIER_", "._", "match_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Not", " ", "a", " ", "valid", " ", "Pyth", "on", " ", "identifi", "er", ":", " ", "%", "r", "'_", "%_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Converti", "ng", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "convert", "ing", " ", "dictionar", "y", " ", "wrapp", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Converti", "ng", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "dict_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "configurator", "_", "._", "convert_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "the", " ", "convert", "ed", " ", "value", " ", "is", " ", "different", ",", " ", "save", " ", "for", " ", "next", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "is_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "[_", "key_", "]_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "result_", ")_", "in_", "(_", "Converti", "ng", "Dict_", ",_", "Converti", "ng", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Converti", "ng", "Tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Converti", "ng", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "key_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "dict_", "._", "get_", "(_", "self_", ",_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "configurator", "_", "._", "convert_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "the", " ", "convert", "ed", " ", "value", " ", "is", " ", "different", ",", " ", "save", " ", "for", " ", "next", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "is_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "[_", "key_", "]_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "result_", ")_", "in_", "(_", "Converti", "ng", "Dict_", ",_", "Converti", "ng", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Converti", "ng", "Tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Converti", "ng", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pop_", "(_", "self_", ",_", "key_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "dict_", "._", "pop_", "(_", "self_", ",_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "configurator", "_", "._", "convert_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "result_", ")_", "in_", "(_", "Converti", "ng", "Dict_", ",_", "Converti", "ng", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Converti", "ng", "Tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Converti", "ng", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "convert", "ing", " ", "list", " ", "wrapp", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Converti", "ng", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "list_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "configurator", "_", "._", "convert_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "the", " ", "convert", "ed", " ", "value", " ", "is", " ", "different", ",", " ", "save", " ", "for", " ", "next", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "is_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "[_", "key_", "]_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "result_", ")_", "in_", "(_", "Converti", "ng", "Dict_", ",_", "Converti", "ng", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Converti", "ng", "Tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Converti", "ng", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pop_", "(_", "self_", ",_", "idx_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "list_", "._", "pop_", "(_", "self_", ",_", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "configurator", "_", "._", "convert_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "result_", ")_", "in_", "(_", "Converti", "ng", "Dict_", ",_", "Converti", "ng", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Converti", "ng", "Tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Converti", "ng", "Tuple_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "convert", "ing", " ", "tuple", " ", "wrapp", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Converti", "ng", "Tuple_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "tuple_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "configurator", "_", "._", "convert_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "result_", ")_", "in_", "(_", "Converti", "ng", "Dict_", ",_", "Converti", "ng", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Converti", "ng", "Tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Configurator_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "configurator", " ", "base", " ", "class", " ", "whi", "ch", " ", "defin", "es", " ", "some", " ", "usef", "ul", " ", "default", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONVERT", "\\u", "PATTERN_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "(?", "P", "<", "prefix", ">[", "a", "-", "z", "]+)", "://", "(?", "P", "<", "suff", "ix", ">.*)", "$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "WORD", "\\u", "PATTERN_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "\\\\", "s", "*(", "\\\\", "w", "+)\\\\", "s", "*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DOT", "\\u", "PATTERN_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "\\\\.\\\\", "s", "*(", "\\\\", "w", "+)\\\\", "s", "*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INDE", "X", "\\u", "PATTERN_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "\\\\[", "\\\\", "s", "*(", "\\\\", "w", "+)\\\\", "s", "*\\\\", "]\\\\", "s", "*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DIGIT", "\\u", "PATTERN_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "\\\\", "d", "+$", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value", "\\u", "converters_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ext", "'_", ":_", "'", "ext", "\\u", "convert", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cfg", "'_", ":_", "'", "cfg", "\\u", "convert", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "mig", "ht", " ", "want", " ", "to", " ", "use", " ", "a", " ", "different", " ", "one", ",", " ", "e", ".", "g", ".", " ", "importlib_", "\\u\\u\\uNL\\u\\u\\u_", "importer_", "=_", "\\u\\u", "import\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Configurator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "=_", "Converti", "ng", "Dict_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "._", "configurator", "_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Configurator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve_", "(_", "self_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Resolv", "e", " ", "string", "s", " ", "to", " ", "object", "s", " ", "usi", "ng", " ", "standard", " ", "import", " ", "and", " ", "attribute", "\\", "10", ";", " ", " ", " ", " ", "synta", "x", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "s_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used_", "=_", "name_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "self_", "._", "importer_", "(_", "used_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "frag_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "used_", "+=_", "'.'_", "+_", "frag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "found_", "=_", "getattr_", "(_", "found_", ",_", "frag_", ")_", "\\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 ", " ", "_", "self_", "._", "importer_", "(_", "used_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "getattr_", "(_", "found_", ",_", "frag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "found_", "\\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 ", " _", "e_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "Value", "Error_", "(_", "'", "Cann", "ot", " ", "resolve", " ", "%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "s_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "._", "\\u\\u", "caus", "e\\u", "\\u_", ",_", "v_", "._", "\\u\\u", "traceback", "\\u\\u_", "=_", "e_", ",_", "tb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Configurator_", "(_", "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_", "ext", "\\u", "convert_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Default", " ", "converter", " ", "for", " ", "the", " ", "ext", "://", " ", "protoc", "ol", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "resolve_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Configurator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cfg", "\\u", "convert_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Default", " ", "converter", " ", "for", " ", "the", " ", "cfg", "://", " ", "protoc", "ol", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rest_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "self_", "._", "WORD", "\\u", "PATTERN_", "._", "match_", "(_", "rest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Una", "ble", " ", "to", " ", "convert", " ", "%", "r", "\"_", "%_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rest_", "=_", "rest_", "[_", "m_", "._", "end_", "(_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "config_", "[_", "m_", "._", "groups_", "(_", ")_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "d", ",", " ", "rest_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "rest_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "self_", "._", "DOT", "\\u", "PATTERN_", "._", "match_", "(_", "rest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "d_", "=_", "d_", "[_", "m_", "._", "groups_", "(_", ")_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "m_", "=_", "self_", "._", "INDE", "X", "\\u", "PATTERN_", "._", "match_", "(_", "rest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "idx_", "=_", "m_", "._", "groups_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "DIGIT", "\\u", "PATTERN_", "._", "match_", "(_", "idx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "d_", "=_", "d_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "n_", "=_", "int_", "(_", "idx_", ")_", "#", " ", "try", " ", "as", " ", "number", " ", "first", " ", "(", "most", " ", "like", "ly", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "d_", "[_", "n_", "]_", "\\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 ", " ", " _", "d_", "=_", "d_", "[_", "idx_", "]_", "\\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_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rest_", "=_", "rest_", "[_", "m_", "._", "end_", "(_", ")_", ":_", "]_", "\\u\\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_", "(_", "'", "Una", "ble", " ", "to", " ", "convert", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", " ", "at", " ", "%", "r", "'_", "%_", "(_", "value_", ",_", "rest_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "rest", " ", "shou", "ld", " ", "be", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Configurator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "convert_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "values", " ", "to", " ", "an", " ", "appropr", "iate", " ", "type", ".", " ", "dict", "s", ",", " ", "lists", " ", "and", " ", "tuple", "s", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "replaced", " ", "by", " ", "thei", "r", " ", "convert", "ing", " ", "alternatives", ".", " ", "String", "s", " ", "are", " ", "checke", "d", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "see", " ", "if", " ", "the", "y", " ", "have", " ", "a", " ", "conve", "rsi", "on", " ", "format", " ", "and", " ", "are", " ", "convert", "ed", " ", "if", " ", "the", "y", " ", "do", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Converti", "ng", "Dict_", ")_", "and_", "isinstance_", "(_", "value_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Converti", "ng", "Dict_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "._", "configurator", "_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "value_", ",_", "Converti", "ng", "List_", ")_", "and_", "isinstance_", "(_", "value_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Converti", "ng", "List_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "._", "configurator", "_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "value_", ",_", "Converti", "ng", "Tuple_", ")_", "and_", "isinstance_", "(_", "value_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Converti", "ng", "Tuple_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "._", "configurator", "_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "#", " ", "str", " ", "for", " ", "py3", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "self_", "._", "CONVERT", "\\u", "PATTERN_", "._", "match_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "m_", "._", "groupdict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "d_", "[_", "'", "prefix", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "converter_", "=_", "self_", "._", "value", "\\u", "converters_", "._", "get_", "(_", "prefix_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "converter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "suffix_", "=_", "d_", "[_", "'", "suff", "ix", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "converter_", "=_", "getattr_", "(_", "self_", ",_", "converter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "converter_", "(_", "suffix_", ")_", "\\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_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Configurator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "configur", "e\\u", "custom_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Configure", " ", "an", " ", "object", " ", "with", " ", "a", " ", "user", "-", "supplie", "d", " ", "factor", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "config_", "._", "pop_", "(_", "'()'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "c_", ",_", "'\\u", "\\u", "call", "\\u\\u'_", ")_", "and_", "hasattr_", "(_", "types_", ",_", "'", "Class", "Type", "'_", ")_", "and_", "type_", "(_", "c_", ")_", "!=_", "types_", "._", "Class", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "resolve_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "props_", "=_", "config_", "._", "pop_", "(_", "'.'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "valid", " ", "identifiers_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "dict_", "(_", "[_", "(_", "k_", ",_", "config_", "[_", "k_", "]_", ")_", "for_", "k_", "in_", "config_", "if_", "valid", "\\u", "ident_", "(_", "k_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "c_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "value_", "in_", "props_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "result_", ",_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Configurator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "as", "\\u", "tuple_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Utili", "ty", " ", "function", " ", "whi", "ch", " ", "convert", "s", " ", "lists", " ", "to", " ", "tuple", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "tuple_", "(_", "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_", "Dict", "Configurator_", "(_", "Base", "Configurator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Configure", " ", "logg", "ing", " ", "usi", "ng", " ", "a", " ", "dictionar", "y", "-", "like", " ", "object", " ", "to", " ", "descri", "be", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "configura", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Configurator_", "(_", "Base", "Configurator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "configure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Do", " ", "the", " ", "configura", "tion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "self_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "version", "'_", "not_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "dictionar", "y", " ", "doe", "sn", "'", "t", " ", "speci", "fy", " ", "a", " ", "version", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "[_", "'", "version", "'_", "]_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Unsu", "ppo", "rted", " ", "version", ":", " ", "%", "s", "\"_", "%_", "config_", "[_", "'", "version", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "incremental", "_", "=_", "config_", "._", "pop_", "(_", "'", "incremental", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "DICT_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "incremental", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handlers_", "=_", "config_", "._", "get_", "(_", "'", "handler", "s", "'_", ",_", "EMP", "TY", "\\u", "DICT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "handlers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "name_", "not_", "in_", "logging_", "._", "\\u", "handlers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "'", "No", " ", "handler", " ", "found", " ", "with", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", " ", "%", "r", "'_", "%_", "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 ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "handler_", "=_", "logging_", "._", "\\u", "handlers_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler", "\\u", "config_", "=_", "handlers_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level_", "=_", "handler", "\\u", "config_", "._", "get_", "(_", "'", "level", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "handler_", "._", "set", "Level_", "(_", "logging_", "._", "\\u", "check", "Level_", "(_", "level_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "configur", "e", " ", "handler", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "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_", "loggers_", "=_", "config_", "._", "get_", "(_", "'", "logg", "ers", "'_", ",_", "EMP", "TY", "\\u", "DICT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "loggers_", ":_", "\\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_", "._", "configur", "e\\u", "logger_", "(_", "name_", ",_", "loggers_", "[_", "name_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "configur", "e", " ", "logg", "er", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root_", "=_", "config_", "._", "get_", "(_", "'", "root", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root_", ":_", "\\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_", "._", "configur", "e\\u", "root_", "(_", "root_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "configur", "e", " ", "root", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "logg", "er", ":", " ", "%", "s", "'_", "%_", "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 ", " _", "disable", "\\u", "existing_", "=_", "config_", "._", "pop_", "(_", "'", "disable", "\\u", "exist", "ing", "\\u", "logg", "ers", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "\\u", "handlers_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "logging_", "._", "\\u", "handler", "List_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "formatter", "s", " ", "first", " ", "-", " ", "the", "y", " ", "don", "'", "t", " ", "refer", " ", "to", " ", "anyt", "hing", " ", "else_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "=_", "config_", "._", "get_", "(_", "'", "formatter", "s", "'_", ",_", "EMP", "TY", "\\u", "DICT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "formatters_", ":_", "\\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 ", " ", " _", "formatters_", "[_", "name_", "]_", "=_", "self_", "._", "configur", "e\\u", "formatter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "configur", "e", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "formatter", " ", "%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "xt", ",", " ", "do", " ", "filter", "s", " ", "-", " ", "the", "y", " ", "don", "'", "t", " ", "refer", " ", "to", " ", "anyt", "hing", " ", "else", ",", " ", "eit", "her_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filters_", "=_", "config_", "._", "get_", "(_", "'", "filter", "s", "'_", ",_", "EMP", "TY", "\\u", "DICT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "filters_", ":_", "\\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 ", " ", " _", "filters_", "[_", "name_", "]_", "=_", "self_", "._", "configur", "e\\u", "filter_", "(_", "filters_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "configur", "e", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filter", " ", "%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "xt", ",", " ", "do", " ", "handler", "s", " ", "-", " ", "the", "y", " ", "refer", " ", "to", " ", "formatter", "s", " ", "and", " ", "filters_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", " ", "handler", "s", " ", "can", " ", "refer", " ", "to", " ", "other", " ", "handler", "s", ",", " ", "sort", " ", "the", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "allow", " ", "a", " ", "deterministic", " ", "order", " ", "of", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "handlers_", "=_", "config_", "._", "get_", "(_", "'", "handler", "s", "'_", ",_", "EMP", "TY", "\\u", "DICT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "sorted_", "(_", "handlers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "handler_", "=_", "self_", "._", "configur", "e\\u", "handler_", "(_", "handlers_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handlers_", "[_", "name_", "]_", "=_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "configur", "e", " ", "handler", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "xt", ",", " ", "do", " ", "logg", "ers", " ", "-", " ", "the", "y", " ", "refer", " ", "to", " ", "handler", "s", " ", "and", " ", "filters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "lose", " ", "the", " ", "exist", "ing", " ", "logg", "ers", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sinc", "e", " ", "other", " ", "thread", "s", " ", "may", " ", "have", " ", "pointers", " ", "to", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "exist", "ing", " ", "is", " ", "set", " ", "to", " ", "contain", " ", "all", " ", "exist", "ing", " ", "logg", "ers", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "and", " ", "as", " ", "we", " ", "go", " ", "through", " ", "the", " ", "new", " ", "configura", "tion", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "remove", " ", "any", " ", "whi", "ch", " ", "are", " ", "configur", "ed", ".", " ", "At", " ", "the", " ", "end", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "what", "'", "s", " ", "left", " ", "in", " ", "exist", "ing", " ", "is", " ", "the", " ", "set", " ", "of", " ", "loggers_", "\\u\\u\\uNL\\u\\u\\u_", "#", "whi", "ch", " ", "wer", "e", " ", "in", " ", "the", " ", "previ", "ous", " ", "configura", "tion", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "whi", "ch", " ", "are", " ", "not", " ", "in", " ", "the", " ", "new", " ", "configura", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root_", "=_", "logging_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "existing_", "=_", "root_", "._", "manager_", "._", "logg", "er", "Dict_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "The", " ", "list", " ", "need", "s", " ", "to", " ", "be", " ", "sorte", "d", " ", "so", " ", "tha", "t", " ", "we", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", "avoid", " ", "disa", "blin", "g", " ", "child", " ", "logg", "ers", " ", "of", " ", "explicit", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", "named", " ", "logg", "ers", ".", " ", "With", " ", "a", " ", "sorte", "d", " ", "list", " ", "it", " ", "is", " ", "easi", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", "to", " ", "find", " ", "the", " ", "child", " ", "logg", "ers", "._", "\\u\\u\\uNL\\u\\u\\u_", "existing_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "We", "'", "ll", " ", "keep", " ", "the", " ", "list", " ", "of", " ", "exist", "ing", " ", "loggers_", "\\u\\u\\uNL\\u\\u\\u_", "#", "whi", "ch", " ", "are", " ", "child", "ren", " ", "of", " ", "named", " ", "logg", "ers", " ", "here", "..._", "\\u\\u\\uNL\\u\\u\\u_", "child", "\\u", "loggers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "now", " ", "set", " ", "up", " ", "the", " ", "new", " ", "ones", "..._", "\\u\\u\\uNL\\u\\u\\u_", "loggers_", "=_", "config_", "._", "get_", "(_", "'", "logg", "ers", "'_", ",_", "EMP", "TY", "\\u", "DICT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "loggers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "\\u", "encoded_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "existing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "i_", "=_", "existing_", "._", "index_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefixed", "_", "=_", "name_", "+_", "\".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pf", "len_", "=_", "len_", "(_", "prefixed", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "existing_", "=_", "len_", "(_", "existing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "i_", "+_", "1_", "#", " ", "look", " ", "at", " ", "the", " ", "entry", " ", "after", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "i_", "<_", "num", "\\u", "existing_", ")_", "and_", "(_", "existing_", "[_", "i_", "]_", "[_", ":_", "pf", "len_", "]_", "==_", "prefixed", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "child", "\\u", "loggers_", "._", "append_", "(_", "existing_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "i_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "existing_", "._", "remove_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "configur", "e\\u", "logger_", "(_", "name_", ",_", "loggers_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "configur", "e", " ", "logg", "er", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Disa", "ble", " ", "any", " ", "old", " ", "logg", "ers", ".", " ", "There", "'", "s", " ", "no", " ", "point", " ", "delet", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", "them", " ", "as", " ", "other", " ", "thread", "s", " ", "may", " ", "continue", " ", "to", " ", "hold", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "#", "and", " ", "by", " ", "disa", "blin", "g", " ", "them", ",", " ", "you", " ", "stop", " ", "them", " ", "doi", "ng", " ", "any", " ", "logg", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "Ho", "we", "ver", ",", " ", "don", "'", "t", " ", "disable", " ", "child", "ren", " ", "of", " ", "named", " ", "logg", "ers", ",", " ", "as", " ", "tha", "t", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", "probab", "ly", " ", "not", " ", "what", " ", "was", " ", "inten", "ded", " ", "by", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "log_", "in_", "existing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "=_", "root_", "._", "manager_", "._", "logg", "er", "Dict_", "[_", "log_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "log_", "in_", "child", "\\u", "loggers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "level_", "=_", "logging_", "._", "NOT", "SET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "handlers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "propagate_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "disable", "\\u", "existing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "disabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "final", "ly", ",", " ", "do", " ", "the", " ", "root", " ", "logger_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root_", "=_", "config_", "._", "get_", "(_", "'", "root", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root_", ":_", "\\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_", "._", "configur", "e\\u", "root_", "(_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "configur", "e", " ", "root", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "logg", "er", ":", " ", "%", "s", "'_", "%_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Configurator_", "(_", "Base", "Configurator_", ")_", ":_", "\\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_", "configur", "e\\u", "formatter_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Configure", " ", "a", " ", "formatter", " ", "from", " ", "a", " ", "dictionar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'()'_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "factory_", "=_", "config_", "[_", "'()'_", "]_", "#", " ", "for", " ", "use", " ", "in", " ", "exception", " ", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "configur", "e\\u", "custom_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"'", "format", "'\"_", "not_", "in_", "str_", "(_", "te_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Name", " ", "of", " ", "parameter", " ", "change", "d", " ", "from", " ", "fmt", " ", "to", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "Retr", "y", " ", "with", " ", "old", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "Thi", "s", " ", "is", " ", "so", " ", "tha", "t", " ", "code", " ", "can", " ", "be", " ", "used", " ", "with", " ", "older", " ", "Pyth", "on", " ", "versions_", "\\u\\u\\uNL\\u\\u\\u_", "#(", "e", ".", "g", ".", " ", "by", " ", "Dj", "ang", "o", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "[_", "'", "fmt", "'_", "]_", "=_", "config_", "._", "pop_", "(_", "'", "format", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "[_", "'()'_", "]_", "=_", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "configur", "e\\u", "custom_", "(_", "config_", ")_", "\\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 ", " _", "fmt_", "=_", "config_", "._", "get_", "(_", "'", "format", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "mt_", "=_", "config_", "._", "get_", "(_", "'", "datef", "mt", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "logging_", "._", "Formatter_", "(_", "fmt_", ",_", "df", "mt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Configurator_", "(_", "Base", "Configurator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "configur", "e\\u", "filter_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Configure", " ", "a", " ", "filter", " ", "from", " ", "a", " ", "dictionar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'()'_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "configur", "e\\u", "custom_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "config_", "._", "get_", "(_", "'", "name", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "logging_", "._", "Filter_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Configurator_", "(_", "Base", "Configurator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "filters_", "(_", "self_", ",_", "filter", "er_", ",_", "filters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "filter", "s", " ", "to", " ", "a", " ", "filter", "er", " ", "from", " ", "a", " ", "list", " ", "of", " ", "names", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "filters_", ":_", "\\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 ", " _", "filter", "er_", "._", "add", "Filter_", "(_", "self_", "._", "config_", "[_", "'", "filter", "s", "'_", "]_", "[_", "f_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "add", " ", "filter", " ", "%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "f_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Configurator_", "(_", "Base", "Configurator_", ")_", ":_", "\\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_", "configur", "e\\u", "handler_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Configure", " ", "a", " ", "handler", " ", "from", " ", "a", " ", "dictionar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formatter_", "=_", "config_", "._", "pop_", "(_", "'", "formatter", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "formatter_", ":_", "\\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 ", " _", "formatter_", "=_", "self_", "._", "config_", "[_", "'", "formatter", "s", "'_", "]_", "[_", "formatter_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "set", " ", "formatter", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "formatter_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "level_", "=_", "config_", "._", "pop_", "(_", "'", "level", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "config_", "._", "pop_", "(_", "'", "filter", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'()'_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "config_", "._", "pop_", "(_", "'()'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "c_", ",_", "'\\u", "\\u", "call", "\\u\\u'_", ")_", "and_", "hasattr_", "(_", "types_", ",_", "'", "Class", "Type", "'_", ")_", "and_", "type_", "(_", "c_", ")_", "!=_", "types_", "._", "Class", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "resolve_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "factory_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "klass_", "=_", "self_", "._", "resolve_", "(_", "config_", "._", "pop_", "(_", "'", "class", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Special", " ", "case", " ", "for", " ", "handler", " ", "whi", "ch", " ", "refer", "s", " ", "to", " ", "anot", "her", " ", "handler_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "issubclass_", "(_", "klass_", ",_", "logging_", "._", "handlers_", "._", "Memo", "ry", "Handler_", ")_", "and_", "'", "target", "'_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "config_", "[_", "'", "target", "'_", "]_", "=_", "self_", "._", "config_", "[_", "'", "handler", "s", "'_", "]_", "[_", "config_", "[_", "'", "target", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "set", " ", "target", " ", "handler", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "config_", "[_", "'", "target", "'_", "]_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "issubclass_", "(_", "klass_", ",_", "logging_", "._", "handlers_", "._", "SMT", "PH", "andle", "r_", ")_", "and_", "'", "mail", "host", "'_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "[_", "'", "mail", "host", "'_", "]_", "=_", "self_", "._", "as", "\\u", "tuple_", "(_", "config_", "[_", "'", "mail", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "issubclass_", "(_", "klass_", ",_", "logging_", "._", "handlers_", "._", "Sys", "Log", "Handler_", ")_", "and_", "'", "address", "'_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "[_", "'", "address", "'_", "]_", "=_", "self_", "._", "as", "\\u", "tuple_", "(_", "config_", "[_", "'", "address", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "factory_", "=_", "klass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "=_", "dict_", "(_", "[_", "(_", "k_", ",_", "config_", "[_", "k_", "]_", ")_", "for_", "k_", "in_", "config_", "if_", "valid", "\\u", "ident_", "(_", "k_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "factory_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"'", "stream", "'\"_", "not_", "in_", "str_", "(_", "te_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "The", " ", "argu", "ment", " ", "name", " ", "change", "d", " ", "from", " ", "strm", " ", "to", " ", "stream_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Retr", "y", " ", "with", " ", "old", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "Thi", "s", " ", "is", " ", "so", " ", "tha", "t", " ", "code", " ", "can", " ", "be", " ", "used", " ", "with", " ", "older", " ", "Pyth", "on", " ", "versions_", "\\u\\u\\uNL\\u\\u\\u_", "#(", "e", ".", "g", ".", " ", "by", " ", "Dj", "ang", "o", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "[_", "'", "strm", "'_", "]_", "=_", "kwargs_", "._", "pop_", "(_", "'", "stream", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "factory_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "formatter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "set", "Formatter_", "(_", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "level_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "set", "Level_", "(_", "logging_", "._", "\\u", "check", "Level_", "(_", "level_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "filters_", "(_", "result_", ",_", "filters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Configurator_", "(_", "Base", "Configurator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "handlers_", "(_", "self_", ",_", "logger_", ",_", "handlers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "handler", "s", " ", "to", " ", "a", " ", "logg", "er", " ", "from", " ", "a", " ", "list", " ", "of", " ", "names", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "h_", "in_", "handlers_", ":_", "\\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 ", " _", "logger_", "._", "add", "Handler_", "(_", "self_", "._", "config_", "[_", "'", "handler", "s", "'_", "]_", "[_", "h_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Standard", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "add", " ", "handler", " ", "%", "r", ":", " ", "%", "s", "'_", "%_", "(_", "h_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Configurator_", "(_", "Base", "Configurator_", ")_", ":_", "\\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_", "common", "\\u", "logg", "er", "\\u", "config_", "(_", "self_", ",_", "logger_", ",_", "config_", ",_", "incremental", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "configura", "tion", " ", "whi", "ch", " ", "is", " ", "common", " ", "to", " ", "root", " ", "and", " ", "non", "-", "root", " ", "logg", "ers", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level_", "=_", "config_", "._", "get_", "(_", "'", "level", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "\\u", "check", "Level_", "(_", "level_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "incremental", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Remove", " ", "any", " ", "exist", "ing", " ", "handlers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "h_", "in_", "logger_", "._", "handlers_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "remove", "Handler_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "handlers_", "=_", "config_", "._", "get_", "(_", "'", "handler", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "handlers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "handlers_", "(_", "logger_", ",_", "handlers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filters_", "=_", "config_", "._", "get_", "(_", "'", "filter", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "filters_", "(_", "logger_", ",_", "filters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Configurator_", "(_", "Base", "Configurator_", ")_", ":_", "\\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_", "configur", "e\\u", "logger_", "(_", "self_", ",_", "name_", ",_", "config_", ",_", "incremental", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Configure", " ", "a", " ", "non", "-", "root", " ", "logg", "er", " ", "from", " ", "a", " ", "dictionar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "common", "\\u", "logg", "er", "\\u", "config_", "(_", "logger_", ",_", "config_", ",_", "incremental", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "propagate_", "=_", "config_", "._", "get_", "(_", "'", "propagate", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "propagate_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "propagate_", "=_", "propagate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Configurator_", "(_", "Base", "Configurator_", ")_", ":_", "\\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_", "configur", "e\\u", "root_", "(_", "self_", ",_", "config_", ",_", "incremental", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Configure", " ", "a", " ", "root", " ", "logg", "er", " ", "from", " ", "a", " ", "dictionar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "common", "\\u", "logg", "er", "\\u", "config_", "(_", "root_", ",_", "config_", ",_", "incremental", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dict", "Config_", "(_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Configure", " ", "logg", "ing", " ", "usi", "ng", " ", "a", " ", "dictionar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dict", "Config", "Class_", "(_", "config_", ")_", "._", "configure_", "(_", ")_", "\\u\\u\\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_", "listen_", "(_", "port_", "=_", "DEF", "AUL", "T", "\\u", "LOGGING", "\\u", "CONFIG", "\\u", "PORT_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Start", " ", "up", " ", "a", " ", "socket", " ", "server", " ", "on", " ", "the", " ", "specified", " ", "port", ",", " ", "and", " ", "listen", " ", "for", " ", "new", "\\", "10", ";", " ", " ", " ", " ", "configura", "tion", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", "se", " ", "will", " ", "be", " ", "sent", " ", "as", " ", "a", " ", "file", " ", "suit", "able", " ", "for", " ", "process", "ing", " ", "by", " ", "file", "Config", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "Thread", " ", "object", " ", "on", " ", "whi", "ch", " ", "you", " ", "can", " ", "call", " ", "start", "()", " ", "to", " ", "start", " ", "the", " ", "server", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "whi", "ch", " ", "you", " ", "can", " ", "join", "()", " ", "whe", "n", " ", "appropr", "iate", ".", " ", "To", " ", "stop", " ", "the", " ", "server", ",", " ", "call", "\\", "10", ";", " ", " ", " ", " ", "stop", "Listen", "ing", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "thread_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "listen", "()", " ", "need", "s", " ", "thread", "ing", " ", "to", " ", "work", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Config", "Stream", "Handler_", "(_", "Stream", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", "r", " ", "for", " ", "a", " ", "logg", "ing", " ", "configura", "tion", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "expect", "s", " ", "a", " ", "complete", "ly", " ", "new", " ", "logg", "ing", " ", "configura", "tion", " ", "and", " ", "use", "s", " ", "file", "Config", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "install", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", " ", "a", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "request", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "a", " ", "4", "-", "byte", " ", "length", ",", " ", "pack", "ed", " ", "usi", "ng", "\\", "10", ";", " ", " ", " ", " ", "struct", ".", "pack", "(\"", ">", "L", "\",", " ", "n", "),", " ", "followe", "d", " ", "by", " ", "the", " ", "config", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "es", " ", "file", "Config", "()", " ", "to", " ", "do", " ", "the", " ", "gru", "nt", " ", "work", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "self_", "._", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "=_", "conn_", "._", "recv_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "chunk_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sle", "n_", "=_", "struct_", "._", "unpack_", "(_", "\">", "L", "\"_", ",_", "chunk_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "=_", "self_", "._", "connection_", "._", "recv_", "(_", "sle", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "chunk_", ")_", "<_", "sle", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "chunk_", "=_", "chunk_", "+_", "conn_", "._", "recv_", "(_", "sle", "n_", "-_", "len_", "(_", "chunk_", ")_", ")_", "\\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 ", " ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "json_", "._", "loads_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "d_", ",_", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dict", "Config_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Apply", " ", "new", " ", "configura", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "file_", "=_", "c", "String", "IO_", "._", "String", "IO_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "file", "Config_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "board", "Interrupt_", ",_", "System", "Exit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "server_", "._", "ready_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "server_", "._", "ready_", "._", "set_", "(_", ")_", "\\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_", "socket_", "._", "error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "e_", "._", "args_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "errcode", "_", "=_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "errcode", "_", "!=_", "RESE", "T", "\\u", "ERROR_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\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_", "class_", "Config", "Sock", "et", "Receiver_", "(_", "Thread", "ing", "TC", "PS", "erver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "simple", " ", "TC", "P", " ", "socket", "-", "based", " ", "logg", "ing", " ", "config", " ", "receive", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "reus", "e\\u", "address_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "host_", "=_", "'", "local", "host", "'_", ",_", "port_", "=_", "DEF", "AUL", "T", "\\u", "LOGGING", "\\u", "CONFIG", "\\u", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "None_", ",_", "ready_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Thread", "ing", "TC", "PS", "erver_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "(_", "host_", ",_", "port_", ")_", ",_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "abort_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timeout_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ready_", "=_", "ready_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serve", "\\u", "unti", "l\\u", "stopped_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "java", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "select_", "import_", "cpy", "tho", "n", "\\u", "compatible", "\\u", "select_", "as_", "select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "select_", "import_", "select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "abort_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "abort_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rd_", ",_", "wr_", ",_", "ex_", "=_", "select_", "(_", "[_", "self_", "._", "socket_", "._", "fileno_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "]_", ",_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "handle", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "self_", "._", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "socket_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Server_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "rcv", "r_", ",_", "hdl", "r_", ",_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Server_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rcv", "r_", "=_", "rcv", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hdl", "r_", "=_", "hdl", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ready_", "=_", "threading_", "._", "Event_", "(_", ")_", "\\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 ", " _", "server_", "=_", "self_", "._", "rcv", "r_", "(_", "port_", "=_", "self_", "._", "port_", ",_", "handler_", "=_", "self_", "._", "hdl", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ready_", "=_", "self_", "._", "ready_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "port_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "port_", "=_", "server_", "._", "server", "\\u", "address_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ready_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "\\u", "listener_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "listener_", "=_", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "serve", "\\u", "unti", "l\\u", "stopped_", "(_", ")_", "\\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_", "Server_", "(_", "Config", "Sock", "et", "Receiver_", ",_", "Config", "Stream", "Handler_", ",_", "port_", ")_", "\\u\\u\\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_", "stop", "Listen", "ing_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sto", "p", " ", "the", " ", "listen", "ing", " ", "server", " ", "whi", "ch", " ", "was", " ", "created", " ", "with", " ", "a", " ", "call", " ", "to", " ", "listen", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "\\u", "listener_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "listener_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "listener_", "._", "abort_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "listener_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNE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content": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n u'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n u'data_exports.column': {\n 'Meta': {'ordering': \"['order']\", 'object_name': 'Column'},\n 'column': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'export': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['data_exports.Export']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'label': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),\n 'order': ('django.db.models.fields.PositiveIntegerField', [], {})\n },\n u'data_exports.export': {\n 'Meta': {'object_name': 'Export'},\n 'export_format': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['data_exports.Format']\", 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['contenttypes.ContentType']\"}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),\n 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'})\n },\n u'data_exports.format': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Format'},\n 'file_ext': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'mime': ('django.db.models.fields.CharField', [], {'max_length': '50'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),\n 'template': ('django.db.models.fields.CharField', [], {'max_length': '255'})\n }\n }\n\n complete_apps = ['data_exports']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding unique constraint on 'Export', fields ['slug']\n db.create_unique(u'data_exports_export', ['slug'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Removing unique constraint on 'Export', fields ['slug']\n db.delete_unique(u'data_exports_export', ['slug'])", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 14 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "data\\u", "export", "s", ".", "column", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "order", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Colum", "n", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "export", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "data\\u", "export", "s", ".", "Export", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "data\\u", "export", "s", ".", "export", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Export", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "export", "\\u", "format", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "data\\u", "export", "s", ".", "Format", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "data\\u", "export", "s", ".", "format", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Format", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "\\u", "ext", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "10", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "template", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "data\\u", "export", "s", "'_", "]_", "[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_", "#", " ", "Add", "ing", " ", "unique", " ", "constraint", " ", "on", " ", "'", "Export", "',", " ", "fields", " ", "['", "slug", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "unique_", "(_", "u", "'", "data\\u", "export", "s", "\\u", "export", "'_", ",_", "[_", "'", "slug", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "unique", " ", "constraint", " ", "on", " ", "'", "Export", "',", " ", "fields", " ", "['", "slug", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "unique_", "(_", "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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
jimmycallin/pydsm/pydsm/__init__.py
[ { "content": "# -*- coding: utf-8 -*-\n\n__title__ = 'pydsm'\n__version__ = '0.1'\n__author__ = 'Jimmy Callin'\n\nimport pickle\nimport bz2\nfrom pydsm.model import CooccurrenceDSM\nfrom pydsm.model import RandomIndexing\nfrom pydsm.indexmatrix import IndexMatrix\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def load(filepath):\n return pickle.load(bz2.open(filepath, 'rb'))", "metadata": "root.load", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def build(model,\n corpus,\n config=None,\n **kwargs):\n \"\"\"\n Builds a distributional semantic model.\n Parameters:\n model: A semantic model class.\n Available models:\n CooccurrenceDSM\n RandomIndexing\n corpus: Either a path to file or an iterable.\n\n Returns: A DSM.\n \"\"\"\n if config is None:\n config = {}\n config = dict(config, **kwargs)\n return model(corpus=corpus, **config)", "metadata": "root.build", "header": "['module', '___EOS___']", "index": 17 } ]
[ { "span": "from pydsm.model import CooccurrenceDSM", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 39 }, { "span": "from pydsm.model import RandomIndexing", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 38 }, { "span": "from pydsm.indexmatrix import IndexMatrix", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 41 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "title\\u\\u", "_", "=_", "'", "pyd", "sm", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "0.", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Ji", "mm", "y", " ", "Call", "in", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bz2", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyd", "sm_", "._", "model_", "import_", "Coo", "ccu", "rren", "ce", "DS", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyd", "sm_", "._", "model_", "import_", "Random", "Index", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyd", "sm_", "._", "index", "matrix_", "import_", "Index", "Matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "load_", "(_", "filepath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pickle_", "._", "load_", "(_", "bz2", "_", "._", "open_", "(_", "filepath_", ",_", "'", "rb", "'_", ")_", ")_", "\\u\\u\\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_", "(_", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "corpus_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Build", "s", " ", "a", " ", "distribu", "tion", "al", " ", "sema", "ntic", " ", "model", ".", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "model", ":", " ", "A", " ", "sema", "ntic", " ", "model", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "Avail", "able", " ", "model", "s", ":", "\\", "10", ";", " ", " ", "Coo", "ccu", "rren", "ce", "DS", "M", "\\", "10", ";", " ", " ", "Random", "Index", "ing", "\\", "10", ";", " ", " ", " ", " ", "corp", "us", ":", " ", "Ei", "ther", " ", "a", " ", "path", " ", "to", " ", "file", " ", "or", " ", "an", " ", "iterable", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", " ", "A", " ", "DS", "M", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "config_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=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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 ]
Unused import
CollabQ/CollabQ/.google_appengine/google/appengine/api/urlfetch_service_pb.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2007 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nfrom google.net.proto import ProtocolBuffer\nimport array\nimport dummy_thread as thread\n\n__pychecker__ = \"\"\"maxreturns=0 maxbranches=0 no-callinit\n unusednames=printElemNumber,debug_strs no-special\"\"\"\n\n\n\n\n__all__ = ['URLFetchServiceError','URLFetchRequest','URLFetchRequest_Header','URLFetchResponse','URLFetchResponse_Header']\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class URLFetchServiceError(ProtocolBuffer.ProtocolMessage):\n\n OK = 0\n INVALID_URL = 1\n FETCH_ERROR = 2\n UNSPECIFIED_ERROR = 3\n RESPONSE_TOO_LARGE = 4\n DEADLINE_EXCEEDED = 5\n\n _ErrorCode_NAMES = {\n 0: \"OK\",\n 1: \"INVALID_URL\",\n 2: \"FETCH_ERROR\",\n 3: \"UNSPECIFIED_ERROR\",\n 4: \"RESPONSE_TOO_LARGE\",\n 5: \"DEADLINE_EXCEEDED\",\n }\n\n ErrorCode_Name = classmethod(ErrorCode_Name)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n }, 0)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n }, 0, ProtocolBuffer.Encoder.MAX_TYPE)\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"", "metadata": "root.URLFetchServiceError", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, \"\")", "metadata": "root.URLFetchServiceError.ErrorCode_Name", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 42 }, { "content": " def __init__(self, contents=None):\n pass\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.URLFetchServiceError.__init__", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 46 }, { "content": " def MergeFrom(self, x):\n assert x is not self", "metadata": "root.URLFetchServiceError.MergeFrom", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 51 }, { "content": " def Equals(self, x):\n if x is self: return 1\n return 1", "metadata": "root.URLFetchServiceError.Equals", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 54 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n return initialized", "metadata": "root.URLFetchServiceError.IsInitialized", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 58 }, { "content": " def ByteSize(self):\n n = 0\n return n + 0", "metadata": "root.URLFetchServiceError.ByteSize", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 62 }, { "content": " def Clear(self):\n pass", "metadata": "root.URLFetchServiceError.Clear", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 66 }, { "content": " def OutputUnchecked(self, out):\n pass", "metadata": "root.URLFetchServiceError.OutputUnchecked", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 69 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.URLFetchServiceError.TryMerge", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 72 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n return res", "metadata": "root.URLFetchServiceError.__str__", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 79 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.URLFetchServiceError._BuildTagLookupTable", "header": "['class', 'URLFetchServiceError', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 84 }, { "content": "class URLFetchRequest_Header(ProtocolBuffer.ProtocolMessage):\n has_key_ = 0\n key_ = \"\"\n has_value_ = 0\n value_ = \"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.URLFetchRequest_Header", "header": "['module', '___EOS___']", "index": 98 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.URLFetchRequest_Header.__init__", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 104 }, { "content": " def key(self): return self.key_", "metadata": "root.URLFetchRequest_Header.key", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 107 }, { "content": " def set_key(self, x):\n self.has_key_ = 1\n self.key_ = x", "metadata": "root.URLFetchRequest_Header.set_key", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 109 }, { "content": " def clear_key(self):\n if self.has_key_:\n self.has_key_ = 0\n self.key_ = \"\"", "metadata": "root.URLFetchRequest_Header.clear_key", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 113 }, { "content": " def has_key(self): return self.has_key_", "metadata": "root.URLFetchRequest_Header.has_key", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 118 }, { "content": " def value(self): return self.value_", "metadata": "root.URLFetchRequest_Header.value", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 120 }, { "content": " def set_value(self, x):\n self.has_value_ = 1\n self.value_ = x", "metadata": "root.URLFetchRequest_Header.set_value", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 122 }, { "content": " def clear_value(self):\n if self.has_value_:\n self.has_value_ = 0\n self.value_ = \"\"", "metadata": "root.URLFetchRequest_Header.clear_value", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 126 }, { "content": " def has_value(self): return self.has_value_", "metadata": "root.URLFetchRequest_Header.has_value", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 131 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_key()): self.set_key(x.key())\n if (x.has_value()): self.set_value(x.value())", "metadata": "root.URLFetchRequest_Header.MergeFrom", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 134 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_key_ != x.has_key_: return 0\n if self.has_key_ and self.key_ != x.key_: return 0\n if self.has_value_ != x.has_value_: return 0\n if self.has_value_ and self.value_ != x.value_: return 0\n return 1", "metadata": "root.URLFetchRequest_Header.Equals", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 139 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n if (not self.has_key_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: key not set.')\n if (not self.has_value_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: value not set.')\n return initialized", "metadata": "root.URLFetchRequest_Header.IsInitialized", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 147 }, { "content": " def ByteSize(self):\n n = 0\n n += self.lengthString(len(self.key_))\n n += self.lengthString(len(self.value_))\n return n + 2", "metadata": "root.URLFetchRequest_Header.ByteSize", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 159 }, { "content": " def Clear(self):\n self.clear_key()\n self.clear_value()", "metadata": "root.URLFetchRequest_Header.Clear", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 165 }, { "content": " def OutputUnchecked(self, out):\n out.putVarInt32(34)\n out.putPrefixedString(self.key_)\n out.putVarInt32(42)\n out.putPrefixedString(self.value_)", "metadata": "root.URLFetchRequest_Header.OutputUnchecked", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 169 }, { "content": " def TryMerge(self, d):\n while 1:\n tt = d.getVarInt32()\n if tt == 28: break\n if tt == 34:\n self.set_key(d.getPrefixedString())\n continue\n if tt == 42:\n self.set_value(d.getPrefixedString())\n continue\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.URLFetchRequest_Header.TryMerge", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 175 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_key_: res+=prefix+(\"Key: %s\\n\" % self.DebugFormatString(self.key_))\n if self.has_value_: res+=prefix+(\"Value: %s\\n\" % self.DebugFormatString(self.value_))\n return res", "metadata": "root.URLFetchRequest_Header.__str__", "header": "['class', 'URLFetchRequest_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 189 }, { "content": "class URLFetchRequest(ProtocolBuffer.ProtocolMessage):\n\n GET = 1\n POST = 2\n HEAD = 3\n PUT = 4\n DELETE = 5\n\n _RequestMethod_NAMES = {\n 1: \"GET\",\n 2: \"POST\",\n 3: \"HEAD\",\n 4: \"PUT\",\n 5: \"DELETE\",\n }\n\n RequestMethod_Name = classmethod(RequestMethod_Name)\n\n has_method_ = 0\n method_ = 0\n has_url_ = 0\n url_ = \"\"\n has_payload_ = 0\n payload_ = \"\"\n has_followredirects_ = 0\n followredirects_ = 1\n has_deadline_ = 0\n deadline_ = 0.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 kMethod = 1\n kUrl = 2\n kHeaderGroup = 3\n kHeaderKey = 4\n kHeaderValue = 5\n kPayload = 6\n kFollowRedirects = 7\n kDeadline = 8\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"Method\",\n 2: \"Url\",\n 3: \"Header\",\n 4: \"Key\",\n 5: \"Value\",\n 6: \"Payload\",\n 7: \"FollowRedirects\",\n 8: \"Deadline\",\n }, 8)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.NUMERIC,\n 2: ProtocolBuffer.Encoder.STRING,\n 3: ProtocolBuffer.Encoder.STARTGROUP,\n 4: ProtocolBuffer.Encoder.STRING,\n 5: ProtocolBuffer.Encoder.STRING,\n 6: ProtocolBuffer.Encoder.STRING,\n 7: ProtocolBuffer.Encoder.NUMERIC,\n 8: ProtocolBuffer.Encoder.DOUBLE,\n }, 8, ProtocolBuffer.Encoder.MAX_TYPE)\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"", "metadata": "root.URLFetchRequest", "header": "['module', '___EOS___']", "index": 195 }, { "content": " def RequestMethod_Name(cls, x): return cls._RequestMethod_NAMES.get(x, \"\")", "metadata": "root.URLFetchRequest.RequestMethod_Name", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 211 }, { "content": " def __init__(self, contents=None):\n self.header_ = []\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.URLFetchRequest.__init__", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 225 }, { "content": " def method(self): return self.method_", "metadata": "root.URLFetchRequest.method", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 229 }, { "content": " def set_method(self, x):\n self.has_method_ = 1\n self.method_ = x", "metadata": "root.URLFetchRequest.set_method", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 231 }, { "content": " def clear_method(self):\n if self.has_method_:\n self.has_method_ = 0\n self.method_ = 0", "metadata": "root.URLFetchRequest.clear_method", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 235 }, { "content": " def has_method(self): return self.has_method_", "metadata": "root.URLFetchRequest.has_method", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 240 }, { "content": " def url(self): return self.url_", "metadata": "root.URLFetchRequest.url", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 242 }, { "content": " def set_url(self, x):\n self.has_url_ = 1\n self.url_ = x", "metadata": "root.URLFetchRequest.set_url", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 244 }, { "content": " def clear_url(self):\n if self.has_url_:\n self.has_url_ = 0\n self.url_ = \"\"", "metadata": "root.URLFetchRequest.clear_url", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 248 }, { "content": " def has_url(self): return self.has_url_", "metadata": "root.URLFetchRequest.has_url", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 253 }, { "content": " def header_size(self): return len(self.header_)", "metadata": "root.URLFetchRequest.header_size", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 255 }, { "content": " def header_list(self): return self.header_", "metadata": "root.URLFetchRequest.header_list", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 256 }, { "content": " def header(self, i):\n return self.header_[i]", "metadata": "root.URLFetchRequest.header", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 258 }, { "content": " def mutable_header(self, i):\n return self.header_[i]", "metadata": "root.URLFetchRequest.mutable_header", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 261 }, { "content": " def add_header(self):\n x = URLFetchRequest_Header()\n self.header_.append(x)\n return x", "metadata": "root.URLFetchRequest.add_header", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 264 }, { "content": " def clear_header(self):\n self.header_ = []", "metadata": "root.URLFetchRequest.clear_header", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 269 }, { "content": " def payload(self): return self.payload_", "metadata": "root.URLFetchRequest.payload", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 271 }, { "content": " def set_payload(self, x):\n self.has_payload_ = 1\n self.payload_ = x", "metadata": "root.URLFetchRequest.set_payload", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 273 }, { "content": " def clear_payload(self):\n if self.has_payload_:\n self.has_payload_ = 0\n self.payload_ = \"\"", "metadata": "root.URLFetchRequest.clear_payload", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 277 }, { "content": " def has_payload(self): return self.has_payload_", "metadata": "root.URLFetchRequest.has_payload", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 282 }, { "content": " def followredirects(self): return self.followredirects_", "metadata": "root.URLFetchRequest.followredirects", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 284 }, { "content": " def set_followredirects(self, x):\n self.has_followredirects_ = 1\n self.followredirects_ = x", "metadata": "root.URLFetchRequest.set_followredirects", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 286 }, { "content": " def clear_followredirects(self):\n if self.has_followredirects_:\n self.has_followredirects_ = 0\n self.followredirects_ = 1", "metadata": "root.URLFetchRequest.clear_followredirects", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 290 }, { "content": " def has_followredirects(self): return self.has_followredirects_", "metadata": "root.URLFetchRequest.has_followredirects", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 295 }, { "content": " def deadline(self): return self.deadline_", "metadata": "root.URLFetchRequest.deadline", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 297 }, { "content": " def set_deadline(self, x):\n self.has_deadline_ = 1\n self.deadline_ = x", "metadata": "root.URLFetchRequest.set_deadline", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 299 }, { "content": " def clear_deadline(self):\n if self.has_deadline_:\n self.has_deadline_ = 0\n self.deadline_ = 0.0", "metadata": "root.URLFetchRequest.clear_deadline", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 303 }, { "content": " def has_deadline(self): return self.has_deadline_", "metadata": "root.URLFetchRequest.has_deadline", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 308 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_method()): self.set_method(x.method())\n if (x.has_url()): self.set_url(x.url())\n for i in xrange(x.header_size()): self.add_header().CopyFrom(x.header(i))\n if (x.has_payload()): self.set_payload(x.payload())\n if (x.has_followredirects()): self.set_followredirects(x.followredirects())\n if (x.has_deadline()): self.set_deadline(x.deadline())", "metadata": "root.URLFetchRequest.MergeFrom", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 311 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_method_ != x.has_method_: return 0\n if self.has_method_ and self.method_ != x.method_: return 0\n if self.has_url_ != x.has_url_: return 0\n if self.has_url_ and self.url_ != x.url_: return 0\n if len(self.header_) != len(x.header_): return 0\n for e1, e2 in zip(self.header_, x.header_):\n if e1 != e2: return 0\n if self.has_payload_ != x.has_payload_: return 0\n if self.has_payload_ and self.payload_ != x.payload_: return 0\n if self.has_followredirects_ != x.has_followredirects_: return 0\n if self.has_followredirects_ and self.followredirects_ != x.followredirects_: return 0\n if self.has_deadline_ != x.has_deadline_: return 0\n if self.has_deadline_ and self.deadline_ != x.deadline_: return 0\n return 1", "metadata": "root.URLFetchRequest.Equals", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 320 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n if (not self.has_method_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: method not set.')\n if (not self.has_url_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: url not set.')\n for p in self.header_:\n if not p.IsInitialized(debug_strs): initialized=0\n return initialized", "metadata": "root.URLFetchRequest.IsInitialized", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 337 }, { "content": " def ByteSize(self):\n n = 0\n n += self.lengthVarInt64(self.method_)\n n += self.lengthString(len(self.url_))\n n += 2 * len(self.header_)\n for i in xrange(len(self.header_)): n += self.header_[i].ByteSize()\n if (self.has_payload_): n += 1 + self.lengthString(len(self.payload_))\n if (self.has_followredirects_): n += 2\n if (self.has_deadline_): n += 9\n return n + 2", "metadata": "root.URLFetchRequest.ByteSize", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 351 }, { "content": " def Clear(self):\n self.clear_method()\n self.clear_url()\n self.clear_header()\n self.clear_payload()\n self.clear_followredirects()\n self.clear_deadline()", "metadata": "root.URLFetchRequest.Clear", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 362 }, { "content": " def OutputUnchecked(self, out):\n out.putVarInt32(8)\n out.putVarInt32(self.method_)\n out.putVarInt32(18)\n out.putPrefixedString(self.url_)\n for i in xrange(len(self.header_)):\n out.putVarInt32(27)\n self.header_[i].OutputUnchecked(out)\n out.putVarInt32(28)\n if (self.has_payload_):\n out.putVarInt32(50)\n out.putPrefixedString(self.payload_)\n if (self.has_followredirects_):\n out.putVarInt32(56)\n out.putBoolean(self.followredirects_)\n if (self.has_deadline_):\n out.putVarInt32(65)\n out.putDouble(self.deadline_)", "metadata": "root.URLFetchRequest.OutputUnchecked", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 370 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 8:\n self.set_method(d.getVarInt32())\n continue\n if tt == 18:\n self.set_url(d.getPrefixedString())\n continue\n if tt == 27:\n self.add_header().TryMerge(d)\n continue\n if tt == 50:\n self.set_payload(d.getPrefixedString())\n continue\n if tt == 56:\n self.set_followredirects(d.getBoolean())\n continue\n if tt == 65:\n self.set_deadline(d.getDouble())\n continue\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.URLFetchRequest.TryMerge", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 389 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_method_: res+=prefix+(\"Method: %s\\n\" % self.DebugFormatInt32(self.method_))\n if self.has_url_: res+=prefix+(\"Url: %s\\n\" % self.DebugFormatString(self.url_))\n cnt=0\n for e in self.header_:\n elm=\"\"\n if printElemNumber: elm=\"(%d)\" % cnt\n res+=prefix+(\"Header%s {\\n\" % elm)\n res+=e.__str__(prefix + \" \", printElemNumber)\n res+=prefix+\"}\\n\"\n cnt+=1\n if self.has_payload_: res+=prefix+(\"Payload: %s\\n\" % self.DebugFormatString(self.payload_))\n if self.has_followredirects_: res+=prefix+(\"FollowRedirects: %s\\n\" % self.DebugFormatBool(self.followredirects_))\n if self.has_deadline_: res+=prefix+(\"Deadline: %s\\n\" % self.DebugFormat(self.deadline_))\n return res", "metadata": "root.URLFetchRequest.__str__", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 414 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.URLFetchRequest._BuildTagLookupTable", "header": "['class', 'URLFetchRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 432 }, { "content": "class URLFetchResponse_Header(ProtocolBuffer.ProtocolMessage):\n has_key_ = 0\n key_ = \"\"\n has_value_ = 0\n value_ = \"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.URLFetchResponse_Header", "header": "['module', '___EOS___']", "index": 470 }, { "content": " def __init__(self, contents=None):\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.URLFetchResponse_Header.__init__", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 476 }, { "content": " def key(self): return self.key_", "metadata": "root.URLFetchResponse_Header.key", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 479 }, { "content": " def set_key(self, x):\n self.has_key_ = 1\n self.key_ = x", "metadata": "root.URLFetchResponse_Header.set_key", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 481 }, { "content": " def clear_key(self):\n if self.has_key_:\n self.has_key_ = 0\n self.key_ = \"\"", "metadata": "root.URLFetchResponse_Header.clear_key", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 485 }, { "content": " def has_key(self): return self.has_key_", "metadata": "root.URLFetchResponse_Header.has_key", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 490 }, { "content": " def value(self): return self.value_", "metadata": "root.URLFetchResponse_Header.value", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 492 }, { "content": " def set_value(self, x):\n self.has_value_ = 1\n self.value_ = x", "metadata": "root.URLFetchResponse_Header.set_value", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 494 }, { "content": " def clear_value(self):\n if self.has_value_:\n self.has_value_ = 0\n self.value_ = \"\"", "metadata": "root.URLFetchResponse_Header.clear_value", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 498 }, { "content": " def has_value(self): return self.has_value_", "metadata": "root.URLFetchResponse_Header.has_value", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 503 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_key()): self.set_key(x.key())\n if (x.has_value()): self.set_value(x.value())", "metadata": "root.URLFetchResponse_Header.MergeFrom", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 506 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_key_ != x.has_key_: return 0\n if self.has_key_ and self.key_ != x.key_: return 0\n if self.has_value_ != x.has_value_: return 0\n if self.has_value_ and self.value_ != x.value_: return 0\n return 1", "metadata": "root.URLFetchResponse_Header.Equals", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 511 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n if (not self.has_key_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: key not set.')\n if (not self.has_value_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: value not set.')\n return initialized", "metadata": "root.URLFetchResponse_Header.IsInitialized", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 519 }, { "content": " def ByteSize(self):\n n = 0\n n += self.lengthString(len(self.key_))\n n += self.lengthString(len(self.value_))\n return n + 2", "metadata": "root.URLFetchResponse_Header.ByteSize", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 531 }, { "content": " def Clear(self):\n self.clear_key()\n self.clear_value()", "metadata": "root.URLFetchResponse_Header.Clear", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 537 }, { "content": " def OutputUnchecked(self, out):\n out.putVarInt32(34)\n out.putPrefixedString(self.key_)\n out.putVarInt32(42)\n out.putPrefixedString(self.value_)", "metadata": "root.URLFetchResponse_Header.OutputUnchecked", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 541 }, { "content": " def TryMerge(self, d):\n while 1:\n tt = d.getVarInt32()\n if tt == 28: break\n if tt == 34:\n self.set_key(d.getPrefixedString())\n continue\n if tt == 42:\n self.set_value(d.getPrefixedString())\n continue\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.URLFetchResponse_Header.TryMerge", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 547 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_key_: res+=prefix+(\"Key: %s\\n\" % self.DebugFormatString(self.key_))\n if self.has_value_: res+=prefix+(\"Value: %s\\n\" % self.DebugFormatString(self.value_))\n return res", "metadata": "root.URLFetchResponse_Header.__str__", "header": "['class', 'URLFetchResponse_Header', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 561 }, { "content": "class URLFetchResponse(ProtocolBuffer.ProtocolMessage):\n has_content_ = 0\n content_ = \"\"\n has_statuscode_ = 0\n statuscode_ = 0\n has_contentwastruncated_ = 0\n contentwastruncated_ = 0\n has_externalbytessent_ = 0\n externalbytessent_ = 0\n has_externalbytesreceived_ = 0\n externalbytesreceived_ = 0\n has_finalurl_ = 0\n finalurl_ = \"\"\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 kContent = 1\n kStatusCode = 2\n kHeaderGroup = 3\n kHeaderKey = 4\n kHeaderValue = 5\n kContentWasTruncated = 6\n kExternalBytesSent = 7\n kExternalBytesReceived = 8\n kFinalUrl = 9\n\n _TEXT = _BuildTagLookupTable({\n 0: \"ErrorCode\",\n 1: \"Content\",\n 2: \"StatusCode\",\n 3: \"Header\",\n 4: \"Key\",\n 5: \"Value\",\n 6: \"ContentWasTruncated\",\n 7: \"ExternalBytesSent\",\n 8: \"ExternalBytesReceived\",\n 9: \"FinalUrl\",\n }, 9)\n\n _TYPES = _BuildTagLookupTable({\n 0: ProtocolBuffer.Encoder.NUMERIC,\n 1: ProtocolBuffer.Encoder.STRING,\n 2: ProtocolBuffer.Encoder.NUMERIC,\n 3: ProtocolBuffer.Encoder.STARTGROUP,\n 4: ProtocolBuffer.Encoder.STRING,\n 5: ProtocolBuffer.Encoder.STRING,\n 6: ProtocolBuffer.Encoder.NUMERIC,\n 7: ProtocolBuffer.Encoder.NUMERIC,\n 8: ProtocolBuffer.Encoder.NUMERIC,\n 9: ProtocolBuffer.Encoder.STRING,\n }, 9, ProtocolBuffer.Encoder.MAX_TYPE)\n\n _STYLE = \"\"\"\"\"\"\n _STYLE_CONTENT_TYPE = \"\"\"\"\"\"", "metadata": "root.URLFetchResponse", "header": "['module', '___EOS___']", "index": 567 }, { "content": " def __init__(self, contents=None):\n self.header_ = []\n if contents is not None: self.MergeFromString(contents)", "metadata": "root.URLFetchResponse.__init__", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 581 }, { "content": " def content(self): return self.content_", "metadata": "root.URLFetchResponse.content", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 585 }, { "content": " def set_content(self, x):\n self.has_content_ = 1\n self.content_ = x", "metadata": "root.URLFetchResponse.set_content", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 587 }, { "content": " def clear_content(self):\n if self.has_content_:\n self.has_content_ = 0\n self.content_ = \"\"", "metadata": "root.URLFetchResponse.clear_content", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 591 }, { "content": " def has_content(self): return self.has_content_", "metadata": "root.URLFetchResponse.has_content", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 596 }, { "content": " def statuscode(self): return self.statuscode_", "metadata": "root.URLFetchResponse.statuscode", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 598 }, { "content": " def set_statuscode(self, x):\n self.has_statuscode_ = 1\n self.statuscode_ = x", "metadata": "root.URLFetchResponse.set_statuscode", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 600 }, { "content": " def clear_statuscode(self):\n if self.has_statuscode_:\n self.has_statuscode_ = 0\n self.statuscode_ = 0", "metadata": "root.URLFetchResponse.clear_statuscode", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 604 }, { "content": " def has_statuscode(self): return self.has_statuscode_", "metadata": "root.URLFetchResponse.has_statuscode", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 609 }, { "content": " def header_size(self): return len(self.header_)", "metadata": "root.URLFetchResponse.header_size", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 611 }, { "content": " def header_list(self): return self.header_", "metadata": "root.URLFetchResponse.header_list", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 612 }, { "content": " def header(self, i):\n return self.header_[i]", "metadata": "root.URLFetchResponse.header", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 614 }, { "content": " def mutable_header(self, i):\n return self.header_[i]", "metadata": "root.URLFetchResponse.mutable_header", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 617 }, { "content": " def add_header(self):\n x = URLFetchResponse_Header()\n self.header_.append(x)\n return x", "metadata": "root.URLFetchResponse.add_header", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 620 }, { "content": " def clear_header(self):\n self.header_ = []", "metadata": "root.URLFetchResponse.clear_header", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 625 }, { "content": " def contentwastruncated(self): return self.contentwastruncated_", "metadata": "root.URLFetchResponse.contentwastruncated", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 627 }, { "content": " def set_contentwastruncated(self, x):\n self.has_contentwastruncated_ = 1\n self.contentwastruncated_ = x", "metadata": "root.URLFetchResponse.set_contentwastruncated", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 629 }, { "content": " def clear_contentwastruncated(self):\n if self.has_contentwastruncated_:\n self.has_contentwastruncated_ = 0\n self.contentwastruncated_ = 0", "metadata": "root.URLFetchResponse.clear_contentwastruncated", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 633 }, { "content": " def has_contentwastruncated(self): return self.has_contentwastruncated_", "metadata": "root.URLFetchResponse.has_contentwastruncated", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 638 }, { "content": " def externalbytessent(self): return self.externalbytessent_", "metadata": "root.URLFetchResponse.externalbytessent", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 640 }, { "content": " def set_externalbytessent(self, x):\n self.has_externalbytessent_ = 1\n self.externalbytessent_ = x", "metadata": "root.URLFetchResponse.set_externalbytessent", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 642 }, { "content": " def clear_externalbytessent(self):\n if self.has_externalbytessent_:\n self.has_externalbytessent_ = 0\n self.externalbytessent_ = 0", "metadata": "root.URLFetchResponse.clear_externalbytessent", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 646 }, { "content": " def has_externalbytessent(self): return self.has_externalbytessent_", "metadata": "root.URLFetchResponse.has_externalbytessent", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 651 }, { "content": " def externalbytesreceived(self): return self.externalbytesreceived_", "metadata": "root.URLFetchResponse.externalbytesreceived", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 653 }, { "content": " def set_externalbytesreceived(self, x):\n self.has_externalbytesreceived_ = 1\n self.externalbytesreceived_ = x", "metadata": "root.URLFetchResponse.set_externalbytesreceived", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 655 }, { "content": " def clear_externalbytesreceived(self):\n if self.has_externalbytesreceived_:\n self.has_externalbytesreceived_ = 0\n self.externalbytesreceived_ = 0", "metadata": "root.URLFetchResponse.clear_externalbytesreceived", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 659 }, { "content": " def has_externalbytesreceived(self): return self.has_externalbytesreceived_", "metadata": "root.URLFetchResponse.has_externalbytesreceived", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 664 }, { "content": " def finalurl(self): return self.finalurl_", "metadata": "root.URLFetchResponse.finalurl", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 666 }, { "content": " def set_finalurl(self, x):\n self.has_finalurl_ = 1\n self.finalurl_ = x", "metadata": "root.URLFetchResponse.set_finalurl", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 668 }, { "content": " def clear_finalurl(self):\n if self.has_finalurl_:\n self.has_finalurl_ = 0\n self.finalurl_ = \"\"", "metadata": "root.URLFetchResponse.clear_finalurl", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 672 }, { "content": " def has_finalurl(self): return self.has_finalurl_", "metadata": "root.URLFetchResponse.has_finalurl", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 677 }, { "content": " def MergeFrom(self, x):\n assert x is not self\n if (x.has_content()): self.set_content(x.content())\n if (x.has_statuscode()): self.set_statuscode(x.statuscode())\n for i in xrange(x.header_size()): self.add_header().CopyFrom(x.header(i))\n if (x.has_contentwastruncated()): self.set_contentwastruncated(x.contentwastruncated())\n if (x.has_externalbytessent()): self.set_externalbytessent(x.externalbytessent())\n if (x.has_externalbytesreceived()): self.set_externalbytesreceived(x.externalbytesreceived())\n if (x.has_finalurl()): self.set_finalurl(x.finalurl())", "metadata": "root.URLFetchResponse.MergeFrom", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 680 }, { "content": " def Equals(self, x):\n if x is self: return 1\n if self.has_content_ != x.has_content_: return 0\n if self.has_content_ and self.content_ != x.content_: return 0\n if self.has_statuscode_ != x.has_statuscode_: return 0\n if self.has_statuscode_ and self.statuscode_ != x.statuscode_: return 0\n if len(self.header_) != len(x.header_): return 0\n for e1, e2 in zip(self.header_, x.header_):\n if e1 != e2: return 0\n if self.has_contentwastruncated_ != x.has_contentwastruncated_: return 0\n if self.has_contentwastruncated_ and self.contentwastruncated_ != x.contentwastruncated_: return 0\n if self.has_externalbytessent_ != x.has_externalbytessent_: return 0\n if self.has_externalbytessent_ and self.externalbytessent_ != x.externalbytessent_: return 0\n if self.has_externalbytesreceived_ != x.has_externalbytesreceived_: return 0\n if self.has_externalbytesreceived_ and self.externalbytesreceived_ != x.externalbytesreceived_: return 0\n if self.has_finalurl_ != x.has_finalurl_: return 0\n if self.has_finalurl_ and self.finalurl_ != x.finalurl_: return 0\n return 1", "metadata": "root.URLFetchResponse.Equals", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 690 }, { "content": " def IsInitialized(self, debug_strs=None):\n initialized = 1\n if (not self.has_statuscode_):\n initialized = 0\n if debug_strs is not None:\n debug_strs.append('Required field: statuscode not set.')\n for p in self.header_:\n if not p.IsInitialized(debug_strs): initialized=0\n return initialized", "metadata": "root.URLFetchResponse.IsInitialized", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 709 }, { "content": " def ByteSize(self):\n n = 0\n if (self.has_content_): n += 1 + self.lengthString(len(self.content_))\n n += self.lengthVarInt64(self.statuscode_)\n n += 2 * len(self.header_)\n for i in xrange(len(self.header_)): n += self.header_[i].ByteSize()\n if (self.has_contentwastruncated_): n += 2\n if (self.has_externalbytessent_): n += 1 + self.lengthVarInt64(self.externalbytessent_)\n if (self.has_externalbytesreceived_): n += 1 + self.lengthVarInt64(self.externalbytesreceived_)\n if (self.has_finalurl_): n += 1 + self.lengthString(len(self.finalurl_))\n return n + 1", "metadata": "root.URLFetchResponse.ByteSize", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 719 }, { "content": " def Clear(self):\n self.clear_content()\n self.clear_statuscode()\n self.clear_header()\n self.clear_contentwastruncated()\n self.clear_externalbytessent()\n self.clear_externalbytesreceived()\n self.clear_finalurl()", "metadata": "root.URLFetchResponse.Clear", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 731 }, { "content": " def OutputUnchecked(self, out):\n if (self.has_content_):\n out.putVarInt32(10)\n out.putPrefixedString(self.content_)\n out.putVarInt32(16)\n out.putVarInt32(self.statuscode_)\n for i in xrange(len(self.header_)):\n out.putVarInt32(27)\n self.header_[i].OutputUnchecked(out)\n out.putVarInt32(28)\n if (self.has_contentwastruncated_):\n out.putVarInt32(48)\n out.putBoolean(self.contentwastruncated_)\n if (self.has_externalbytessent_):\n out.putVarInt32(56)\n out.putVarInt64(self.externalbytessent_)\n if (self.has_externalbytesreceived_):\n out.putVarInt32(64)\n out.putVarInt64(self.externalbytesreceived_)\n if (self.has_finalurl_):\n out.putVarInt32(74)\n out.putPrefixedString(self.finalurl_)", "metadata": "root.URLFetchResponse.OutputUnchecked", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 740 }, { "content": " def TryMerge(self, d):\n while d.avail() > 0:\n tt = d.getVarInt32()\n if tt == 10:\n self.set_content(d.getPrefixedString())\n continue\n if tt == 16:\n self.set_statuscode(d.getVarInt32())\n continue\n if tt == 27:\n self.add_header().TryMerge(d)\n continue\n if tt == 48:\n self.set_contentwastruncated(d.getBoolean())\n continue\n if tt == 56:\n self.set_externalbytessent(d.getVarInt64())\n continue\n if tt == 64:\n self.set_externalbytesreceived(d.getVarInt64())\n continue\n if tt == 74:\n self.set_finalurl(d.getPrefixedString())\n continue\n if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError\n d.skipData(tt)", "metadata": "root.URLFetchResponse.TryMerge", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 763 }, { "content": " def __str__(self, prefix=\"\", printElemNumber=0):\n res=\"\"\n if self.has_content_: res+=prefix+(\"Content: %s\\n\" % self.DebugFormatString(self.content_))\n if self.has_statuscode_: res+=prefix+(\"StatusCode: %s\\n\" % self.DebugFormatInt32(self.statuscode_))\n cnt=0\n for e in self.header_:\n elm=\"\"\n if printElemNumber: elm=\"(%d)\" % cnt\n res+=prefix+(\"Header%s {\\n\" % elm)\n res+=e.__str__(prefix + \" \", printElemNumber)\n res+=prefix+\"}\\n\"\n cnt+=1\n if self.has_contentwastruncated_: res+=prefix+(\"ContentWasTruncated: %s\\n\" % self.DebugFormatBool(self.contentwastruncated_))\n if self.has_externalbytessent_: res+=prefix+(\"ExternalBytesSent: %s\\n\" % self.DebugFormatInt64(self.externalbytessent_))\n if self.has_externalbytesreceived_: res+=prefix+(\"ExternalBytesReceived: %s\\n\" % self.DebugFormatInt64(self.externalbytesreceived_))\n if self.has_finalurl_: res+=prefix+(\"FinalUrl: %s\\n\" % self.DebugFormatString(self.finalurl_))\n return res", "metadata": "root.URLFetchResponse.__str__", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 791 }, { "content": " def _BuildTagLookupTable(sparse, maxtag, default=None):\n return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])", "metadata": "root.URLFetchResponse._BuildTagLookupTable", "header": "['class', 'URLFetchResponse', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 810 } ]
[ { "span": "import array", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 12 }, { "span": "import dummy_thread as thread", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2007", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "net_", "._", "proto_", "import_", "Proto", "col", "Buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dummy", "\\u", "thread_", "as_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "pyche", "cker", "\\u\\u_", "=_", "\"\"\"", "maxr", "etu", "rn", "s", "=", "0", " ", "max", "branch", "es", "=", "0", " ", "no", "-", "call", "init", "\\", "10", ";", " ", "unu", "sed", "names", "=", "print", "Ele", "m", "Number", ",", "debug", "\\u", "strs", " ", "no", "-", "special", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "all\\u\\u_", "=_", "[_", "'", "URL", "Fe", "tch", "Service", "Error", "'_", ",_", "'", "URL", "Fe", "tch", "Request", "'_", ",_", "'", "URL", "Fe", "tch", "Request", "\\u", "Head", "er", "'_", ",_", "'", "URL", "Fe", "tch", "Respons", "e", "'_", ",_", "'", "URL", "Fe", "tch", "Respons", "e\\u", "Head", "er", "'_", "]_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "OK_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INVALID", "\\u", "URL_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FETCH", "\\u", "ERROR_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UNSPEC", "IFIED", "\\u", "ERROR_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RESPONSE", "\\u", "TOO", "\\u", "LARGE", "_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEAD", "LINE", "\\u", "EXCE", "EDE", "D_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Error", "Code", "\\u", "NAMES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "OK", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "INVALID", "\\u", "URL", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "FETCH", "\\u", "ERROR", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "\"", "UNSPEC", "IFIED", "\\u", "ERROR", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "\"", "RESPONSE", "\\u", "TOO", "\\u", "LARGE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "\"", "DEAD", "LINE", "\\u", "EXCE", "EDE", "D", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Error", "Code", "\\u", "Name_", "=_", "classmethod_", "(_", "Error", "Code", "\\u", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "0_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Error", "Code", "\\u", "Name_", "(_", "cls_", ",_", "x_", ")_", ":_", "return_", "cls_", "._", "\\u", "Error", "Code", "\\u", "NAMES_", "._", "get_", "(_", "x_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "+_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Service", "Error_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "key", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "value\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "key_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "key", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "key_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "key", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "key", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "key", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "key", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "key", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "key_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "key", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "value_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "value\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "value\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "value\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "value\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "value_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "value\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "key_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "key_", "(_", "x_", "._", "key_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "value_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "value_", "(_", "x_", "._", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "key", "\\u_", "!=_", "x_", "._", "has", "\\u", "key", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "key", "\\u_", "and_", "self_", "._", "key", "\\u_", "!=_", "x_", "._", "key", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "value\\u_", "!=_", "x_", "._", "has", "\\u", "value\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "value\\u_", "and_", "self_", "._", "value\\u_", "!=_", "x_", "._", "value\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "key", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "key", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "value\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "value", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "key", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "value\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "34_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "key", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int32_", "(_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "value\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "28_", ":_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "34_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "key_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "42_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "value_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "key", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Key", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "key", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "value\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Value", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "value\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "GET_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "POST_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HEAD_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PUT_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DELETE_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Request", "Meth", "od", "\\u", "NAMES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "GET", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "POST", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "\"", "HEAD", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "\"", "PU", "T", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "\"", "DELET", "E", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Request", "Meth", "od", "\\u", "Name_", "=_", "classmethod_", "(_", "Request", "Meth", "od", "\\u", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "method", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "url", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "payload", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "follow", "redirec", "ts", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "follow", "redirec", "ts", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "deadl", "ine", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deadl", "ine", "\\u_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\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uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "k", "Method_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Url_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Head", "er", "Group_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Head", "er", "Key_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Head", "er", "Value_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Payload_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Follow", "Redirects_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Dead", "line_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "Meth", "od", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "Ur", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "\"", "Head", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "\"", "Key", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "\"", "Value", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "6_", ":_", "\"", "Pay", "load", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "7_", ":_", "\"", "Follow", "Redirect", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "8_", ":_", "\"", "Dead", "line", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "START", "GROUP_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "6_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "7_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "8_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "DOUBLE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "8_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Request", "Meth", "od", "\\u", "Name_", "(_", "cls_", ",_", "x_", ")_", ":_", "return_", "cls_", "._", "\\u", "Request", "Meth", "od", "\\u", "NAMES_", "._", "get_", "(_", "x_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "header", "\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "method_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "method", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "method_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "method", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "method", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "method", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "method", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "method", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "method_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "method", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "url_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "url", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "url_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "url", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "url", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "url", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "url", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "url", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "url_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "url", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "header", "\\u", "size_", "(_", "self_", ")_", ":_", "return_", "len_", "(_", "self_", "._", "header", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "header", "\\u", "list_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "header", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "header_", "(_", "self_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "header", "\\u_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mutable", "\\u", "header_", "(_", "self_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "header", "\\u_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "URL", "Fe", "tch", "Request", "\\u", "Header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "header", "\\u_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "header", "\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "payload_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "payload", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "payload_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "payload", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "payload", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "payload_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "payload", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "payload", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "payload", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "payload_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "payload", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "follow", "redirects_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "follow", "redirec", "ts", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "follow", "redirects_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "follow", "redirec", "ts", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "follow", "redirec", "ts", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "follow", "redirects_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "follow", "redirec", "ts", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "follow", "redirec", "ts", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "follow", "redirec", "ts", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "follow", "redirects_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "follow", "redirec", "ts", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "deadline_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "deadl", "ine", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "deadline_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "deadl", "ine", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "deadl", "ine", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "deadline_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "deadl", "ine", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "deadl", "ine", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "deadl", "ine", "\\u_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "deadline_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "deadl", "ine", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "method_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "method_", "(_", "x_", "._", "method_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "url_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "url_", "(_", "x_", "._", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "x_", "._", "header", "\\u", "size_", "(_", ")_", ")_", ":_", "self_", "._", "add", "\\u", "header_", "(_", ")_", "._", "Copy", "From_", "(_", "x_", "._", "header_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "payload_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "payload_", "(_", "x_", "._", "payload_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "follow", "redirects_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "follow", "redirects_", "(_", "x_", "._", "follow", "redirects_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "deadline_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "deadline_", "(_", "x_", "._", "deadline_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "method", "\\u_", "!=_", "x_", "._", "has", "\\u", "method", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "method", "\\u_", "and_", "self_", "._", "method", "\\u_", "!=_", "x_", "._", "method", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "url", "\\u_", "!=_", "x_", "._", "has", "\\u", "url", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "url", "\\u_", "and_", "self_", "._", "url", "\\u_", "!=_", "x_", "._", "url", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "header", "\\u_", ")_", "!=_", "len_", "(_", "x_", "._", "header", "\\u_", ")_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e1_", ",_", "e2_", "in_", "zip_", "(_", "self_", "._", "header", "\\u_", ",_", "x_", "._", "header", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e1_", "!=_", "e2_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "payload", "\\u_", "!=_", "x_", "._", "has", "\\u", "payload", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "payload", "\\u_", "and_", "self_", "._", "payload", "\\u_", "!=_", "x_", "._", "payload", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "follow", "redirec", "ts", "\\u_", "!=_", "x_", "._", "has", "\\u", "follow", "redirec", "ts", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "follow", "redirec", "ts", "\\u_", "and_", "self_", "._", "follow", "redirec", "ts", "\\u_", "!=_", "x_", "._", "follow", "redirec", "ts", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "deadl", "ine", "\\u_", "!=_", "x_", "._", "has", "\\u", "deadl", "ine", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "deadl", "ine", "\\u_", "and_", "self_", "._", "deadl", "ine", "\\u_", "!=_", "x_", "._", "deadl", "ine", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "method", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "method", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "url", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "url", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "p_", "in_", "self_", "._", "header", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "p_", "._", "Is", "Initialized", "_", "(_", "debug", "\\u", "strs_", ")_", ":_", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "Var", "Int64", "_", "(_", "self_", "._", "method", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "url", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "2_", "*_", "len_", "(_", "self_", "._", "header", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "header", "\\u_", ")_", ")_", ":_", "n_", "+=_", "self_", "._", "header", "\\u_", "[_", "i_", "]_", "._", "Byte", "Size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "payload", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "payload", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "follow", "redirec", "ts", "\\u_", ")_", ":_", "n_", "+=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "deadl", "ine", "\\u_", ")_", ":_", "n_", "+=_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "payload_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "follow", "redirects_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "deadline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int32_", "(_", "self_", "._", "method", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int32_", "(_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "url", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "header", "\\u_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "27_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "header", "\\u_", "[_", "i_", "]_", "._", "Output", "Unc", "heck", "ed_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int32_", "(_", "28_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "payload", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "payload", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "follow", "redirec", "ts", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "56_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Boolean_", "(_", "self_", "._", "follow", "redirec", "ts", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "deadl", "ine", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "65_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Double_", "(_", "self_", "._", "deadl", "ine", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "method_", "(_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "18_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "url_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "27_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "header_", "(_", ")_", "._", "Tr", "y", "Merge_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "50_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "payload_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "56_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "follow", "redirects_", "(_", "d_", "._", "get", "Boolean_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "65_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "deadline_", "(_", "d_", "._", "get", "Double_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "method", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Meth", "od", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "Int32_", "(_", "self_", "._", "method", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "url", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Ur", "l", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "url", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "self_", "._", "header", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elm_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "print", "Ele", "m", "Number_", ":_", "elm_", "=_", "\"(", "%", "d", ")\"_", "%_", "cnt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Head", "er", "%", "s", " ", "{\\\\", "n", "\"_", "%_", "elm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "+=_", "e_", "._", "\\u\\u", "str\\u\\u_", "(_", "prefix_", "+_", "\"", " ", " ", "\"_", ",_", "print", "Ele", "m", "Number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "+=_", "prefix_", "+_", "\"}", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "payload", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Pay", "load", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "payload", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "follow", "redirec", "ts", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Follow", "Redirect", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "Bool_", "(_", "self_", "._", "follow", "redirec", "ts", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "deadl", "ine", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Dead", "line", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format_", "(_", "self_", "._", "deadl", "ine", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "key", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "value\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "key_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "key", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "key_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "key", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "key", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "key", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "key", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "key", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "key_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "key", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "value_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "value\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "value\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "value\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "value\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "value_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "value\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "key_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "key_", "(_", "x_", "._", "key_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "value_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "value_", "(_", "x_", "._", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "key", "\\u_", "!=_", "x_", "._", "has", "\\u", "key", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "key", "\\u_", "and_", "self_", "._", "key", "\\u_", "!=_", "x_", "._", "key", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "value\\u_", "!=_", "x_", "._", "has", "\\u", "value\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "value\\u_", "and_", "self_", "._", "value\\u_", "!=_", "x_", "._", "value\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "key", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "key", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "value\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "value", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "key", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "value\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "34_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "key", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int32_", "(_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "value\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "28_", ":_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "34_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "key_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "42_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "value_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "key", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Key", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "key", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "value\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Value", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "value\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "content", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "statusc", "ode", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statusc", "ode", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "wast", "runc", "ated", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "external", "bytes", "sent", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external", "bytes", "sent", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external", "bytes", "receive", "d\\u", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "final", "url", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "url", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "k", "Content_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Status", "Code_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Head", "er", "Group_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Head", "er", "Key_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Head", "er", "Value_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Conten", "t", "Wa", "s", "Truncate", "d_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Exter", "nal", "Byte", "s", "Sent", "_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Exter", "nal", "Byte", "s", "Received_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "Final", "Url_", "=_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TEXT_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "Error", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "Conten", "t", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "Status", "Code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "\"", "Head", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "\"", "Key", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "\"", "Value", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "6_", ":_", "\"", "Conten", "t", "Wa", "s", "Truncate", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "7_", ":_", "\"", "Exter", "nal", "Byte", "s", "Sent", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "8_", ":_", "\"", "Exter", "nal", "Byte", "s", "Receive", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "9_", ":_", "\"", "Final", "Ur", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TYPES_", "=_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "START", "GROUP_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "6_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "7_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "8_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "NUMERIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "9_", ":_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "9_", ",_", "Proto", "col", "Buffer_", "._", "Encoder_", "._", "MAX", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "STYLE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "STYLE", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "contents_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "header", "\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contents_", "is_", "not_", "None_", ":_", "self_", "._", "Merge", "Fro", "m", "String_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "content_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "content", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "content_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "content", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "content_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "content", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "content", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "content_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "content", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "statusc", "ode_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "statusc", "ode", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "statusc", "ode_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "statusc", "ode", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "statusc", "ode", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "statusc", "ode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "statusc", "ode", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "statusc", "ode", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "statusc", "ode", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "statusc", "ode_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "statusc", "ode", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "header", "\\u", "size_", "(_", "self_", ")_", ":_", "return_", "len_", "(_", "self_", "._", "header", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "header", "\\u", "list_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "header", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "header_", "(_", "self_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "header", "\\u_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mutable", "\\u", "header_", "(_", "self_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "header", "\\u_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "URL", "Fe", "tch", "Respons", "e\\u", "Header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "header", "\\u_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "header", "\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "content", "wast", "runc", "ated", "_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "content", "wast", "runc", "ated", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "content", "wast", "runc", "ated", "_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content", "wast", "runc", "ated", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "content", "wast", "runc", "ated", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content", "wast", "runc", "ated", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "content", "wast", "runc", "ated", "_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "external", "bytes", "sent_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "external", "bytes", "sent", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "external", "bytes", "sent_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "external", "bytes", "sent", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "external", "bytes", "sent", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "external", "bytes", "sent_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "external", "bytes", "sent", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "external", "bytes", "sent", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "external", "bytes", "sent", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "external", "bytes", "sent_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "external", "bytes", "sent", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "external", "bytes", "received_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "external", "bytes", "receive", "d\\u", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "external", "bytes", "received_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "external", "bytes", "receive", "d\\u", "_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "external", "bytes", "received_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "external", "bytes", "receive", "d\\u", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "external", "bytes", "received_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "final", "url_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "final", "url", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "final", "url_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "final", "url", "\\u_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "final", "url", "\\u_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "\\u", "final", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "final", "url", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "final", "url", "\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "final", "url", "\\u_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "has", "\\u", "final", "url_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "has", "\\u", "final", "url", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Merge", "From_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "x_", "is_", "not_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "content_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "content_", "(_", "x_", "._", "content_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "statusc", "ode_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "statusc", "ode_", "(_", "x_", "._", "statusc", "ode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "x_", "._", "header", "\\u", "size_", "(_", ")_", ")_", ":_", "self_", "._", "add", "\\u", "header_", "(_", ")_", "._", "Copy", "From_", "(_", "x_", "._", "header_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "content", "wast", "runc", "ated", "_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "content", "wast", "runc", "ated", "_", "(_", "x_", "._", "content", "wast", "runc", "ated", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "external", "bytes", "sent_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "external", "bytes", "sent_", "(_", "x_", "._", "external", "bytes", "sent_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "external", "bytes", "received_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "external", "bytes", "received_", "(_", "x_", "._", "external", "bytes", "received_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x_", "._", "has", "\\u", "final", "url_", "(_", ")_", ")_", ":_", "self_", "._", "set\\u", "final", "url_", "(_", "x_", "._", "final", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "content", "\\u_", "!=_", "x_", "._", "has", "\\u", "content", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "content", "\\u_", "and_", "self_", "._", "content", "\\u_", "!=_", "x_", "._", "content", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "statusc", "ode", "\\u_", "!=_", "x_", "._", "has", "\\u", "statusc", "ode", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "statusc", "ode", "\\u_", "and_", "self_", "._", "statusc", "ode", "\\u_", "!=_", "x_", "._", "statusc", "ode", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "header", "\\u_", ")_", "!=_", "len_", "(_", "x_", "._", "header", "\\u_", ")_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e1_", ",_", "e2_", "in_", "zip_", "(_", "self_", "._", "header", "\\u_", ",_", "x_", "._", "header", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e1_", "!=_", "e2_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", "!=_", "x_", "._", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", "and_", "self_", "._", "content", "wast", "runc", "ated", "\\u_", "!=_", "x_", "._", "content", "wast", "runc", "ated", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "external", "bytes", "sent", "\\u_", "!=_", "x_", "._", "has", "\\u", "external", "bytes", "sent", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "external", "bytes", "sent", "\\u_", "and_", "self_", "._", "external", "bytes", "sent", "\\u_", "!=_", "x_", "._", "external", "bytes", "sent", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", "!=_", "x_", "._", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", "and_", "self_", "._", "external", "bytes", "receive", "d\\u", "_", "!=_", "x_", "._", "external", "bytes", "receive", "d\\u", "_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "final", "url", "\\u_", "!=_", "x_", "._", "has", "\\u", "final", "url", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "final", "url", "\\u_", "and_", "self_", "._", "final", "url", "\\u_", "!=_", "x_", "._", "final", "url", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Initialized", "_", "(_", "self_", ",_", "debug", "\\u", "strs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "has", "\\u", "statusc", "ode", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug", "\\u", "strs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "strs_", "._", "append_", "(_", "'", "Requ", "ired", " ", "field", ":", " ", "statusc", "ode", " ", "not", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "p_", "in_", "self_", "._", "header", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "p_", "._", "Is", "Initialized", "_", "(_", "debug", "\\u", "strs_", ")_", ":_", "initialized_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Byte", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "content", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "content", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "self_", "._", "length", "Var", "Int64", "_", "(_", "self_", "._", "statusc", "ode", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "2_", "*_", "len_", "(_", "self_", "._", "header", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "header", "\\u_", ")_", ")_", ":_", "n_", "+=_", "self_", "._", "header", "\\u_", "[_", "i_", "]_", "._", "Byte", "Size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", ")_", ":_", "n_", "+=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "external", "bytes", "sent", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "Var", "Int64", "_", "(_", "self_", "._", "external", "bytes", "sent", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "Var", "Int64", "_", "(_", "self_", "._", "external", "bytes", "receive", "d\\u", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "final", "url", "\\u_", ")_", ":_", "n_", "+=_", "1_", "+_", "self_", "._", "length", "String_", "(_", "len_", "(_", "self_", "._", "final", "url", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "n_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "content_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "statusc", "ode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "content", "wast", "runc", "ated", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "external", "bytes", "sent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "external", "bytes", "received_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "final", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Output", "Unc", "heck", "ed_", "(_", "self_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "content", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "content", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "._", "put", "Var", "Int32_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int32_", "(_", "self_", "._", "statusc", "ode", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "self_", "._", "header", "\\u_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "27_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "header", "\\u_", "[_", "i_", "]_", "._", "Output", "Unc", "heck", "ed_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int32_", "(_", "28_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "48_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Boolean_", "(_", "self_", "._", "content", "wast", "runc", "ated", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "external", "bytes", "sent", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "56_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int64", "_", "(_", "self_", "._", "external", "bytes", "sent", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Var", "Int64", "_", "(_", "self_", "._", "external", "bytes", "receive", "d\\u", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "final", "url", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "put", "Var", "Int32_", "(_", "74_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "put", "Prefixe", "d", "String_", "(_", "self_", "._", "final", "url", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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_", "Tr", "y", "Merge_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "d_", "._", "avail_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tt_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "content_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "16_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "statusc", "ode_", "(_", "d_", "._", "get", "Var", "Int32_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "27_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "header_", "(_", ")_", "._", "Tr", "y", "Merge_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "48_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "content", "wast", "runc", "ated", "_", "(_", "d_", "._", "get", "Boolean_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "56_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "external", "bytes", "sent_", "(_", "d_", "._", "get", "Var", "Int64", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "64_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "external", "bytes", "received_", "(_", "d_", "._", "get", "Var", "Int64", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tt_", "==_", "74_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "final", "url_", "(_", "d_", "._", "get", "Prefixe", "d", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "tt_", "==_", "0_", ")_", ":_", "raise_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Buffer", "Decode", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "skip", "Data_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\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", "str\\u\\u_", "(_", "self_", ",_", "prefix_", "=_", "\"\"_", ",_", "print", "Ele", "m", "Number_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "content", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Conten", "t", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "content", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "statusc", "ode", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Status", "Code", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "Int32_", "(_", "self_", "._", "statusc", "ode", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "self_", "._", "header", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elm_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "print", "Ele", "m", "Number_", ":_", "elm_", "=_", "\"(", "%", "d", ")\"_", "%_", "cnt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Head", "er", "%", "s", " ", "{\\\\", "n", "\"_", "%_", "elm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "+=_", "e_", "._", "\\u\\u", "str\\u\\u_", "(_", "prefix_", "+_", "\"", " ", " ", "\"_", ",_", "print", "Ele", "m", "Number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "+=_", "prefix_", "+_", "\"}", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "content", "wast", "runc", "ated", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Conten", "t", "Wa", "s", "Truncate", "d", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "Bool_", "(_", "self_", "._", "content", "wast", "runc", "ated", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "external", "bytes", "sent", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Exter", "nal", "Byte", "s", "Sent", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "Int64", "_", "(_", "self_", "._", "external", "bytes", "sent", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "external", "bytes", "receive", "d\\u", "_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Exter", "nal", "Byte", "s", "Receive", "d", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "Int64", "_", "(_", "self_", "._", "external", "bytes", "receive", "d\\u", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "final", "url", "\\u_", ":_", "res_", "+=_", "prefix_", "+_", "(_", "\"", "Final", "Ur", "l", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "Deb", "ug", "Format", "String_", "(_", "self_", "._", "final", "url", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Fe", "tch", "Response_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Ta", "g", "Look", "up", "Table_", "(_", "sparse_", ",_", "maxt", "ag_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "(_", "[_", "sparse_", "._", "get_", "(_", "i_", ",_", "default_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "1_", "+_", "maxt", "ag_", ")_", "]_", ")_", "\\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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ejeschke/ginga/ginga/canvas/types/layer.py
[ { "content": "#\n# layers.py -- classes for special compound objects layered on\n# ginga canvases.\n#\n# Eric Jeschke ([email protected])\n#\n# Copyright (c) Eric R. Jeschke. All rights reserved.\n# This is open-source software licensed under a BSD license.\n# Please see the file LICENSE.txt for details.\n#\nfrom ginga.canvas.CanvasObject import (CanvasObjectBase,\n register_canvas_types)\nfrom ginga.misc.ParamSet import Param\nfrom ginga import Mixins\nfrom ginga.misc.log import get_logger\n\nfrom ..CompoundMixin import CompoundMixin\nfrom ..CanvasMixin import CanvasMixin\nfrom ..DrawingMixin import DrawingMixin\n\n\n\n\n\n\n\n\n\ncatalog = dict(compoundobject=CompoundObject, canvas=Canvas,\n drawingcanvas=DrawingCanvas)\nregister_canvas_types(catalog)\n\n\n#END\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CompoundObject(CompoundMixin, CanvasObjectBase):\n \"\"\"Compound object on a ImageViewCanvas.\n Parameters are:\n the child objects making up the compound object. Objects are drawn\n in the order listed.\n Example:\n CompoundObject(Point(x, y, radius, ...),\n Circle(x, y, radius, ...))\n This makes a point inside a circle.\n \"\"\"\n\n", "metadata": "root.CompoundObject", "header": "['module', '___EOS___']", "index": 21 }, { "content": " @classmethod\n def get_params_metadata(cls):\n return [\n ## Param(name='coord', type=str, default='data',\n ## valid=['data', 'wcs'],\n ## description=\"Set type of coordinates\"),\n ]", "metadata": "root.CompoundObject.get_params_metadata", "header": "['class', 'CompoundObject', '(', 'CompoundMixin', ',', 'CanvasObjectBase', ')', ':', '___EOS___']", "index": 32 }, { "content": " def __init__(self, *objects):\n CanvasObjectBase.__init__(self)\n CompoundMixin.__init__(self)\n self.objects = list(objects)\n self.logger = get_logger('foo', log_stderr=True, level=10)\n\n self.kind = 'compound'\n self.editable = False", "metadata": "root.CompoundObject.__init__", "header": "['class', 'CompoundObject', '(', 'CompoundMixin', ',', 'CanvasObjectBase', ')', ':', '___EOS___']", "index": 40 }, { "content": "class Canvas(CanvasMixin, CompoundObject):\n", "metadata": "root.Canvas", "header": "['module', '___EOS___']", "index": 50 }, { "content": " @classmethod\n def get_params_metadata(cls):\n return [\n ## Param(name='coord', type=str, default='data',\n ## valid=['data', 'wcs'],\n ## description=\"Set type of coordinates\"),\n ]", "metadata": "root.Canvas.get_params_metadata", "header": "['class', 'Canvas', '(', 'CanvasMixin', ',', 'CompoundObject', ')', ':', '___EOS___']", "index": 51 }, { "content": " def __init__(self, *objects):\n CompoundObject.__init__(self, *objects)\n CanvasMixin.__init__(self)\n\n self.kind = 'canvas'\n self.editable = False", "metadata": "root.Canvas.__init__", "header": "['class', 'Canvas', '(', 'CanvasMixin', ',', 'CompoundObject', ')', ':', '___EOS___']", "index": 59 }, { "content": "class DrawingCanvas(Mixins.UIMixin, DrawingMixin, Canvas):", "metadata": "root.DrawingCanvas", "header": "['module', '___EOS___']", "index": 67 }, { "content": " def __init__(self):\n Canvas.__init__(self)\n DrawingMixin.__init__(self)\n Mixins.UIMixin.__init__(self)\n\n self.kind = 'drawingcanvas'\n self.editable = False", "metadata": "root.DrawingCanvas.__init__", "header": "['class', 'DrawingCanvas', '(', 'Mixins', '.', 'UIMixin', ',', 'DrawingMixin', ',', 'Canvas', ')', ':', '___EOS___']", "index": 68 } ]
[ { "span": "from ginga.misc.ParamSet import Param", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 37 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "layer", "s", ".", "py", " ", "--", " ", "classe", "s", " ", "for", " ", "special", " ", "compo", "und", " ", "object", "s", " ", "layer", "ed", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ging", "a", " ", "canv", "ases", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Eri", "c", " ", "Je", "sch", "ke", " ", "(", "eric", "@", "nao", "j", ".", "org", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Eri", "c", " ", "R", ".", " ", "Je", "sch", "ke", ".", " ", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "open", "-", "source", " ", "software", " ", "license", "d", " ", "under", " ", "a", " ", "BS", "D", " ", "license", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ple", "ase", " ", "see", " ", "the", " ", "file", " ", "LICENSE", ".", "txt", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ging", "a_", "._", "canvas_", "._", "Can", "vas", "Object_", "import_", "(_", "Can", "vas", "Object", "Base_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "register", "\\u", "canv", "as", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ging", "a_", "._", "misc_", "._", "Param", "Set_", "import_", "Param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ging", "a_", "import_", "Mix", "ins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ging", "a_", "._", "misc_", "._", "log_", "import_", "get", "\\u", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "Compo", "und", "Mixin_", "import_", "Compo", "und", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "Can", "vas", "Mixin_", "import_", "Can", "vas", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "Draw", "ing", "Mixin_", "import_", "Draw", "ing", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "catalog_", "=_", "dict_", "(_", "compo", "undo", "bject_", "=_", "Compo", "und", "Object_", ",_", "canvas_", "=_", "Canvas_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "drawing", "canvas_", "=_", "Draw", "ing", "Canvas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "canv", "as", "\\u", "types_", "(_", "catalog_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "END_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Compo", "und", "Object_", "(_", "Compo", "und", "Mixin_", ",_", "Can", "vas", "Object", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compo", "und", " ", "object", " ", "on", " ", "a", " ", "Image", "View", "Can", "vas", ".", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", " ", "are", ":", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "child", " ", "object", "s", " ", "mak", "ing", " ", "up", " ", "the", " ", "compo", "und", " ", "object", ".", " ", " ", "Object", "s", " ", "are", " ", "draw", "n", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "order", " ", "liste", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", "Compo", "und", "Object", "(", "Point", "(", "x", ",", " ", "y", ",", " ", "radi", "us", ",", " ", "...)", ",", "\\", "10", ";", " ", " ", " ", "Circ", "le", "(", "x", ",", " ", "y", ",", " ", "radi", "us", ",", " ", "...)", ")", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "make", "s", " ", "a", " ", "point", " ", "insi", "de", " ", "a", " ", "circle", ".", "\\", "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_", "Compo", "und", "Object_", "(_", "Compo", "und", "Mixin_", ",_", "Can", "vas", "Object", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "params", "\\u", "metadata_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Param", "(", "name", "='", "coord", "',", " ", "type", "=", "str", ",", " ", "default", "='", "data", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", "valid", "=[", "'", "data", "',", " ", "'", "wcs", "']", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", "description", "=\"", "Set", " ", "type", " ", "of", " ", "coordinate", "s", "\")", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compo", "und", "Object_", "(_", "Compo", "und", "Mixin_", ",_", "Can", "vas", "Object", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "objects_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Can", "vas", "Object", "Base_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Compo", "und", "Mixin_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "objects_", "=_", "list_", "(_", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "=_", "get", "\\u", "logger_", "(_", "'", "foo", "'_", ",_", "log", "\\u", "stderr_", "=_", "True_", ",_", "level_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "kind_", "=_", "'", "compo", "und", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "editable_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Canvas_", "(_", "Can", "vas", "Mixin_", ",_", "Compo", "und", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Canvas_", "(_", "Can", "vas", "Mixin_", ",_", "Compo", "und", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "params", "\\u", "metadata_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Param", "(", "name", "='", "coord", "',", " ", "type", "=", "str", ",", " ", "default", "='", "data", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", "valid", "=[", "'", "data", "',", " ", "'", "wcs", "']", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", "description", "=\"", "Set", " ", "type", " ", "of", " ", "coordinate", "s", "\")", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Canvas_", "(_", "Can", "vas", "Mixin_", ",_", "Compo", "und", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "objects_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Compo", "und", "Object_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Can", "vas", "Mixin_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "kind_", "=_", "'", "canv", "as", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "editable_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Draw", "ing", "Canvas_", "(_", "Mix", "ins_", "._", "UI", "Mixin_", ",_", "Draw", "ing", "Mixin_", ",_", "Canvas_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Draw", "ing", "Canvas_", "(_", "Mix", "ins_", "._", "UI", "Mixin_", ",_", "Draw", "ing", "Mixin_", ",_", "Canvas_", ")_", ":_", "\\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 ", " _", "Canvas_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Draw", "ing", "Mixin_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mix", "ins_", "._", "UI", "Mixin_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "kind_", "=_", "'", "drawing", "canv", "as", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "editable_", "=_", "False_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused import
cloudera/hue/apps/impala/gen-py/beeswaxd/ttypes.py
[ { "content": "#\n# Autogenerated by Thrift Compiler (0.9.3)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n# options string: py:new_style\n#\n\nfrom thrift.Thrift import TType, TMessageType, TException, TApplicationException\nimport hive_metastore.ttypes\n\n\nfrom thrift.transport import TTransport\nfrom thrift.protocol import TBinaryProtocol, TProtocol\ntry:\n from thrift.protocol import fastbinary\nexcept:\n fastbinary = None\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class QueryState(object):\n CREATED = 0\n INITIALIZED = 1\n COMPILED = 2\n RUNNING = 3\n FINISHED = 4\n EXCEPTION = 5\n\n _VALUES_TO_NAMES = {\n 0: \"CREATED\",\n 1: \"INITIALIZED\",\n 2: \"COMPILED\",\n 3: \"RUNNING\",\n 4: \"FINISHED\",\n 5: \"EXCEPTION\",\n }\n\n _NAMES_TO_VALUES = {\n \"CREATED\": 0,\n \"INITIALIZED\": 1,\n \"COMPILED\": 2,\n \"RUNNING\": 3,\n \"FINISHED\": 4,\n \"EXCEPTION\": 5,\n }", "metadata": "root.QueryState", "header": "['module', '___EOS___']", "index": 20 }, { "content": "class Query(object):\n \"\"\"\n Attributes:\n - query\n - configuration\n - hadoop_user\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRING, 'query', None, None, ), # 1\n None, # 2\n (3, TType.LIST, 'configuration', (TType.STRING,None), None, ), # 3\n (4, TType.STRING, 'hadoop_user', None, None, ), # 4\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.Query", "header": "['module', '___EOS___']", "index": 47 }, { "content": " def __init__(self, query=None, configuration=None, hadoop_user=None,):\n self.query = query\n self.configuration = configuration\n self.hadoop_user = hadoop_user", "metadata": "root.Query.__init__", "header": "['class', 'Query', '(', 'object', ')', ':', '___EOS___']", "index": 63 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRING:\n self.query = iprot.readString()\n else:\n iprot.skip(ftype)\n elif fid == 3:\n if ftype == TType.LIST:\n self.configuration = []\n (_etype3, _size0) = iprot.readListBegin()\n for _i4 in xrange(_size0):\n _elem5 = iprot.readString()\n self.configuration.append(_elem5)\n iprot.readListEnd()\n else:\n iprot.skip(ftype)\n elif fid == 4:\n if ftype == TType.STRING:\n self.hadoop_user = iprot.readString()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.Query.read", "header": "['class', 'Query', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('Query')\n if self.query is not None:\n oprot.writeFieldBegin('query', TType.STRING, 1)\n oprot.writeString(self.query)\n oprot.writeFieldEnd()\n if self.configuration is not None:\n oprot.writeFieldBegin('configuration', TType.LIST, 3)\n oprot.writeListBegin(TType.STRING, len(self.configuration))\n for iter6 in self.configuration:\n oprot.writeString(iter6)\n oprot.writeListEnd()\n oprot.writeFieldEnd()\n if self.hadoop_user is not None:\n oprot.writeFieldBegin('hadoop_user', TType.STRING, 4)\n oprot.writeString(self.hadoop_user)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.Query.write", "header": "['class', 'Query', '(', 'object', ')', ':', '___EOS___']", "index": 102 }, { "content": " def validate(self):\n return", "metadata": "root.Query.validate", "header": "['class', 'Query', '(', 'object', ')', ':', '___EOS___']", "index": 125 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.query)\n value = (value * 31) ^ hash(self.configuration)\n value = (value * 31) ^ hash(self.hadoop_user)\n return value", "metadata": "root.Query.__hash__", "header": "['class', 'Query', '(', 'object', ')', ':', '___EOS___']", "index": 129 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.Query.__repr__", "header": "['class', 'Query', '(', 'object', ')', ':', '___EOS___']", "index": 136 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.Query.__eq__", "header": "['class', 'Query', '(', 'object', ')', ':', '___EOS___']", "index": 141 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.Query.__ne__", "header": "['class', 'Query', '(', 'object', ')', ':', '___EOS___']", "index": 144 }, { "content": "class QueryHandle(object):\n \"\"\"\n Attributes:\n - id\n - log_context\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRING, 'id', None, None, ), # 1\n (2, TType.STRING, 'log_context', None, None, ), # 2\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.QueryHandle", "header": "['module', '___EOS___']", "index": 147 }, { "content": " def __init__(self, id=None, log_context=None,):\n self.id = id\n self.log_context = log_context", "metadata": "root.QueryHandle.__init__", "header": "['class', 'QueryHandle', '(', 'object', ')', ':', '___EOS___']", "index": 160 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRING:\n self.id = iprot.readString()\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.STRING:\n self.log_context = iprot.readString()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.QueryHandle.read", "header": "['class', 'QueryHandle', '(', 'object', ')', ':', '___EOS___']", "index": 164 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('QueryHandle')\n if self.id is not None:\n oprot.writeFieldBegin('id', TType.STRING, 1)\n oprot.writeString(self.id)\n oprot.writeFieldEnd()\n if self.log_context is not None:\n oprot.writeFieldBegin('log_context', TType.STRING, 2)\n oprot.writeString(self.log_context)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.QueryHandle.write", "header": "['class', 'QueryHandle', '(', 'object', ')', ':', '___EOS___']", "index": 188 }, { "content": " def validate(self):\n return", "metadata": "root.QueryHandle.validate", "header": "['class', 'QueryHandle', '(', 'object', ')', ':', '___EOS___']", "index": 204 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.id)\n value = (value * 31) ^ hash(self.log_context)\n return value", "metadata": "root.QueryHandle.__hash__", "header": "['class', 'QueryHandle', '(', 'object', ')', ':', '___EOS___']", "index": 208 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.QueryHandle.__repr__", "header": "['class', 'QueryHandle', '(', 'object', ')', ':', '___EOS___']", "index": 214 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.QueryHandle.__eq__", "header": "['class', 'QueryHandle', '(', 'object', ')', ':', '___EOS___']", "index": 219 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.QueryHandle.__ne__", "header": "['class', 'QueryHandle', '(', 'object', ')', ':', '___EOS___']", "index": 222 }, { "content": "class QueryExplanation(object):\n \"\"\"\n Attributes:\n - textual\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRING, 'textual', None, None, ), # 1\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.QueryExplanation", "header": "['module', '___EOS___']", "index": 225 }, { "content": " def __init__(self, textual=None,):\n self.textual = textual", "metadata": "root.QueryExplanation.__init__", "header": "['class', 'QueryExplanation', '(', 'object', ')', ':', '___EOS___']", "index": 236 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRING:\n self.textual = iprot.readString()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.QueryExplanation.read", "header": "['class', 'QueryExplanation', '(', 'object', ')', ':', '___EOS___']", "index": 239 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('QueryExplanation')\n if self.textual is not None:\n oprot.writeFieldBegin('textual', TType.STRING, 1)\n oprot.writeString(self.textual)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.QueryExplanation.write", "header": "['class', 'QueryExplanation', '(', 'object', ')', ':', '___EOS___']", "index": 258 }, { "content": " def validate(self):\n return", "metadata": "root.QueryExplanation.validate", "header": "['class', 'QueryExplanation', '(', 'object', ')', ':', '___EOS___']", "index": 270 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.textual)\n return value", "metadata": "root.QueryExplanation.__hash__", "header": "['class', 'QueryExplanation', '(', 'object', ')', ':', '___EOS___']", "index": 274 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.QueryExplanation.__repr__", "header": "['class', 'QueryExplanation', '(', 'object', ')', ':', '___EOS___']", "index": 279 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.QueryExplanation.__eq__", "header": "['class', 'QueryExplanation', '(', 'object', ')', ':', '___EOS___']", "index": 284 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.QueryExplanation.__ne__", "header": "['class', 'QueryExplanation', '(', 'object', ')', ':', '___EOS___']", "index": 287 }, { "content": "class Results(object):\n \"\"\"\n Attributes:\n - ready\n - columns\n - data\n - start_row\n - has_more\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.BOOL, 'ready', None, None, ), # 1\n (2, TType.LIST, 'columns', (TType.STRING,None), None, ), # 2\n (3, TType.LIST, 'data', (TType.STRING,None), None, ), # 3\n (4, TType.I64, 'start_row', None, None, ), # 4\n (5, TType.BOOL, 'has_more', None, None, ), # 5\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.Results", "header": "['module', '___EOS___']", "index": 290 }, { "content": " def __init__(self, ready=None, columns=None, data=None, start_row=None, has_more=None,):\n self.ready = ready\n self.columns = columns\n self.data = data\n self.start_row = start_row\n self.has_more = has_more", "metadata": "root.Results.__init__", "header": "['class', 'Results', '(', 'object', ')', ':', '___EOS___']", "index": 309 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.BOOL:\n self.ready = iprot.readBool()\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.LIST:\n self.columns = []\n (_etype10, _size7) = iprot.readListBegin()\n for _i11 in xrange(_size7):\n _elem12 = iprot.readString()\n self.columns.append(_elem12)\n iprot.readListEnd()\n else:\n iprot.skip(ftype)\n elif fid == 3:\n if ftype == TType.LIST:\n self.data = []\n (_etype16, _size13) = iprot.readListBegin()\n for _i17 in xrange(_size13):\n _elem18 = iprot.readString()\n self.data.append(_elem18)\n iprot.readListEnd()\n else:\n iprot.skip(ftype)\n elif fid == 4:\n if ftype == TType.I64:\n self.start_row = iprot.readI64()\n else:\n iprot.skip(ftype)\n elif fid == 5:\n if ftype == TType.BOOL:\n self.has_more = iprot.readBool()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.Results.read", "header": "['class', 'Results', '(', 'object', ')', ':', '___EOS___']", "index": 316 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('Results')\n if self.ready is not None:\n oprot.writeFieldBegin('ready', TType.BOOL, 1)\n oprot.writeBool(self.ready)\n oprot.writeFieldEnd()\n if self.columns is not None:\n oprot.writeFieldBegin('columns', TType.LIST, 2)\n oprot.writeListBegin(TType.STRING, len(self.columns))\n for iter19 in self.columns:\n oprot.writeString(iter19)\n oprot.writeListEnd()\n oprot.writeFieldEnd()\n if self.data is not None:\n oprot.writeFieldBegin('data', TType.LIST, 3)\n oprot.writeListBegin(TType.STRING, len(self.data))\n for iter20 in self.data:\n oprot.writeString(iter20)\n oprot.writeListEnd()\n oprot.writeFieldEnd()\n if self.start_row is not None:\n oprot.writeFieldBegin('start_row', TType.I64, 4)\n oprot.writeI64(self.start_row)\n oprot.writeFieldEnd()\n if self.has_more is not None:\n oprot.writeFieldBegin('has_more', TType.BOOL, 5)\n oprot.writeBool(self.has_more)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.Results.write", "header": "['class', 'Results', '(', 'object', ')', ':', '___EOS___']", "index": 365 }, { "content": " def validate(self):\n return", "metadata": "root.Results.validate", "header": "['class', 'Results', '(', 'object', ')', ':', '___EOS___']", "index": 399 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.ready)\n value = (value * 31) ^ hash(self.columns)\n value = (value * 31) ^ hash(self.data)\n value = (value * 31) ^ hash(self.start_row)\n value = (value * 31) ^ hash(self.has_more)\n return value", "metadata": "root.Results.__hash__", "header": "['class', 'Results', '(', 'object', ')', ':', '___EOS___']", "index": 403 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.Results.__repr__", "header": "['class', 'Results', '(', 'object', ')', ':', '___EOS___']", "index": 412 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.Results.__eq__", "header": "['class', 'Results', '(', 'object', ')', ':', '___EOS___']", "index": 417 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.Results.__ne__", "header": "['class', 'Results', '(', 'object', ')', ':', '___EOS___']", "index": 420 }, { "content": "class ResultsMetadata(object):\n \"\"\"\n Metadata information about the results.\n Applicable only for SELECT.\n\n Attributes:\n - schema: The schema of the results\n - table_dir: The directory containing the results. Not applicable for partition table.\n - in_tablename: If the results are straight from an existing table, the table name.\n - delim: Field delimiter\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRUCT, 'schema', (hive_metastore.ttypes.Schema, hive_metastore.ttypes.Schema.thrift_spec), None, ), # 1\n (2, TType.STRING, 'table_dir', None, None, ), # 2\n (3, TType.STRING, 'in_tablename', None, None, ), # 3\n (4, TType.STRING, 'delim', None, None, ), # 4\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.ResultsMetadata", "header": "['module', '___EOS___']", "index": 423 }, { "content": " def __init__(self, schema=None, table_dir=None, in_tablename=None, delim=None,):\n self.schema = schema\n self.table_dir = table_dir\n self.in_tablename = in_tablename\n self.delim = delim", "metadata": "root.ResultsMetadata.__init__", "header": "['class', 'ResultsMetadata', '(', 'object', ')', ':', '___EOS___']", "index": 443 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRUCT:\n self.schema = hive_metastore.ttypes.Schema()\n self.schema.read(iprot)\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.STRING:\n self.table_dir = iprot.readString()\n else:\n iprot.skip(ftype)\n elif fid == 3:\n if ftype == TType.STRING:\n self.in_tablename = iprot.readString()\n else:\n iprot.skip(ftype)\n elif fid == 4:\n if ftype == TType.STRING:\n self.delim = iprot.readString()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.ResultsMetadata.read", "header": "['class', 'ResultsMetadata', '(', 'object', ')', ':', '___EOS___']", "index": 449 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('ResultsMetadata')\n if self.schema is not None:\n oprot.writeFieldBegin('schema', TType.STRUCT, 1)\n self.schema.write(oprot)\n oprot.writeFieldEnd()\n if self.table_dir is not None:\n oprot.writeFieldBegin('table_dir', TType.STRING, 2)\n oprot.writeString(self.table_dir)\n oprot.writeFieldEnd()\n if self.in_tablename is not None:\n oprot.writeFieldBegin('in_tablename', TType.STRING, 3)\n oprot.writeString(self.in_tablename)\n oprot.writeFieldEnd()\n if self.delim is not None:\n oprot.writeFieldBegin('delim', TType.STRING, 4)\n oprot.writeString(self.delim)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.ResultsMetadata.write", "header": "['class', 'ResultsMetadata', '(', 'object', ')', ':', '___EOS___']", "index": 484 }, { "content": " def validate(self):\n return", "metadata": "root.ResultsMetadata.validate", "header": "['class', 'ResultsMetadata', '(', 'object', ')', ':', '___EOS___']", "index": 508 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.schema)\n value = (value * 31) ^ hash(self.table_dir)\n value = (value * 31) ^ hash(self.in_tablename)\n value = (value * 31) ^ hash(self.delim)\n return value", "metadata": "root.ResultsMetadata.__hash__", "header": "['class', 'ResultsMetadata', '(', 'object', ')', ':', '___EOS___']", "index": 512 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.ResultsMetadata.__repr__", "header": "['class', 'ResultsMetadata', '(', 'object', ')', ':', '___EOS___']", "index": 520 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.ResultsMetadata.__eq__", "header": "['class', 'ResultsMetadata', '(', 'object', ')', ':', '___EOS___']", "index": 525 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.ResultsMetadata.__ne__", "header": "['class', 'ResultsMetadata', '(', 'object', ')', ':', '___EOS___']", "index": 528 }, { "content": "class BeeswaxException(TException):\n \"\"\"\n Attributes:\n - message\n - log_context\n - handle\n - errorCode\n - SQLState\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRING, 'message', None, None, ), # 1\n (2, TType.STRING, 'log_context', None, None, ), # 2\n (3, TType.STRUCT, 'handle', (QueryHandle, QueryHandle.thrift_spec), None, ), # 3\n (4, TType.I32, 'errorCode', None, 0, ), # 4\n (5, TType.STRING, 'SQLState', None, \" \", ), # 5\n )\n\n\n\n\n\n\n\n\n\n", "metadata": "root.BeeswaxException", "header": "['module', '___EOS___']", "index": 531 }, { "content": " def __init__(self, message=None, log_context=None, handle=None, errorCode=thrift_spec[4][4], SQLState=thrift_spec[5][4],):\n self.message = message\n self.log_context = log_context\n self.handle = handle\n self.errorCode = errorCode\n self.SQLState = SQLState", "metadata": "root.BeeswaxException.__init__", "header": "['class', 'BeeswaxException', '(', 'TException', ')', ':', '___EOS___']", "index": 550 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRING:\n self.message = iprot.readString()\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.STRING:\n self.log_context = iprot.readString()\n else:\n iprot.skip(ftype)\n elif fid == 3:\n if ftype == TType.STRUCT:\n self.handle = QueryHandle()\n self.handle.read(iprot)\n else:\n iprot.skip(ftype)\n elif fid == 4:\n if ftype == TType.I32:\n self.errorCode = iprot.readI32()\n else:\n iprot.skip(ftype)\n elif fid == 5:\n if ftype == TType.STRING:\n self.SQLState = iprot.readString()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.BeeswaxException.read", "header": "['class', 'BeeswaxException', '(', 'TException', ')', ':', '___EOS___']", "index": 557 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('BeeswaxException')\n if self.message is not None:\n oprot.writeFieldBegin('message', TType.STRING, 1)\n oprot.writeString(self.message)\n oprot.writeFieldEnd()\n if self.log_context is not None:\n oprot.writeFieldBegin('log_context', TType.STRING, 2)\n oprot.writeString(self.log_context)\n oprot.writeFieldEnd()\n if self.handle is not None:\n oprot.writeFieldBegin('handle', TType.STRUCT, 3)\n self.handle.write(oprot)\n oprot.writeFieldEnd()\n if self.errorCode is not None:\n oprot.writeFieldBegin('errorCode', TType.I32, 4)\n oprot.writeI32(self.errorCode)\n oprot.writeFieldEnd()\n if self.SQLState is not None:\n oprot.writeFieldBegin('SQLState', TType.STRING, 5)\n oprot.writeString(self.SQLState)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.BeeswaxException.write", "header": "['class', 'BeeswaxException', '(', 'TException', ')', ':', '___EOS___']", "index": 597 }, { "content": " def validate(self):\n return", "metadata": "root.BeeswaxException.validate", "header": "['class', 'BeeswaxException', '(', 'TException', ')', ':', '___EOS___']", "index": 625 }, { "content": " def __str__(self):\n return repr(self)", "metadata": "root.BeeswaxException.__str__", "header": "['class', 'BeeswaxException', '(', 'TException', ')', ':', '___EOS___']", "index": 629 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.message)\n value = (value * 31) ^ hash(self.log_context)\n value = (value * 31) ^ hash(self.handle)\n value = (value * 31) ^ hash(self.errorCode)\n value = (value * 31) ^ hash(self.SQLState)\n return value", "metadata": "root.BeeswaxException.__hash__", "header": "['class', 'BeeswaxException', '(', 'TException', ')', ':', '___EOS___']", "index": 632 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.BeeswaxException.__repr__", "header": "['class', 'BeeswaxException', '(', 'TException', ')', ':', '___EOS___']", "index": 641 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.BeeswaxException.__eq__", "header": "['class', 'BeeswaxException', '(', 'TException', ')', ':', '___EOS___']", "index": 646 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.BeeswaxException.__ne__", "header": "['class', 'BeeswaxException', '(', 'TException', ')', ':', '___EOS___']", "index": 649 }, { "content": "class QueryNotFoundException(TException):\n\n thrift_spec = (\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.QueryNotFoundException", "header": "['module', '___EOS___']", "index": 652 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.QueryNotFoundException.read", "header": "['class', 'QueryNotFoundException', '(', 'TException', ')', ':', '___EOS___']", "index": 657 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('QueryNotFoundException')\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.QueryNotFoundException.write", "header": "['class', 'QueryNotFoundException', '(', 'TException', ')', ':', '___EOS___']", "index": 671 }, { "content": " def validate(self):\n return", "metadata": "root.QueryNotFoundException.validate", "header": "['class', 'QueryNotFoundException', '(', 'TException', ')', ':', '___EOS___']", "index": 679 }, { "content": " def __str__(self):\n return repr(self)", "metadata": "root.QueryNotFoundException.__str__", "header": "['class', 'QueryNotFoundException', '(', 'TException', ')', ':', '___EOS___']", "index": 683 }, { "content": " def __hash__(self):\n value = 17\n return value", "metadata": "root.QueryNotFoundException.__hash__", "header": "['class', 'QueryNotFoundException', '(', 'TException', ')', ':', '___EOS___']", "index": 686 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.QueryNotFoundException.__repr__", "header": "['class', 'QueryNotFoundException', '(', 'TException', ')', ':', '___EOS___']", "index": 690 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.QueryNotFoundException.__eq__", "header": "['class', 'QueryNotFoundException', '(', 'TException', ')', ':', '___EOS___']", "index": 695 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.QueryNotFoundException.__ne__", "header": "['class', 'QueryNotFoundException', '(', 'TException', ')', ':', '___EOS___']", "index": 698 }, { "content": "class ConfigVariable(object):\n \"\"\"\n Represents a Hadoop-style configuration variable.\n\n Attributes:\n - key\n - value\n - description\n \"\"\"\n\n thrift_spec = (\n None, # 0\n (1, TType.STRING, 'key', None, None, ), # 1\n (2, TType.STRING, 'value', None, None, ), # 2\n (3, TType.STRING, 'description', None, None, ), # 3\n )\n\n\n\n\n\n\n\n\n", "metadata": "root.ConfigVariable", "header": "['module', '___EOS___']", "index": 701 }, { "content": " def __init__(self, key=None, value=None, description=None,):\n self.key = key\n self.value = value\n self.description = description", "metadata": "root.ConfigVariable.__init__", "header": "['class', 'ConfigVariable', '(', 'object', ')', ':', '___EOS___']", "index": 718 }, { "content": " def read(self, iprot):\n if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:\n fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))\n return\n iprot.readStructBegin()\n while True:\n (fname, ftype, fid) = iprot.readFieldBegin()\n if ftype == TType.STOP:\n break\n if fid == 1:\n if ftype == TType.STRING:\n self.key = iprot.readString()\n else:\n iprot.skip(ftype)\n elif fid == 2:\n if ftype == TType.STRING:\n self.value = iprot.readString()\n else:\n iprot.skip(ftype)\n elif fid == 3:\n if ftype == TType.STRING:\n self.description = iprot.readString()\n else:\n iprot.skip(ftype)\n else:\n iprot.skip(ftype)\n iprot.readFieldEnd()\n iprot.readStructEnd()", "metadata": "root.ConfigVariable.read", "header": "['class', 'ConfigVariable', '(', 'object', ')', ':', '___EOS___']", "index": 723 }, { "content": " def write(self, oprot):\n if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:\n oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))\n return\n oprot.writeStructBegin('ConfigVariable')\n if self.key is not None:\n oprot.writeFieldBegin('key', TType.STRING, 1)\n oprot.writeString(self.key)\n oprot.writeFieldEnd()\n if self.value is not None:\n oprot.writeFieldBegin('value', TType.STRING, 2)\n oprot.writeString(self.value)\n oprot.writeFieldEnd()\n if self.description is not None:\n oprot.writeFieldBegin('description', TType.STRING, 3)\n oprot.writeString(self.description)\n oprot.writeFieldEnd()\n oprot.writeFieldStop()\n oprot.writeStructEnd()", "metadata": "root.ConfigVariable.write", "header": "['class', 'ConfigVariable', '(', 'object', ')', ':', '___EOS___']", "index": 752 }, { "content": " def validate(self):\n return", "metadata": "root.ConfigVariable.validate", "header": "['class', 'ConfigVariable', '(', 'object', ')', ':', '___EOS___']", "index": 772 }, { "content": " def __hash__(self):\n value = 17\n value = (value * 31) ^ hash(self.key)\n value = (value * 31) ^ hash(self.value)\n value = (value * 31) ^ hash(self.description)\n return value", "metadata": "root.ConfigVariable.__hash__", "header": "['class', 'ConfigVariable', '(', 'object', ')', ':', '___EOS___']", "index": 776 }, { "content": " def __repr__(self):\n L = ['%s=%r' % (key, value)\n for key, value in self.__dict__.iteritems()]\n return '%s(%s)' % (self.__class__.__name__, ', '.join(L))", "metadata": "root.ConfigVariable.__repr__", "header": "['class', 'ConfigVariable', '(', 'object', ')', ':', '___EOS___']", "index": 783 }, { "content": " def __eq__(self, other):\n return isinstance(other, self.__class__) and self.__dict__ == other.__dict__", "metadata": "root.ConfigVariable.__eq__", "header": "['class', 'ConfigVariable', '(', 'object', ')', ':', '___EOS___']", "index": 788 }, { "content": " def __ne__(self, other):\n return not (self == other)", "metadata": "root.ConfigVariable.__ne__", "header": "['class', 'ConfigVariable', '(', 'object', ')', ':', '___EOS___']", "index": 791 } ]
[ { "span": "from thrift.Thrift import TType, TMessageType, TException, TApplicationException", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 80 }, { "span": "from thrift.protocol import TBinaryProtocol, TProtocol", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 54 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Auto", "generat", "ed", " ", "by", " ", "Thri", "ft", " ", "Compil", "er", " ", "(", "0.", "9.3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DO", " ", "NOT", " ", "EDIT", " ", "UNL", "ESS", " ", "YOU", " ", "ARE", " ", "SUR", "E", " ", "THA", "T", " ", "YOU", " ", "KN", "OW", " ", "WH", "AT", " ", "YOU", " ", "ARE", " ", "DOI", "NG_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "options", " ", "string", ":", " ", "py", ":", "new", "\\u", "style_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "thrift", "_", "._", "Thri", "ft_", "import_", "TT", "ype_", ",_", "TM", "essage", "Type_", ",_", "TE", "xcept", "ion_", ",_", "TA", "ppl", "ication", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hive", "\\u", "metas", "tore_", "._", "ttype", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "thrift", "_", "._", "transport_", "import_", "TT", "rans", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thrift", "_", "._", "protocol_", "import_", "TB", "inary", "Protocol_", ",_", "TP", "roto", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "thrift", "_", "._", "protocol_", "import_", "fastbinary_", "\\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 ", " _", "fastbinary_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Query", "State_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CREATED_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INITIAL", "IZED", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COMPIL", "ED_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RUNNING_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FINISH", "ED_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXCEPTION_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "VALU", "ES", "\\u", "TO", "\\u", "NAMES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "CREATE", "D", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "INITIAL", "IZED", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "COMPIL", "ED", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "\"", "RUNN", "ING", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "\"", "FINISH", "ED", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "\"", "EXCEPTION", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "NAMES", "\\u", "TO", "\\u", "VALUES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", "D", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "INITIAL", "IZED", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "COMPIL", "ED", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "RUNN", "ING", "\"_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FINISH", "ED", "\"_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EXCEPTION", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Query_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "query", "\\", "10", ";", " ", " ", " ", "-", " ", "configura", "tion", "\\", "10", ";", " ", " ", " ", "-", " ", "hadoop", "\\u", "user", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "query", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "TT", "ype_", "._", "LIST_", ",_", "'", "configura", "tion", "'_", ",_", "(_", "TT", "ype_", "._", "STRING_", ",_", "None_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "hadoop", "\\u", "user", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Query_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "query_", "=_", "None_", ",_", "configuration_", "=_", "None_", ",_", "hadoop", "\\u", "user_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "query_", "=_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "configuration_", "=_", "configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hadoop", "\\u", "user_", "=_", "hadoop", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\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_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "query_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "LIST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "configuration_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u", "etype", "3_", ",_", "\\u", "size", "0_", ")_", "=_", "iprot_", "._", "read", "List", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "i", "4_", "in_", "xrange_", "(_", "\\u", "size", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "elem", "5_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "configuration_", "._", "append_", "(_", "\\u", "elem", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "List", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hadoop", "\\u", "user_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\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 ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Query", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "query_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "query", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "configuration_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "configura", "tion", "'_", ",_", "TT", "ype_", "._", "LIST_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "List", "Begin_", "(_", "TT", "ype_", "._", "STRING_", ",_", "len_", "(_", "self_", "._", "configuration_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iter", "6_", "in_", "self_", "._", "configuration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "String_", "(_", "iter", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "List", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "hadoop", "\\u", "user_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "hadoop", "\\u", "user", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "hadoop", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "configuration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "hadoop", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query_", "(_", "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 ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Query", "Handle_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "id", "\\", "10", ";", " ", " ", " ", "-", " ", "log", "\\u", "context", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "id", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "log", "\\u", "context", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Query", "Handle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "id_", "=_", "None_", ",_", "log", "\\u", "context_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "id_", "=_", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "context_", "=_", "log", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Handle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\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_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "id_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "\\u", "context_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\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 ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Handle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Query", "Handle", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "id", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "log", "\\u", "context_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "log", "\\u", "context", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "log", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Handle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Handle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "log", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Handle_", "(_", "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 ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Handle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Handle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Query", "Expla", "nation_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "textu", "al", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "textu", "al", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Query", "Expla", "nation_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "textu", "al_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "textu", "al_", "=_", "textu", "al_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Expla", "nation_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\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_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "textu", "al_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\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 ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Expla", "nation_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Query", "Expla", "nati", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "textu", "al_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "textu", "al", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "textu", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Expla", "nation_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Expla", "nation_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "textu", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Expla", "nation_", "(_", "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 ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Expla", "nation_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Expla", "nation_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Results_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "read", "y", "\\", "10", ";", " ", " ", " ", "-", " ", "column", "s", "\\", "10", ";", " ", " ", " ", "-", " ", "data", "\\", "10", ";", " ", " ", " ", "-", " ", "start", "\\u", "row", "\\", "10", ";", " ", " ", " ", "-", " ", "has", "\\u", "more", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "BOOL_", ",_", "'", "read", "y", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "LIST_", ",_", "'", "column", "s", "'_", ",_", "(_", "TT", "ype_", "._", "STRING_", ",_", "None_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "TT", "ype_", "._", "LIST_", ",_", "'", "data", "'_", ",_", "(_", "TT", "ype_", "._", "STRING_", ",_", "None_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "TT", "ype_", "._", "I64_", ",_", "'", "start", "\\u", "row", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "TT", "ype_", "._", "BOOL_", ",_", "'", "has", "\\u", "more", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "5_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Results_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "ready_", "=_", "None_", ",_", "columns_", "=_", "None_", ",_", "data_", "=_", "None_", ",_", "start", "\\u", "row_", "=_", "None_", ",_", "has", "\\u", "more_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ready_", "=_", "ready_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "columns_", "=_", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "\\u", "row_", "=_", "start", "\\u", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "has", "\\u", "more_", "=_", "has", "\\u", "more_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Results_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\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_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "BOOL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ready_", "=_", "iprot_", "._", "read", "Bool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "LIST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "columns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u", "etype", "10_", ",_", "\\u", "size", "7_", ")_", "=_", "iprot_", "._", "read", "List", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "i1", "1_", "in_", "xrange_", "(_", "\\u", "size", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "elem", "12_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "columns_", "._", "append_", "(_", "\\u", "elem", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "List", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "LIST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u", "etype", "16_", ",_", "\\u", "size", "13_", ")_", "=_", "iprot_", "._", "read", "List", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "i1", "7_", "in_", "xrange_", "(_", "\\u", "size", "13_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "elem", "18_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "._", "append_", "(_", "\\u", "elem", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "List", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "I64_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start", "\\u", "row_", "=_", "iprot_", "._", "read", "I64_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "BOOL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "has", "\\u", "more_", "=_", "iprot_", "._", "read", "Bool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\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 ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Results_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Result", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "ready_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "read", "y", "'_", ",_", "TT", "ype_", "._", "BOOL_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Bool_", "(_", "self_", "._", "ready_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "columns_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "column", "s", "'_", ",_", "TT", "ype_", "._", "LIST_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "List", "Begin_", "(_", "TT", "ype_", "._", "STRING_", ",_", "len_", "(_", "self_", "._", "columns_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iter", "19_", "in_", "self_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "String_", "(_", "iter", "19_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "List", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "data", "'_", ",_", "TT", "ype_", "._", "LIST_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "List", "Begin_", "(_", "TT", "ype_", "._", "STRING_", ",_", "len_", "(_", "self_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iter", "20_", "in_", "self_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "String_", "(_", "iter", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "List", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "start", "\\u", "row_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "start", "\\u", "row", "'_", ",_", "TT", "ype_", "._", "I64_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "I64_", "(_", "self_", "._", "start", "\\u", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "more_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "has", "\\u", "more", "'_", ",_", "TT", "ype_", "._", "BOOL_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Bool_", "(_", "self_", "._", "has", "\\u", "more_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Results_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Results_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "ready_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "start", "\\u", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "has", "\\u", "more_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Results_", "(_", "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 ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Results_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Results_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Result", "s", "Metadata_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Meta", "data", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "results", ".", "\\", "10", ";", " ", " ", "Applica", "ble", " ", "only", " ", "for", " ", "SELECT", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "schema", ":", " ", "The", " ", "schema", " ", "of", " ", "the", " ", "results", "\\", "10", ";", " ", " ", " ", "-", " ", "table", "\\u", "dir", ":", " ", "The", " ", "director", "y", " ", "contain", "ing", " ", "the", " ", "results", ".", " ", "Not", " ", "applica", "ble", " ", "for", " ", "partit", "ion", " ", "table", ".", "\\", "10", ";", " ", " ", " ", "-", " ", "in", "\\u", "tablename", ":", " ", "If", " ", "the", " ", "results", " ", "are", " ", "straight", " ", "from", " ", "an", " ", "exist", "ing", " ", "table", ",", " ", "the", " ", "table", " ", "name", ".", "\\", "10", ";", " ", " ", " ", "-", " ", "delim", ":", " ", "Field", " ", "delimiter", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "schema", "'_", ",_", "(_", "hive", "\\u", "metas", "tore_", "._", "ttype", "s_", "._", "Schema_", ",_", "hive", "\\u", "metas", "tore_", "._", "ttype", "s_", "._", "Schema_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "table", "\\u", "dir", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "in", "\\u", "tablename", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "delim", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Result", "s", "Metadata_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "schema_", "=_", "None_", ",_", "table", "\\u", "dir_", "=_", "None_", ",_", "in", "\\u", "tablename_", "=_", "None_", ",_", "delim_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "schema_", "=_", "schema_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table", "\\u", "dir_", "=_", "table", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "in", "\\u", "tablename_", "=_", "in", "\\u", "tablename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delim_", "=_", "delim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "s", "Metadata_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\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_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "schema_", "=_", "hive", "\\u", "metas", "tore_", "._", "ttype", "s_", "._", "Schema_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "schema_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "table", "\\u", "dir_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "in", "\\u", "tablename_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "delim_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\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 ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "s", "Metadata_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Result", "s", "Meta", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "schema_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "schema", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "schema_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "table", "\\u", "dir_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "table", "\\u", "dir", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "table", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "in", "\\u", "tablename_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "in", "\\u", "tablename", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "in", "\\u", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "delim_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "delim", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "delim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "s", "Metadata_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "s", "Metadata_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "table", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "in", "\\u", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "delim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "s", "Metadata_", "(_", "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 ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "s", "Metadata_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "s", "Metadata_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Bee", "swa", "x", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "message", "\\", "10", ";", " ", " ", " ", "-", " ", "log", "\\u", "context", "\\", "10", ";", " ", " ", " ", "-", " ", "handle", "\\", "10", ";", " ", " ", " ", "-", " ", "error", "Code", "\\", "10", ";", " ", " ", " ", "-", " ", "SQL", "State", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "message", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "log", "\\u", "context", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "'", "handle", "'_", ",_", "(_", "Query", "Handle_", ",_", "Query", "Handle_", "._", "thrift", "\\u", "spec_", ")_", ",_", "None_", ",_", ")_", ",_", "#", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "TT", "ype_", "._", "I32_", ",_", "'", "error", "Code", "'_", ",_", "None_", ",_", "0_", ",_", ")_", ",_", "#", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "SQL", "State", "'_", ",_", "None_", ",_", "\"", " ", "\"_", ",_", ")_", ",_", "#", " ", "5_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bee", "swa", "x", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "message_", "=_", "None_", ",_", "log", "\\u", "context_", "=_", "None_", ",_", "handle_", "=_", "None_", ",_", "error", "Code_", "=_", "thrift", "\\u", "spec_", "[_", "4_", "]_", "[_", "4_", "]_", ",_", "SQL", "State_", "=_", "thrift", "\\u", "spec_", "[_", "5_", "]_", "[_", "4_", "]_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "message_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "context_", "=_", "log", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle_", "=_", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "Code_", "=_", "error", "Code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "SQL", "State_", "=_", "SQL", "State_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bee", "swa", "x", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\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_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "message_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "\\u", "context_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRUCT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handle_", "=_", "Query", "Handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle_", "._", "read_", "(_", "iprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "I32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error", "Code_", "=_", "iprot_", "._", "read", "I32_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "SQL", "State_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\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 ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bee", "swa", "x", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Bee", "swa", "x", "Except", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "message_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "message", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "log", "\\u", "context_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "log", "\\u", "context", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "log", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "handle_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "handle", "'_", ",_", "TT", "ype_", "._", "STRUCT_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle_", "._", "write_", "(_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "error", "Code_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "error", "Code", "'_", ",_", "TT", "ype_", "._", "I32_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "I32_", "(_", "self_", "._", "error", "Code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "SQL", "State_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "SQL", "State", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "SQL", "State_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bee", "swa", "x", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bee", "swa", "x", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "repr_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bee", "swa", "x", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "log", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "error", "Code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "SQL", "State_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bee", "swa", "x", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\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 ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bee", "swa", "x", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bee", "swa", "x", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Query", "Not", "Foun", "d", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Query", "Not", "Foun", "d", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Not", "Foun", "d", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Query", "Not", "Foun", "d", "Except", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Not", "Foun", "d", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Not", "Foun", "d", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "repr_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Not", "Foun", "d", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Not", "Foun", "d", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\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 ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Not", "Foun", "d", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Not", "Foun", "d", "Exception_", "(_", "TE", "xcept", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Config", "Variable_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Represent", "s", " ", "a", " ", "Had", "oop", "-", "style", " ", "configura", "tion", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "key", "\\", "10", ";", " ", " ", " ", "-", " ", "value", "\\", "10", ";", " ", " ", " ", "-", " ", "description", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thrift", "\\u", "spec_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "key", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "value", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "TT", "ype_", "._", "STRING_", ",_", "'", "description", "'_", ",_", "None_", ",_", "None_", ",_", ")_", ",_", "#", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Config", "Variable_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "key_", "=_", "None_", ",_", "value_", "=_", "None_", ",_", "description_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description_", "=_", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Variable_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "iprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "isinstance_", "(_", "iprot_", "._", "trans_", ",_", "TT", "rans", "port_", "._", "CR", "ead", "able", "Transport_", ")_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "._", "decode", "\\u", "binary_", "(_", "self_", ",_", "iprot_", "._", "trans_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "fname_", ",_", "ftype_", ",_", "fid_", ")_", "=_", "iprot_", "._", "read", "Field", "Begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ftype_", "==_", "TT", "ype_", "._", "STOP_", ":_", "\\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_", "if_", "fid_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "key_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fid_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ftype_", "==_", "TT", "ype_", "._", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "description_", "=_", "iprot_", "._", "read", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\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 ", " _", "iprot_", "._", "skip_", "(_", "ftype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iprot_", "._", "read", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Variable_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "oprot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "oprot_", "._", "\\u\\u", "class\\u\\u_", "==_", "TB", "inary", "Protocol_", "._", "TB", "inary", "Proto", "col", "Accelerated_", "and_", "self_", "._", "thrift", "\\u", "spec_", "is_", "not_", "None_", "and_", "fastbinary_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "trans_", "._", "write_", "(_", "fastbinary_", "._", "encode", "\\u", "binary_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", "._", "thrift", "\\u", "spec_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "Begin_", "(_", "'", "Config", "Varia", "ble", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "key", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "value", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "description_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "._", "write", "Field", "Begin_", "(_", "'", "description", "'_", ",_", "TT", "ype_", "._", "STRING_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "String_", "(_", "self_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Field", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oprot_", "._", "write", "Field", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oprot_", "._", "write", "Stru", "ct", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Variable_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Variable_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "17_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "(_", "value_", "*_", "31_", ")_", "^_", "hash_", "(_", "self_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Variable_", "(_", "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 ", " _", "L_", "=_", "[_", "'%", "s", "=", "%", "r", "'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "iteritems_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "s", "(%", "s", ")'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Variable_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "other_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "self_", "._", "\\u\\u", "dict\\u\\u_", "==_", "other_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Variable_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "(_", "self_", "==_", "other_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ufora/ufora/ufora/core/math/StableHashFunction.py
[ { "content": "# Copyright 2015 Ufora Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport ufora.native.Hash as HashNative\nimport sys\nimport hashlib\nimport cPickle as pickle\nimport weakref\nimport sys\n\n\n\nfuncType_ = type(funcEx_)\n\n\nmemoizedHashes_ = WeakObjectAssociationDict()\n\nbadTypes = set()\n\n\n\n\ntheNoneHash_ = str(HashNative.Hash.sha1(\"Nothing\"))\n\n\npickleablePrimitiveTypes = set([\n float,\n int,\n long,\n unicode,\n str,\n type,\n type(AClass), #old-style class objects\n type(AClass2), #new-style class objects\n type(HashNative.Hash), #boost python class objects\n bool\n ])\n\nhashFunctionsByType = {}\ntypesUsedByIDMemo = set()\n\n#hashing policies\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def getClosure(func):\n tr = func.__closure__\n if tr is None:\n return ()\n return [x.cell_contents for x in tr]", "metadata": "root.getClosure", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def funcEx_():\n pass", "metadata": "root.funcEx_", "header": "['module', '___EOS___']", "index": 27 }, { "content": "class WeakObjectAssociationDict:\n\n\n", "metadata": "root.WeakObjectAssociationDict", "header": "['module', '___EOS___']", "index": 32 }, { "content": " def __init__(self):\n self.weakObjectsById = weakref.WeakValueDictionary()\n self.weakValuesById = dict()", "metadata": "root.WeakObjectAssociationDict.__init__", "header": "['class', 'WeakObjectAssociationDict', ':', '___EOS___']", "index": 33 }, { "content": " def __setitem__(self, k, v):\n self.weakObjectsById[id(k)] = k\n self.weakValuesById[id(k)] = v", "metadata": "root.WeakObjectAssociationDict.__setitem__", "header": "['class', 'WeakObjectAssociationDict', ':', '___EOS___']", "index": 37 }, { "content": " def __getitem__(self, k):\n if id(k) in self.weakObjectsById:\n return self.weakValuesById[id(k)]", "metadata": "root.WeakObjectAssociationDict.__getitem__", "header": "['class', 'WeakObjectAssociationDict', ':', '___EOS___']", "index": 41 }, { "content": " def __contains__(self, k):\n return id(k) in self.weakObjectsById", "metadata": "root.WeakObjectAssociationDict.__contains__", "header": "['class', 'WeakObjectAssociationDict', ':', '___EOS___']", "index": 45 }, { "content": "def stableHashForIterable_(iterable, unhashableObjectPolicy):\n return stableHashOfHashes_([\n stableShaHashForObject(x, unhashableObjectPolicy) for x in iterable\n ]\n )", "metadata": "root.stableHashForIterable_", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def stableHashOfHashes_(hashes):\n return str(HashNative.Hash.sha1(\":\".join(hashes)))", "metadata": "root.stableHashOfHashes_", "header": "['module', '___EOS___']", "index": 59 }, { "content": "class AClass:\n pass", "metadata": "root.AClass", "header": "['module', '___EOS___']", "index": 64 }, { "content": "class AClass2(object):\n pass", "metadata": "root.AClass2", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def pickleUnhashableObjects(val):\n return str(HashNative.Hash.sha1(pickle.dumps(val,0)))", "metadata": "root.pickleUnhashableObjects", "header": "['module', '___EOS___']", "index": 86 }, { "content": "def useIdForUnhashableObjects(val):\n try:\n if val.__class__ not in typesUsedByIDMemo:\n print \"Using \", val, \" as a StableHash value, but keying on instance ID\"\n typesUsedByIDMemo.add(val.__class__)\n except AttributeError:\n pass\n return str(id(val))", "metadata": "root.useIdForUnhashableObjects", "header": "['module', '___EOS___']", "index": 89 }, { "content": "def allObjectsShouldBeHashable(val):\n assert False, \"Unable to hash %s of type %s\" % (val, type(val))", "metadata": "root.allObjectsShouldBeHashable", "header": "['module', '___EOS___']", "index": 98 }, { "content": "def stableShaHashForObject(x, unhashableObjectPolicy = allObjectsShouldBeHashable):\n if x in memoizedHashes_:\n return memoizedHashes_[x]\n \n assert type(x) not in badTypes, type(x)\n \n #first, check if its a computed graph location or a function. These have special forms required\n #to make them work\n if type(x) in hashFunctionsByType:\n h = hashFunctionsByType[type(x)](x, unhashableObjectPolicy)\n \n memoizedHashes_[x] = h\n return h\n \n if isinstance(x, funcType_):\n h = stableHashForIterable_( \n (getClosure(x),\n x.func_code.co_code, \n x.func_globals['__version__'] if '__version__' in x.func_globals else 0\n ),\n unhashableObjectPolicy\n )\n memoizedHashes_[x] = h\n return h\n\n #tuples, lists, dicts, and sets, we can't use the memo because of the weakrefs. So,\n #we just hash their hashes. If they have anything big/complex in them, we'll hash those.\n if isinstance(x, tuple) or isinstance(x, list):\n return stableHashOfHashes_(\n [stableShaHashForObject(x, unhashableObjectPolicy) for x in x]\n )\n \n elif isinstance(x, dict):\n return stableHashOfHashes_(\n sorted([stableShaHashForObject(x, unhashableObjectPolicy) for x in x.iteritems()])\n )\n\n elif isinstance(x, set) or isinstance(x, frozenset):\n return stableHashOfHashes_(\n sorted([stableShaHashForObject(elt, unhashableObjectPolicy) for elt in x])\n )\n\n elif x is None:\n return theNoneHash_\n\n if isinstance(x,unicode):\n x = str(x)\n\n #just a regular object. first, see if it has a getstate function\n objectState = None\n try:\n objectState = (x.__class__.__getstate__(x), x.__class__)\n except AttributeError:\n pass\n\n if objectState is None:\n try:\n objectState = (x.__class__, x.__class__.__stable_hash_state__(x))\n except AttributeError:\n pass\n\n if objectState is not None:\n #yes, so we use that\n h = stableHashForIterable_(objectState, unhashableObjectPolicy)\n else:\n #no - check if we should use pickle\n if type(x) in pickleablePrimitiveTypes:\n h = str(HashNative.Hash.sha1(pickle.dumps(x,0)))\n else:\n #we can't use pickle, so the object instance ID is the next best thing\n h = unhashableObjectPolicy(x)\n\n try:\n memoizedHashes_[x] = h\n except TypeError:\n #some types can't go in the memo\n pass\n\n return h", "metadata": "root.stableShaHashForObject", "header": "['module', '___EOS___']", "index": 103 } ]
[ { "span": "import sys", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 10 }, { "span": "import hashlib", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 14 }, { "span": "import sys", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "201", "5", " ", "Uf", "ora", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ufo", "ra_", "._", "native_", "._", "Hash_", "as_", "Hash", "Nat", "ive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "weakref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "func", "Type", "\\u_", "=_", "type_", "(_", "func", "Ex", "\\u_", ")_", "\\u\\u\\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_", "memoized", "Hashe", "s\\u_", "=_", "Wea", "k", "Object", "Assoc", "iation", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "Types_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "the", "Non", "e", "Hash", "\\u_", "=_", "str_", "(_", "Hash", "Nat", "ive_", "._", "Hash_", "._", "sha1_", "(_", "\"", "Not", "hing", "\"_", ")_", ")_", "\\u\\u\\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_", "pickle", "able", "Primitive", "Types_", "=_", "set_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "float_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unicode_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "AC", "lass_", ")_", ",_", "#", "old", "-", "style", " ", "class", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "AC", "lass", "2_", ")_", ",_", "#", "new", "-", "style", " ", "class", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "Hash", "Nat", "ive_", "._", "Hash_", ")_", ",_", "#", "boost", " ", "python", " ", "class", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "bool_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hash", "Function", "s", "By", "Type_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types", "Us", "ed", "By", "ID", "Memo", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "hashin", "g", " ", "policies_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Clos", "ure_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tr_", "=_", "func_", "._", "\\u\\u", "clos", "ure", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tr_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "x_", "._", "cell", "\\u", "contents_", "for_", "x_", "in_", "tr_", "]_", "\\u\\u\\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_", "func", "Ex", "\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Wea", "k", "Object", "Assoc", "iation", "Dict_", ":_", "\\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_", "Wea", "k", "Object", "Assoc", "iation", "Dict_", ":_", "\\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_", "._", "weak", "Object", "s", "By", "Id_", "=_", "weakref_", "._", "Wea", "k", "Value", "Dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "weak", "Value", "s", "By", "Id_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wea", "k", "Object", "Assoc", "iation", "Dict_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "k_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "weak", "Object", "s", "By", "Id_", "[_", "id_", "(_", "k_", ")_", "]_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "weak", "Value", "s", "By", "Id_", "[_", "id_", "(_", "k_", ")_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wea", "k", "Object", "Assoc", "iation", "Dict_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "id_", "(_", "k_", ")_", "in_", "self_", "._", "weak", "Object", "s", "By", "Id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "weak", "Value", "s", "By", "Id_", "[_", "id_", "(_", "k_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wea", "k", "Object", "Assoc", "iation", "Dict_", ":_", "\\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", "contains\\u\\u_", "(_", "self_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "id_", "(_", "k_", ")_", "in_", "self_", "._", "weak", "Object", "s", "By", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "stable", "Hash", "For", "It", "era", "ble", "\\u_", "(_", "iterable_", ",_", "unh", "ash", "able", "Object", "Policy_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "stable", "Hash", "Of", "Hashe", "s\\u_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "stable", "Sha", "Hash", "For", "Object_", "(_", "x_", ",_", "unh", "ash", "able", "Object", "Policy_", ")_", "for_", "x_", "in_", "iterable_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\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_", "stable", "Hash", "Of", "Hashe", "s\\u_", "(_", "hashes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "Hash", "Nat", "ive_", "._", "Hash_", "._", "sha1_", "(_", "\":\"_", "._", "join_", "(_", "hashes_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "AC", "lass_", ":_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "AC", "lass", "2_", "(_", "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_", "def_", "pickle", "Unh", "ash", "able", "Objects_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "Hash", "Nat", "ive_", "._", "Hash_", "._", "sha1_", "(_", "pickle_", "._", "dumps_", "(_", "val_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "use", "Id", "For", "Unh", "ash", "able", "Objects_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "val_", "._", "\\u\\u", "class\\u\\u_", "not_", "in_", "types", "Us", "ed", "By", "ID", "Memo", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Us", "ing", " ", "\"_", ",_", "val_", ",_", "\"", " ", "as", " ", "a", " ", "Sta", "ble", "Hash", " ", "value", ",", " ", "but", " ", "key", "ing", " ", "on", " ", "instance", " ", "ID", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types", "Us", "ed", "By", "ID", "Memo", "_", "._", "add_", "(_", "val_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "return_", "str_", "(_", "id_", "(_", "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_", "all", "Object", "s", "Sho", "ul", "d", "Be", "Hash", "able_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "\"", "Una", "ble", " ", "to", " ", "hash", " ", "%", "s", " ", "of", " ", "type", " ", "%", "s", "\"_", "%_", "(_", "val_", ",_", "type_", "(_", "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_", "stable", "Sha", "Hash", "For", "Object_", "(_", "x_", ",_", "unh", "ash", "able", "Object", "Policy_", "=_", "all", "Object", "s", "Sho", "ul", "d", "Be", "Hash", "able_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "in_", "memoized", "Hashe", "s\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "memoized", "Hashe", "s\\u_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "type_", "(_", "x_", ")_", "not_", "in_", "bad", "Types_", ",_", "type_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "first", ",", " ", "check", " ", "if", " ", "its", " ", "a", " ", "compute", "d", " ", "graph", " ", "location", " ", "or", " ", "a", " ", "function", ".", " ", "The", "se", " ", "have", " ", "special", " ", "forms", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", "to", " ", "make", " ", "them", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type_", "(_", "x_", ")_", "in_", "hash", "Function", "s", "By", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "hash", "Function", "s", "By", "Type_", "[_", "type_", "(_", "x_", ")_", "]_", "(_", "x_", ",_", "unh", "ash", "able", "Object", "Policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "memoized", "Hashe", "s\\u_", "[_", "x_", "]_", "=_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "x_", ",_", "func", "Type", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "stable", "Hash", "For", "It", "era", "ble", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "get", "Clos", "ure_", "(_", "x_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "func", "\\u", "code_", "._", "co", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "func", "\\u", "globals_", "[_", "'\\u", "\\u", "version", "\\u\\u'_", "]_", "if_", "'\\u", "\\u", "version", "\\u\\u'_", "in_", "x_", "._", "func", "\\u", "globals_", "else_", "0_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unh", "ash", "able", "Object", "Policy_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memoized", "Hashe", "s\\u_", "[_", "x_", "]_", "=_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tuple", "s", ",", " ", "lists", ",", " ", "dict", "s", ",", " ", "and", " ", "sets", ",", " ", "we", " ", "can", "'", "t", " ", "use", " ", "the", " ", "memo", " ", "bec", "aus", "e", " ", "of", " ", "the", " ", "weak", "refs", ".", " ", "So", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "we", " ", "just", " ", "hash", " ", "thei", "r", " ", "hashe", "s", ".", " ", "If", " ", "the", "y", " ", "have", " ", "anyt", "hing", " ", "big", "/", "complex", " ", "in", " ", "them", ",", " ", "we", "'", "ll", " ", "hash", " ", "tho", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "x_", ",_", "tuple_", ")_", "or_", "isinstance_", "(_", "x_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "stable", "Hash", "Of", "Hashe", "s\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "stable", "Sha", "Hash", "For", "Object_", "(_", "x_", ",_", "unh", "ash", "able", "Object", "Policy_", ")_", "for_", "x_", "in_", "x_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "x_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "stable", "Hash", "Of", "Hashe", "s\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sorted_", "(_", "[_", "stable", "Sha", "Hash", "For", "Object_", "(_", "x_", ",_", "unh", "ash", "able", "Object", "Policy_", ")_", "for_", "x_", "in_", "x_", "._", "iteritems_", "(_", ")_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "x_", ",_", "set_", ")_", "or_", "isinstance_", "(_", "x_", ",_", "frozenset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "stable", "Hash", "Of", "Hashe", "s\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sorted_", "(_", "[_", "stable", "Sha", "Hash", "For", "Object_", "(_", "elt_", ",_", "unh", "ash", "able", "Object", "Policy_", ")_", "for_", "elt_", "in_", "x_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "the", "Non", "e", "Hash", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "x_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "str_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "just", " ", "a", " ", "regular", " ", "object", ".", " ", "first", ",", " ", "see", " ", "if", " ", "it", " ", "has", " ", "a", " ", "getstate", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object", "State_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object", "State_", "=_", "(_", "x_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "getstate", "\\u\\u_", "(_", "x_", ")_", ",_", "x_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object", "State_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object", "State_", "=_", "(_", "x_", "._", "\\u\\u", "class\\u\\u_", ",_", "x_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "stable", "\\u", "hash", "\\u", "state", "\\u\\u_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object", "State_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ye", "s", ",", " ", "so", " ", "we", " ", "use", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "stable", "Hash", "For", "It", "era", "ble", "\\u_", "(_", "object", "State_", ",_", "unh", "ash", "able", "Object", "Policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "no", " ", "-", " ", "check", " ", "if", " ", "we", " ", "shou", "ld", " ", "use", " ", "pickle_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "x_", ")_", "in_", "pickle", "able", "Primitive", "Types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "str_", "(_", "Hash", "Nat", "ive_", "._", "Hash_", "._", "sha1_", "(_", "pickle_", "._", "dumps_", "(_", "x_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "we", " ", "can", "'", "t", " ", "use", " ", "pickle", ",", " ", "so", " ", "the", " ", "object", " ", "instance", " ", "ID", " ", "is", " ", "the", " ", "next", " ", "best", " ", "thing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "unh", "ash", "able", "Object", "Policy_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "memoized", "Hashe", "s\\u_", "[_", "x_", "]_", "=_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "some", " ", "types", " ", "can", "'", "t", " ", "go", " ", "in", " ", "the", " ", "memo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "h_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
PublicMapping/DistrictBuilder/django/publicmapping/redistricting/config.py
[ { "content": " def import_superuser(self, force):\n \"\"\"\n Create the django superuser, based on the config.\n\n @param force: Should the Admin settings be written if the model already exist?\n @returns: A flag indicating if the import was successful.\n \"\"\"\n try:\n admcfg = self.store.get_admin()\n admin_attributes = {\n 'first_name':'Admin',\n 'last_name':'User',\n 'is_staff':True,\n 'is_active':True,\n 'is_superuser':True,\n 'username':admcfg.get('user')[:30],\n 'email':admcfg.get('email')[:75]\n }\n\n admin, created, changed, message = check_and_update(User, unique_id_field='username', overwrite=force, **admin_attributes)\n\n if changed and not force:\n logger.info(message)\n else:\n logger.debug(message)\n\n if created or changed or force:\n m = hashlib.sha1()\n m.update(admcfg.get('password'))\n admin.set_password(m.hexdigest())\n admin.save()\n\n return True\n\n except:\n logger.info('Error when creating superuser.')\n logger.info(traceback.format_exc())\n\n return False", "metadata": "root.ConfigImporter.import_superuser", "header": "['class', 'ConfigImporter', ':', '___EOS___']", "index": 140 }, { "content": " def import_regional_geolevels(self, force):\n \"\"\"\n Map geolevels to regions.\n\n @param force: Should the Regional GeoLevel settings be written if the model already exist?\n @returns: A flag indicating if the import was successful.\n \"\"\"\n regions = self.store.filter_regions()\n for region in regions:\n regional_geolevels = self.store.filter_regional_geolevel(region)\n\n # Get the zoom level of the largest geolevel (last one in the regional_geolevels list)\n zero_geolevel_config = self.store.get_geolevel(regional_geolevels[len(regional_geolevels)-1].get('ref'))\n # store this zoom level, and use it as an offset for the geolevels in this region\n zero_zoom = int(zero_geolevel_config.get('min_zoom'))\n\n for geolevel in regional_geolevels:\n try:\n geolevel_obj = Geolevel.objects.get(name=geolevel.get('ref'))\n except:\n logger.debug(\"Base geolevel %s for %s not found in the database. Import base geolevels before regional geolevels\", name, region.get('name'))\n return\n\n attributes = {\n 'name': '%s_%s' % (region.get('name'), geolevel.get('ref')),\n 'min_zoom': geolevel_obj.min_zoom - zero_zoom,\n 'tolerance': geolevel_obj.tolerance\n }\n obj, created, changed, message = check_and_update(Geolevel, overwrite=force, **attributes)\n\n for locale in [l[0] for l in settings.LANGUAGES]:\n po = self.poutils[locale]\n po.add_or_update(\n msgid=u'%s short label' % attributes['name'],\n msgstr=geolevel.get('name') or '',\n occurs=[(os.path.abspath(self.store.datafile), geolevel.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s label' % attributes['name'],\n msgstr=geolevel.get('label') or '',\n occurs=[(os.path.abspath(self.store.datafile), geolevel.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s long description' % attributes['name'],\n msgstr='',\n occurs=[(os.path.abspath(self.store.datafile), geolevel.sourceline,)]\n )\n\n if changed and not force:\n logger.info(message)\n else:\n logger.debug(message)\n\n\n # Use the Region nodes to link bodies and geolevels\n for region in regions:\n\n # Map the imported geolevel to a legislative body\n lbodies = self.store.filter_regional_legislative_bodies(region)\n for lbody in lbodies:\n legislative_body = LegislativeBody.objects.get(name=lbody.get('ref')[:256])\n \n # Add a mapping for the subjects in this GL/LB combo.\n sconfig = self.store.get_legislative_body_default_subject(lbody)\n if not sconfig.get('aliasfor') is None:\n # dereference any subject alias\n sconfig = self.store.get_subject(sconfig.get('aliasfor'))\n subject = Subject.objects.get(name=sconfig.get('id').lower()[:50])\n\n def add_legislative_level_for_geolevel(node, body, subject, parent):\n \"\"\"\n Helper method to recursively add LegislativeLevel mappings from Region configs\n \"\"\"\n geolevel_node = self.store.get_geolevel(node.get('ref'))\n geolevel_name = \"%s_%s\" % (region.get('id'), geolevel_node.get('id'))\n geolevel = Geolevel.objects.get(name=geolevel_name)\n obj, created = LegislativeLevel.objects.get_or_create(\n legislative_body=body,\n geolevel=geolevel,\n subject=subject, \n parent=parent)\n\n if created:\n logger.debug('Created LegislativeBody/GeoLevel mapping \"%s/%s\"', legislative_body.name, geolevel.name)\n else:\n logger.debug('LegislativeBody/GeoLevel mapping \"%s/%s\" already exists', legislative_body.name, geolevel.name)\n\n if len(node) > 0:\n add_legislative_level_for_geolevel(node[0], body, subject, obj)\n\n parentless = self.store.get_top_regional_geolevel(region)\n if parentless is not None:\n add_legislative_level_for_geolevel(parentless, legislative_body, subject, None)\n\n return True", "metadata": "root.ConfigImporter.import_regional_geolevels", "header": "['class', 'ConfigImporter', ':', '___EOS___']", "index": 419 }, { "content": " def import_scoring(self, force):\n \"\"\"\n Create the Scoring models.\n\n @param force: Should the Scoring settings be written if the model already exist?\n @returns: A flag indicating if the import was successful.\n \"\"\"\n result = True\n if not self.store.has_scoring():\n logger.debug('Scoring not configured')\n \n admin = User.objects.filter(is_superuser=True)\n if admin.count() == 0:\n logger.debug('There was no superuser installed; ScoreDisplays need to be assigned ownership to a superuser.')\n return False\n else:\n admin = admin[0]\n\n # Import score displays.\n for sd in self.store.filter_scoredisplays():\n lb = LegislativeBody.objects.get(name=sd.get('legislativebodyref'))\n \n sd_obj, created = ScoreDisplay.objects.get_or_create(\n name=sd.get('id')[:50],\n title=sd.get('title')[:50],\n legislative_body=lb,\n is_page=sd.get('type') == 'leaderboard',\n cssclass=(sd.get('cssclass') or '')[:50],\n owner=admin\n )\n\n for locale in [l[0] for l in settings.LANGUAGES]:\n po = self.poutils[locale]\n po.add_or_update(\n msgid=u'%s short label' % sd.get('id'),\n msgstr=sd.get('title') or '',\n occurs=[(os.path.abspath(self.store.datafile), sd.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s label' % sd.get('id'),\n msgstr=sd.get('title') or '',\n occurs=[(os.path.abspath(self.store.datafile), sd.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s long description' % sd.get('id'),\n msgstr='',\n occurs=[(os.path.abspath(self.store.datafile), sd.sourceline,)]\n )\n\n\n if created:\n logger.debug('Created ScoreDisplay \"%s\"', sd.get('title'))\n else:\n logger.debug('ScoreDisplay \"%s\" already exists', sd.get('title'))\n\n # Import score panels for this score display.\n for spref in self.store.filter_displayed_score_panels(sd):\n sp = self.store.get_score_panel(spref.get('ref'))\n name = sp.get('id')[:50]\n position = int(sp.get('position'))\n template = sp.get('template')[:500]\n cssclass = (sp.get('cssclass') or '')[:50]\n pnltype = sp.get('type')[:20]\n\n is_ascending = sp.get('is_ascending')\n if is_ascending is None:\n is_ascending = True\n \n ascending = sp.get('is_ascending')\n sp_obj, created = ScorePanel.objects.get_or_create(\n type=pnltype,\n position=position,\n name=name,\n template=template,\n cssclass=cssclass,\n is_ascending=(ascending is None or ascending=='true'), \n )\n\n if created:\n sd_obj.scorepanel_set.add(sp_obj)\n\n logger.debug('Created ScorePanel \"%s\"', name)\n else:\n attached = sd_obj.scorepanel_set.filter(id=sp_obj.id).count() == 1\n if not attached:\n sd_obj.scorepanel_set.add(sp_obj)\n\n logger.debug('ScorePanel \"%s\" already exists', name)\n\n for locale in[l[0] for l in settings.LANGUAGES]:\n po = self.poutils[locale]\n po.add_or_update(\n msgid=u'%s short label' % sp_obj.name,\n msgstr=sp.get('title') or '',\n occurs=[(os.path.abspath(self.store.datafile), sp.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s label' % sp_obj.name,\n msgstr=sp.get('title') or '',\n occurs=[(os.path.abspath(self.store.datafile), sp.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s long description' % sp_obj.name,\n msgstr='',\n occurs=[(os.path.abspath(self.store.datafile), sp.sourceline,)]\n )\n\n # Import score functions for this score panel\n for sfref in self.store.filter_paneled_score_functions(sp):\n sf_node = self.store.get_score_function(sfref.get('ref'))\n sf_obj = self.import_function(sf_node, force)\n\n # Add ScoreFunction reference to ScorePanel\n sp_obj.score_functions.add(sf_obj)\n\n # It's possible to define ScoreFunctions that are not part of any ScorePanels, yet\n # still need to be added to allow for user selection. Find and import these functions.\n for sf_node in self.store.filter_score_functions():\n self.import_function(sf_node, force)\n\n # Import validation criteria.\n if not self.store.has_validation():\n logger.debug('Validation not configured')\n return False;\n\n for vc in self.store.filter_criteria():\n lb = LegislativeBody.objects.get(name=vc.get('legislativebodyref'))\n\n for crit in self.store.filter_criteria_criterion(vc):\n # Import the score function for this validation criterion\n sfref = self.store.get_criterion_score(crit)\n try:\n sf = self.store.get_score_function(sfref.get('ref'))\n except:\n logger.info(\"Couldn't import ScoreFunction for Criteria %s\", crit.get('name'))\n result = False\n\n sf_obj = self.import_function(sf, force)\n\n # Import this validation criterion\n attributes = {\n 'name': crit.get('id')[0:50],\n 'function': sf_obj,\n 'legislative_body': lb\n }\n crit_obj, created, changed, message = check_and_update(ValidationCriteria, overwrite=force, **attributes)\n\n for locale in [l[0] for l in settings.LANGUAGES]:\n po = self.poutils[locale]\n po.add_or_update(\n msgid=u'%s short label' % attributes['name'],\n msgstr=crit.get('name') or '',\n occurs=[(os.path.abspath(self.store.datafile), crit.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s label' % attributes['name'],\n msgstr=crit.get('name') or '',\n occurs=[(os.path.abspath(self.store.datafile), crit.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s long description' % attributes['name'],\n msgstr=crit.get('description') or '',\n occurs=[(os.path.abspath(self.store.datafile), crit.sourceline,)]\n )\n\n if changed and not force:\n logger.info(message)\n else:\n logger.debug(message)\n\n return result", "metadata": "root.ConfigImporter.import_scoring", "header": "['class', 'ConfigImporter', ':', '___EOS___']", "index": 515 }, { "content": " def configure_geoserver(self):\n \"\"\"\n Configure all the components in Geoserver. This method configures the\n geoserver workspace, datastore, feature types, and styles. All \n configuration steps get processed through the REST config.\n\n @returns: A flag indicating if geoserver was configured correctly.\n \"\"\"\n try:\n srid = Geounit.objects.all()[0].geom.srid\n except:\n srid = 0\n logger.debug('Spatial Reference could not be determined, defaulting to %d', srid)\n\n # Create our namespace\n namespace_url = '/geoserver/rest/namespaces'\n namespace_obj = { 'namespace': { 'prefix': self.ns, 'uri': self.nshref } }\n if self._check_spatial_resource(namespace_url, self.ns, namespace_obj):\n logger.debug('Created namespace \"%s\"' % self.ns)\n else:\n logger.warn('Could not create Namespace')\n return\n\n # Create our DataStore\n if self.store is None:\n logger.warning('Geoserver cannot be fully configured without a stored config.')\n return\n\n dbconfig = self.store.get_database()\n\n data_store_url = '/geoserver/rest/workspaces/%s/datastores' % self.ns\n data_store_name = 'PostGIS'\n\n data_store_obj = {\n 'dataStore': {\n 'name': data_store_name,\n 'connectionParameters': {\n 'host': dbconfig.get('host',self.host),\n 'port': 5432,\n 'database': dbconfig.get('name'),\n 'user': dbconfig.get('user'),\n 'passwd': dbconfig.get('password'),\n 'dbtype': 'postgis',\n 'namespace': self.ns,\n 'schema': dbconfig.get('user')\n }\n }\n }\n\n if self._check_spatial_resource(data_store_url, data_store_name, data_store_obj):\n logger.debug('Created datastore \"%s\"' % data_store_name)\n else:\n logger.warn('Could not create Datastore')\n return\n\n # Create the feature types and their styles\n\n if self.create_featuretype('identify_geounit'):\n logger.debug('Created feature type \"identify_geounit\"')\n else:\n logger.warn('Could not create \"identify_geounit\" feature type')\n\n for geolevel in Geolevel.objects.all():\n if geolevel.legislativelevel_set.all().count() == 0:\n # Skip 'abstract' geolevels if regions are configured\n continue\n \n if self.create_featuretype('simple_%s' % geolevel.name):\n logger.debug('Created \"simple_%s\" feature type' % geolevel.name)\n else:\n logger.warn('Could not create \"simple_%s\" feature type' % geolevel.name)\n\n if self.create_featuretype('simple_district_%s' % geolevel.name):\n logger.debug('Created \"simple_district_%s\" feature type' % geolevel.name)\n else:\n logger.warn('Colud not create \"simple_district_%s\" feature type' % geolevel.name)\n\n all_subjects = Subject.objects.all().order_by('sort_key') \n if all_subjects.count() > 0:\n subject = all_subjects[0]\n\n # Create NONE demographic layer, based on first subject\n featuretype_name = get_featuretype_name(geolevel.name)\n if self.create_featuretype(featuretype_name, alias=get_featuretype_name(geolevel.name, subject.name)):\n logger.debug('Created \"%s\" feature type' % featuretype_name)\n else:\n logger.warn('Could not create \"%s\" feature type' % featuretype_name)\n\n if self.create_style(featuretype_name):\n logger.debug('Created \"%s\" style' % featuretype_name)\n else:\n logger.warn('Could not create style for \"%s\"' % featuretype_name)\n\n try:\n sld_content = SpatialUtils.generate_style(geolevel, geolevel.geounit_set.all(), 1, layername='none')\n\n self.write_style(geolevel.name + '_none', sld_content)\n except Exception, ex:\n logger.error(traceback.format_exc())\n\n\n if self.set_style(featuretype_name, sld_content):\n logger.debug('Set \"%s\" style' % featuretype_name)\n else:\n logger.warn('Could not set \"%s\" style' % featuretype_name)\n\n if self.assign_style(featuretype_name, featuretype_name):\n logger.debug('Assigned style for \"%s\"' % featuretype_name)\n else:\n logger.warn('Could not assign style for \"%s\"' % featuretype_name)\n\n # Create boundary layer, based on geographic boundaries\n featuretype_name = '%s_boundaries' % geolevel.name\n if self.create_featuretype(featuretype_name, alias=get_featuretype_name(geolevel.name, subject.name)):\n logger.debug('Created \"%s\" feature type' % featuretype_name)\n else:\n logger.warn('Could not create \"%s\" feature type' % featuretype_name)\n\n if self.create_style(featuretype_name):\n logger.debug('Created \"%s\" style' % featuretype_name)\n else:\n logger.warn('Could not create \"%s\" style' % featuretype_name)\n\n try:\n sld_content = SpatialUtils.generate_style(geolevel, geolevel.geounit_set.all(), 1, layername='boundary')\n\n self.write_style(geolevel.name + '_boundaries', sld_content)\n except Exception, ex:\n logger.error(traceback.format_exc())\n\n if self.set_style(featuretype_name, sld_content):\n logger.debug('Set \"%s\" style' % featuretype_name)\n else:\n logger.warn('Could not set \"%s\" style' % featuretype_name)\n\n if self.assign_style(featuretype_name, featuretype_name):\n logger.debug('Assigned style for \"%s\"' % featuretype_name)\n else:\n logger.warn('Could not assign style for \"%s\"' % featuretype_name)\n \n for subject in all_subjects:\n featuretype_name = get_featuretype_name(geolevel.name, subject.name)\n\n if self.create_featuretype(featuretype_name):\n logger.debug('Created \"%s\" feature type' % featuretype_name)\n else:\n logger.warn('Could not create \"%s\" feature type' % featuretype_name)\n\n if self.create_style(featuretype_name):\n logger.debug('Created \"%s\" style' % featuretype_name)\n else:\n logger.warn('Could not create \"%s\" style' % featuretype_name)\n\n try:\n sld_content = SpatialUtils.generate_style(geolevel, geolevel.geounit_set.all(), 5, subject=subject)\n\n self.write_style(geolevel.name + '_' + subject.name, sld_content)\n except Exception, ex:\n logger.error(traceback.format_exc())\n\n if self.set_style(featuretype_name, sld_content):\n logger.debug('Set \"%s\" style' % featuretype_name)\n else:\n logger.warn('Could not set \"%s\" style' % featuretype_name)\n\n if self.assign_style(featuretype_name, featuretype_name):\n logger.debug('Assigned \"%s\" style' % featuretype_name)\n else:\n logger.warn('Could not assign \"%s\" style' % featuretype_name)\n \n # map all the legislative body / geolevels combos\n ngeolevels_map = []\n for lbody in LegislativeBody.objects.all():\n geolevels = lbody.get_geolevels()\n # list by # of geolevels, and the first geolevel\n ngeolevels_map.append((len(geolevels), lbody, geolevels[0],))\n # sorf by the # of geolevels\n ngeolevels_map.sort(lambda x,y:cmp(y[0],x[0]))\n\n # get the first (most # of geolevels)\n lbody = ngeolevels_map[0][1]\n geolevel = ngeolevels_map[0][2]\n\n # create simple_district as an alias to the largest geolevel (e.g. counties)\n if self.create_featuretype('simple_district', alias='simple_district_%s' % geolevel.name):\n logger.debug('Created \"simple_district\" feature type')\n else:\n logger.warn('Could not create \"simple_district\" feature type')\n\n if self.assign_style('simple_district', 'polygon'):\n logger.debug('Assigned style \"polygon\" to feature type')\n else:\n logger.warn('Could not assign \"polygon\" style to simple_district')\n\n try:\n # add the district intervals\n intervals = self.store.filter_nodes('//ScoreFunction[@calculator=\"publicmapping.redistricting.calculators.Interval\"]')\n for interval in intervals:\n subject_name = interval.xpath('SubjectArgument')[0].get('ref')\n lbody_name = interval.xpath('LegislativeBody')[0].get('ref')\n interval_avg = float(interval.xpath('Argument[@name=\"target\"]')[0].get('value'))\n interval_bnd1 = float(interval.xpath('Argument[@name=\"bound1\"]')[0].get('value'))\n interval_bnd2 = float(interval.xpath('Argument[@name=\"bound2\"]')[0].get('value'))\n\n intervals = [\n (interval_avg + interval_avg * interval_bnd2, None, \n _('Far Over Target'), {'fill':'#ebb95e', 'fill-opacity':'0.3'}),\n (interval_avg + interval_avg * interval_bnd1, interval_avg + interval_avg * interval_bnd2, \n _('Over Target'), {'fill':'#ead3a7', 'fill-opacity':'0.3'}),\n (interval_avg - interval_avg * interval_bnd1, interval_avg + interval_avg * interval_bnd1, \n _('Meets Target'), {'fill':'#eeeeee', 'fill-opacity':'0.1'}),\n (interval_avg - interval_avg * interval_bnd2, interval_avg - interval_avg * interval_bnd1,\n _('Under Target'), {'fill':'#a2d5d0', 'fill-opacity':'0.3'}),\n (None, interval_avg - interval_avg * interval_bnd2,\n _('Far Under Target'), {'fill':'#0aac98', 'fill-opacity':'0.3'})]\n\n doc = sld.StyledLayerDescriptor()\n fts = doc.create_namedlayer(subject_name).create_userstyle().create_featuretypestyle()\n\n for interval in intervals:\n imin, imax, ititle, ifill = interval\n rule = fts.create_rule(ititle, sld.PolygonSymbolizer)\n if imin is None:\n rule.create_filter('number', '<', str(int(round(imax))))\n elif imax is None:\n rule.create_filter('number', '>=', str(int(round(imin))))\n else:\n f1 = sld.Filter(rule)\n f1.PropertyIsGreaterThanOrEqualTo = sld.PropertyCriterion(f1, 'PropertyIsGreaterThanOrEqualTo')\n f1.PropertyIsGreaterThanOrEqualTo.PropertyName = 'number'\n f1.PropertyIsGreaterThanOrEqualTo.Literal = str(int(round(imin)))\n\n f2 = sld.Filter(rule)\n f2.PropertyIsLessThan = sld.PropertyCriterion(f2, 'PropertyIsLessThan')\n f2.PropertyIsLessThan.PropertyName = 'number'\n f2.PropertyIsLessThan.Literal = str(int(round(imax)))\n\n rule.Filter = f1 + f2\n\n ps = rule.PolygonSymbolizer\n ps.Fill.CssParameters[0].Value = ifill['fill']\n ps.Fill.create_cssparameter('fill-opacity', ifill['fill-opacity'])\n ps.Stroke.CssParameters[0].Value = '#fdb913'\n ps.Stroke.CssParameters[1].Value = '2'\n ps.Stroke.create_cssparameter('stroke-opacity', '1')\n\n self.write_style(lbody_name + '_' + subject_name, doc.as_sld(pretty_print=True))\n\n except Exception, ex:\n logger.debug(traceback.format_exc())\n logger.warn('LegislativeBody intervals are not configured.')\n\n logger.info(\"Geoserver configuration complete.\")\n\n # finished configure_geoserver\n return True", "metadata": "root.SpatialUtils.configure_geoserver", "header": "['class', 'SpatialUtils', ':', '___EOS___']", "index": 1003 }, { "content": " def _rest_check(self, url):\n \"\"\"\n Attempt to get a REST resource. If the resource exists, and can\n be retrieved successfully, it will pass the check.\n\n @returns: True if the resource exists and is readable.\n \"\"\"\n try:\n conn = httplib.HTTPConnection(self.host, self.port)\n conn.request('GET', url, None, self.headers['default'])\n rsp = conn.getresponse()\n rsp.read() # and discard\n conn.close()\n return rsp.status == 200\n except:\n # HTTP 400, 500 errors are also considered exceptions by the httplib\n return False", "metadata": "root.SpatialUtils._rest_check", "header": "['class', 'SpatialUtils', ':', '___EOS___']", "index": 1329 } ]
[ { "span": "except:", "start_line": 174, "start_column": 8, "end_line": 174, "end_column": 15 }, { "span": "except:", "start_line": 438, "start_column": 16, "end_line": 438, "end_column": 23 }, { "span": "except:", "start_line": 648, "start_column": 16, "end_line": 648, "end_column": 23 }, { "span": "except:", "start_line": 1013, "start_column": 8, "end_line": 1013, "end_column": 15 }, { "span": "except:", "start_line": 1343, "start_column": 8, "end_line": 1343, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Config", "Importer_", ":_", "\\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_", "import", "\\u", "superuser_", "(_", "self_", ",_", "force_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "the", " ", "django", " ", "super", "user", ",", " ", "based", " ", "on", " ", "the", " ", "config", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "force", ":", " ", "Sho", "ul", "d", " ", "the", " ", "Admi", "n", " ", "settings", " ", "be", " ", "writt", "en", " ", "if", " ", "the", " ", "model", " ", "alr", "ead", "y", " ", "exist", "?", "\\", "10", ";", " ", " ", " ", " ", "@", "return", "s", ":", " ", "A", " ", "flag", " ", "indicati", "ng", " ", "if", " ", "the", " ", "import", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "adm", "cfg_", "=_", "self_", "._", "store_", "._", "get", "\\u", "admin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "attributes_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "'", "Admi", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "'", "User", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "active", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "super", "user", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "adm", "cfg_", "._", "get_", "(_", "'", "user", "'_", ")_", "[_", ":_", "30_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "adm", "cfg_", "._", "get_", "(_", "'", "email", "'_", ")_", "[_", ":_", "75_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", ",_", "created_", ",_", "changed_", ",_", "message_", "=_", "check", "\\u", "and", "\\u", "update_", "(_", "User_", ",_", "unique", "\\u", "id", "\\u", "field_", "=_", "'", "user", "name", "'_", ",_", "overwrite_", "=_", "force_", ",_", "**_", "admin", "\\u", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "changed_", "and_", "not_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "created_", "or_", "changed_", "or_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "hashlib_", "._", "sha1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "update_", "(_", "adm", "cfg_", "._", "get_", "(_", "'", "password", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "set\\u", "password_", "(_", "m_", "._", "hexdigest_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Error", " ", "whe", "n", " ", "creati", "ng", " ", "super", "user", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Importer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "regional", "\\u", "geo", "levels_", "(_", "self_", ",_", "force_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Map", " ", "geo", "level", "s", " ", "to", " ", "regions", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "force", ":", " ", "Sho", "ul", "d", " ", "the", " ", "Region", "al", " ", "Geo", "Leve", "l", " ", "settings", " ", "be", " ", "writt", "en", " ", "if", " ", "the", " ", "model", " ", "alr", "ead", "y", " ", "exist", "?", "\\", "10", ";", " ", " ", " ", " ", "@", "return", "s", ":", " ", "A", " ", "flag", " ", "indicati", "ng", " ", "if", " ", "the", " ", "import", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regions_", "=_", "self_", "._", "store_", "._", "filter", "\\u", "regions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "region_", "in_", "regions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "regional", "\\u", "geo", "levels_", "=_", "self_", "._", "store_", "._", "filter", "\\u", "regional", "\\u", "geo", "level_", "(_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "zoom", " ", "level", " ", "of", " ", "the", " ", "large", "st", " ", "geo", "level", " ", "(", "last", " ", "one", " ", "in", " ", "the", " ", "regional", "\\u", "geo", "level", "s", " ", "list", ")_", "\\u\\u\\uNL\\u\\u\\u_", "zero", "\\u", "geo", "level", "\\u", "config_", "=_", "self_", "._", "store_", "._", "get", "\\u", "geo", "level_", "(_", "regional", "\\u", "geo", "levels_", "[_", "len_", "(_", "regional", "\\u", "geo", "levels_", ")_", "-_", "1_", "]_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "this", " ", "zoom", " ", "level", ",", " ", "and", " ", "use", " ", "it", " ", "as", " ", "an", " ", "offset", " ", "for", " ", "the", " ", "geo", "level", "s", " ", "in", " ", "this", " ", "region_", "\\u\\u\\uNL\\u\\u\\u_", "zero", "\\u", "zoom_", "=_", "int_", "(_", "zero", "\\u", "geo", "level", "\\u", "config_", "._", "get_", "(_", "'", "min", "\\u", "zoom", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "geo", "level_", "in_", "regional", "\\u", "geo", "levels_", ":_", "\\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 ", " ", "_", "geo", "level", "\\u", "obj_", "=_", "Geo", "level_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "geo", "level_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "\"", "Base", " ", "geo", "level", " ", "%", "s", " ", "for", " ", "%", "s", " ", "not", " ", "found", " ", "in", " ", "the", " ", "databa", "se", ".", " ", " ", "Import", " ", "base", " ", "geo", "level", "s", " ", "bef", "ore", " ", "regional", " ", "geo", "level", "s", "\"_", ",_", "name_", ",_", "region_", "._", "get_", "(_", "'", "name", "'_", ")_", ")_", "\\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_", "attributes_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'%", "s", "\\u", "%", "s", "'_", "%_", "(_", "region_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "geo", "level_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "\\u", "zoom", "'_", ":_", "geo", "level", "\\u", "obj_", "._", "min", "\\u", "zoom_", "-_", "zero", "\\u", "zoom_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tolera", "nce", "'_", ":_", "geo", "level", "\\u", "obj_", "._", "tolerance_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", ",_", "created_", ",_", "changed_", ",_", "message_", "=_", "check", "\\u", "and", "\\u", "update_", "(_", "Geo", "level_", ",_", "overwrite_", "=_", "force_", ",_", "**_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "locale_", "in_", "[_", "l_", "[_", "0_", "]_", "for_", "l_", "in_", "settings_", "._", "LANGUAGES_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "po_", "=_", "self_", "._", "pou", "tils_", "[_", "locale_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "short", " ", "label", "'_", "%_", "attributes_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "geo", "level_", "._", "get_", "(_", "'", "name", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "geo", "level_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "label", "'_", "%_", "attributes_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "geo", "level_", "._", "get_", "(_", "'", "label", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "geo", "level_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "long", " ", "description", "'_", "%_", "attributes_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "geo", "level_", "._", "source", "line_", ",_", ")_", "]_", "\\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_", "changed_", "and_", "not_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "info_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "Region", " ", "nodes", " ", "to", " ", "link", " ", "bodi", "es", " ", "and", " ", "geo", "levels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "region_", "in_", "regions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Map", " ", "the", " ", "import", "ed", " ", "geo", "level", " ", "to", " ", "a", " ", "legislat", "ive", " ", "body_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lbo", "die", "s_", "=_", "self_", "._", "store_", "._", "filter", "\\u", "regional", "\\u", "legislat", "ive", "\\u", "bodies_", "(_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lbo", "dy_", "in_", "lbo", "die", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "legislat", "ive", "\\u", "body_", "=_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "lbo", "dy_", "._", "get_", "(_", "'", "ref", "'_", ")_", "[_", ":_", "256_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "a", " ", "mapping", " ", "for", " ", "the", " ", "subject", "s", " ", "in", " ", "this", " ", "GL", "/", "LB", " ", "combo", "._", "\\u\\u\\uNL\\u\\u\\u_", "scon", "fig_", "=_", "self_", "._", "store_", "._", "get", "\\u", "legislat", "ive", "\\u", "body", "\\u", "default", "\\u", "subject_", "(_", "lbo", "dy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "scon", "fig_", "._", "get_", "(_", "'", "alias", "for", "'_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dereferenc", "e", " ", "any", " ", "subject", " ", "alias_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "scon", "fig_", "=_", "self_", "._", "store_", "._", "get", "\\u", "subject_", "(_", "scon", "fig_", "._", "get_", "(_", "'", "alias", "for", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subject_", "=_", "Subject_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "scon", "fig_", "._", "get_", "(_", "'", "id", "'_", ")_", "._", "lower_", "(_", ")_", "[_", ":_", "50_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "\\u", "legislat", "ive", "\\u", "level", "\\u", "for", "\\u", "geo", "level_", "(_", "node_", ",_", "body_", ",_", "subject_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\"\"\"", "\\", "10", ";", " ", " ", "Help", "er", " ", "method", " ", "to", " ", "recurs", "ively", " ", "add", " ", "Legi", "slat", "ive", "Leve", "l", " ", "mapping", "s", " ", "from", " ", "Region", " ", "configs", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo", "level", "\\u", "node_", "=_", "self_", "._", "store_", "._", "get", "\\u", "geo", "level_", "(_", "node_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo", "level", "\\u", "name_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "region_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "geo", "level", "\\u", "node_", "._", "get_", "(_", "'", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo", "level_", "=_", "Geo", "level_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "geo", "level", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", ",_", "created_", "=_", "Legi", "slat", "ive", "Level_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "legislat", "ive", "\\u", "body_", "=_", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "geo", "level_", "=_", "geo", "level_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subject_", "=_", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "created_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "Legi", "slat", "ive", "Bod", "y", "/", "Geo", "Leve", "l", " ", "mapping", " ", "\"%", "s", "/", "%", "s", "\"'_", ",_", "legislat", "ive", "\\u", "body_", "._", "name_", ",_", "geo", "level_", "._", "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 ", " ", " _", "logger_", "._", "debug_", "(_", "'", "Legi", "slat", "ive", "Bod", "y", "/", "Geo", "Leve", "l", " ", "mapping", " ", "\"%", "s", "/", "%", "s", "\"", " ", "alr", "ead", "y", " ", "exist", "s", "'_", ",_", "legislat", "ive", "\\u", "body_", "._", "name_", ",_", "geo", "level_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "node_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "add", "\\u", "legislat", "ive", "\\u", "level", "\\u", "for", "\\u", "geo", "level_", "(_", "node_", "[_", "0_", "]_", ",_", "body_", ",_", "subject_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parent", "less_", "=_", "self_", "._", "store_", "._", "get", "\\u", "top", "\\u", "regional", "\\u", "geo", "level_", "(_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parent", "less_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "add", "\\u", "legislat", "ive", "\\u", "level", "\\u", "for", "\\u", "geo", "level_", "(_", "parent", "less_", ",_", "legislat", "ive", "\\u", "body_", ",_", "subject_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Importer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "scoring_", "(_", "self_", ",_", "force_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "the", " ", "Sco", "ring", " ", "model", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "force", ":", " ", "Sho", "ul", "d", " ", "the", " ", "Sco", "ring", " ", "settings", " ", "be", " ", "writt", "en", " ", "if", " ", "the", " ", "model", " ", "alr", "ead", "y", " ", "exist", "?", "\\", "10", ";", " ", " ", " ", " ", "@", "return", "s", ":", " ", "A", " ", "flag", " ", "indicati", "ng", " ", "if", " ", "the", " ", "import", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "store_", "._", "has", "\\u", "scoring_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Sco", "ring", " ", "not", " ", "configur", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "admin_", "=_", "User_", "._", "objects_", "._", "filter_", "(_", "is", "\\u", "superuser_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "admin_", "._", "count_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "There", " ", "was", " ", "no", " ", "super", "user", " ", "install", "ed", ";", " ", "Score", "Display", "s", " ", "need", " ", "to", " ", "be", " ", "assign", "ed", " ", "owner", "ship", " ", "to", " ", "a", " ", "super", "user", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin_", "=_", "admin_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "score", " ", "display", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sd_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "scored", "isp", "lay", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb_", "=_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "sd_", "._", "get_", "(_", "'", "legislat", "ive", "body", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sd", "\\u", "obj_", ",_", "created_", "=_", "Score", "Display_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "sd_", "._", "get_", "(_", "'", "id", "'_", ")_", "[_", ":_", "50_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "sd_", "._", "get_", "(_", "'", "title", "'_", ")_", "[_", ":_", "50_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "legislat", "ive", "\\u", "body_", "=_", "lb_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "page_", "=_", "sd_", "._", "get_", "(_", "'", "type", "'_", ")_", "==_", "'", "leader", "board", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "class_", "=_", "(_", "sd_", "._", "get_", "(_", "'", "css", "class", "'_", ")_", "or_", "''_", ")_", "[_", ":_", "50_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "owner_", "=_", "admin_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "locale_", "in_", "[_", "l_", "[_", "0_", "]_", "for_", "l_", "in_", "settings_", "._", "LANGUAGES_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "po_", "=_", "self_", "._", "pou", "tils_", "[_", "locale_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "short", " ", "label", "'_", "%_", "sd_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "sd_", "._", "get_", "(_", "'", "title", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sd_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "label", "'_", "%_", "sd_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "sd_", "._", "get_", "(_", "'", "title", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sd_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "long", " ", "description", "'_", "%_", "sd_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sd_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\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_", "created_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "Score", "Display", " ", "\"%", "s", "\"'_", ",_", "sd_", "._", "get_", "(_", "'", "title", "'_", ")_", ")_", "\\u\\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_", "(_", "'", "Score", "Display", " ", "\"%", "s", "\"", " ", "alr", "ead", "y", " ", "exist", "s", "'_", ",_", "sd_", "._", "get_", "(_", "'", "title", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "score", " ", "panel", "s", " ", "for", " ", "this", " ", "score", " ", "display", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "spr", "ef_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "displaye", "d\\u", "score", "\\u", "panels_", "(_", "sd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sp_", "=_", "self_", "._", "store_", "._", "get", "\\u", "score", "\\u", "panel_", "(_", "spr", "ef_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "sp_", "._", "get_", "(_", "'", "id", "'_", ")_", "[_", ":_", "50_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "position_", "=_", "int_", "(_", "sp_", "._", "get_", "(_", "'", "position", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "sp_", "._", "get_", "(_", "'", "template", "'_", ")_", "[_", ":_", "500_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "class_", "=_", "(_", "sp_", "._", "get_", "(_", "'", "css", "class", "'_", ")_", "or_", "''_", ")_", "[_", ":_", "50_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pn", "lty", "pe_", "=_", "sp_", "._", "get_", "(_", "'", "type", "'_", ")_", "[_", ":_", "20_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "ascending_", "=_", "sp_", "._", "get_", "(_", "'", "is", "\\u", "ascen", "ding", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "ascending_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "is", "\\u", "ascending_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ascending_", "=_", "sp_", "._", "get_", "(_", "'", "is", "\\u", "ascen", "ding", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp", "\\u", "obj_", ",_", "created_", "=_", "Score", "Panel_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "pn", "lty", "pe_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "position_", "=_", "position_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "class_", "=_", "css", "class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "ascending_", "=_", "(_", "ascending_", "is_", "None_", "or_", "ascending_", "==_", "'", "true", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "created_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sd", "\\u", "obj_", "._", "score", "panel", "\\u", "set_", "._", "add_", "(_", "sp", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "Score", "Pane", "l", " ", "\"%", "s", "\"'_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "attache", "d_", "=_", "sd", "\\u", "obj_", "._", "score", "panel", "\\u", "set_", "._", "filter_", "(_", "id_", "=_", "sp", "\\u", "obj_", "._", "id_", ")_", "._", "count_", "(_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "attache", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sd", "\\u", "obj_", "._", "score", "panel", "\\u", "set_", "._", "add_", "(_", "sp", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Score", "Pane", "l", " ", "\"%", "s", "\"", " ", "alr", "ead", "y", " ", "exist", "s", "'_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "locale_", "in_", "[_", "l_", "[_", "0_", "]_", "for_", "l_", "in_", "settings_", "._", "LANGUAGES_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "po_", "=_", "self_", "._", "pou", "tils_", "[_", "locale_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "short", " ", "label", "'_", "%_", "sp", "\\u", "obj_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "sp_", "._", "get_", "(_", "'", "title", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sp_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "label", "'_", "%_", "sp", "\\u", "obj_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "sp_", "._", "get_", "(_", "'", "title", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sp_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "long", " ", "description", "'_", "%_", "sp", "\\u", "obj_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sp_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "score", " ", "function", "s", " ", "for", " ", "this", " ", "score", " ", "panel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sfr", "ef_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "panel", "ed", "\\u", "score", "\\u", "functions_", "(_", "sp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sf", "\\u", "node_", "=_", "self_", "._", "store_", "._", "get", "\\u", "score", "\\u", "function_", "(_", "sfr", "ef_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf", "\\u", "obj_", "=_", "self_", "._", "import", "\\u", "function_", "(_", "sf", "\\u", "node_", ",_", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "Score", "Function", " ", "reference", " ", "to", " ", "Score", "Panel_", "\\u\\u\\uNL\\u\\u\\u_", "sp", "\\u", "obj_", "._", "score", "\\u", "functions_", "._", "add_", "(_", "sf", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "possib", "le", " ", "to", " ", "defin", "e", " ", "Score", "Function", "s", " ", "tha", "t", " ", "are", " ", "not", " ", "part", " ", "of", " ", "any", " ", "Score", "Pane", "ls", ",", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "still", " ", "need", " ", "to", " ", "be", " ", "adde", "d", " ", "to", " ", "allow", " ", "for", " ", "user", " ", "selection", ".", " ", "Fin", "d", " ", "and", " ", "import", " ", "these", " ", "function", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sf", "\\u", "node_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "score", "\\u", "functions_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "import", "\\u", "function_", "(_", "sf", "\\u", "node_", ",_", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "validation", " ", "crite", "ria", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "store_", "._", "has", "\\u", "validation_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Validat", "ion", " ", "not", " ", "configur", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "vc_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "criteria_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb_", "=_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "vc_", "._", "get_", "(_", "'", "legislat", "ive", "body", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "crit_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "crite", "ria", "\\u", "criterion_", "(_", "vc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Import", " ", "the", " ", "score", " ", "function", " ", "for", " ", "this", " ", "validation", " ", "criterion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sfr", "ef_", "=_", "self_", "._", "store_", "._", "get", "\\u", "criterio", "n", "\\u", "score_", "(_", "crit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sf_", "=_", "self_", "._", "store_", "._", "get", "\\u", "score", "\\u", "function_", "(_", "sfr", "ef_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "info_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "import", " ", "Score", "Function", " ", "for", " ", "Criteria", " ", "%", "s", "\"_", ",_", "crit_", "._", "get_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sf", "\\u", "obj_", "=_", "self_", "._", "import", "\\u", "function_", "(_", "sf_", ",_", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "this", " ", "validation", " ", "criterion_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "crit_", "._", "get_", "(_", "'", "id", "'_", ")_", "[_", "0_", ":_", "50_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "function", "'_", ":_", "sf", "\\u", "obj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "legislat", "ive", "\\u", "body", "'_", ":_", "lb_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "crit", "\\u", "obj_", ",_", "created_", ",_", "changed_", ",_", "message_", "=_", "check", "\\u", "and", "\\u", "update_", "(_", "Validat", "ion", "Criteria", "_", ",_", "overwrite_", "=_", "force_", ",_", "**_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "locale_", "in_", "[_", "l_", "[_", "0_", "]_", "for_", "l_", "in_", "settings_", "._", "LANGUAGES_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "po_", "=_", "self_", "._", "pou", "tils_", "[_", "locale_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "short", " ", "label", "'_", "%_", "attributes_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "crit_", "._", "get_", "(_", "'", "name", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "crit_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "label", "'_", "%_", "attributes_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "crit_", "._", "get_", "(_", "'", "name", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "crit_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "long", " ", "description", "'_", "%_", "attributes_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "crit_", "._", "get_", "(_", "'", "description", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "crit_", "._", "source", "line_", ",_", ")_", "]_", "\\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_", "changed_", "and_", "not_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "info_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spa", "tial", "Utils_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "configur", "e\\u", "geoserver", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Configure", " ", "all", " ", "the", " ", "component", "s", " ", "in", " ", "Geos", "erver", ".", " ", "Thi", "s", " ", "method", " ", "configur", "es", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "geoserver", " ", "works", "pace", ",", " ", "datast", "ore", ",", " ", "feature", " ", "types", ",", " ", "and", " ", "style", "s", ".", " ", "All", " ", "\\", "10", ";", " ", " ", " ", " ", "configura", "tion", " ", "step", "s", " ", "get", " ", "process", "ed", " ", "through", " ", "the", " ", "REST", " ", "config", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", "s", ":", " ", "A", " ", "flag", " ", "indicati", "ng", " ", "if", " ", "geoserver", " ", "was", " ", "configur", "ed", " ", "correct", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "srid_", "=_", "Geo", "unit_", "._", "objects_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "geom_", "._", "srid_", "\\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 ", " _", "srid_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Spa", "tial", " ", "Reference", " ", "coul", "d", " ", "not", " ", "be", " ", "dete", "rmin", "ed", ",", " ", "default", "ing", " ", "to", " ", "%", "d", "'_", ",_", "srid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "our", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "namespace", "\\u", "url_", "=_", "'/", "geoserver", "/", "rest", "/", "namespace", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "namespace", "\\u", "obj_", "=_", "{_", "'", "namespace", "'_", ":_", "{_", "'", "prefix", "'_", ":_", "self_", "._", "ns_", ",_", "'", "uri", "'_", ":_", "self_", "._", "nsh", "ref_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "check", "\\u", "spat", "ial", "\\u", "resource_", "(_", "namespace", "\\u", "url_", ",_", "self_", "._", "ns_", ",_", "namespace", "\\u", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "namespace", " ", "\"%", "s", "\"'_", "%_", "self_", "._", "ns_", ")_", "\\u\\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_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "Names", "pace", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "our", " ", "Data", "Store_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "store_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "Geos", "erver", " ", "cann", "ot", " ", "be", " ", "full", "y", " ", "configur", "ed", " ", "with", "out", " ", "a", " ", "store", "d", " ", "config", ".'_", ")_", "\\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_", "dbco", "nfig_", "=_", "self_", "._", "store_", "._", "get", "\\u", "database_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "store", "\\u", "url_", "=_", "'/", "geoserver", "/", "rest", "/", "workspaces", "/", "%", "s", "/", "datast", "ore", "s", "'_", "%_", "self_", "._", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "store", "\\u", "name_", "=_", "'", "Post", "GI", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "store", "\\u", "obj_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "Stor", "e", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "data\\u", "store", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "connecti", "on", "Parameter", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "dbco", "nfig_", "._", "get_", "(_", "'", "host", "'_", ",_", "self_", "._", "host_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "5432", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "databa", "se", "'_", ":_", "dbco", "nfig_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "dbco", "nfig_", "._", "get_", "(_", "'", "user", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "passw", "d", "'_", ":_", "dbco", "nfig_", "._", "get_", "(_", "'", "password", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dbt", "ype", "'_", ":_", "'", "post", "gi", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "namespace", "'_", ":_", "self_", "._", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "schema", "'_", ":_", "dbco", "nfig_", "._", "get_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "check", "\\u", "spat", "ial", "\\u", "resource_", "(_", "data\\u", "store", "\\u", "url_", ",_", "data\\u", "store", "\\u", "name_", ",_", "data\\u", "store", "\\u", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "datast", "ore", " ", "\"%", "s", "\"'_", "%_", "data\\u", "store", "\\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 ", " _", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "Datas", "tore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "feature", " ", "types", " ", "and", " ", "thei", "r", " ", "styles_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "create", "\\u", "feature", "type_", "(_", "'", "identify", "\\u", "geo", "unit", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "feature", " ", "type", " ", "\"", "identify", "\\u", "geo", "unit", "\"'_", ")_", "\\u\\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_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "\"", "identify", "\\u", "geo", "unit", "\"", " ", "feature", " ", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "geo", "level_", "in_", "Geo", "level_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "geo", "level_", "._", "legislat", "ive", "level", "\\u", "set_", "._", "all_", "(_", ")_", "._", "count_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "'", "abstract", "'", " ", "geo", "level", "s", " ", "if", " ", "regions", " ", "are", " ", "configured_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "create", "\\u", "feature", "type_", "(_", "'", "simple", "\\u", "%", "s", "'_", "%_", "geo", "level_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "\"", "simple", "\\u", "%", "s", "\"", " ", "feature", " ", "type", "'_", "%_", "geo", "level_", "._", "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 ", " _", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "\"", "simple", "\\u", "%", "s", "\"", " ", "feature", " ", "type", "'_", "%_", "geo", "level_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "create", "\\u", "feature", "type_", "(_", "'", "simple", "\\u", "district", "\\u", "%", "s", "'_", "%_", "geo", "level_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "\"", "simple", "\\u", "district", "\\u", "%", "s", "\"", " ", "feature", " ", "type", "'_", "%_", "geo", "level_", "._", "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 ", " _", "logger_", "._", "warn_", "(_", "'", "Col", "ud", " ", "not", " ", "create", " ", "\"", "simple", "\\u", "district", "\\u", "%", "s", "\"", " ", "feature", " ", "type", "'_", "%_", "geo", "level_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "subjects_", "=_", "Subject_", "._", "objects_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "sort", "\\u", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "all", "\\u", "subjects_", "._", "count_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject_", "=_", "all", "\\u", "subjects_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "NON", "E", " ", "demo", "graphic", " ", "layer", ",", " ", "based", " ", "on", " ", "first", " ", "subject_", "\\u\\u\\uNL\\u\\u\\u_", "feature", "type", "\\u", "name_", "=_", "get", "\\u", "feature", "type", "\\u", "name_", "(_", "geo", "level_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "create", "\\u", "feature", "type_", "(_", "feature", "type", "\\u", "name_", ",_", "alias_", "=_", "get", "\\u", "feature", "type", "\\u", "name_", "(_", "geo", "level_", "._", "name_", ",_", "subject_", "._", "name_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "\"%", "s", "\"", " ", "feature", " ", "type", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "\"%", "s", "\"", " ", "feature", " ", "type", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "create", "\\u", "style_", "(_", "feature", "type", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "style", " ", "for", " ", "\"%", "s", "\"'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sld", "\\u", "content_", "=_", "Spa", "tial", "Utils_", "._", "generat", "e\\u", "style_", "(_", "geo", "level_", ",_", "geo", "level_", "._", "geo", "unit", "\\u", "set_", "._", "all_", "(_", ")_", ",_", "1_", ",_", "layer", "name_", "=_", "'", "none", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write", "\\u", "style_", "(_", "geo", "level_", "._", "name_", "+_", "'\\u", "none", "'_", ",_", "sld", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "error_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\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_", "self_", "._", "set\\u", "style_", "(_", "feature", "type", "\\u", "name_", ",_", "sld", "\\u", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Set", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "set", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "assign", "\\u", "style_", "(_", "feature", "type", "\\u", "name_", ",_", "feature", "type", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Assign", "ed", " ", "style", " ", "for", " ", "\"%", "s", "\"'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "assign", " ", "style", " ", "for", " ", "\"%", "s", "\"'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "bound", "ary", " ", "layer", ",", " ", "based", " ", "on", " ", "geographic", " ", "boundaries_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "feature", "type", "\\u", "name_", "=_", "'%", "s", "\\u", "bound", "aries", "'_", "%_", "geo", "level_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "create", "\\u", "feature", "type_", "(_", "feature", "type", "\\u", "name_", ",_", "alias_", "=_", "get", "\\u", "feature", "type", "\\u", "name_", "(_", "geo", "level_", "._", "name_", ",_", "subject_", "._", "name_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "\"%", "s", "\"", " ", "feature", " ", "type", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "\"%", "s", "\"", " ", "feature", " ", "type", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "create", "\\u", "style_", "(_", "feature", "type", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sld", "\\u", "content_", "=_", "Spa", "tial", "Utils_", "._", "generat", "e\\u", "style_", "(_", "geo", "level_", ",_", "geo", "level_", "._", "geo", "unit", "\\u", "set_", "._", "all_", "(_", ")_", ",_", "1_", ",_", "layer", "name_", "=_", "'", "bound", "ary", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write", "\\u", "style_", "(_", "geo", "level_", "._", "name_", "+_", "'\\u", "bound", "aries", "'_", ",_", "sld", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "error_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "set\\u", "style_", "(_", "feature", "type", "\\u", "name_", ",_", "sld", "\\u", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Set", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "set", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "assign", "\\u", "style_", "(_", "feature", "type", "\\u", "name_", ",_", "feature", "type", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Assign", "ed", " ", "style", " ", "for", " ", "\"%", "s", "\"'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "assign", " ", "style", " ", "for", " ", "\"%", "s", "\"'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subject_", "in_", "all", "\\u", "subjects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feature", "type", "\\u", "name_", "=_", "get", "\\u", "feature", "type", "\\u", "name_", "(_", "geo", "level_", "._", "name_", ",_", "subject_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "create", "\\u", "feature", "type_", "(_", "feature", "type", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "\"%", "s", "\"", " ", "feature", " ", "type", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "\"%", "s", "\"", " ", "feature", " ", "type", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "create", "\\u", "style_", "(_", "feature", "type", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sld", "\\u", "content_", "=_", "Spa", "tial", "Utils_", "._", "generat", "e\\u", "style_", "(_", "geo", "level_", ",_", "geo", "level_", "._", "geo", "unit", "\\u", "set_", "._", "all_", "(_", ")_", ",_", "5_", ",_", "subject_", "=_", "subject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write", "\\u", "style_", "(_", "geo", "level_", "._", "name_", "+_", "'\\u'_", "+_", "subject_", "._", "name_", ",_", "sld", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "error_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "set\\u", "style_", "(_", "feature", "type", "\\u", "name_", ",_", "sld", "\\u", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Set", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "set", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "assign", "\\u", "style_", "(_", "feature", "type", "\\u", "name_", ",_", "feature", "type", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Assign", "ed", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "assign", " ", "\"%", "s", "\"", " ", "style", "'_", "%_", "feature", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "map", " ", "all", " ", "the", " ", "legislat", "ive", " ", "body", " ", "/", " ", "geo", "level", "s", " ", "combo", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nge", "ole", "vels", "\\u", "map_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lbo", "dy_", "in_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geo", "levels_", "=_", "lbo", "dy_", "._", "get", "\\u", "geo", "levels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "list", " ", "by", " ", "#", " ", "of", " ", "geo", "level", "s", ",", " ", "and", " ", "the", " ", "first", " ", "geo", "level_", "\\u\\u\\uNL\\u\\u\\u_", "nge", "ole", "vels", "\\u", "map_", "._", "append_", "(_", "(_", "len_", "(_", "geo", "levels_", ")_", ",_", "lbo", "dy_", ",_", "geo", "levels_", "[_", "0_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sor", "f", " ", "by", " ", "the", " ", "#", " ", "of", " ", "geo", "levels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nge", "ole", "vels", "\\u", "map_", "._", "sort_", "(_", "lambda_", "x_", ",_", "y_", ":_", "cmp_", "(_", "y_", "[_", "0_", "]_", ",_", "x_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "first", " ", "(", "most", " ", "#", " ", "of", " ", "geo", "level", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "lbo", "dy_", "=_", "nge", "ole", "vels", "\\u", "map_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo", "level_", "=_", "nge", "ole", "vels", "\\u", "map_", "[_", "0_", "]_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "simple", "\\u", "district", " ", "as", " ", "an", " ", "alias", " ", "to", " ", "the", " ", "large", "st", " ", "geo", "level", " ", "(", "e", ".", "g", ".", " ", "counti", "es", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "create", "\\u", "feature", "type_", "(_", "'", "simple", "\\u", "district", "'_", ",_", "alias_", "=_", "'", "simple", "\\u", "district", "\\u", "%", "s", "'_", "%_", "geo", "level_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "\"", "simple", "\\u", "district", "\"", " ", "feature", " ", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "\"", "simple", "\\u", "district", "\"", " ", "feature", " ", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "assign", "\\u", "style_", "(_", "'", "simple", "\\u", "district", "'_", ",_", "'", "poly", "gon", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Assign", "ed", " ", "style", " ", "\"", "poly", "gon", "\"", " ", "to", " ", "feature", " ", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "assign", " ", "\"", "poly", "gon", "\"", " ", "style", " ", "to", " ", "simple", "\\u", "district", "'_", ")_", "\\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_", "#", " ", "add", " ", "the", " ", "district", " ", "intervals_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "intervals_", "=_", "self_", "._", "store_", "._", "filter", "\\u", "nodes_", "(_", "'//", "Score", "Function", "[", "@", "calculator", "=\"", "public", "mapping", ".", "redis", "tric", "ting", ".", "calculator", "s", ".", "Interv", "al", "\"]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "interval_", "in_", "intervals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject", "\\u", "name_", "=_", "interval_", "._", "xpath_", "(_", "'", "Sub", "ject", "Arg", "ument", "'_", ")_", "[_", "0_", "]_", "._", "get_", "(_", "'", "ref", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lbo", "dy", "\\u", "name_", "=_", "interval_", "._", "xpath_", "(_", "'", "Legi", "slat", "ive", "Bod", "y", "'_", ")_", "[_", "0_", "]_", "._", "get_", "(_", "'", "ref", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval", "\\u", "avg_", "=_", "float_", "(_", "interval_", "._", "xpath_", "(_", "'", "Arg", "ument", "[", "@", "name", "=\"", "target", "\"]'_", ")_", "[_", "0_", "]_", "._", "get_", "(_", "'", "value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval", "\\u", "bnd", "1_", "=_", "float_", "(_", "interval_", "._", "xpath_", "(_", "'", "Arg", "ument", "[", "@", "name", "=\"", "bound", "1", "\"]'_", ")_", "[_", "0_", "]_", "._", "get_", "(_", "'", "value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval", "\\u", "bnd", "2_", "=_", "float_", "(_", "interval_", "._", "xpath_", "(_", "'", "Arg", "ument", "[", "@", "name", "=\"", "bound", "2", "\"]'_", ")_", "[_", "0_", "]_", "._", "get_", "(_", "'", "value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "intervals_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "interval", "\\u", "avg_", "+_", "interval", "\\u", "avg_", "*_", "interval", "\\u", "bnd", "2_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Far", " ", "Over", " ", "Target", "'_", ")_", ",_", "{_", "'", "fill", "'_", ":_", "'#", "eb", "b9", "5e", "'_", ",_", "'", "fill", "-", "opa", "city", "'_", ":_", "'", "0.", "3", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "interval", "\\u", "avg_", "+_", "interval", "\\u", "avg_", "*_", "interval", "\\u", "bnd", "1_", ",_", "interval", "\\u", "avg_", "+_", "interval", "\\u", "avg_", "*_", "interval", "\\u", "bnd", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Over", " ", "Target", "'_", ")_", ",_", "{_", "'", "fill", "'_", ":_", "'#", "ead", "3a", "7", "'_", ",_", "'", "fill", "-", "opa", "city", "'_", ":_", "'", "0.", "3", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "interval", "\\u", "avg_", "-_", "interval", "\\u", "avg_", "*_", "interval", "\\u", "bnd", "1_", ",_", "interval", "\\u", "avg_", "+_", "interval", "\\u", "avg_", "*_", "interval", "\\u", "bnd", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Meet", "s", " ", "Target", "'_", ")_", ",_", "{_", "'", "fill", "'_", ":_", "'#", "eeee", "ee", "'_", ",_", "'", "fill", "-", "opa", "city", "'_", ":_", "'", "0.", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "interval", "\\u", "avg_", "-_", "interval", "\\u", "avg_", "*_", "interval", "\\u", "bnd", "2_", ",_", "interval", "\\u", "avg_", "-_", "interval", "\\u", "avg_", "*_", "interval", "\\u", "bnd", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Under", " ", "Target", "'_", ")_", ",_", "{_", "'", "fill", "'_", ":_", "'#", "a2", "d5", "d0", "'_", ",_", "'", "fill", "-", "opa", "city", "'_", ":_", "'", "0.", "3", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "interval", "\\u", "avg_", "-_", "interval", "\\u", "avg_", "*_", "interval", "\\u", "bnd", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Far", " ", "Under", " ", "Target", "'_", ")_", ",_", "{_", "'", "fill", "'_", ":_", "'#", "0a", "ac", "98", "'_", ",_", "'", "fill", "-", "opa", "city", "'_", ":_", "'", "0.", "3", "'_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "sld", "_", "._", "Style", "d", "Layer", "Descriptor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fts", "_", "=_", "doc_", "._", "create", "\\u", "named", "layer_", "(_", "subject", "\\u", "name_", ")_", "._", "create", "\\u", "users", "tyle_", "(_", ")_", "._", "create", "\\u", "feature", "types", "tyle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "interval_", "in_", "intervals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "imi", "n_", ",_", "imax", "_", ",_", "iti", "tle_", ",_", "ifi", "ll_", "=_", "interval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule_", "=_", "fts", "_", "._", "create", "\\u", "rule_", "(_", "iti", "tle_", ",_", "sld", "_", "._", "Polygon", "Symboli", "zer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "imi", "n_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rule_", "._", "create", "\\u", "filter_", "(_", "'", "number", "'_", ",_", "'<'_", ",_", "str_", "(_", "int_", "(_", "round_", "(_", "imax", "_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "imax", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rule_", "._", "create", "\\u", "filter_", "(_", "'", "number", "'_", ",_", "'>='_", ",_", "str_", "(_", "int_", "(_", "round_", "(_", "imi", "n_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f1_", "=_", "sld", "_", "._", "Filter_", "(_", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1_", "._", "Proper", "ty", "Is", "Great", "er", "Than", "Or", "Equal", "To_", "=_", "sld", "_", "._", "Proper", "ty", "Criterion", "_", "(_", "f1_", ",_", "'", "Proper", "ty", "Is", "Great", "er", "Than", "Or", "Equal", "To", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1_", "._", "Proper", "ty", "Is", "Great", "er", "Than", "Or", "Equal", "To_", "._", "Proper", "ty", "Name_", "=_", "'", "number", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1_", "._", "Proper", "ty", "Is", "Great", "er", "Than", "Or", "Equal", "To_", "._", "Literal_", "=_", "str_", "(_", "int_", "(_", "round_", "(_", "imi", "n_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f2_", "=_", "sld", "_", "._", "Filter_", "(_", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2_", "._", "Proper", "ty", "Is", "Less", "Than", "_", "=_", "sld", "_", "._", "Proper", "ty", "Criterion", "_", "(_", "f2_", ",_", "'", "Proper", "ty", "Is", "Less", "Than", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2_", "._", "Proper", "ty", "Is", "Less", "Than", "_", "._", "Proper", "ty", "Name_", "=_", "'", "number", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2_", "._", "Proper", "ty", "Is", "Less", "Than", "_", "._", "Literal_", "=_", "str_", "(_", "int_", "(_", "round_", "(_", "imax", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rule_", "._", "Filter_", "=_", "f1_", "+_", "f2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ps_", "=_", "rule_", "._", "Polygon", "Symboli", "zer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ps_", "._", "Fill_", "._", "Cs", "s", "Parameters_", "[_", "0_", "]_", "._", "Value_", "=_", "ifi", "ll_", "[_", "'", "fill", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ps_", "._", "Fill_", "._", "create", "\\u", "css", "parameter_", "(_", "'", "fill", "-", "opa", "city", "'_", ",_", "ifi", "ll_", "[_", "'", "fill", "-", "opa", "city", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ps_", "._", "Str", "oke", "_", "._", "Cs", "s", "Parameters_", "[_", "0_", "]_", "._", "Value_", "=_", "'#", "fdb", "913", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ps_", "._", "Str", "oke", "_", "._", "Cs", "s", "Parameters_", "[_", "1_", "]_", "._", "Value_", "=_", "'", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ps_", "._", "Str", "oke", "_", "._", "create", "\\u", "css", "parameter_", "(_", "'", "strok", "e-", "opa", "city", "'_", ",_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "write", "\\u", "style_", "(_", "lbo", "dy", "\\u", "name_", "+_", "'\\u'_", "+_", "subject", "\\u", "name_", ",_", "doc_", "._", "as", "\\u", "sld", "_", "(_", "pretty", "\\u", "print_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "'", "Legi", "slat", "ive", "Bod", "y", " ", "interval", "s", " ", "are", " ", "not", " ", "configur", "ed", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Geos", "erver", " ", "configura", "tion", " ", "complete", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "finish", "ed", " ", "configur", "e\\u", "geoserver", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spa", "tial", "Utils_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rest", "\\u", "check_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Atte", "mpt", " ", "to", " ", "get", " ", "a", " ", "REST", " ", "resource", ".", " ", "If", " ", "the", " ", "resource", " ", "exist", "s", ",", " ", "and", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "retrieved", " ", "success", "full", "y", ",", " ", "it", " ", "will", " ", "pass", " ", "the", " ", "check", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", "s", ":", " ", "Tru", "e", " ", "if", " ", "the", " ", "resource", " ", "exist", "s", " ", "and", " ", "is", " ", "reada", "ble", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "httplib_", "._", "HTTP", "Connection_", "(_", "self_", "._", "host_", ",_", "self_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "request_", "(_", "'", "GET", "'_", ",_", "url_", ",_", "None_", ",_", "self_", "._", "headers_", "[_", "'", "default", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsp_", "=_", "conn_", "._", "getresponse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsp_", "._", "read_", "(_", ")_", "#", " ", "and", " ", "discard_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rsp_", "._", "status_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "HTTP", " ", "400", ",", " ", "500", " ", "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 2, 2, 2, 2, 2 ]
Unused local variable
maraoz/proofofexistence/babel/messages/catalog.py
[ { "content": " def __setitem__(self, id, message):\n \"\"\"Add or update the message with the specified ID.\n\n >>> catalog = Catalog()\n >>> catalog[u'foo'] = Message(u'foo')\n >>> catalog[u'foo']\n <Message u'foo' (flags: [])>\n\n If a message with that ID is already in the catalog, it is updated\n to include the locations and flags of the new message.\n\n >>> catalog = Catalog()\n >>> catalog[u'foo'] = Message(u'foo', locations=[('main.py', 1)])\n >>> catalog[u'foo'].locations\n [('main.py', 1)]\n >>> catalog[u'foo'] = Message(u'foo', locations=[('utils.py', 5)])\n >>> catalog[u'foo'].locations\n [('main.py', 1), ('utils.py', 5)]\n\n :param id: the message ID\n :param message: the `Message` object\n \"\"\"\n assert isinstance(message, Message), 'expected a Message object'\n key = self._key_for(id, message.context)\n current = self._messages.get(key)\n if current:\n if message.pluralizable and not current.pluralizable:\n # The new message adds pluralization\n current.id = message.id\n current.string = message.string\n current.locations = list(distinct(current.locations +\n message.locations))\n current.auto_comments = list(distinct(current.auto_comments +\n message.auto_comments))\n current.user_comments = list(distinct(current.user_comments +\n message.user_comments))\n current.flags |= message.flags\n message = current\n elif id == '':\n # special treatment for the header message\n self.mime_headers = _parse_header(message.string).items()\n self.header_comment = '\\n'.join([('# %s' % c).rstrip() for c\n in message.user_comments])\n self.fuzzy = message.fuzzy\n else:\n if isinstance(id, (list, tuple)):\n assert isinstance(message.string, (list, tuple)), \\\n 'Expected sequence but got %s' % type(message.string)\n self._messages[key] = message", "metadata": "root.Catalog.__setitem__", "header": "['class', 'Catalog', '(', 'object', ')', ':', '___EOS___']", "index": 557 } ]
[ { "span": "message ", "start_line": 594, "start_column": 12, "end_line": 594, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Catalog_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "id_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "or", " ", "update", " ", "the", " ", "message", " ", "with", " ", "the", " ", "specified", " ", "ID", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "catal", "og", " ", "=", " ", "Catalog", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "catal", "og", "[", "u", "'", "foo", "']", " ", "=", " ", "Messag", "e", "(", "u", "'", "foo", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "catal", "og", "[", "u", "'", "foo", "']", "\\", "10", ";", " ", " ", " ", " ", "<", "Messag", "e", " ", "u", "'", "foo", "'", " ", "(", "flags", ":", " ", "[]", ")>", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "a", " ", "message", " ", "with", " ", "tha", "t", " ", "ID", " ", "is", " ", "alr", "ead", "y", " ", "in", " ", "the", " ", "catal", "og", ",", " ", "it", " ", "is", " ", "update", "d", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "include", " ", "the", " ", "location", "s", " ", "and", " ", "flags", " ", "of", " ", "the", " ", "new", " ", "message", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "catal", "og", " ", "=", " ", "Catalog", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "catal", "og", "[", "u", "'", "foo", "']", " ", "=", " ", "Messag", "e", "(", "u", "'", "foo", "',", " ", "location", "s", "=[", "('", "main", ".", "py", "',", " ", "1", ")])", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "catal", "og", "[", "u", "'", "foo", "']", ".", "location", "s", "\\", "10", ";", " ", " ", " ", " ", "[(", "'", "main", ".", "py", "',", " ", "1", ")]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "catal", "og", "[", "u", "'", "foo", "']", " ", "=", " ", "Messag", "e", "(", "u", "'", "foo", "',", " ", "location", "s", "=[", "('", "util", "s", ".", "py", "',", " ", "5", ")])", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "catal", "og", "[", "u", "'", "foo", "']", ".", "location", "s", "\\", "10", ";", " ", " ", " ", " ", "[(", "'", "main", ".", "py", "',", " ", "1", "),", " ", "('", "util", "s", ".", "py", "',", " ", "5", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "id", ":", " ", "the", " ", "message", " ", "ID", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "message", ":", " ", "the", " ", "`", "Messag", "e", "`", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "message_", ",_", "Message_", ")_", ",_", "'", "expected", " ", "a", " ", "Messag", "e", " ", "object", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "\\u", "key", "\\u", "for_", "(_", "id_", ",_", "message_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "=_", "self_", "._", "\\u", "messages_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "message_", "._", "plural", "iza", "ble_", "and_", "not_", "current_", "._", "plural", "iza", "ble_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "new", " ", "message", " ", "adds", " ", "plural", "ization_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current_", "._", "id_", "=_", "message_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "._", "string_", "=_", "message_", "._", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current_", "._", "locations_", "=_", "list_", "(_", "distinct_", "(_", "current_", "._", "locations_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "._", "locations_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "._", "auto", "\\u", "comments_", "=_", "list_", "(_", "distinct_", "(_", "current_", "._", "auto", "\\u", "comments_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "._", "auto", "\\u", "comments_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "._", "user", "\\u", "comments_", "=_", "list_", "(_", "distinct_", "(_", "current_", "._", "user", "\\u", "comments_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "._", "user", "\\u", "comments_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "._", "flags_", "|=_", "message_", "._", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "current_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "id_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "special", " ", "treatment", " ", "for", " ", "the", " ", "header", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mime", "\\u", "headers_", "=_", "\\u", "parse", "\\u", "header_", "(_", "message_", "._", "string_", ")_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "header", "\\u", "comment_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "(_", "'#", " ", "%", "s", "'_", "%_", "c_", ")_", "._", "rstrip_", "(_", ")_", "for_", "c_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "message_", "._", "user", "\\u", "comments_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fuzzy_", "=_", "message_", "._", "fuzzy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "id_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "message_", "._", "string_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ",_", "'", "Expect", "ed", " ", "sequence", " ", "but", " ", "got", " ", "%", "s", "'_", "%_", "type_", "(_", "message_", "._", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "messages_", "[_", "key_", "]_", "=_", "message_", "\\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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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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
appcelerator-archive/poc-nodejs-desktop/Resources/nodejs/builds/linux/node/lib/node/wafadmin/pproc.py
[ { "content": "# borrowed from python 2.5.2c1\n# Copyright (c) 2003-2005 by Peter Astrand <[email protected]>\n# Licensed to PSF under a Contributor Agreement.\n\nimport sys\nmswindows = (sys.platform == \"win32\")\n\nimport os\nimport types\nimport traceback\nimport gc\n\n\nif mswindows:\n import threading\n import msvcrt\n if 0:\n import pywintypes\n from win32api import GetStdHandle, STD_INPUT_HANDLE, \\\n STD_OUTPUT_HANDLE, STD_ERROR_HANDLE\n from win32api import GetCurrentProcess, DuplicateHandle, \\\n GetModuleFileName, GetVersion\n from win32con import DUPLICATE_SAME_ACCESS, SW_HIDE\n from win32pipe import CreatePipe\n from win32process import CreateProcess, STARTUPINFO, \\\n GetExitCodeProcess, STARTF_USESTDHANDLES, \\\n STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE\n from win32event import WaitForSingleObject, INFINITE, WAIT_OBJECT_0\n else:\n from _subprocess import *\nelse:\n import select\n import errno\n import fcntl\n import pickle\n\n__all__ = [\"Popen\", \"PIPE\", \"STDOUT\", \"call\", \"check_call\", \"CalledProcessError\"]\n\ntry:\n MAXFD = os.sysconf(\"SC_OPEN_MAX\")\nexcept:\n MAXFD = 256\n\ntry:\n False\nexcept NameError:\n False = 0\n True = 1\n\n_active = []\n\n\nPIPE = -1\nSTDOUT = -2\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def _close_fds(self, but):\n for i in xrange(3, MAXFD):\n if i == but:\n continue\n try:\n os.close(i)\n except:\n pass", "metadata": "root.Popen._close_fds", "header": "['class', 'Popen', '(', 'object', ')', ':', '___EOS___']", "index": 438 }, { "content": " def _execute_child(self, args, executable, preexec_fn, close_fds,\n cwd, env, universal_newlines, startupinfo, creationflags, shell,\n p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite):\n\n if isinstance(args, types.StringTypes):\n args = [args]\n else:\n args = list(args)\n\n if shell:\n args = [\"/bin/sh\", \"-c\"] + args\n\n if executable is None:\n executable = args[0]\n\n errpipe_read, errpipe_write = os.pipe()\n self._set_cloexec_flag(errpipe_write)\n\n gc_was_enabled = gc.isenabled()\n gc.disable()\n try:\n self.pid = os.fork()\n except:\n if gc_was_enabled:\n gc.enable()\n raise\n self._child_created = True\n if self.pid == 0:\n try:\n if p2cwrite:\n os.close(p2cwrite)\n if c2pread:\n os.close(c2pread)\n if errread:\n os.close(errread)\n os.close(errpipe_read)\n\n if p2cread:\n os.dup2(p2cread, 0)\n if c2pwrite:\n os.dup2(c2pwrite, 1)\n if errwrite:\n os.dup2(errwrite, 2)\n\n if p2cread and p2cread not in (0,):\n os.close(p2cread)\n if c2pwrite and c2pwrite not in (p2cread, 1):\n os.close(c2pwrite)\n if errwrite and errwrite not in (p2cread, c2pwrite, 2):\n os.close(errwrite)\n\n if close_fds:\n self._close_fds(but=errpipe_write)\n\n if cwd is not None:\n os.chdir(cwd)\n\n if preexec_fn:\n apply(preexec_fn)\n\n if env is None:\n os.execvp(executable, args)\n else:\n os.execvpe(executable, args, env)\n\n except:\n exc_type, exc_value, tb = sys.exc_info()\n exc_lines = traceback.format_exception(exc_type, exc_value, tb)\n exc_value.child_traceback = ''.join(exc_lines)\n os.write(errpipe_write, pickle.dumps(exc_value))\n\n os._exit(255)\n\n if gc_was_enabled:\n gc.enable()\n os.close(errpipe_write)\n if p2cread and p2cwrite:\n os.close(p2cread)\n if c2pwrite and c2pread:\n os.close(c2pwrite)\n if errwrite and errread:\n os.close(errwrite)\n\n data = os.read(errpipe_read, 1048576)\n os.close(errpipe_read)\n if data != \"\":\n os.waitpid(self.pid, 0)\n child_exception = pickle.loads(data)\n raise child_exception", "metadata": "root.Popen._execute_child", "header": "['class', 'Popen', '(', 'object', ')', ':', '___EOS___']", "index": 447 } ]
[ { "span": "except:", "start_line": 54, "start_column": 0, "end_line": 54, "end_column": 7 }, { "span": "except:", "start_line": 444, "start_column": 16, "end_line": 444, "end_column": 23 }, { "span": "except:", "start_line": 512, "start_column": 16, "end_line": 512, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "borrow", "ed", " ", "from", " ", "python", " ", "2.5", ".2", "c1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2003", "-", "2005", " ", "by", " ", "Peter", " ", "Ast", "rand", " ", "<", "astr", "and", "@", "lys", "ator", ".", "li", "u", ".", "se", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "to", " ", "PSF", " ", "under", " ", "a", " ", "Contributor", " ", "Agreement", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ms", "windows_", "=_", "(_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gc_", "\\u\\u\\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_", "ms", "windows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "msvcrt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pywi", "ntype", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "win32", "api_", "import_", "Get", "Std", "Handle_", ",_", "STD", "\\u", "INPUT", "\\u", "HANDLE_", ",_", "STD", "\\u", "OUTPU", "T", "\\u", "HANDLE_", ",_", "STD", "\\u", "ERROR", "\\u", "HANDLE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "win32", "api_", "import_", "Get", "Curr", "ent", "Process_", ",_", "Duplicate", "Handle_", ",_", "Get", "Modul", "e", "File", "Name_", ",_", "Get", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "win32con_", "import_", "DUPL", "ICAT", "E", "\\u", "SAM", "E", "\\u", "ACCESS", "_", ",_", "SW", "\\u", "HID", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "win32", "pipe_", "import_", "Creat", "e", "Pipe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "win32", "process_", "import_", "Creat", "e", "Process_", ",_", "START", "UP", "INFO_", ",_", "Get", "Exi", "t", "Code", "Process_", ",_", "START", "F", "\\u", "USE", "STD", "HANDLE", "S_", ",_", "START", "F", "\\u", "USE", "SHOW", "WINDOW_", ",_", "CREATE", "\\u", "NEW", "\\u", "CONSOLE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "win32", "event_", "import_", "Wait", "For", "Sing", "le", "Object_", ",_", "INFINIT", "E_", ",_", "WAIT", "\\u", "OBJ", "ECT", "\\u", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "\\u", "subprocess_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fcntl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\"", "Pop", "en", "\"_", ",_", "\"", "PIPE", "\"_", ",_", "\"", "STD", "OUT", "\"_", ",_", "\"", "call", "\"_", ",_", "\"", "check", "\\u", "call", "\"_", ",_", "\"", "Call", "ed", "Process", "Error", "\"_", "]_", "\\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 ", " _", "MAX", "FD_", "=_", "os_", "._", "sysc", "onf_", "(_", "\"", "SC", "\\u", "OPEN", "\\u", "MAX", "\"_", ")_", "\\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 ", " _", "MAX", "FD_", "=_", "256_", "\\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 ", " _", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "False_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "True_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "active_", "=_", "[_", "]_", "\\u\\u\\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_", "PIPE_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STDOUT_", "=_", "-_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Popen_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "close", "\\u", "fds_", "(_", "self_", ",_", "but", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "3_", ",_", "MAX", "FD_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "but", "_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "close_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Popen_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "execute", "\\u", "child_", "(_", "self_", ",_", "args_", ",_", "executable_", ",_", "pree", "xec", "\\u", "fn_", ",_", "close", "\\u", "fds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", ",_", "env_", ",_", "universal", "\\u", "newlines_", ",_", "start", "upi", "nfo_", ",_", "creati", "onf", "lags_", ",_", "shell_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p2", "crea", "d_", ",_", "p2", "cw", "rite_", ",_", "c2", "prea", "d_", ",_", "c2", "pwr", "ite_", ",_", "err", "read_", ",_", "err", "write_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "args_", ",_", "types_", "._", "String", "Types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "args_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "list_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "shell_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "\"/", "bin", "/", "sh", "\"_", ",_", "\"-", "c", "\"_", "]_", "+_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "executable_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "executable_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "err", "pipe", "\\u", "read_", ",_", "err", "pipe", "\\u", "write_", "=_", "os_", "._", "pipe_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "clo", "exec", "\\u", "flag_", "(_", "err", "pipe", "\\u", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gc", "\\u", "was", "\\u", "enabled_", "=_", "gc_", "._", "ise", "nable", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gc_", "._", "disable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pid_", "=_", "os_", "._", "fork_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "gc", "\\u", "was", "\\u", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "gc_", "._", "enable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "child", "\\u", "created_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "pid_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "p2", "cw", "rite_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "close_", "(_", "p2", "cw", "rite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c2", "prea", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "close_", "(_", "c2", "prea", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "err", "read_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "close_", "(_", "err", "read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "close_", "(_", "err", "pipe", "\\u", "read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "p2", "crea", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "dup", "2_", "(_", "p2", "crea", "d_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c2", "pwr", "ite_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "dup", "2_", "(_", "c2", "pwr", "ite_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "err", "write_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "dup", "2_", "(_", "err", "write_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p2", "crea", "d_", "and_", "p2", "crea", "d_", "not_", "in_", "(_", "0_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "close_", "(_", "p2", "crea", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c2", "pwr", "ite_", "and_", "c2", "pwr", "ite_", "not_", "in_", "(_", "p2", "crea", "d_", ",_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "close_", "(_", "c2", "pwr", "ite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "err", "write_", "and_", "err", "write_", "not_", "in_", "(_", "p2", "crea", "d_", ",_", "c2", "pwr", "ite_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "close_", "(_", "err", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "close", "\\u", "fds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "close", "\\u", "fds_", "(_", "but", "_", "=_", "err", "pipe", "\\u", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cwd_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "chdir_", "(_", "cwd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pree", "xec", "\\u", "fn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "apply_", "(_", "pree", "xec", "\\u", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "env_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "exec", "vp_", "(_", "executable_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "exec", "vp", "e_", "(_", "executable_", ",_", "args_", ",_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "lines_", "=_", "traceback_", "._", "format\\u", "exception_", "(_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "value_", "._", "child", "\\u", "traceback_", "=_", "''_", "._", "join_", "(_", "exc", "\\u", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "write_", "(_", "err", "pipe", "\\u", "write_", ",_", "pickle_", "._", "dumps_", "(_", "exc", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "\\u", "exit_", "(_", "255_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gc", "\\u", "was", "\\u", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gc_", "._", "enable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "close_", "(_", "err", "pipe", "\\u", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p2", "crea", "d_", "and_", "p2", "cw", "rite_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "close_", "(_", "p2", "crea", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c2", "pwr", "ite_", "and_", "c2", "prea", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "close_", "(_", "c2", "pwr", "ite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "err", "write_", "and_", "err", "read_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "close_", "(_", "err", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "os_", "._", "read_", "(_", "err", "pipe", "\\u", "read_", ",_", "104857", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "close_", "(_", "err", "pipe", "\\u", "read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "wait", "pid_", "(_", "self_", "._", "pid_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "\\u", "exception_", "=_", "pickle_", "._", "loads_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "child", "\\u", "exception_", "\\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, 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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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
open-cloud/xos/xos/synchronizers/vtn/steps/sync_port_addresses.py
[ { "content": " def call(self, **args):\n global glo_saved_vtn_maps\n\n logger.info(\"sync'ing vsg tenant to port addresses\")\n\n # build up a dictionary of port-->[wan_addrs] mappings\n port_addrs = {}\n for vsg in VSGTenant.get_tenant_objects().all():\n if not vsg.instance:\n logger.info(\"skipping vsg %s because it has no instance\" % vsg)\n\n wan_ip = vsg.wan_container_ip\n if not wan_ip:\n logger.info(\"skipping vsg %s because it has no wan_container_ip\" % vsg)\n\n wan_mac = vsg.wan_container_mac\n if not wan_mac:\n logger.info(\"skipping vsg %s because it has no wan_container_mac\" % vsg)\n\n lan_network = vsg.get_lan_network(vsg.instance)\n if not lan_network:\n logger.info(\"skipping vsg %s because it has no lan_network\" % vsg)\n\n lan_port = Port.objects.filter(instance = vsg.instance, network=lan_network)\n if not lan_port:\n logger.info(\"skipping vsg %s because it has no lan_port\" % vsg)\n lan_port = lan_port[0]\n\n if not lan_port.port_id:\n logger.info(\"skipping vsg %s because its lan_port has no port_id\" % vsg)\n\n if not (lan_port.pk in port_addrs):\n port_addrs[lan_port.pk] = []\n entry = {\"mac_address\": wan_mac, \"ip_address\": wan_ip}\n addr_pairs = port_addrs[lan_port.pk]\n if not entry in addr_pairs:\n addr_pairs.append(entry)\n\n # now do the VM_WAN_IP from the instance\n if vsg.instance:\n wan_vm_ip = vsg.wan_vm_ip\n wan_vm_mac = vsg.wan_vm_mac\n entry = {\"mac_address\": wan_vm_mac, \"ip_address\": wan_vm_ip}\n if not entry in addr_pairs:\n addr_pairs.append(entry)\n\n # Get all ports in all controllers\n ports_by_id = {}\n for controller in Controller.objects.all():\n if not controller.admin_tenant:\n logger.info(\"controller %s has no admin_tenant\" % controller)\n continue\n try:\n driver = self.driver.admin_driver(controller = controller)\n ports = driver.shell.quantum.list_ports()[\"ports\"]\n except:\n logger.log_exc(\"failed to get ports from controller %s\" % controller)\n continue\n\n for port in ports:\n ports_by_id[port[\"id\"]] = port\n\n for port_pk in port_addrs.keys():\n port = Port.objects.get(pk=port_pk)\n addr_pairs = port_addrs[port_pk]\n neutron_port = ports_by_id.get(port.port_id,None)\n if not neutron_port:\n logger.info(\"failed to get neutron port for port %s\" % port)\n continue\n\n ips = [x[\"ip_address\"] for x in addr_pairs]\n\n changed = False\n\n # delete addresses in neutron that don't exist in XOS\n aaps = neutron_port.get(\"allowed_address_pairs\", [])\n for aap in aaps[:]:\n if not aap[\"ip_address\"] in ips:\n logger.info(\"removing address %s from port %s\" % (aap[\"ip_address\"], port))\n aaps.remove(aap)\n changed = True\n\n aaps_ips = [x[\"ip_address\"] for x in aaps]\n\n # add addresses in XOS that don't exist in neutron\n for addr in addr_pairs:\n if not addr[\"ip_address\"] in aaps_ips:\n logger.info(\"adding address %s to port %s\" % (addr, port))\n aaps.append( addr )\n aaps_ips.append(addr[\"ip_address\"])\n changed = True\n\n if changed:\n logger.info(\"updating port %s\" % port)\n driver.shell.quantum.update_port(port.port_id, {\"port\": {\"allowed_address_pairs\": aaps}})", "metadata": "root.SyncPortAddresses.call", "header": "['class', 'SyncPortAddresses', '(', 'SyncStep', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "except:", "start_line": 87, "start_column": 12, "end_line": 87, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Sync", "Port", "Address", "es_", "(_", "Sync", "Step_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "call_", "(_", "self_", ",_", "**_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "glo", "\\u", "saved", "\\u", "vt", "n", "\\u", "maps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "sync", "'", "ing", " ", "vs", "g", " ", "tenan", "t", " ", "to", " ", "port", " ", "addresse", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "up", " ", "a", " ", "dictionar", "y", " ", "of", " ", "port", "-->", "[", "wan", "\\u", "addr", "s", "]", " ", "mappings_", "\\u\\u\\uNL\\u\\u\\u_", "port", "\\u", "addrs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "vs", "g_", "in_", "VS", "GT", "ena", "nt_", "._", "get", "\\u", "tenan", "t", "\\u", "objects_", "(_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "vs", "g_", "._", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "skip", "ping", " ", "vs", "g", " ", "%", "s", " ", "bec", "aus", "e", " ", "it", " ", "has", " ", "no", " ", "instance", "\"_", "%_", "vs", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wan", "\\u", "ip_", "=_", "vs", "g_", "._", "wan", "\\u", "container", "\\u", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "wan", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "skip", "ping", " ", "vs", "g", " ", "%", "s", " ", "bec", "aus", "e", " ", "it", " ", "has", " ", "no", " ", "wan", "\\u", "container", "\\u", "ip", "\"_", "%_", "vs", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wan", "\\u", "mac_", "=_", "vs", "g_", "._", "wan", "\\u", "container", "\\u", "mac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "wan", "\\u", "mac_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "skip", "ping", " ", "vs", "g", " ", "%", "s", " ", "bec", "aus", "e", " ", "it", " ", "has", " ", "no", " ", "wan", "\\u", "container", "\\u", "mac", "\"_", "%_", "vs", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lan", "\\u", "network_", "=_", "vs", "g_", "._", "get", "\\u", "lan", "\\u", "network_", "(_", "vs", "g_", "._", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "lan", "\\u", "network_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "skip", "ping", " ", "vs", "g", " ", "%", "s", " ", "bec", "aus", "e", " ", "it", " ", "has", " ", "no", " ", "lan", "\\u", "network", "\"_", "%_", "vs", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lan", "\\u", "port_", "=_", "Port_", "._", "objects_", "._", "filter_", "(_", "instance_", "=_", "vs", "g_", "._", "instance_", ",_", "network_", "=_", "lan", "\\u", "network_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "lan", "\\u", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "skip", "ping", " ", "vs", "g", " ", "%", "s", " ", "bec", "aus", "e", " ", "it", " ", "has", " ", "no", " ", "lan", "\\u", "port", "\"_", "%_", "vs", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lan", "\\u", "port_", "=_", "lan", "\\u", "port_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "lan", "\\u", "port_", "._", "port", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "skip", "ping", " ", "vs", "g", " ", "%", "s", " ", "bec", "aus", "e", " ", "its", " ", "lan", "\\u", "port", " ", "has", " ", "no", " ", "port", "\\u", "id", "\"_", "%_", "vs", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "lan", "\\u", "port_", "._", "pk_", "in_", "port", "\\u", "addrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "\\u", "addrs_", "[_", "lan", "\\u", "port_", "._", "pk_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entry_", "=_", "{_", "\"", "mac", "\\u", "address", "\"_", ":_", "wan", "\\u", "mac_", ",_", "\"", "ip", "\\u", "address", "\"_", ":_", "wan", "\\u", "ip_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr", "\\u", "pairs_", "=_", "port", "\\u", "addrs_", "[_", "lan", "\\u", "port_", "._", "pk_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "entry_", "in_", "addr", "\\u", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr", "\\u", "pairs_", "._", "append_", "(_", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "do", " ", "the", " ", "VM", "\\u", "WAN", "\\u", "IP", " ", "from", " ", "the", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "vs", "g_", "._", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wan", "\\u", "vm", "\\u", "ip_", "=_", "vs", "g_", "._", "wan", "\\u", "vm", "\\u", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wan", "\\u", "vm", "\\u", "mac_", "=_", "vs", "g_", "._", "wan", "\\u", "vm", "\\u", "mac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry_", "=_", "{_", "\"", "mac", "\\u", "address", "\"_", ":_", "wan", "\\u", "vm", "\\u", "mac_", ",_", "\"", "ip", "\\u", "address", "\"_", ":_", "wan", "\\u", "vm", "\\u", "ip_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "entry_", "in_", "addr", "\\u", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "addr", "\\u", "pairs_", "._", "append_", "(_", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "all", " ", "port", "s", " ", "in", " ", "all", " ", "controllers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "port", "s", "\\u", "by", "\\u", "id_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "controller_", "in_", "Controller_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "controller_", "._", "admin", "\\u", "tenant_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "controlle", "r", " ", "%", "s", " ", "has", " ", "no", " ", "admin", "\\u", "tenan", "t", "\"_", "%_", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "driver_", "=_", "self_", "._", "driver_", "._", "admin", "\\u", "driver_", "(_", "controller_", "=_", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ports_", "=_", "driver_", "._", "shell_", "._", "quantum", "_", "._", "list", "\\u", "ports_", "(_", ")_", "[_", "\"", "port", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "log", "\\u", "exc_", "(_", "\"", "fail", "ed", " ", "to", " ", "get", " ", "port", "s", " ", "from", " ", "controlle", "r", " ", "%", "s", "\"_", "%_", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "port_", "in_", "ports_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "s", "\\u", "by", "\\u", "id_", "[_", "port_", "[_", "\"", "id", "\"_", "]_", "]_", "=_", "port_", "\\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_", "port", "\\u", "pk_", "in_", "port", "\\u", "addrs_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "Port_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "port", "\\u", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr", "\\u", "pairs_", "=_", "port", "\\u", "addrs_", "[_", "port", "\\u", "pk_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neut", "ron", "\\u", "port_", "=_", "port", "s", "\\u", "by", "\\u", "id_", "._", "get_", "(_", "port_", "._", "port", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "neut", "ron", "\\u", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "fail", "ed", " ", "to", " ", "get", " ", "neut", "ron", " ", "port", " ", "for", " ", "port", " ", "%", "s", "\"_", "%_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ips_", "=_", "[_", "x_", "[_", "\"", "ip", "\\u", "address", "\"_", "]_", "for_", "x_", "in_", "addr", "\\u", "pairs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "changed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "addresse", "s", " ", "in", " ", "neut", "ron", " ", "tha", "t", " ", "don", "'", "t", " ", "exist", " ", "in", " ", "XO", "S_", "\\u\\u\\uNL\\u\\u\\u_", "aa", "ps_", "=_", "neut", "ron", "\\u", "port_", "._", "get_", "(_", "\"", "allow", "ed", "\\u", "address", "\\u", "pair", "s", "\"_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "aa", "p_", "in_", "aa", "ps_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "aa", "p_", "[_", "\"", "ip", "\\u", "address", "\"_", "]_", "in_", "ips_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "info_", "(_", "\"", "remo", "ving", " ", "address", " ", "%", "s", " ", "from", " ", "port", " ", "%", "s", "\"_", "%_", "(_", "aa", "p_", "[_", "\"", "ip", "\\u", "address", "\"_", "]_", ",_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aa", "ps_", "._", "remove_", "(_", "aa", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aa", "ps", "\\u", "ips_", "=_", "[_", "x_", "[_", "\"", "ip", "\\u", "address", "\"_", "]_", "for_", "x_", "in_", "aa", "ps_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "addresse", "s", " ", "in", " ", "XO", "S", " ", "tha", "t", " ", "don", "'", "t", " ", "exist", " ", "in", " ", "neutron_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "addr_", "in_", "addr", "\\u", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "addr_", "[_", "\"", "ip", "\\u", "address", "\"_", "]_", "in_", "aa", "ps", "\\u", "ips_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "info_", "(_", "\"", "addin", "g", " ", "address", " ", "%", "s", " ", "to", " ", "port", " ", "%", "s", "\"_", "%_", "(_", "addr_", ",_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aa", "ps_", "._", "append_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aa", "ps", "\\u", "ips_", "._", "append_", "(_", "addr_", "[_", "\"", "ip", "\\u", "address", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "updat", "ing", " ", "port", " ", "%", "s", "\"_", "%_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver_", "._", "shell_", "._", "quantum", "_", "._", "update", "\\u", "port_", "(_", "port_", "._", "port", "\\u", "id_", ",_", "{_", "\"", "port", "\"_", ":_", "{_", "\"", "allow", "ed", "\\u", "address", "\\u", "pair", "s", "\"_", ":_", "aa", "ps_", "}_", "}_", ")_" ]
[ 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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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 ]
Module is imported with 'import' and 'import from'
qtile/qtile/libqtile/widget/keyboardlayout.py
[ { "content": "# Copyright (c) 2013 Jacob Mourelos\n# Copyright (c) 2014 Shepilov Vladislav\n# Copyright (c) 2014-2015 Sean Vig\n# Copyright (c) 2014 Tycho Andersen\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\n\nimport re\nimport subprocess\nfrom subprocess import CalledProcessError\n\nfrom . import base\nfrom libqtile.log_utils import logger\n\n\nkb_regex = re.compile('layout:\\s+(?P<layout>\\w+)')\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import subprocess", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "Jacob", " ", "Mo", "ure", "los", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "She", "pil", "ov", " ", "Vla", "dis", "lav", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", "-", "201", "5", " ", "Sea", "n", " ", "Vi", "g_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Ty", "cho", " ", "And", "erse", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "subprocess_", "import_", "Call", "ed", "Process", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lib", "qti", "le_", "._", "log", "\\u", "utils_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kb", "\\u", "regex_", "=_", "re_", "._", "compile_", "(_", "'", "layout", ":\\\\", "s", "+(?", "P", "<", "layout", ">\\\\", "w", "+)'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
niwinz/django-greenqueue/greenqueue/worker/pgevent.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom .base import BaseWorker, BaseManager\nfrom ..scheduler.gevent_scheduler import Scheduler\nfrom .. import settings\n\nimport gevent\nfrom gevent import Greenlet\nfrom gevent.event import Event\nfrom gevent.queue import Queue\n\nfrom Queue import Empty\n\nimport logging\nlog = logging.getLogger('greenqueue')\n\nfrom django.utils.timezone import now\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Worker(BaseWorker):\n", "metadata": "root.Worker", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def _name(self):\n return self.greenlet_name", "metadata": "root.Worker._name", "header": "['class', 'Worker', '(', 'BaseWorker', ')', ':', '___EOS___']", "index": 19 }, { "content": " def set_name(self, name):\n self.greenlet_name = name", "metadata": "root.Worker.set_name", "header": "['class', 'Worker', '(', 'BaseWorker', ')', ':', '___EOS___']", "index": 22 }, { "content": "class ACKWatcher(Greenlet):\n \"\"\"\n This is a dummy ack watcher greenlet, because the zeromq backend not precise\n ack managment.\n \"\"\"\n\n", "metadata": "root.ACKWatcher", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def __init__(self, queue, stop_event, callback):\n super(ACKWatcher, self).__init__()\n self.queue = queue\n self.stop_event = stop_event\n self.callback = callback", "metadata": "root.ACKWatcher.__init__", "header": "['class', 'ACKWatcher', '(', 'Greenlet', ')', ':', '___EOS___']", "index": 32 }, { "content": " def _run(self):\n while not self.stop_event.is_set():\n try:\n ack_uuid = self.queue.get(True, 1)\n self.callback(ack_uuid)\n except Empty:\n pass", "metadata": "root.ACKWatcher._run", "header": "['class', 'ACKWatcher', '(', 'Greenlet', ')', ':', '___EOS___']", "index": 38 }, { "content": "class GreenletManager(BaseManager):\n greenlet = True\n process_list = []\n\n\n\n\n", "metadata": "root.GreenletManager", "header": "['module', '___EOS___']", "index": 47 }, { "content": " def __init__(self):\n super(GreenletManager, self).__init__()\n self.stop_event = Event()\n self.work_queue = Queue(settings.GREENQUEUE_BACKEND_TASKBUFF)\n self.ack_queue = Queue()", "metadata": "root.GreenletManager.__init__", "header": "['class', 'GreenletManager', '(', 'BaseManager', ')', ':', '___EOS___']", "index": 51 }, { "content": " def start_greenlet_pool(self):\n for i in xrange(settings.GREENQUEUE_BACKEND_POOLSIZE):\n log.info(\"greenqueue: starting worker process {0}\".format(i))\n\n worker = Worker(self.work_queue, self.ack_queue, self.stop_event)\n worker.set_name(\"greenlet-{0}\".format(i))\n\n g = Greenlet.spawn(worker)\n self.process_list.append(g)", "metadata": "root.GreenletManager.start_greenlet_pool", "header": "['class', 'GreenletManager', '(', 'BaseManager', ')', ':', '___EOS___']", "index": 57 }, { "content": " def start(self):\n # starts a dummy watcher, because zeromq is not need ack.\n self.watcher = ACKWatcher(self.ack_queue, self.stop_event, self._ack_callback)\n self.watcher.start()\n\n self.scheduler = Scheduler(self.stop_event, self._handle_message)\n self.scheduler.start()\n\n self.start_greenlet_pool()", "metadata": "root.GreenletManager.start", "header": "['class', 'GreenletManager', '(', 'BaseManager', ')', ':', '___EOS___']", "index": 67 }, { "content": " def _handle_message(self, name, uuid, args, kwargs, message={}):\n now_date = now()\n\n if \"eta\" in message:\n eta = self.parse_eta(message['eta'])\n\n if now() < eta:\n log.debug(\"greenqueue: task schedulet with eta [%s]\", eta.isoformat())\n self.scheduler.push_task(eta, (name, uuid, args, kwargs))\n return\n\n self.work_queue.put((name, uuid, args, kwargs), block=True)", "metadata": "root.GreenletManager._handle_message", "header": "['class', 'GreenletManager', '(', 'BaseManager', ')', ':', '___EOS___']", "index": 77 }, { "content": " def close(self):\n self.stop_event.set()", "metadata": "root.GreenletManager.close", "header": "['class', 'GreenletManager', '(', 'BaseManager', ')', ':', '___EOS___']", "index": 90 } ]
[ { "span": "import gevent", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "base_", "import_", "Base", "Worker_", ",_", "Base", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "scheduler_", "._", "gev", "ent", "\\u", "scheduler_", "import_", "Scheduler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gevent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gevent_", "import_", "Green", "let_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gevent_", "._", "event_", "import_", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gevent_", "._", "queue_", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Queue_", "import_", "Empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "green", "queue", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "timezone_", "import_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Worker_", "(_", "Base", "Worker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Worker_", "(_", "Base", "Worker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "greenlet", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Worker_", "(_", "Base", "Worker_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "name_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "greenlet", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "AC", "KW", "atch", "er_", "(_", "Green", "let_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "dummy", " ", "ack", " ", "watcher", " ", "greenlet", ",", " ", "bec", "aus", "e", " ", "the", " ", "zero", "mq", " ", "back", "end", " ", "not", " ", "precise", "\\", "10", ";", " ", " ", " ", " ", "ack", " ", "mana", "gment", ".", "\\", "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_", "AC", "KW", "atch", "er_", "(_", "Green", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "queue_", ",_", "stop", "\\u", "event_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "AC", "KW", "atch", "er_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "queue_", "=_", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "\\u", "event_", "=_", "stop", "\\u", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "callback_", "=_", "callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AC", "KW", "atch", "er_", "(_", "Green", "let_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "stop", "\\u", "event_", "._", "is", "\\u", "set_", "(_", ")_", ":_", "\\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 ", " _", "ack", "\\u", "uuid_", "=_", "self_", "._", "queue_", "._", "get_", "(_", "True_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "callback_", "(_", "ack", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Empty_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Green", "let", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "greenlet", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Green", "let", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\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_", "(_", "Green", "let", "Manager_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "\\u", "event_", "=_", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "work", "\\u", "queue_", "=_", "Queue_", "(_", "settings_", "._", "GREEN", "QUEUE", "\\u", "BACK", "END", "\\u", "TASK", "BUFF", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ack", "\\u", "queue_", "=_", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Green", "let", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "greenlet", "\\u", "pool_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "settings_", "._", "GREEN", "QUEUE", "\\u", "BACK", "END", "\\u", "POOL", "SIZE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "green", "queue", ":", " ", "startin", "g", " ", "worker", " ", "process", " ", "{", "0", "}\"_", "._", "format_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "worker_", "=_", "Worker_", "(_", "self_", "._", "work", "\\u", "queue_", ",_", "self_", "._", "ack", "\\u", "queue_", ",_", "self_", "._", "stop", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker_", "._", "set\\u", "name_", "(_", "\"", "greenlet", "-", "{", "0", "}\"_", "._", "format_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "Green", "let_", "._", "spawn_", "(_", "worker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "process", "\\u", "list_", "._", "append_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Green", "let", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\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_", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "starts", " ", "a", " ", "dummy", " ", "watcher", ",", " ", "bec", "aus", "e", " ", "zero", "mq", " ", "is", " ", "not", " ", "need", " ", "ack", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "watcher_", "=_", "AC", "KW", "atch", "er_", "(_", "self_", "._", "ack", "\\u", "queue_", ",_", "self_", "._", "stop", "\\u", "event_", ",_", "self_", "._", "\\u", "ack", "\\u", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "watcher_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "scheduler_", "=_", "Scheduler_", "(_", "self_", "._", "stop", "\\u", "event_", ",_", "self_", "._", "\\u", "handle", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scheduler_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "start", "\\u", "greenlet", "\\u", "pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Green", "let", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "message_", "(_", "self_", ",_", "name_", ",_", "uuid_", ",_", "args_", ",_", "kwargs_", ",_", "message_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now", "\\u", "date_", "=_", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "eta", "\"_", "in_", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta_", "=_", "self_", "._", "parse", "\\u", "eta_", "(_", "message_", "[_", "'", "eta", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "now_", "(_", ")_", "<_", "eta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "green", "queue", ":", " ", "task", " ", "schedule", "t", " ", "with", " ", "eta", " ", "[", "%", "s", "]\"_", ",_", "eta_", "._", "isoformat_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scheduler_", "._", "push", "\\u", "task_", "(_", "eta_", ",_", "(_", "name_", ",_", "uuid_", ",_", "args_", ",_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "work", "\\u", "queue_", "._", "put_", "(_", "(_", "name_", ",_", "uuid_", ",_", "args_", ",_", "kwargs_", ")_", ",_", "block_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Green", "let", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stop", "\\u", "event_", "._", "set_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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, 4, 2, 2, 2, 2, 2, 2, 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
scalyr/scalyr-agent-2/scalyr_agent/builtin_monitors/tomcat_monitor.py
[ { "content": " def _get_status(self, url):\n data = None\n # verify that the URL is valid\n try:\n testurl = urlparse.urlparse(url)\n except Exception as e:\n print(\n \"The URL configured for requesting the status page appears to be invalid. Please verify that the URL is correct in your monitor configuration. The specified url: %s\" %\n url)\n return data\n # attempt to request server status\n try:\n request = urllib2.Request(self._monitor_url)\n if self._monitor_user != None:\n b64cred = base64.encodestring('%s:%s' % (self._monitor_user, self._monitor_password)).replace('\\n', '')\n request.add_header(\"Authorization\", \"Basic %s\" % b64cred)\n opener = urllib2.build_opener(BindableHTTPHandler)\n handle = opener.open(request)\n data = handle.read()\n except urllib2.HTTPError as err:\n message = \"An HTTP error occurred attempting to retrieve the status. Please consult your server logs to determine the cause. HTTP error code: \", err.code\n if err.code == 404:\n message = \"The URL used to request the status page appears to be incorrect. Please verify the correct URL and update your apache_monitor configuration.\"\n elif err.code == 403:\n message = \"The server is denying access to the URL specified for requesting the status page. Please verify that permissions to access the status page are correctly configured in your server configuration and that your apache_monitor configuration reflects the same configuration requirements.\"\n elif err.code >= 500 or err.code < 600:\n message = \"The server failed to fulfill the request to get the status page. Please consult your server logs to determine the cause. HTTP error code: \", err.code\n self._logger.error(message)\n data = None\n except urllib2.URLError as err:\n message = \"The was an error attempting to reach the server. Make sure the server is running and properly configured. The error reported is: \", err\n if err.reason.errno == 111:\n message = \"The HTTP server does not appear to running or cannot be reached. Please check that it is running and is reachable at the address: %s\" % url.netloc\n self._logger.error(message)\n data = None\n except Exception as e:\n self._logger.error(\n \"An error occurred attempting to request the server status: %s\" %\n e)\n data = None\n return data", "metadata": "root.TomcatMonitor._get_status", "header": "['class', 'TomcatMonitor', '(', 'ScalyrMonitor', ')', ':', '___EOS___']", "index": 301 }, { "content": " def gather_sample(self):\n \"\"\"Invoked once per sample interval to gather a statistic.\n \"\"\"\n \n def get_value_as_str(value):\n if type(value) is int:\n return \"%d\" % value\n elif type(value) is float:\n return \"%f\" % value\n elif type(value) is str:\n return \"%r\" % value\n else:\n return \"%r\" % value\n\n status = self._get_status(self._monitor_url)\n if status != None:\n stats = self._parse_general_status(status)\n heap = self._parse_heap_status(status)\n \n if stats != None:\n for key in stats.keys():\n extra = None\n if len(stats[key]) == 4:\n extra = { stats[key][2] : stats[key][3] }\n self._logger.emit_value(\"tomcat.runtime.%s\" % stats[key][0], stats[key][1], extra) \n if heap != None:\n for key in heap.keys():\n extra = { heap[key][2] : heap[key][3] }\n self._logger.emit_value(\"tomcat.memory_pools.%s\" % heap[key][0], heap[key][1], extra)", "metadata": "root.TomcatMonitor.gather_sample", "header": "['class', 'TomcatMonitor', '(', 'ScalyrMonitor', ')', ':', '___EOS___']", "index": 411 } ]
[ { "span": "testurl ", "start_line": 305, "start_column": 12, "end_line": 305, "end_column": 19 }, { "span": "get_value_as_str(", "start_line": 415, "start_column": 12, "end_line": 415, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Tom", "cat", "Monitor_", "(_", "Sca", "lyr", "Monitor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "status_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "tha", "t", " ", "the", " ", "URL", " ", "is", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testu", "rl_", "=_", "urlparse_", "._", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "URL", " ", "configur", "ed", " ", "for", " ", "request", "ing", " ", "the", " ", "status", " ", "page", " ", "appear", "s", " ", "to", " ", "be", " ", "invalid", ".", " ", " ", "Ple", "ase", " ", "verify", " ", "tha", "t", " ", "the", " ", "URL", " ", "is", " ", "correct", " ", "in", " ", "your", " ", "monit", "or", " ", "configura", "tion", ".", " ", " ", "The", " ", "specified", " ", "url", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "to", " ", "request", " ", "server", " ", "status_", "\\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 ", " _", "request_", "=_", "urllib2_", "._", "Request_", "(_", "self_", "._", "\\u", "monit", "or", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "monit", "or", "\\u", "user_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b64", "cred_", "=_", "base64_", "._", "encodes", "tring_", "(_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "self_", "._", "\\u", "monit", "or", "\\u", "user_", ",_", "self_", "._", "\\u", "monit", "or", "\\u", "password_", ")_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "add", "\\u", "header_", "(_", "\"", "Authoriz", "ation", "\"_", ",_", "\"", "Basic", " ", "%", "s", "\"_", "%_", "b64", "cred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "opener_", "=_", "urllib2_", "._", "build", "\\u", "opener_", "(_", "Bind", "able", "HTTP", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "=_", "opener_", "._", "open_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "handle_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"", "An", " ", "HTTP", " ", "error", " ", "occur", "red", " ", "atte", "mpt", "ing", " ", "to", " ", "retrieve", " ", "the", " ", "status", ".", " ", " ", "Ple", "ase", " ", "consul", "t", " ", "your", " ", "server", " ", "logs", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "caus", "e", ".", " ", " ", "HTTP", " ", "error", " ", "code", ":", " ", "\"_", ",_", "err_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "._", "code_", "==_", "404_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"", "The", " ", "URL", " ", "used", " ", "to", " ", "request", " ", "the", " ", "status", " ", "page", " ", "appear", "s", " ", "to", " ", "be", " ", "incorrect", ".", " ", " ", "Ple", "ase", " ", "verify", " ", "the", " ", "correct", " ", "URL", " ", "and", " ", "update", " ", "your", " ", "apa", "che", "\\u", "monit", "or", " ", "configura", "tion", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "err_", "._", "code_", "==_", "403_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"", "The", " ", "server", " ", "is", " ", "deny", "ing", " ", "access", " ", "to", " ", "the", " ", "URL", " ", "specified", " ", "for", " ", "request", "ing", " ", "the", " ", "status", " ", "page", ".", " ", " ", "Ple", "ase", " ", "verify", " ", "tha", "t", " ", "permissi", "ons", " ", "to", " ", "access", " ", "the", " ", "status", " ", "page", " ", "are", " ", "correct", "ly", " ", "configur", "ed", " ", "in", " ", "your", " ", "server", " ", "configura", "tion", " ", "and", " ", "tha", "t", " ", "your", " ", "apa", "che", "\\u", "monit", "or", " ", "configura", "tion", " ", "reflect", "s", " ", "the", " ", "same", " ", "configura", "tion", " ", "require", "ment", "s", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "err_", "._", "code_", ">=_", "500_", "or_", "err_", "._", "code_", "<_", "600_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"", "The", " ", "server", " ", "fail", "ed", " ", "to", " ", "fulfill", " ", "the", " ", "request", " ", "to", " ", "get", " ", "the", " ", "status", " ", "page", ".", " ", " ", "Ple", "ase", " ", "consul", "t", " ", "your", " ", "server", " ", "logs", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "caus", "e", ".", " ", " ", "HTTP", " ", "error", " ", "code", ":", " ", "\"_", ",_", "err_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "error_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"", "The", " ", "was", " ", "an", " ", "error", " ", "atte", "mpt", "ing", " ", "to", " ", "reach", " ", "the", " ", "server", ".", " ", " ", "Make", " ", "sure", " ", "the", " ", "server", " ", "is", " ", "runn", "ing", " ", "and", " ", "proper", "ly", " ", "configur", "ed", ".", " ", " ", "The", " ", "error", " ", "reporte", "d", " ", "is", ":", " ", "\"_", ",_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "._", "reason_", "._", "errno_", "==_", "111_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"", "The", " ", "HTTP", " ", "server", " ", "doe", "s", " ", "not", " ", "appear", " ", "to", " ", "runn", "ing", " ", "or", " ", "cann", "ot", " ", "be", " ", "reache", "d", ".", " ", " ", "Ple", "ase", " ", "check", " ", "tha", "t", " ", "it", " ", "is", " ", "runn", "ing", " ", "and", " ", "is", " ", "reachable", " ", "at", " ", "the", " ", "address", ":", " ", "%", "s", "\"_", "%_", "url_", "._", "netloc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "error_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "None_", "\\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_", "._", "\\u", "logger_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "An", " ", "error", " ", "occur", "red", " ", "atte", "mpt", "ing", " ", "to", " ", "request", " ", "the", " ", "server", " ", "status", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tom", "cat", "Monitor_", "(_", "Sca", "lyr", "Monitor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gather", "\\u", "sample_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Invok", "ed", " ", "onc", "e", " ", "per", " ", "sample", " ", "interval", " ", "to", " ", "gather", " ", "a", " ", "statistic", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "value", "\\u", "as", "\\u", "str_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "value_", ")_", "is_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "d", "\"_", "%_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "value_", ")_", "is_", "float_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "f", "\"_", "%_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "value_", ")_", "is_", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "r", "\"_", "%_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "r", "\"_", "%_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "=_", "self_", "._", "\\u", "get", "\\u", "status_", "(_", "self_", "._", "\\u", "monit", "or", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "=_", "self_", "._", "\\u", "parse", "\\u", "genera", "l\\u", "status_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heap_", "=_", "self_", "._", "\\u", "parse", "\\u", "heap", "\\u", "status_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stats_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "stats_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "extra_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "stats_", "[_", "key_", "]_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "extra_", "=_", "{_", "stats_", "[_", "key_", "]_", "[_", "2_", "]_", ":_", "stats_", "[_", "key_", "]_", "[_", "3_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "emit", "\\u", "value_", "(_", "\"", "tom", "cat", ".", "runt", "ime", ".", "%", "s", "\"_", "%_", "stats_", "[_", "key_", "]_", "[_", "0_", "]_", ",_", "stats_", "[_", "key_", "]_", "[_", "1_", "]_", ",_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "heap_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "heap_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "extra_", "=_", "{_", "heap_", "[_", "key_", "]_", "[_", "2_", "]_", ":_", "heap_", "[_", "key_", "]_", "[_", "3_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "emit", "\\u", "value_", "(_", "\"", "tom", "cat", ".", "memory", "\\u", "pools", ".", "%", "s", "\"_", "%_", "heap_", "[_", "key_", "]_", "[_", "0_", "]_", ",_", "heap_", "[_", "key_", "]_", "[_", "1_", "]_", ",_", "extra_", ")_" ]
[ 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
CGATOxford/cgat/obsolete/calculate_histogram.py
[ { "content": "def main( argv = None ):\n \n if argv == None: argv = sys.argv\n\n # setup command line parser\n parser = E.OptionParser( version = \"%prog version: $Id$\", \n usage = globals()[\"__doc__\"] )\n\n parser.add_option(\"-n\", \"--nonull\", dest=\"nonull\", action = \"store_true\",\n help=\"no null [default=%default]\" )\n\n parser.add_option(\"-e\", \"--show-empty\", dest=\"empty_bins\", action = \"store_true\",\n help=\"show empty bins [default=%default]\" )\n\n parser.add_option(\"-o\", \"--normalize\", dest=\"normalize\", action = \"store_true\",\n help=\"normalize histogram [default=%default]\" )\n\n parser.add_option(\"-i\", \"--titles\", dest=\"titles\", action = \"store_true\",\n help=\"use titles supplied in ... [default=%default]\" )\n\n parser.add_option( \"--cumulative\", dest=\"cumulative\", action = \"store_true\",\n help=\"compute cumulative histogram [default=%default]\" )\n\n parser.add_option( \"--reverse-cumulative\", dest=\"reverse_cumulative\", action = \"store_true\",\n help=\"compute reverse cumulative histogram [default=%default]\" )\n\n parser.add_option( \"-c\", \"--column\", dest=\"column\", type = \"int\",\n help=\"columns to take [default=%default]\" )\n \n parser.add_option( \"-b\", \"--bin-size\", dest=\"bin_size\", type = \"float\",\n help=\"bin size to use [default=%default]\" )\n\n parser.add_option( \"-u\", \"--upper\", dest=\"upper_limit\", type = \"float\",\n help=\"upper limit to use [default=%default]\" )\n\n parser.add_option( \"-l\", \"--lower\", dest=\"lower_limit\", type = \"float\",\n help=\"lower limit to use [default=%default]\" )\n\n parser.add_option( \"-s\", \"--scale\", dest=\"scale\", type = \"float\",\n help=\"scale to use [default=%default]\" )\n\n parser.add_option( \"-a\", \"--append\", dest=\"append\", type = \"choice\", action=\"append\",\n choices = (\"normalize\", ),\n help=\"append columns [default=%default]\" )\n\n parser.set_defaults(\n nonull = None,\n columns = [0,],\n empty_bins = True,\n titles = False,\n lower_limit = None,\n upper_limit = None,\n bin_size = None,\n scale = None,\n normalize = None,\n append = [],\n cumulative = False,\n reverse_cumulative = False )\n\n ## add common options (-h/--help, ...) and parse command line \n (options, args) = E.Start( parser, argv = argv )\n\n if options.columns:\n if options.columns != \"all\":\n options.columns = [ int(x) - 1 for x in options.columns.split( \",\") ]\n else:\n options.columns.append( 0 )\n\n histograms = []\n \n vals = []\n \n for x in options.columns: vals.append( [] )\n \n # retrieve histogram\n lines = filter( lambda x: x[0] <> \"#\", sys.stdin.readlines())\n\n ncols = len(string.split(lines[0][:-1], \"\\t\"))\n if options.columns == \"all\":\n options.columns = range(ncols)\n for x in options.columns: vals.append( [] )\n\n if options.titles:\n data = lines[0][:-1].split(\"\\t\")\n del lines[0]\n options.titles = map( lambda x: data[x], options.columns)\n \n for l in lines:\n data = string.split(l[:-1], \"\\t\")\n \n for x in range(len(options.columns)):\n try:\n v = string.atof(data[options.columns[x]])\n except IndexError:\n print \"# IndexError in line:\", l[:-1]\n continue\n except ValueError:\n continue\n\n if options.scale:\n v *= options.scale\n\n if options.upper_limit != None and v > options.upper_limit:\n v = options.upper_limit\n\n if options.lower_limit != None and v < options.lower_limit:\n v = options.lower_limit\n\n vals[x].append( v )\n\n lines = None\n\n hists = []\n titles = []\n \n for x in range(len(options.columns)):\n E.info( \"column=%i, num_values=%i\" % (options.columns[x], len(vals[x])) )\n\n if len(vals[x]) == 0: continue\n \n h = Histogram.Calculate( vals[x], no_empty_bins = options.empty_bins, increment = options.bin_size)\n if options.scale: h = Histogram.Scale( h, 1.0 / options.scale )\n\n if options.normalize: h = Histogram.Normalize( h )\n if options.cumulative: h = Histogram.Cumulate( h )\n if options.reverse_cumulative: h = Histogram.Cumulate( h, direction = 0 )\n \n hists.append(h)\n\n for m in options.append:\n if m == \"normalize\":\n hists.append( Histogram.Normalize( h ) )\n\n if options.titles:\n titles.append( options.titles[x] )\n\n if titles:\n options.stdout.write( \"bin\\t\" + \"\\t\".join(titles) + \"\\n\" )\n\n if len(hists) == 1:\n Histogram.Print( hists[0], nonull = options.nonull )\n else:\n combined_histogram = Histogram.Combine( hists )\n Histogram.Print( combined_histogram, nonull = options.nonull ) \n\n E.Stop()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 65 } ]
[ { "span": "histograms ", "start_line": 133, "start_column": 4, "end_line": 133, "end_column": 14 }, { "span": "lines ", "start_line": 175, "start_column": 4, "end_line": 175, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", "argv_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argv_", "==_", "None_", ":_", "argv_", "=_", "sys_", "._", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "command", " ", "line", " ", "parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "E_", "._", "Optio", "n", "Parser_", "(_", "version_", "=_", "\"%", "prog", " ", "version", ":", " ", "$", "Id", "$\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "globals_", "(_", ")_", "[_", "\"\\u\\u", "doc", "\\u\\u\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "n", "\"_", ",_", "\"--", "non", "ull", "\"_", ",_", "dest_", "=_", "\"", "non", "ull", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "no", " ", "null", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "e", "\"_", ",_", "\"--", "show", "-", "empty", "\"_", ",_", "dest_", "=_", "\"", "empty", "\\u", "bins", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "show", " ", "empty", " ", "bins", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "o", "\"_", ",_", "\"--", "normali", "ze", "\"_", ",_", "dest_", "=_", "\"", "normali", "ze", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "normali", "ze", " ", "histo", "gram", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "i", "\"_", ",_", "\"--", "titles", "\"_", ",_", "dest_", "=_", "\"", "titles", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "use", " ", "titles", " ", "supplie", "d", " ", "in", " ", "...", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "cumul", "ative", "\"_", ",_", "dest_", "=_", "\"", "cumul", "ative", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "compute", " ", "cumul", "ative", " ", "histo", "gram", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "reverse", "-", "cumul", "ative", "\"_", ",_", "dest_", "=_", "\"", "reverse", "\\u", "cumul", "ative", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "compute", " ", "reverse", " ", "cumul", "ative", " ", "histo", "gram", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "c", "\"_", ",_", "\"--", "column", "\"_", ",_", "dest_", "=_", "\"", "column", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "column", "s", " ", "to", " ", "take", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "b", "\"_", ",_", "\"--", "bin", "-", "size", "\"_", ",_", "dest_", "=_", "\"", "bin", "\\u", "size", "\"_", ",_", "type_", "=_", "\"", "float", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "bin", " ", "size", " ", "to", " ", "use", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "u", "\"_", ",_", "\"--", "upper", "\"_", ",_", "dest_", "=_", "\"", "upper", "\\u", "limit", "\"_", ",_", "type_", "=_", "\"", "float", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "upper", " ", "limit", " ", "to", " ", "use", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "l", "\"_", ",_", "\"--", "lower", "\"_", ",_", "dest_", "=_", "\"", "lower", "\\u", "limit", "\"_", ",_", "type_", "=_", "\"", "float", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "lower", " ", "limit", " ", "to", " ", "use", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "s", "\"_", ",_", "\"--", "scale", "\"_", ",_", "dest_", "=_", "\"", "scale", "\"_", ",_", "type_", "=_", "\"", "float", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "scale", " ", "to", " ", "use", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "a", "\"_", ",_", "\"--", "append", "\"_", ",_", "dest_", "=_", "\"", "append", "\"_", ",_", "type_", "=_", "\"", "choice", "\"_", ",_", "action_", "=_", "\"", "append", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "\"", "normali", "ze", "\"_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "append", " ", "column", "s", " ", "[", "default", "=", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "set\\u", "defaults_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "non", "ull", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "[_", "0_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "bins_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "titles_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lower", "\\u", "limit_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upper", "\\u", "limit_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bin", "\\u", "size_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "normalize_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "append_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cumul", "ative_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse", "\\u", "cumul", "ative_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "add", " ", "common", " ", "options", " ", "(-", "h", "/--", "help", ",", " ", "...)", " ", "and", " ", "parse", " ", "command", " ", "line", " _", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "E_", "._", "Start_", "(_", "parser_", ",_", "argv_", "=_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "columns_", "!=_", "\"", "all", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "columns_", "=_", "[_", "int_", "(_", "x_", ")_", "-_", "1_", "for_", "x_", "in_", "options_", "._", "columns_", "._", "split_", "(_", "\",\"_", ")_", "]_", "\\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 ", " _", "options_", "._", "columns_", "._", "append_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "histograms", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "options_", "._", "columns_", ":_", "vals_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "retrieve", " ", "histogram_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "filter_", "(_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", "<_", ">_", "\"#\"_", ",_", "sys_", "._", "stdin_", "._", "readlines_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ncols_", "=_", "len_", "(_", "string_", "._", "split_", "(_", "lines_", "[_", "0_", "]_", "[_", ":_", "-_", "1_", "]_", ",_", "\"\\\\", "t", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "columns_", "==_", "\"", "all", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "columns_", "=_", "range_", "(_", "ncols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "options_", "._", "columns_", ":_", "vals_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "titles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "lines_", "[_", "0_", "]_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "lines_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "titles_", "=_", "map_", "(_", "lambda_", "x_", ":_", "data_", "[_", "x_", "]_", ",_", "options_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "l_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "string_", "._", "split_", "(_", "l_", "[_", ":_", "-_", "1_", "]_", ",_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "len_", "(_", "options_", "._", "columns_", ")_", ")_", ":_", "\\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_", "=_", "string_", "._", "ato", "f_", "(_", "data_", "[_", "options_", "._", "columns_", "[_", "x_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"#", " ", "Index", "Error", " ", "in", " ", "line", ":\"_", ",_", "l_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\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 ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "scale_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "*=_", "options_", "._", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "upper", "\\u", "limit_", "!=_", "None_", "and_", "v_", ">_", "options_", "._", "upper", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "options_", "._", "upper", "\\u", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "lower", "\\u", "limit_", "!=_", "None_", "and_", "v_", "<_", "options_", "._", "lower", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "options_", "._", "lower", "\\u", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vals_", "[_", "x_", "]_", "._", "append_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lines_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hist", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "titles_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "len_", "(_", "options_", "._", "columns_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "info_", "(_", "\"", "column", "=", "%", "i", ",", " ", "num", "\\u", "values", "=", "%", "i", "\"_", "%_", "(_", "options_", "._", "columns_", "[_", "x_", "]_", ",_", "len_", "(_", "vals_", "[_", "x_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "vals_", "[_", "x_", "]_", ")_", "==_", "0_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h_", "=_", "Histogram", "_", "._", "Calculat", "e_", "(_", "vals_", "[_", "x_", "]_", ",_", "no", "\\u", "empty", "\\u", "bins_", "=_", "options_", "._", "empty", "\\u", "bins_", ",_", "increment_", "=_", "options_", "._", "bin", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "scale_", ":_", "h_", "=_", "Histogram", "_", "._", "Scale_", "(_", "h_", ",_", "1.0_", "/_", "options_", "._", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "normalize_", ":_", "h_", "=_", "Histogram", "_", "._", "Normalize", "_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "cumul", "ative_", ":_", "h_", "=_", "Histogram", "_", "._", "Cum", "ulate", "_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "reverse", "\\u", "cumul", "ative_", ":_", "h_", "=_", "Histogram", "_", "._", "Cum", "ulate", "_", "(_", "h_", ",_", "direction_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hist", "s_", "._", "append_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "m_", "in_", "options_", "._", "append_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "m_", "==_", "\"", "normali", "ze", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hist", "s_", "._", "append_", "(_", "Histogram", "_", "._", "Normalize", "_", "(_", "h_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "titles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "titles_", "._", "append_", "(_", "options_", "._", "titles_", "[_", "x_", "]_", ")_", "\\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_", "titles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "stdout_", "._", "write_", "(_", "\"", "bin", "\\\\", "t", "\"_", "+_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "titles_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "hist", "s_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Histogram", "_", "._", "Print_", "(_", "hist", "s_", "[_", "0_", "]_", ",_", "non", "ull", "_", "=_", "options_", "._", "non", "ull", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "combin", "ed", "\\u", "histogram_", "=_", "Histogram", "_", "._", "Combine", "_", "(_", "hist", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Histogram", "_", "._", "Print_", "(_", "combin", "ed", "\\u", "histogram_", ",_", "non", "ull", "_", "=_", "options_", "._", "non", "ull", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "E_", "._", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Variable defined multiple times
charanpald/APGL/apgl/graph/test/MatrixGraphTest.py
[ { "content": " def testHarmonicGeodesicDistance(self):\n numVertices = 5\n numFeatures = 1\n vList = VertexList(numVertices, numFeatures)\n graph = self.GraphType(vList)\n\n graph.addEdge(0, 1, 1)\n graph.addEdge(1, 2, 1)\n graph.addEdge(2, 3, 1)\n graph.addEdge(3, 4, 1)\n graph.addEdge(4, 0, 1)\n\n self.assertEquals(graph.harmonicGeodesicDistance(), 2.0)\n P = graph.floydWarshall(True)\n self.assertEquals(graph.harmonicGeodesicDistance(P), 2.0)\n\n #Test a string of vertices\n numVertices = 5\n numFeatures = 1\n vList = VertexList(numVertices, numFeatures)\n graph = self.GraphType(vList)\n\n graph.addEdge(0, 1, 1)\n graph.addEdge(1, 2, 1)\n graph.addEdge(2, 3, 1)\n graph.addEdge(3, 4, 1)\n\n self.assertAlmostEquals(graph.harmonicGeodesicDistance(), 180/77.0, places=5)\n P = graph.floydWarshall(True)\n self.assertAlmostEquals(graph.harmonicGeodesicDistance(P), 180/77.0, places=5)\n\n #Test case with isolated node\n numVertices = 5\n numFeatures = 1\n vList = VertexList(numVertices, numFeatures)\n graph = self.GraphType(vList)\n\n graph.addEdge(0, 1, 1)\n graph.addEdge(1, 2, 1)\n graph.addEdge(2, 3, 1)\n\n self.assertAlmostEquals(graph.harmonicGeodesicDistance(), 45/13.0, places=5)\n P = graph.floydWarshall(True)\n self.assertAlmostEquals(graph.harmonicGeodesicDistance(P), 45/13.0, places=5)\n\n #Totally empty graph\n graph = self.GraphType(vList)\n self.assertEquals(graph.harmonicGeodesicDistance(), float('inf'))\n\n #Test use of indices \n graph = self.GraphType(vList)\n graph.addEdge(0, 1, 1)\n graph.addEdge(1, 2, 1)\n graph.addEdge(2, 3, 1)\n graph.addEdge(3, 4, 1)\n\n P = graph.floydWarshall(True)\n inds = [0, 4]\n self.assertEquals(graph.harmonicGeodesicDistance(vertexInds=inds), 12.0)\n\n #Test directed graph\n graph = self.GraphType(vList, False)\n\n graph.addEdge(0, 1, 1)\n graph.addEdge(1, 2, 1)\n graph.addEdge(2, 3, 1)\n graph.addEdge(3, 4, 1)\n\n P = graph.floydWarshall(True)\n self.assertAlmostEquals(graph.harmonicGeodesicDistance(P), 300/77.0, places=5)", "metadata": "root.MatrixGraphTest.testHarmonicGeodesicDistance", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 389 } ]
[ { "span": "P ", "start_line": 445, "start_column": 8, "end_line": 445, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Harm", "onic", "Geo", "desi", "c", "Distance_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "4_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "4_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "harmonic", "Geo", "desi", "c", "Distance_", "(_", ")_", ",_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "=_", "graph_", "._", "flo", "yd", "War", "sha", "ll_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "harmonic", "Geo", "desi", "c", "Distance_", "(_", "P_", ")_", ",_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "a", " ", "string", " ", "of", " ", "vertices_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Vertices_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "4_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equals_", "(_", "graph_", "._", "harmonic", "Geo", "desi", "c", "Distance_", "(_", ")_", ",_", "180_", "/_", "77.0_", ",_", "places_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "=_", "graph_", "._", "flo", "yd", "War", "sha", "ll_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equals_", "(_", "graph_", "._", "harmonic", "Geo", "desi", "c", "Distance_", "(_", "P_", ")_", ",_", "180_", "/_", "77.0_", ",_", "places_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "case", " ", "with", " ", "isolated", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Vertices_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equals_", "(_", "graph_", "._", "harmonic", "Geo", "desi", "c", "Distance_", "(_", ")_", ",_", "45_", "/_", "13.", "0_", ",_", "places_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "=_", "graph_", "._", "flo", "yd", "War", "sha", "ll_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equals_", "(_", "graph_", "._", "harmonic", "Geo", "desi", "c", "Distance_", "(_", "P_", ")_", ",_", "45_", "/_", "13.", "0_", ",_", "places_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Total", "ly", " ", "empty", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "harmonic", "Geo", "desi", "c", "Distance_", "(_", ")_", ",_", "float_", "(_", "'", "inf", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "use", " ", "of", " ", "indice", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "4_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "=_", "graph_", "._", "flo", "yd", "War", "sha", "ll_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inds_", "=_", "[_", "0_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "harmonic", "Geo", "desi", "c", "Distance_", "(_", "vertex", "Ind", "s_", "=_", "inds_", ")_", ",_", "12.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "direct", "ed", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "4_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "=_", "graph_", "._", "flo", "yd", "War", "sha", "ll_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equals_", "(_", "graph_", "._", "harmonic", "Geo", "desi", "c", "Distance_", "(_", "P_", ")_", ",_", "300_", "/_", "77.0_", ",_", "places_", "=_", "5_", ")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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
rst2pdf/rst2pdf/rst2pdf/tests/input/sphinx-issue318/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# Issue 318 documentation build configuration file, created by\n# sphinx-quickstart on Sun Oct 3 18:23:18 2010.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys, os\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.insert(0, os.path.abspath('.'))\n\n# -- General configuration -----------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = ['rst2pdf.pdfbuilder']\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\n#source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'test'\n\n# General information about the project.\nproject = u'Issue 318'\ncopyright = u'2010, Roberto Alsina'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = '0.0'\n# The full version, including alpha/beta/rc tags.\nrelease = '0.0'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n\n# -- Options for HTML output ---------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\nhtml_theme = 'default'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\nhtml_domain_indices = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'Issue318doc'\n\n\n# -- Options for LaTeX output --------------------------------------------------\n\n# The paper size ('letter' or 'a4').\n#latex_paper_size = 'letter'\n\n# The font size ('10pt', '11pt' or '12pt').\n#latex_font_size = '10pt'\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass [howto/manual]).\nlatex_documents = [\n ('test', 'Issue318.tex', u'Issue 318 Documentation',\n u'Roberto Alsina', 'manual'),\n]\n\npdf_documents = [\n ('test', 'Issue318', u'Issue 318 Documentation',\n u'Roberto Alsina'),\n]\n\npdf_use_index = True\n#pdf_verbosity = 2\npdf_domain_indices = True\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# If true, show page references after internal links.\n#latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n#latex_show_urls = False\n\n# Additional stuff for the LaTeX preamble.\n#latex_preamble = ''\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_domain_indices = True\n\n\n# -- Options for manual page output --------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n ('test', 'issue318', u'Issue 318 Documentation',\n [u'Roberto Alsina'], 1)\n]\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys, os", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Issue", " ", "318", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Sun", " ", "Oct", " ", " ", "3", " ", "1", "8", ":", "23", ":", "1", "8", " ", "2010", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "'", "rst", "2p", "df", ".", "pdf", "builde", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "-", "sig", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "u", "'", "Issue", " ", "318", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "2010", ",", " ", "Robert", "o", " ", "Al", "sin", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "0.", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "0.", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output", " ", "--------------", "--------------", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "See", " ", "the", " ", "documentation", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "of", " ", "bui", "lti", "n", " ", "themes", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "domain", "\\u", "indices_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"", "Creat", "ed", " ", "usi", "ng", " ", "Sph", "inx", "\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "sphinx", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"(", "C", ")", " ", "Copy", "right", " ", "...\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "copyr", "ight", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "Issue", "318", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "'", " ", "or", " ", "'", "a4", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "pape", "r", "\\u", "size", " ", "=", " ", "'", "letter", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "font", "\\u", "size", " ", "=", " ", "'", "10", "pt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "test", "'_", ",_", "'", "Issue", "318", ".", "tex", "'_", ",_", "u", "'", "Issue", " ", "318", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Robert", "o", " ", "Al", "sin", "a", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "test", "'_", ",_", "'", "Issue", "318", "'_", ",_", "u", "'", "Issue", " ", "318", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Robert", "o", " ", "Al", "sin", "a", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "use", "\\u", "index_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pdf", "\\u", "verbo", "sity", " ", "=", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "domain", "\\u", "indices_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "page", " ", "reference", "s", " ", "after", " ", "internal", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "pager", "ef", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "preamble", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "manu", "al", " ", "page", " ", "output", " ", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "entry", " ", "per", " ", "manu", "al", " ", "page", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "name", ",", " ", "description", ",", " ", "author", "s", ",", " ", "manu", "al", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "man", "\\u", "pages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "test", "'_", ",_", "'", "issue", "318", "'_", ",_", "u", "'", "Issue", " ", "318", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "u", "'", "Robert", "o", " ", "Al", "sin", "a", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
HewlettPackard/python-hpOneView/examples/scripts/del-san-manager.py
[ { "content": "def login(con, credential):\n # Login with givin credentials\n try:\n con.login(credential)\n except:\n print('Login failed')", "metadata": "root.login", "header": "['module', '___EOS___']", "index": 57 } ]
[ { "span": "except:", "start_line": 61, "start_column": 4, "end_line": 61, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "login_", "(_", "con_", ",_", "credential_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Logi", "n", " ", "with", " ", "gi", "vin", " ", "credentials_", "\\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 ", " _", "con_", "._", "login_", "(_", "credential_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Logi", "n", " ", "fail", "ed", "'_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
MegaMark16/django-live-support/live_support/tests.py
[ { "content": " def test_start_chat(self):\n # Login and call get_messages to set the admin_active cache\n login = self.client.login(username='test', password='test')\n self.client.get(reverse('get_messages'))\n\n resp = self.client.post(reverse('start_chat'), {\n 'name': 'Test Name',\n 'details': 'Test Details'\n })\n self.assertEqual(resp.status_code, 302)\n resp2 = self.client.get(resp['location'])\n self.assertEqual(resp2.status_code, 200)\n self.assertTrue(resp2.context['chat'].hash_key in resp['location'])", "metadata": "root.ClientTests.test_start_chat", "header": "['class', 'ClientTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_get_messages_with_hash_key_returns_messages(self):\n chat = Chat.objects.create(name='Test Chat', details='Details')\n chat.messages.create(name=chat.name, message='new message text')\n resp = self.client.get(reverse('client_get_messages', args=[chat.hash_key]))\n self.assertTrue('new message text' in resp.content)", "metadata": "root.ClientTests.test_get_messages_with_hash_key_returns_messages", "header": "['class', 'ClientTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " def test_get_all_messages(self):\n login = self.client.login(username='test', password='test')\n chat = Chat.objects.create(name='Test Chat', details='Details')\n chat.messages.create(name=chat.name, message='new message text')\n url = reverse('get_messages')\n resp = self.client.get('%s?%s=0' % (url, chat.id))\n self.assertTrue('new message text' in resp.content)", "metadata": "root.AdminTests.test_get_all_messages", "header": "['class', 'AdminTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 71 } ]
[ { "span": "self.assertTrue(resp2.context['chat'].hash_key in resp['location'])", "start_line": 27, "start_column": 8, "end_line": 27, "end_column": 75 }, { "span": "self.assertTrue('new message text' in resp.content)", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 59 }, { "span": "self.assertTrue('new message text' in resp.content)", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 59 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Client", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "start", "\\u", "chat_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Logi", "n", " ", "and", " ", "call", " ", "get", "\\u", "message", "s", " ", "to", " ", "set", " ", "the", " ", "admin", "\\u", "active", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login_", "=_", "self_", "._", "client_", "._", "login_", "(_", "username_", "=_", "'", "test", "'_", ",_", "password_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "get", "\\u", "message", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "reverse_", "(_", "'", "start", "\\u", "chat", "'_", ")_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Test", " ", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deta", "il", "s", "'_", ":_", "'", "Test", " ", "Det", "ail", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp", "2_", "=_", "self_", "._", "client_", "._", "get_", "(_", "resp_", "[_", "'", "location", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp", "2_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "resp", "2_", "._", "context_", "[_", "'", "chat", "'_", "]_", "._", "hash", "\\u", "key_", "in_", "resp_", "[_", "'", "location", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Client", "Tests_", "(_", "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", "message", "s", "\\u", "with", "\\u", "hash", "\\u", "key", "\\u", "return", "s", "\\u", "messages_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chat_", "=_", "Chat_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "Test", " ", "Cha", "t", "'_", ",_", "details_", "=_", "'", "Det", "ail", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chat_", "._", "messages_", "._", "create_", "(_", "name_", "=_", "chat_", "._", "name_", ",_", "message_", "=_", "'", "new", " ", "message", " ", "text", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "client", "\\u", "get", "\\u", "message", "s", "'_", ",_", "args_", "=_", "[_", "chat_", "._", "hash", "\\u", "key_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "new", " ", "message", " ", "text", "'_", "in_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Tests_", "(_", "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", "all", "\\u", "messages_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login_", "=_", "self_", "._", "client_", "._", "login_", "(_", "username_", "=_", "'", "test", "'_", ",_", "password_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chat_", "=_", "Chat_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "Test", " ", "Cha", "t", "'_", ",_", "details_", "=_", "'", "Det", "ail", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chat_", "._", "messages_", "._", "create_", "(_", "name_", "=_", "chat_", "._", "name_", ",_", "message_", "=_", "'", "new", " ", "message", " ", "text", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "'", "get", "\\u", "message", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'%", "s", "?", "%", "s", "=", "0", "'_", "%_", "(_", "url_", ",_", "chat_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "new", " ", "message", " ", "text", "'_", "in_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
thomasmesnard/DeepMind-Teaching-Machines-to-Read-and-Comprehend/config/deepmind_attentive_reader.py
[ { "content": "from blocks.bricks import Tanh\nfrom blocks.algorithms import BasicMomentum, AdaDelta, RMSProp, Adam, CompositeRule, StepClipping, Momentum\nfrom blocks.initialization import IsotropicGaussian, Constant\n\nfrom model.attentive_reader import Model\n\n\nbatch_size = 32\nsort_batch_count = 20\n\nshuffle_questions = True\n\nconcat_ctx_and_question = False\n\nn_entities = 550\nembed_size = 200\n\nctx_lstm_size = [256]\nctx_skip_connections = True\n\nquestion_lstm_size = [256]\nquestion_skip_connections = True\n\nattention_mlp_hidden = [100]\nattention_mlp_activations = [Tanh()]\n\nout_mlp_hidden = []\nout_mlp_activations = []\n\nstep_rule = CompositeRule([RMSProp(decay_rate=0.95, learning_rate=5e-5),\n BasicMomentum(momentum=0.9)])\n\ndropout = 0.2\nw_noise = 0.\n\nvalid_freq = 1000\nsave_freq = 1000\nprint_freq = 100\n\nweights_init = IsotropicGaussian(0.01)\nbiases_init = Constant(0.)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from blocks.algorithms import BasicMomentum, AdaDelta, RMSProp, Adam, CompositeRule, StepClipping, Momentum", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 107 }, { "span": "from model.attentive_reader import Model", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "blocks_", "._", "bricks", "_", "import_", "Tan", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "algorithms_", "import_", "Basic", "Moment", "um_", ",_", "Ada", "Delta_", ",_", "RMS", "Prop_", ",_", "Adam", "_", ",_", "Composit", "e", "Rule_", ",_", "Step", "Clip", "ping_", ",_", "Moment", "um_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blocks_", "._", "initialization", "_", "import_", "Iso", "trop", "ic", "Gaussian", "_", ",_", "Constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "model_", "._", "atten", "tiv", "e\\u", "reader_", "import_", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "size_", "=_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "batch", "\\u", "count_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shu", "ffle", "\\u", "questions_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conc", "at", "\\u", "ctx", "\\u", "and", "\\u", "question_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "entities_", "=_", "550_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "embed", "\\u", "size_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ctx", "\\u", "lstm", "\\u", "size_", "=_", "[_", "256_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx", "\\u", "skip", "\\u", "connections_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "lstm", "\\u", "size_", "=_", "[_", "256_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "question", "\\u", "skip", "\\u", "connections_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "atten", "tion", "\\u", "mlp", "\\u", "hidden_", "=_", "[_", "100_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atten", "tion", "\\u", "mlp", "\\u", "activations_", "=_", "[_", "Tan", "h_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "\\u", "mlp", "\\u", "hidden_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "mlp", "\\u", "activations_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "step", "\\u", "rule_", "=_", "Composit", "e", "Rule_", "(_", "[_", "RMS", "Prop_", "(_", "deca", "y", "\\u", "rate_", "=_", "0.95_", ",_", "learn", "ing", "\\u", "rate_", "=_", "5e-", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Basic", "Moment", "um_", "(_", "momentum_", "=_", "0.9_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dropout_", "=_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w", "\\u", "noise_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "freq_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "freq_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "freq_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\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2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
operasoftware/tlsprober/probedb/probedata2/proberun.py
[ { "content": "# Copyright 2010-2012 Opera Software ASA \n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\nfrom django.db import models\n#from django.db.models.fields.related import ForeignKey\nimport base64\n\n# Create your models here.\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ProbeRunSort(models.Model):\n\t\"\"\"How to sort a specific run category\"\"\"\n\tsort_name = models.CharField(max_length = 100, db_index=True, unique = True)\n\tsort_rank = models.IntegerField()\n", "metadata": "root.ProbeRunSort", "header": "['module', '___EOS___']", "index": 21 }, { "content": "\tdef __unicode__(self):\n\t\treturn self.sort_name + \" \" + str(self.sort_rank) ", "metadata": "root.ProbeRunSort.__unicode__", "header": "['class', 'ProbeRunSort', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 26 }, { "content": "class ProbeRun(models.Model):\n\t\"\"\"\n\tDefines the source and description of batch run, \n\talso the optional git branch to be used for the job\n\t\"\"\"\n\tdate = models.DateTimeField(auto_now_add=True)\n\tsource_name = models.CharField(max_length = 100, db_index=True)\n\tsort_rank = models.ForeignKey(ProbeRunSort, null=True)\n\tdescription = models.CharField(max_length=300)\n\tbranch = models.CharField(max_length=100, null=True, blank=True)\n", "metadata": "root.ProbeRun", "header": "['module', '___EOS___']", "index": 29 }, { "content": "\tdef __unicode__(self):\n\t\treturn self.source_name + \" \" + self.description+ \" \" + str(self.date) ", "metadata": "root.ProbeRun.__unicode__", "header": "['class', 'ProbeRun', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 40 } ]
[ { "span": "import base64", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "2010", "-", "2012", " ", "Opera", " ", "Sof", "twa", "re", " ", "AS", "A", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", " ", "import", " ", "Fore", "ign", "Key_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "your", " ", "model", "s", " ", "here", "._", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Probe", "Run", "Sort_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Ho", "w", " ", "to", " ", "sort", " ", "a", " ", "specific", " ", "run", " ", "category", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "rank_", "=_", "models_", "._", "Integer", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Probe", "Run", "Sort_", "(_", "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\t", "\t_", "return_", "self_", "._", "sort", "\\u", "name_", "+_", "\"", " ", "\"_", "+_", "str_", "(_", "self_", "._", "sort", "\\u", "rank_", ")_", "\\u\\u\\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_", "Probe", "Run_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "\\", "10", ";", "\t", "Define", "s", " ", "the", " ", "source", " ", "and", " ", "description", " ", "of", " ", "batch", " ", "run", ",", " ", "\\", "10", ";", "\t", "als", "o", " ", "the", " ", "option", "al", " ", "git", " ", "branch", " ", "to", " ", "be", " ", "used", " ", "for", " ", "the", " ", "job", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "auto", "\\u", "now", "\\u", "add_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "rank_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Probe", "Run", "Sort_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "300_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Probe", "Run_", "(_", "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\t", "\t_", "return_", "self_", "._", "source", "\\u", "name_", "+_", "\"", " ", "\"_", "+_", "self_", "._", "description_", "+_", "\"", " ", "\"_", "+_", "str_", "(_", "self_", "._", "date_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
gkno/gkno_launcher/src/networkx/algorithms/connectivity/cuts.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\nFlow based cut algorithms\n\"\"\"\n# http://www.informatik.uni-augsburg.de/thi/personen/kammer/Graph_Connectivity.pdf\n# http://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf\nimport itertools\nfrom operator import itemgetter\nimport networkx as nx\nfrom networkx.algorithms.connectivity.connectivity import \\\n _aux_digraph_node_connectivity, _aux_digraph_edge_connectivity, \\\n dominating_set, node_connectivity\n\n__author__ = '\\n'.join(['Jordi Torrents <[email protected]>'])\n\n__all__ = [ 'minimum_st_node_cut',\n 'minimum_node_cut',\n 'minimum_st_edge_cut',\n 'minimum_edge_cut',\n ]\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def minimum_st_edge_cut(G, s, t, capacity='capacity'):\n \"\"\"Returns the edges of the cut-set of a minimum (s, t)-cut.\n\n We use the max-flow min-cut theorem, i.e., the capacity of a minimum\n capacity cut is equal to the flow value of a maximum flow.\n\n Parameters\n ----------\n G : NetworkX graph\n Edges of the graph are expected to have an attribute called\n 'capacity'. If this attribute is not present, the edge is\n considered to have infinite capacity.\n\n s : node\n Source node for the flow.\n\n t : node\n Sink node for the flow.\n\n capacity: string\n Edges of the graph G are expected to have an attribute capacity\n that indicates how much flow the edge can support. If this\n attribute is not present, the edge is considered to have\n infinite capacity. Default value: 'capacity'.\n\n Returns\n -------\n cutset : set\n Set of edges that, if removed from the graph, will disconnect it\n \n Raises\n ------\n NetworkXUnbounded\n If the graph has a path of infinite capacity, all cuts have\n infinite capacity and the function raises a NetworkXError.\n \n Examples\n --------\n >>> G = nx.DiGraph()\n >>> G.add_edge('x','a', capacity = 3.0)\n >>> G.add_edge('x','b', capacity = 1.0)\n >>> G.add_edge('a','c', capacity = 3.0)\n >>> G.add_edge('b','c', capacity = 5.0)\n >>> G.add_edge('b','d', capacity = 4.0)\n >>> G.add_edge('d','e', capacity = 2.0)\n >>> G.add_edge('c','y', capacity = 2.0)\n >>> G.add_edge('e','y', capacity = 3.0)\n >>> sorted(nx.minimum_edge_cut(G, 'x', 'y'))\n [('c', 'y'), ('x', 'b')]\n >>> nx.min_cut(G, 'x', 'y')\n 3.0\n \"\"\"\n try:\n flow, H = nx.ford_fulkerson_flow_and_auxiliary(G, s, t, capacity=capacity)\n cutset = set()\n # Compute reachable nodes from source in the residual network\n reachable = set(nx.single_source_shortest_path(H,s)) \n # And unreachable nodes\n others = set(H) - reachable # - set([s])\n # Any edge in the original network linking these two partitions\n # is part of the edge cutset\n for u, nbrs in ((n, G[n]) for n in reachable):\n cutset.update((u,v) for v in nbrs if v in others)\n return cutset\n except nx.NetworkXUnbounded:\n # Should we raise any other exception or just let ford_fulkerson \n # propagate nx.NetworkXUnbounded ?\n raise nx.NetworkXUnbounded(\"Infinite capacity path, no minimum cut.\")", "metadata": "root.minimum_st_edge_cut", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def minimum_st_node_cut(G, s, t, aux_digraph=None, mapping=None):\n r\"\"\"Returns a set of nodes of minimum cardinality that disconnect source\n from target in G.\n\n This function returns the set of nodes of minimum cardinality that, \n if removed, would destroy all paths among source and target in G. \n \n Parameters\n ----------\n G : NetworkX graph\n\n s : node\n Source node.\n\n t : node\n Target node.\n\n Returns\n -------\n cutset : set\n Set of nodes that, if removed, would destroy all paths between \n source and target in G.\n\n Examples\n --------\n >>> # Platonic icosahedral graph has node connectivity 5 \n >>> G = nx.icosahedral_graph()\n >>> len(nx.minimum_node_cut(G, 0, 6))\n 5\n\n Notes\n -----\n This is a flow based implementation of minimum node cut. The algorithm \n is based in solving a number of max-flow problems (ie local st-node\n connectivity, see local_node_connectivity) to determine the capacity \n of the minimum cut on an auxiliary directed network that corresponds \n to the minimum node cut of G. It handles both directed and undirected \n graphs.\n\n This implementation is based on algorithm 11 in [1]_. We use the Ford \n and Fulkerson algorithm to compute max flow (see ford_fulkerson).\n\n See also\n --------\n node_connectivity\n edge_connectivity\n minimum_edge_cut\n max_flow\n ford_fulkerson \n\n References\n ----------\n .. [1] Abdol-Hossein Esfahanian. Connectivity Algorithms. \n http://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf\n\n \"\"\"\n if aux_digraph is None or mapping is None:\n H, mapping = _aux_digraph_node_connectivity(G)\n else:\n H = aux_digraph\n edge_cut = minimum_st_edge_cut(H, '%sB' % mapping[s], '%sA' % mapping[t])\n # Each node in the original graph maps to two nodes of the auxiliary graph\n node_cut = set(H.node[node]['id'] for edge in edge_cut for node in edge)\n return node_cut - set([s,t])", "metadata": "root.minimum_st_node_cut", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def minimum_node_cut(G, s=None, t=None):\n r\"\"\"Returns a set of nodes of minimum cardinality that disconnects G.\n\n If source and target nodes are provided, this function returns the \n set of nodes of minimum cardinality that, if removed, would destroy \n all paths among source and target in G. If not, it returns a set \n of nodes of minimum cardinality that disconnects G.\n \n Parameters\n ----------\n G : NetworkX graph\n\n s : node\n Source node. Optional (default=None)\n\n t : node\n Target node. Optional (default=None)\n\n Returns\n -------\n cutset : set\n Set of nodes that, if removed, would disconnect G. If source \n and target nodes are provided, the set contians the nodes that\n if removed, would destroy all paths between source and target.\n\n Examples\n --------\n >>> # Platonic icosahedral graph has node connectivity 5 \n >>> G = nx.icosahedral_graph()\n >>> len(nx.minimum_node_cut(G))\n 5\n >>> # this is the minimum over any pair of non adjacent nodes\n >>> from itertools import combinations\n >>> for u,v in combinations(G, 2):\n ... if v not in G[u]:\n ... assert(len(nx.minimum_node_cut(G,u,v)) == 5)\n ... \n\n Notes\n -----\n This is a flow based implementation of minimum node cut. The algorithm \n is based in solving a number of max-flow problems (ie local st-node\n connectivity, see local_node_connectivity) to determine the capacity \n of the minimum cut on an auxiliary directed network that corresponds \n to the minimum node cut of G. It handles both directed and undirected \n graphs.\n\n This implementation is based on algorithm 11 in [1]_. We use the Ford \n and Fulkerson algorithm to compute max flow (see ford_fulkerson).\n\n See also\n --------\n node_connectivity\n edge_connectivity\n minimum_edge_cut\n max_flow\n ford_fulkerson \n\n References\n ----------\n .. [1] Abdol-Hossein Esfahanian. Connectivity Algorithms. \n http://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf\n\n \"\"\"\n # Local minimum node cut\n if s is not None and t is not None:\n if s not in G:\n raise nx.NetworkXError('node %s not in graph' % s)\n if t not in G:\n raise nx.NetworkXError('node %s not in graph' % t)\n return minimum_st_node_cut(G, s, t)\n # Global minimum node cut\n # Analog to the algoritm 11 for global node connectivity in [1]\n if G.is_directed():\n if not nx.is_weakly_connected(G):\n raise nx.NetworkXError('Input graph is not connected')\n iter_func = itertools.permutations\n def neighbors(v):\n return itertools.chain.from_iterable([G.predecessors_iter(v),\n G.successors_iter(v)])\n else:\n if not nx.is_connected(G):\n raise nx.NetworkXError('Input graph is not connected')\n iter_func = itertools.combinations\n neighbors = G.neighbors_iter\n # Choose a node with minimum degree\n deg = G.degree()\n min_deg = min(deg.values())\n v = next(n for n,d in deg.items() if d == min_deg)\n # Initial node cutset is all neighbors of the node with minimum degree\n min_cut = set(G[v])\n # Reuse the auxiliary digraph\n H, mapping = _aux_digraph_node_connectivity(G)\n # compute st node cuts between v and all its non-neighbors nodes in G\n # and store the minimum\n for w in set(G) - set(neighbors(v)) - set([v]):\n this_cut = minimum_st_node_cut(G, v, w, aux_digraph=H, mapping=mapping)\n if len(min_cut) >= len(this_cut):\n min_cut = this_cut\n # Same for non adjacent pairs of neighbors of v\n for x,y in iter_func(neighbors(v),2):\n if y in G[x]: continue\n this_cut = minimum_st_node_cut(G, x, y, aux_digraph=H, mapping=mapping)\n if len(min_cut) >= len(this_cut):\n min_cut = this_cut\n return min_cut", "metadata": "root.minimum_node_cut", "header": "['module', '___EOS___']", "index": 155 }, { "content": "def minimum_edge_cut(G, s=None, t=None):\n r\"\"\"Returns a set of edges of minimum cardinality that disconnects G.\n\n If source and target nodes are provided, this function returns the \n set of edges of minimum cardinality that, if removed, would break \n all paths among source and target in G. If not, it returns a set of \n edges of minimum cardinality that disconnects G.\n \n Parameters\n ----------\n G : NetworkX graph\n\n s : node\n Source node. Optional (default=None)\n\n t : node\n Target node. Optional (default=None)\n\n Returns\n -------\n cutset : set\n Set of edges that, if removed, would disconnect G. If source \n and target nodes are provided, the set contians the edges that\n if removed, would destroy all paths between source and target.\n\n Examples\n --------\n >>> # Platonic icosahedral graph has edge connectivity 5\n >>> G = nx.icosahedral_graph()\n >>> len(nx.minimum_edge_cut(G))\n 5\n >>> # this is the minimum over any pair of nodes\n >>> from itertools import combinations\n >>> for u,v in combinations(G, 2):\n ... assert(len(nx.minimum_edge_cut(G,u,v)) == 5)\n ... \n\n Notes\n -----\n This is a flow based implementation of minimum edge cut. For\n undirected graphs the algorithm works by finding a 'small' dominating\n set of nodes of G (see algorithm 7 in [1]_) and computing the maximum\n flow between an arbitrary node in the dominating set and the rest of\n nodes in it. This is an implementation of algorithm 6 in [1]_.\n\n For directed graphs, the algorithm does n calls to the max flow function.\n This is an implementation of algorithm 8 in [1]_. We use the Ford and\n Fulkerson algorithm to compute max flow (see ford_fulkerson).\n\n See also\n --------\n node_connectivity\n edge_connectivity\n minimum_node_cut\n max_flow\n ford_fulkerson\n\n References\n ----------\n .. [1] Abdol-Hossein Esfahanian. Connectivity Algorithms.\n http://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf\n\n \"\"\"\n # reuse auxiliary digraph\n H = _aux_digraph_edge_connectivity(G)\n # Local minimum edge cut if s and t are not None\n if s is not None and t is not None:\n if s not in G:\n raise nx.NetworkXError('node %s not in graph' % s)\n if t not in G:\n raise nx.NetworkXError('node %s not in graph' % t)\n return minimum_st_edge_cut(H, s, t)\n # Global minimum edge cut\n # Analog to the algoritm for global edge connectivity\n if G.is_directed():\n # Based on algorithm 8 in [1]\n if not nx.is_weakly_connected(G):\n raise nx.NetworkXError('Input graph is not connected')\n # Initial cutset is all edges of a node with minimum degree\n deg = G.degree()\n min_deg = min(deg.values())\n node = next(n for n,d in deg.items() if d==min_deg)\n min_cut = G.edges(node)\n nodes = G.nodes()\n n = len(nodes)\n for i in range(n):\n try:\n this_cut = minimum_st_edge_cut(H, nodes[i], nodes[i+1])\n if len(this_cut) <= len(min_cut):\n min_cut = this_cut\n except IndexError: # Last node!\n this_cut = minimum_st_edge_cut(H, nodes[i], nodes[0])\n if len(this_cut) <= len(min_cut):\n min_cut = this_cut\n return min_cut\n else: # undirected\n # Based on algorithm 6 in [1]\n if not nx.is_connected(G):\n raise nx.NetworkXError('Input graph is not connected')\n # Initial cutset is all edges of a node with minimum degree\n deg = G.degree()\n min_deg = min(deg.values())\n node = next(n for n,d in deg.items() if d==min_deg)\n min_cut = G.edges(node)\n # A dominating set is \\lambda-covering\n # We need a dominating set with at least two nodes\n for node in G:\n D = dominating_set(G, start_with=node)\n v = D.pop()\n if D: break\n else:\n # in complete graphs the dominating set will always be of one node\n # thus we return min_cut, which now contains the edges of a node\n # with minimum degree\n return min_cut\n for w in D:\n this_cut = minimum_st_edge_cut(H, v, w)\n if len(this_cut) <= len(min_cut):\n min_cut = this_cut\n return min_cut", "metadata": "root.minimum_edge_cut", "header": "['module', '___EOS___']", "index": 262 } ]
[ { "span": "from operator import itemgetter", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 31 }, { "span": "from networkx.algorithms.connectivity.connectivity import \\\n _aux_digraph_node_connectivity, _aux_digraph_edge_connectivity, \\\n dominating_set, node_connectivity", "start_line": 9, "start_column": 0, "end_line": 11, "end_column": 37 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Flow", " ", "based", " ", "cut", " ", "algo", "rit", "hms", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "informati", "k", ".", "uni", "-", "aug", "sbu", "rg", ".", "de", "/", "thi", "/", "person", "en", "/", "kam", "mer", "/", "Graph", "\\u", "Connectivity", ".", "pdf_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "cse", ".", "ms", "u", ".", "edu", "/", "~", "cse", "835", "/", "Pap", "ers", "/", "Graph", "\\u", "connecti", "vity", "\\u", "revis", "ed", ".", "pdf_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "operator_", "import_", "itemgetter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "networkx_", "as_", "nx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "networkx_", "._", "algorithms_", "._", "connectivity_", "._", "connectivity_", "import_", "\\u", "aux", "\\u", "digraph", "\\u", "node", "\\u", "connectivity_", ",_", "\\u", "aux", "\\u", "digraph", "\\u", "edge", "\\u", "connectivity_", ",_", "domina", "ting", "\\u", "set_", ",_", "node", "\\u", "connectivity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "'", "Jo", "rdi", " ", "Torrent", "s", " ", "<", "jt", "orr", "ents", "@", "mil", "nou", ".", "net", ">'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "minim", "um", "\\u", "st", "\\u", "node", "\\u", "cut", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "minim", "um", "\\u", "node", "\\u", "cut", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "minim", "um", "\\u", "st", "\\u", "edge", "\\u", "cut", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "minim", "um", "\\u", "edge", "\\u", "cut", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "minim", "um", "\\u", "st", "\\u", "edge", "\\u", "cut_", "(_", "G_", ",_", "s_", ",_", "t_", ",_", "capacity_", "=_", "'", "capacit", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "edge", "s", " ", "of", " ", "the", " ", "cut", "-", "set", " ", "of", " ", "a", " ", "minim", "um", " ", "(", "s", ",", " ", "t", ")-", "cut", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "use", " ", "the", " ", "max", "-", "flow", " ", "min", "-", "cut", " ", "theore", "m", ",", " ", "i", ".", "e", ".,", " ", "the", " ", "capacit", "y", " ", "of", " ", "a", " ", "minim", "um", "\\", "10", ";", " ", " ", " ", " ", "capacit", "y", " ", "cut", " ", "is", " ", "equal", " ", "to", " ", "the", " ", "flow", " ", "value", " ", "of", " ", "a", " ", "maxim", "um", " ", "flow", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "G", " ", ":", " ", "Network", "X", " ", "graph", "\\", "10", ";", " ", " ", " ", " ", "Ed", "ges", " ", "of", " ", "the", " ", "graph", " ", "are", " ", "expected", " ", "to", " ", "have", " ", "an", " ", "attribute", " ", "call", "ed", "\\", "10", ";", " ", " ", " ", " ", "'", "capacit", "y", "'.", " ", "If", " ", "this", " ", "attribute", " ", "is", " ", "not", " ", "presen", "t", ",", " ", "the", " ", "edge", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "consider", "ed", " ", "to", " ", "have", " ", "infini", "te", " ", "capacit", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "s", " ", ":", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "Sou", "rce", " ", "node", " ", "for", " ", "the", " ", "flow", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "t", " ", ":", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "Sin", "k", " ", "node", " ", "for", " ", "the", " ", "flow", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "capacit", "y", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "Ed", "ges", " ", "of", " ", "the", " ", "graph", " ", "G", " ", "are", " ", "expected", " ", "to", " ", "have", " ", "an", " ", "attribute", " ", "capacit", "y", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "indicat", "es", " ", "how", " ", "muc", "h", " ", "flow", " ", "the", " ", "edge", " ", "can", " ", "support", ".", " ", "If", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "attribute", " ", "is", " ", "not", " ", "presen", "t", ",", " ", "the", " ", "edge", " ", "is", " ", "consider", "ed", " ", "to", " ", "have", "\\", "10", ";", " ", " ", " ", " ", "infini", "te", " ", "capacit", "y", ".", " ", "Default", " ", "value", ":", " ", "'", "capacit", "y", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "cuts", "et", " ", ":", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "of", " ", "edge", "s", " ", "tha", "t", ",", " ", "if", " ", "remove", "d", " ", "from", " ", "the", " ", "graph", ",", " ", "will", " ", "discon", "nect", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", "\\", "10", ";", " ", " ", " ", " ", "------", "\\", "10", ";", " ", " ", " ", " ", "Network", "XU", "nbo", "unde", "d", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "graph", " ", "has", " ", "a", " ", "path", " ", "of", " ", "infini", "te", " ", "capacit", "y", ",", " ", "all", " ", "cuts", " ", "have", "\\", "10", ";", " ", " ", " ", " ", "infini", "te", " ", "capacit", "y", " ", "and", " ", "the", " ", "function", " ", "raise", "s", " ", "a", " ", "Network", "XE", "rror", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", " ", "=", " ", "nx", ".", "Di", "Graph", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", ".", "add", "\\u", "edge", "('", "x", "','", "a", "',", " ", "capacit", "y", " ", "=", " ", "3.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", ".", "add", "\\u", "edge", "('", "x", "','", "b", "',", " ", "capacit", "y", " ", "=", " ", "1.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", ".", "add", "\\u", "edge", "('", "a", "','", "c", "',", " ", "capacit", "y", " ", "=", " ", "3.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", ".", "add", "\\u", "edge", "('", "b", "','", "c", "',", " ", "capacit", "y", " ", "=", " ", "5.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", ".", "add", "\\u", "edge", "('", "b", "','", "d", "',", " ", "capacit", "y", " ", "=", " ", "4.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", ".", "add", "\\u", "edge", "('", "d", "','", "e", "',", " ", "capacit", "y", " ", "=", " ", "2.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", ".", "add", "\\u", "edge", "('", "c", "','", "y", "',", " ", "capacit", "y", " ", "=", " ", "2.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", ".", "add", "\\u", "edge", "('", "e", "','", "y", "',", " ", "capacit", "y", " ", "=", " ", "3.0", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "nx", ".", "minim", "um", "\\u", "edge", "\\u", "cut", "(", "G", ",", " ", "'", "x", "',", " ", "'", "y", "'))", "\\", "10", ";", " ", " ", " ", " ", "[(", "'", "c", "',", " ", "'", "y", "')", ",", " ", "('", "x", "',", " ", "'", "b", "')]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "nx", ".", "min", "\\u", "cut", "(", "G", ",", " ", "'", "x", "',", " ", "'", "y", "')", "\\", "10", ";", " ", " ", " ", " ", "3.0", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flow_", ",_", "H_", "=_", "nx_", "._", "for", "d\\u", "ful", "ker", "son", "\\u", "flow", "\\u", "and", "\\u", "auxiliary", "_", "(_", "G_", ",_", "s_", ",_", "t_", ",_", "capacity_", "=_", "capacity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cuts", "et_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Compute", " ", "reachable", " ", "nodes", " ", "from", " ", "source", " ", "in", " ", "the", " ", "residu", "al", " ", "network_", "\\u\\u\\uNL\\u\\u\\u_", "reachable", "_", "=_", "set_", "(_", "nx_", "._", "single", "\\u", "source", "\\u", "short", "est", "\\u", "path_", "(_", "H_", ",_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "And", " ", "unreachable", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "others_", "=_", "set_", "(_", "H_", ")_", "-_", "reachable", "_", "#", " ", "-", " ", "set", "([", "s", "])", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Any", " ", "edge", " ", "in", " ", "the", " ", "original", " ", "network", " ", "linking", " ", "these", " ", "two", " ", "partitions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "part", " ", "of", " ", "the", " ", "edge", " ", "cuts", "et_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "u_", ",_", "nbr", "s_", "in_", "(_", "(_", "n_", ",_", "G_", "[_", "n_", "]_", ")_", "for_", "n_", "in_", "reachable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cuts", "et_", "._", "update_", "(_", "(_", "u_", ",_", "v_", ")_", "for_", "v_", "in_", "nbr", "s_", "if_", "v_", "in_", "others_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cuts", "et_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "nx_", "._", "Network", "XU", "nbo", "unde", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sho", "ul", "d", " ", "we", " ", "raise", " ", "any", " ", "other", " ", "exception", " ", "or", " ", "just", " ", "let", " ", "for", "d\\u", "ful", "ker", "son", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "propagate", " ", "nx", ".", "Network", "XU", "nbo", "unde", "d", " ", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nx_", "._", "Network", "XU", "nbo", "unde", "d_", "(_", "\"", "Infinit", "e", " ", "capacit", "y", " ", "path", ",", " ", "no", " ", "minim", "um", " ", "cut", ".\"_", ")_", "\\u\\u\\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_", "minim", "um", "\\u", "st", "\\u", "node", "\\u", "cut_", "(_", "G_", ",_", "s_", ",_", "t_", ",_", "aux", "\\u", "digraph", "_", "=_", "None_", ",_", "mapping_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Return", "s", " ", "a", " ", "set", " ", "of", " ", "nodes", " ", "of", " ", "minim", "um", " ", "cardinalit", "y", " ", "tha", "t", " ", "discon", "nect", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "target", " ", "in", " ", "G", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "return", "s", " ", "the", " ", "set", " ", "of", " ", "nodes", " ", "of", " ", "minim", "um", " ", "cardinalit", "y", " ", "tha", "t", ",", " ", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "remove", "d", ",", " ", "wou", "ld", " ", "destroy", " ", "all", " ", "path", "s", " ", "amo", "ng", " ", "source", " ", "and", " ", "target", " ", "in", " ", "G", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "G", " ", ":", " ", "Network", "X", " ", "graph", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "s", " ", ":", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "Sou", "rce", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "t", " ", ":", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "Target", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "cuts", "et", " ", ":", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "of", " ", "nodes", " ", "tha", "t", ",", " ", "if", " ", "remove", "d", ",", " ", "wou", "ld", " ", "destroy", " ", "all", " ", "path", "s", " ", "bet", "ween", " ", "\\", "10", ";", " ", " ", " ", " ", "source", " ", "and", " ", "target", " ", "in", " ", "G", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "#", " ", "Plat", "onic", " ", "ico", "sa", "hedr", "al", " ", "graph", " ", "has", " ", "node", " ", "connecti", "vity", " ", "5", " ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", " ", "=", " ", "nx", ".", "ico", "sa", "hedr", "al", "\\u", "graph", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "len", "(", "nx", ".", "minim", "um", "\\u", "node", "\\u", "cut", "(", "G", ",", " ", "0", ",", " ", "6", "))\\", "10", ";", " ", " ", " ", " ", "5", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "flow", " ", "based", " ", "implementation", " ", "of", " ", "minim", "um", " ", "node", " ", "cut", ".", " ", "The", " ", "algo", "rit", "hm", " ", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "based", " ", "in", " ", "solv", "ing", " ", "a", " ", "number", " ", "of", " ", "max", "-", "flow", " ", "problem", "s", " ", "(", "ie", " ", "local", " ", "st", "-", "node", "\\", "10", ";", " ", " ", " ", " ", "connecti", "vity", ",", " ", "see", " ", "local", "\\u", "node", "\\u", "connecti", "vity", ")", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "capacit", "y", " ", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "minim", "um", " ", "cut", " ", "on", " ", "an", " ", "auxiliary", " ", "direct", "ed", " ", "network", " ", "tha", "t", " ", "correspond", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "minim", "um", " ", "node", " ", "cut", " ", "of", " ", "G", ".", " ", "It", " ", "handle", "s", " ", "bot", "h", " ", "direct", "ed", " ", "and", " ", "undi", "rect", "ed", " ", "\\", "10", ";", " ", " ", " ", " ", "graph", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "implementation", " ", "is", " ", "based", " ", "on", " ", "algo", "rit", "hm", " ", "11", " ", "in", " ", "[", "1", "]\\u", ".", " ", "We", " ", "use", " ", "the", " ", "For", "d", " ", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "Fu", "lke", "rson", " ", "algo", "rit", "hm", " ", "to", " ", "compute", " ", "max", " ", "flow", " ", "(", "see", " ", "for", "d\\u", "ful", "ker", "son", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "als", "o", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "node", "\\u", "connecti", "vity", "\\", "10", ";", " ", " ", " ", " ", "edge", "\\u", "connecti", "vity", "\\", "10", ";", " ", " ", " ", " ", "minim", "um", "\\u", "edge", "\\u", "cut", "\\", "10", ";", " ", " ", " ", " ", "max", "\\u", "flow", "\\", "10", ";", " ", " ", " ", " ", "for", "d\\u", "ful", "ker", "son", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "1", "]", " ", "Ab", "dol", "-", "Ho", "sse", "in", " ", "Es", "fa", "han", "ian", ".", " ", "Connectivity", " ", "Algorit", "hms", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "cse", ".", "ms", "u", ".", "edu", "/", "~", "cse", "835", "/", "Pap", "ers", "/", "Graph", "\\u", "connecti", "vity", "\\u", "revis", "ed", ".", "pdf", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aux", "\\u", "digraph", "_", "is_", "None_", "or_", "mapping_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "H_", ",_", "mapping_", "=_", "\\u", "aux", "\\u", "digraph", "\\u", "node", "\\u", "connectivity_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "H_", "=_", "aux", "\\u", "digraph", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "edge", "\\u", "cut_", "=_", "minim", "um", "\\u", "st", "\\u", "edge", "\\u", "cut_", "(_", "H_", ",_", "'%", "s", "B", "'_", "%_", "mapping_", "[_", "s_", "]_", ",_", "'%", "s", "A", "'_", "%_", "mapping_", "[_", "t_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ea", "ch", " ", "node", " ", "in", " ", "the", " ", "original", " ", "graph", " ", "maps", " ", "to", " ", "two", " ", "nodes", " ", "of", " ", "the", " ", "auxiliary", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "cut_", "=_", "set_", "(_", "H_", "._", "node_", "[_", "node_", "]_", "[_", "'", "id", "'_", "]_", "for_", "edge_", "in_", "edge", "\\u", "cut_", "for_", "node_", "in_", "edge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "node", "\\u", "cut_", "-_", "set_", "(_", "[_", "s_", ",_", "t_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "minim", "um", "\\u", "node", "\\u", "cut_", "(_", "G_", ",_", "s_", "=_", "None_", ",_", "t_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Return", "s", " ", "a", " ", "set", " ", "of", " ", "nodes", " ", "of", " ", "minim", "um", " ", "cardinalit", "y", " ", "tha", "t", " ", "discon", "nect", "s", " ", "G", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "source", " ", "and", " ", "target", " ", "nodes", " ", "are", " ", "provided", ",", " ", "this", " ", "function", " ", "return", "s", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "of", " ", "nodes", " ", "of", " ", "minim", "um", " ", "cardinalit", "y", " ", "tha", "t", ",", " ", "if", " ", "remove", "d", ",", " ", "wou", "ld", " ", "destroy", " ", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "path", "s", " ", "amo", "ng", " ", "source", " ", "and", " ", "target", " ", "in", " ", "G", ".", " ", "If", " ", "not", ",", " ", "it", " ", "return", "s", " ", "a", " ", "set", " ", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "nodes", " ", "of", " ", "minim", "um", " ", "cardinalit", "y", " ", "tha", "t", " ", "discon", "nect", "s", " ", "G", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "G", " ", ":", " ", "Network", "X", " ", "graph", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "s", " ", ":", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "Sou", "rce", " ", "node", ".", " ", "Optio", "nal", " ", "(", "default", "=", "Non", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "t", " ", ":", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "Target", " ", "node", ".", " ", "Optio", "nal", " ", "(", "default", "=", "Non", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "cuts", "et", " ", ":", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "of", " ", "nodes", " ", "tha", "t", ",", " ", "if", " ", "remove", "d", ",", " ", "wou", "ld", " ", "discon", "nect", " ", "G", ".", " ", "If", " ", "source", " ", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "target", " ", "nodes", " ", "are", " ", "provided", ",", " ", "the", " ", "set", " ", "conti", "ans", " ", "the", " ", "nodes", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "remove", "d", ",", " ", "wou", "ld", " ", "destroy", " ", "all", " ", "path", "s", " ", "bet", "ween", " ", "source", " ", "and", " ", "target", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "#", " ", "Plat", "onic", " ", "ico", "sa", "hedr", "al", " ", "graph", " ", "has", " ", "node", " ", "connecti", "vity", " ", "5", " ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", " ", "=", " ", "nx", ".", "ico", "sa", "hedr", "al", "\\u", "graph", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "len", "(", "nx", ".", "minim", "um", "\\u", "node", "\\u", "cut", "(", "G", "))\\", "10", ";", " ", " ", " ", " ", "5", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "#", " ", "this", " ", "is", " ", "the", " ", "minim", "um", " ", "over", " ", "any", " ", "pair", " ", "of", " ", "non", " ", "adjacent", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "iter", "tool", "s", " ", "import", " ", "combinat", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "for", " ", "u", ",", "v", " ", "in", " ", "combinat", "ion", "s", "(", "G", ",", " ", "2", "):", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "if", " ", "v", " ", "not", " ", "in", " ", "G", "[", "u", "]:", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", " ", "assert", "(", "len", "(", "nx", ".", "minim", "um", "\\u", "node", "\\u", "cut", "(", "G", ",", "u", ",", "v", "))", " ", "==", " ", "5", ")", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "flow", " ", "based", " ", "implementation", " ", "of", " ", "minim", "um", " ", "node", " ", "cut", ".", " ", "The", " ", "algo", "rit", "hm", " ", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "based", " ", "in", " ", "solv", "ing", " ", "a", " ", "number", " ", "of", " ", "max", "-", "flow", " ", "problem", "s", " ", "(", "ie", " ", "local", " ", "st", "-", "node", "\\", "10", ";", " ", " ", " ", " ", "connecti", "vity", ",", " ", "see", " ", "local", "\\u", "node", "\\u", "connecti", "vity", ")", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "capacit", "y", " ", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "minim", "um", " ", "cut", " ", "on", " ", "an", " ", "auxiliary", " ", "direct", "ed", " ", "network", " ", "tha", "t", " ", "correspond", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "minim", "um", " ", "node", " ", "cut", " ", "of", " ", "G", ".", " ", "It", " ", "handle", "s", " ", "bot", "h", " ", "direct", "ed", " ", "and", " ", "undi", "rect", "ed", " ", "\\", "10", ";", " ", " ", " ", " ", "graph", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "implementation", " ", "is", " ", "based", " ", "on", " ", "algo", "rit", "hm", " ", "11", " ", "in", " ", "[", "1", "]\\u", ".", " ", "We", " ", "use", " ", "the", " ", "For", "d", " ", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "Fu", "lke", "rson", " ", "algo", "rit", "hm", " ", "to", " ", "compute", " ", "max", " ", "flow", " ", "(", "see", " ", "for", "d\\u", "ful", "ker", "son", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "als", "o", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "node", "\\u", "connecti", "vity", "\\", "10", ";", " ", " ", " ", " ", "edge", "\\u", "connecti", "vity", "\\", "10", ";", " ", " ", " ", " ", "minim", "um", "\\u", "edge", "\\u", "cut", "\\", "10", ";", " ", " ", " ", " ", "max", "\\u", "flow", "\\", "10", ";", " ", " ", " ", " ", "for", "d\\u", "ful", "ker", "son", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "1", "]", " ", "Ab", "dol", "-", "Ho", "sse", "in", " ", "Es", "fa", "han", "ian", ".", " ", "Connectivity", " ", "Algorit", "hms", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "cse", ".", "ms", "u", ".", "edu", "/", "~", "cse", "835", "/", "Pap", "ers", "/", "Graph", "\\u", "connecti", "vity", "\\u", "revis", "ed", ".", "pdf", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Local", " ", "minim", "um", " ", "node", " ", "cut_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "s_", "is_", "not_", "None_", "and_", "t_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "not_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nx_", "._", "Network", "XE", "rror_", "(_", "'", "node", " ", "%", "s", " ", "not", " ", "in", " ", "graph", "'_", "%_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "t_", "not_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nx_", "._", "Network", "XE", "rror_", "(_", "'", "node", " ", "%", "s", " ", "not", " ", "in", " ", "graph", "'_", "%_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "minim", "um", "\\u", "st", "\\u", "node", "\\u", "cut_", "(_", "G_", ",_", "s_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Global", " ", "minim", "um", " ", "node", " ", "cut_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ana", "log", " ", "to", " ", "the", " ", "algo", "rit", "m", " ", "11", " ", "for", " ", "global", " ", "node", " ", "connecti", "vity", " ", "in", " ", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "G_", "._", "is", "\\u", "directed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "nx_", "._", "is", "\\u", "weak", "ly", "\\u", "connected_", "(_", "G_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nx_", "._", "Network", "XE", "rror_", "(_", "'", "Inp", "ut", " ", "graph", " ", "is", " ", "not", " ", "connect", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iter", "\\u", "func_", "=_", "itertools_", "._", "permutations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "neighbors_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "itertools_", "._", "chain_", "._", "from", "\\u", "iterable_", "(_", "[_", "G_", "._", "predecessor", "s", "\\u", "iter_", "(_", "v_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "G_", "._", "successor", "s", "\\u", "iter_", "(_", "v_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "nx_", "._", "is", "\\u", "connected_", "(_", "G_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nx_", "._", "Network", "XE", "rror_", "(_", "'", "Inp", "ut", " ", "graph", " ", "is", " ", "not", " ", "connect", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iter", "\\u", "func_", "=_", "itertools_", "._", "combinations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "G_", "._", "neighbor", "s", "\\u", "iter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Choose", " ", "a", " ", "node", " ", "with", " ", "minim", "um", " ", "degree_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "deg_", "=_", "G_", "._", "degree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "deg_", "=_", "min_", "(_", "deg_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "next_", "(_", "n_", "for_", "n_", ",_", "d_", "in_", "deg_", "._", "items_", "(_", ")_", "if_", "d_", "==_", "min", "\\u", "deg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Initial", " ", "node", " ", "cuts", "et", " ", "is", " ", "all", " ", "neighbor", "s", " ", "of", " ", "the", " ", "node", " ", "with", " ", "minim", "um", " ", "degree_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "cut_", "=_", "set_", "(_", "G_", "[_", "v_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reu", "se", " ", "the", " ", "auxiliary", " ", "digraph", "_", "\\u\\u\\uNL\\u\\u\\u_", "H_", ",_", "mapping_", "=_", "\\u", "aux", "\\u", "digraph", "\\u", "node", "\\u", "connectivity_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "compute", " ", "st", " ", "node", " ", "cuts", " ", "bet", "ween", " ", "v", " ", "and", " ", "all", " ", "its", " ", "non", "-", "neighbor", "s", " ", "nodes", " ", "in", " ", "G_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "store", " ", "the", " ", "minimum_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "w_", "in_", "set_", "(_", "G_", ")_", "-_", "set_", "(_", "neighbors_", "(_", "v_", ")_", ")_", "-_", "set_", "(_", "[_", "v_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "\\u", "cut_", "=_", "minim", "um", "\\u", "st", "\\u", "node", "\\u", "cut_", "(_", "G_", ",_", "v_", ",_", "w_", ",_", "aux", "\\u", "digraph", "_", "=_", "H_", ",_", "mapping_", "=_", "mapping_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "min", "\\u", "cut_", ")_", ">=_", "len_", "(_", "this", "\\u", "cut_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "cut_", "=_", "this", "\\u", "cut_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sam", "e", " ", "for", " ", "non", " ", "adjacent", " ", "pair", "s", " ", "of", " ", "neighbor", "s", " ", "of", " ", "v_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "x_", ",_", "y_", "in_", "iter", "\\u", "func_", "(_", "neighbors_", "(_", "v_", ")_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "y_", "in_", "G_", "[_", "x_", "]_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "cut_", "=_", "minim", "um", "\\u", "st", "\\u", "node", "\\u", "cut_", "(_", "G_", ",_", "x_", ",_", "y_", ",_", "aux", "\\u", "digraph", "_", "=_", "H_", ",_", "mapping_", "=_", "mapping_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "min", "\\u", "cut_", ")_", ">=_", "len_", "(_", "this", "\\u", "cut_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "cut_", "=_", "this", "\\u", "cut_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "min", "\\u", "cut_", "\\u\\u\\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_", "minim", "um", "\\u", "edge", "\\u", "cut_", "(_", "G_", ",_", "s_", "=_", "None_", ",_", "t_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Return", "s", " ", "a", " ", "set", " ", "of", " ", "edge", "s", " ", "of", " ", "minim", "um", " ", "cardinalit", "y", " ", "tha", "t", " ", "discon", "nect", "s", " ", "G", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "source", " ", "and", " ", "target", " ", "nodes", " ", "are", " ", "provided", ",", " ", "this", " ", "function", " ", "return", "s", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "of", " ", "edge", "s", " ", "of", " ", "minim", "um", " ", "cardinalit", "y", " ", "tha", "t", ",", " ", "if", " ", "remove", "d", ",", " ", "wou", "ld", " ", "break", " ", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "path", "s", " ", "amo", "ng", " ", "source", " ", "and", " ", "target", " ", "in", " ", "G", ".", " ", "If", " ", "not", ",", " ", "it", " ", "return", "s", " ", "a", " ", "set", " ", "of", " ", "\\", "10", ";", " ", " ", " ", " ", "edge", "s", " ", "of", " ", "minim", "um", " ", "cardinalit", "y", " ", "tha", "t", " ", "discon", "nect", "s", " ", "G", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "G", " ", ":", " ", "Network", "X", " ", "graph", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "s", " ", ":", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "Sou", "rce", " ", "node", ".", " ", "Optio", "nal", " ", "(", "default", "=", "Non", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "t", " ", ":", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "Target", " ", "node", ".", " ", "Optio", "nal", " ", "(", "default", "=", "Non", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "cuts", "et", " ", ":", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "of", " ", "edge", "s", " ", "tha", "t", ",", " ", "if", " ", "remove", "d", ",", " ", "wou", "ld", " ", "discon", "nect", " ", "G", ".", " ", "If", " ", "source", " ", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "target", " ", "nodes", " ", "are", " ", "provided", ",", " ", "the", " ", "set", " ", "conti", "ans", " ", "the", " ", "edge", "s", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "remove", "d", ",", " ", "wou", "ld", " ", "destroy", " ", "all", " ", "path", "s", " ", "bet", "ween", " ", "source", " ", "and", " ", "target", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "#", " ", "Plat", "onic", " ", "ico", "sa", "hedr", "al", " ", "graph", " ", "has", " ", "edge", " ", "connecti", "vity", " ", "5", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", " ", "=", " ", "nx", ".", "ico", "sa", "hedr", "al", "\\u", "graph", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "len", "(", "nx", ".", "minim", "um", "\\u", "edge", "\\u", "cut", "(", "G", "))\\", "10", ";", " ", " ", " ", " ", "5", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "#", " ", "this", " ", "is", " ", "the", " ", "minim", "um", " ", "over", " ", "any", " ", "pair", " ", "of", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "iter", "tool", "s", " ", "import", " ", "combinat", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "for", " ", "u", ",", "v", " ", "in", " ", "combinat", "ion", "s", "(", "G", ",", " ", "2", "):", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "assert", "(", "len", "(", "nx", ".", "minim", "um", "\\u", "edge", "\\u", "cut", "(", "G", ",", "u", ",", "v", "))", " ", "==", " ", "5", ")", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "flow", " ", "based", " ", "implementation", " ", "of", " ", "minim", "um", " ", "edge", " ", "cut", ".", " ", "For", "\\", "10", ";", " ", " ", " ", " ", "undi", "rect", "ed", " ", "graph", "s", " ", "the", " ", "algo", "rit", "hm", " ", "works", " ", "by", " ", "finding", " ", "a", " ", "'", "small", "'", " ", "domina", "ting", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "of", " ", "nodes", " ", "of", " ", "G", " ", "(", "see", " ", "algo", "rit", "hm", " ", "7", " ", "in", " ", "[", "1", "]\\u", ")", " ", "and", " ", "compu", "ting", " ", "the", " ", "maxim", "um", "\\", "10", ";", " ", " ", " ", " ", "flow", " ", "bet", "ween", " ", "an", " ", "arbitra", "ry", " ", "node", " ", "in", " ", "the", " ", "domina", "ting", " ", "set", " ", "and", " ", "the", " ", "rest", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "nodes", " ", "in", " ", "it", ".", " ", "Thi", "s", " ", "is", " ", "an", " ", "implementation", " ", "of", " ", "algo", "rit", "hm", " ", "6", " ", "in", " ", "[", "1", "]\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "direct", "ed", " ", "graph", "s", ",", " ", "the", " ", "algo", "rit", "hm", " ", "doe", "s", " ", "n", " ", "calls", " ", "to", " ", "the", " ", "max", " ", "flow", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "an", " ", "implementation", " ", "of", " ", "algo", "rit", "hm", " ", "8", " ", "in", " ", "[", "1", "]\\u", ".", " ", "We", " ", "use", " ", "the", " ", "For", "d", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "Fu", "lke", "rson", " ", "algo", "rit", "hm", " ", "to", " ", "compute", " ", "max", " ", "flow", " ", "(", "see", " ", "for", "d\\u", "ful", "ker", "son", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "als", "o", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "node", "\\u", "connecti", "vity", "\\", "10", ";", " ", " ", " ", " ", "edge", "\\u", "connecti", "vity", "\\", "10", ";", " ", " ", " ", " ", "minim", "um", "\\u", "node", "\\u", "cut", "\\", "10", ";", " ", " ", " ", " ", "max", "\\u", "flow", "\\", "10", ";", " ", " ", " ", " ", "for", "d\\u", "ful", "ker", "son", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "1", "]", " ", "Ab", "dol", "-", "Ho", "sse", "in", " ", "Es", "fa", "han", "ian", ".", " ", "Connectivity", " ", "Algorit", "hms", ".", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "cse", ".", "ms", "u", ".", "edu", "/", "~", "cse", "835", "/", "Pap", "ers", "/", "Graph", "\\u", "connecti", "vity", "\\u", "revis", "ed", ".", "pdf", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "reus", "e", " ", "auxiliary", " ", "digraph", "_", "\\u\\u\\uNL\\u\\u\\u_", "H_", "=_", "\\u", "aux", "\\u", "digraph", "\\u", "edge", "\\u", "connectivity_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Local", " ", "minim", "um", " ", "edge", " ", "cut", " ", "if", " ", "s", " ", "and", " ", "t", " ", "are", " ", "not", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "s_", "is_", "not_", "None_", "and_", "t_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "not_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nx_", "._", "Network", "XE", "rror_", "(_", "'", "node", " ", "%", "s", " ", "not", " ", "in", " ", "graph", "'_", "%_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "t_", "not_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nx_", "._", "Network", "XE", "rror_", "(_", "'", "node", " ", "%", "s", " ", "not", " ", "in", " ", "graph", "'_", "%_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "minim", "um", "\\u", "st", "\\u", "edge", "\\u", "cut_", "(_", "H_", ",_", "s_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Global", " ", "minim", "um", " ", "edge", " ", "cut_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ana", "log", " ", "to", " ", "the", " ", "algo", "rit", "m", " ", "for", " ", "global", " ", "edge", " ", "connectivity_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "G_", "._", "is", "\\u", "directed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Base", "d", " ", "on", " ", "algo", "rit", "hm", " ", "8", " ", "in", " ", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "nx_", "._", "is", "\\u", "weak", "ly", "\\u", "connected_", "(_", "G_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nx_", "._", "Network", "XE", "rror_", "(_", "'", "Inp", "ut", " ", "graph", " ", "is", " ", "not", " ", "connect", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Initial", " ", "cuts", "et", " ", "is", " ", "all", " ", "edge", "s", " ", "of", " ", "a", " ", "node", " ", "with", " ", "minim", "um", " ", "degree_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "deg_", "=_", "G_", "._", "degree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "deg_", "=_", "min_", "(_", "deg_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "next_", "(_", "n_", "for_", "n_", ",_", "d_", "in_", "deg_", "._", "items_", "(_", ")_", "if_", "d_", "==_", "min", "\\u", "deg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "cut_", "=_", "G_", "._", "edges_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes_", "=_", "G_", "._", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "len_", "(_", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "\\u", "cut_", "=_", "minim", "um", "\\u", "st", "\\u", "edge", "\\u", "cut_", "(_", "H_", ",_", "nodes_", "[_", "i_", "]_", ",_", "nodes_", "[_", "i_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "this", "\\u", "cut_", ")_", "<=_", "len_", "(_", "min", "\\u", "cut_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "min", "\\u", "cut_", "=_", "this", "\\u", "cut_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "#", " ", "Las", "t", " ", "node", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "\\u", "cut_", "=_", "minim", "um", "\\u", "st", "\\u", "edge", "\\u", "cut_", "(_", "H_", ",_", "nodes_", "[_", "i_", "]_", ",_", "nodes_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "this", "\\u", "cut_", ")_", "<=_", "len_", "(_", "min", "\\u", "cut_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "min", "\\u", "cut_", "=_", "this", "\\u", "cut_", "\\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_", "min", "\\u", "cut_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "undi", "rect", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Base", "d", " ", "on", " ", "algo", "rit", "hm", " ", "6", " ", "in", " ", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "nx_", "._", "is", "\\u", "connected_", "(_", "G_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nx_", "._", "Network", "XE", "rror_", "(_", "'", "Inp", "ut", " ", "graph", " ", "is", " ", "not", " ", "connect", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Initial", " ", "cuts", "et", " ", "is", " ", "all", " ", "edge", "s", " ", "of", " ", "a", " ", "node", " ", "with", " ", "minim", "um", " ", "degree_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "deg_", "=_", "G_", "._", "degree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "deg_", "=_", "min_", "(_", "deg_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "next_", "(_", "n_", "for_", "n_", ",_", "d_", "in_", "deg_", "._", "items_", "(_", ")_", "if_", "d_", "==_", "min", "\\u", "deg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "cut_", "=_", "G_", "._", "edges_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "domina", "ting", " ", "set", " ", "is", " ", "\\\\", "lambda", "-", "cover", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "a", " ", "domina", "ting", " ", "set", " ", "with", " ", "at", " ", "leas", "t", " ", "two", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", "in_", "G_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "D_", "=_", "domina", "ting", "\\u", "set_", "(_", "G_", ",_", "start", "\\u", "with_", "=_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "D_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "D_", ":_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "complete", " ", "graph", "s", " ", "the", " ", "domina", "ting", " ", "set", " ", "will", " ", "alw", "ay", "s", " ", "be", " ", "of", " ", "one", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thu", "s", " ", "we", " ", "return", " ", "min", "\\u", "cut", ",", " ", "whi", "ch", " ", "now", " ", "contain", "s", " ", "the", " ", "edge", "s", " ", "of", " ", "a", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "minim", "um", " ", "degree_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "min", "\\u", "cut_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "w_", "in_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "\\u", "cut_", "=_", "minim", "um", "\\u", "st", "\\u", "edge", "\\u", "cut_", "(_", "H_", ",_", "v_", ",_", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "this", "\\u", "cut_", ")_", "<=_", "len_", "(_", "min", "\\u", "cut_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "cut_", "=_", "this", "\\u", "cut_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "min", "\\u", "cut_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 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 ]
Module is imported with 'import' and 'import from'
sympy/sympy/sympy/printing/preview.py
[ { "content": "from __future__ import print_function, division\n\nfrom os.path import join\nimport tempfile\nimport shutil\nimport io\nfrom io import BytesIO\n\ntry:\n from subprocess import STDOUT, CalledProcessError, check_output\nexcept ImportError:\n pass\n\nfrom sympy.core.compatibility import unicode, u_decode\n\nfrom sympy.utilities.exceptions import SymPyDeprecationWarning\nfrom sympy.utilities.misc import find_executable\nfrom .latex import latex\n\nfrom sympy.utilities.decorator import doctest_depends_on\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import io", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "subprocess_", "import_", "STDOUT_", ",_", "Call", "ed", "Process", "Error_", ",_", "check", "\\u", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "sympy_", "._", "core_", "._", "compatibility", "_", "import_", "unicode_", ",_", "u\\u", "decode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sympy_", "._", "utilities_", "._", "exceptions_", "import_", "Sym", "Py", "Dep", "reca", "tion", "Warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "utilities_", "._", "misc_", "import_", "find", "\\u", "executable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "latex_", "import_", "latex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sympy_", "._", "utilities_", "._", "decorator_", "import_", "docte", "st", "\\u", "depend", "s", "\\u", "on_", "\\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_" ]
[ 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
adampresley/sublime-view-in-browser/ViewInBrowserCommand.py
[ { "content": "#\n# History:\n#\n# \t\t03/11/2016:\n# \t\t\t- Fix issue where parenthesis in paths would cause a failure to load. Solves #52\n#\n# \t\t10/06/2014:\n# \t\t\t- Rewrite for version 2.0.0\n# \t\t\t- Using subprocess instead of webbrowser. Seems to solve #19\n# \t\t\t- Smaller, simplier sublime-settings file\n#\n# \t\t05/15/2014:\n# \t\t\t- Current view only saves if there are modifications\n#\n# \t\t07/03/2013:\n# \t\t\t- Changes to support Sublime Text 3 and Python 3\n#\n# \t\t06/15/2013:\n# \t\t\t- Forward slashes in paths on Windows are now converted prior to opening using local server path\n#\n# \t\t03/07/2013:\n# \t\t\t- Changed loading of settings so that getting shell folders for Windows is only called on a Windows platform\n#\n# \t\t01/30/2013:\n# \t\t\t- Changed to use the sublime-setting tiered loading scheme. This allow users to override\n# \t\t\t settings in their own user file in the User directory\n#\n# \t\t11/01/2012:\n# \t\t\t- Altered command to open Safari on Mac\n# \t\t\t- When invoked the current view is auto-saved\n#\n# \t\t10/25/2012:\n# \t\t\t- New settings.json file to map browser/commands to OSes\n# \t\t\t- Plugin will use the specified browser to open files, or default to OS default when browser is unsupported\n# \t\t\t- Addressed encoding issue when calling open_new_tab\n# \t\t\t- Added ability to specify and respect local server config per project\n#\n# \t\t05/21/2012:\n# \t\t\t- Temp file only created if view is unsaved\n#\n# \t\t05/18/2012:\n# \t\t\t- Initial code\n#\nimport os\nimport sys\nimport re\nimport json\nimport urllib\nimport sublime\nimport tempfile\nimport subprocess\nimport sublime_plugin\nimport webbrowser\n\nPLUGIN_VERSION = \"2.0.0\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ViewInBrowserCommand(sublime_plugin.TextCommand):\n\t_pythonVersion = sys.version_info[0]\n\n\t#\n\t# Takes a Windows variable, such as %APPDATA% and get the\n\t# proper path.\n\t#\n\n\t#\n\t# Returns the correct base command.\n\t#\n\n\t#\n\t# Return the name of the running operating system.\n\t# i.e. darwin, nt, linux\n\t#\n\n\t#\n\t# Get the current running platform. i.e.\n\t# posix, win32\n\t#\n\n\t#\n\t# Thanks to the Python for Windows site for this snippet.\n\t# http://win32com.goermezer.de/content/view/221/285/\n\t#\n\n\n\n\n\n\n", "metadata": "root.ViewInBrowserCommand", "header": "['module', '___EOS___']", "index": 56 }, { "content": "\tdef expandWindowsUserShellFolder(self, command):\n\t\tbrowserCommand = \"\"\n\n\t\twindowsFolders = self.getWindowsUserShellFolders()\n\t\tspecialFolder = re.sub(r\"%([A-Za-z\\s]+)%.*\", \"\\\\1\", command)\n\n\t\tif specialFolder != command:\n\t\t\texpandedFolder = windowsFolders[specialFolder].replace(\"\\\\\", \"\\\\\\\\\")\n\t\t\tbrowserCommand = re.sub(r\"%[A-Za-z\\s]+%(.*)\", \"%s\\\\1\" % expandedFolder, command)\n\t\telse:\n\t\t\tbrowserCommand = command\n\n\t\treturn browserCommand.encode(\"ascii\", \"ignore\") if self._pythonVersion < 3 else browserCommand", "metadata": "root.ViewInBrowserCommand.expandWindowsUserShellFolder", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 63 }, { "content": "\tdef getBaseCommand(self, command, osName):\n\t\tbaseCommand = command\n\n\t\tif osName == \"nt\":\n\t\t\tbaseCommand = self.expandWindowsUserShellFolder(baseCommand)\n\n\t\treturn baseCommand", "metadata": "root.ViewInBrowserCommand.getBaseCommand", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 80 }, { "content": "\tdef getOsName(self):\n\t\treturn os.name", "metadata": "root.ViewInBrowserCommand.getOsName", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 92 }, { "content": "\tdef getPlatform(self):\n\t\treturn sys.platform", "metadata": "root.ViewInBrowserCommand.getPlatform", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 99 }, { "content": "\tdef getWindowsUserShellFolders(self):\n\t\t# Routine to grab all the Windows Shell Folder locations from the registry. If successful, returns dictionary\n\t\t# of shell folder locations indexed on Windows keyword for each; otherwise, returns an empty dictionary.\n\t\tif self._pythonVersion < 3:\n\t\t\timport _winreg\n\t\telse:\n\t\t\timport winreg as _winreg\n\n\t\treturn_dict = {}\n\n\t\t# First open the registry hive\n\t\ttry:\n\t\t\tHive = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)\n\t\texcept WindowsError:\n\t\t\tprint(\"Can't connect to registry hive HKEY_CURRENT_USER.\")\n\t\t\treturn return_dict\n\n\t\t# Then open the registry key where Windows stores the Shell Folder locations\n\t\ttry:\n\t\t\tKey = _winreg.OpenKey(Hive, \"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\")\n\t\texcept WindowsError:\n\t\t\tprint(\"Can't open registry key Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders.\")\n\t\t\t_winreg.CloseKey(Hive)\n\t\t\treturn return_dict\n\n\t\t# Nothing failed above, so enumerate through all the Shell Folder values and return in a dictionary\n\t\t# This relies on error at end of\n\t\ttry:\n\t\t\tfor i in range(0, _winreg.QueryInfoKey(Key)[1]):\n\t\t\t\tname, value, val_type = _winreg.EnumValue(Key, i)\n\t\t\t\treturn_dict[name] = value.encode(\"ascii\")\n\t\t\t\ti += 1\n\t\t\t_winreg.CloseKey(Key) # Only use with for loop\n\t\t\t_winreg.CloseKey(Hive) # Only use with for loop\n\t\t\treturn return_dict # Only use with for loop\n\n\t\texcept WindowsError:\n\t\t\t# In case of failure before read completed, don't return partial results\n\t\t\t_winreg.CloseKey(Key)\n\t\t\t_winreg.CloseKey(Hive)\n\t\t\treturn {}", "metadata": "root.ViewInBrowserCommand.getWindowsUserShellFolders", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 106 }, { "content": "\tdef giveFileAProjectPath(self, fileToOpen, basePath, baseUrl):\n\t\treturn re.sub(r\"\\\\\", \"/\", fileToOpen.replace(basePath, baseUrl)).replace(\" \", \"%20\").replace(\"(\", \"%28\").replace(\")\", \"%29\")", "metadata": "root.ViewInBrowserCommand.giveFileAProjectPath", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 148 }, { "content": "\tdef loadPluginSettings(self, defaultBrowser):\n\t\tresult = {\n\t\t\t\"browser\": \"\",\n\t\t\t\"baseCommand\": \"\"\n\t\t}\n\n\t\t#\n\t\t# Load default/user settings. The browser choice may\n\t\t# be overridden by custom commands.\n\t\t#\n\t\tsettings = sublime.load_settings(\"View In Browser.sublime-settings\")\n\n\t\tif not defaultBrowser:\n\t\t\tresult[\"browser\"] = settings.get(\"browser\")\n\t\telse:\n\t\t\tresult[\"browser\"] = defaultBrowser\n\n\t\t#\n\t\t# Get the correct command based on platform and OS\n\t\t#\n\t\tosName = self.getOsName()\n\t\tplatform = self.getPlatform()\n\n\t\tselectedOs = settings.get(osName)\n\t\tresult[\"baseCommand\"] = self.getBaseCommand(selectedOs[platform][result[\"browser\"]], osName)\n\n\t\treturn result", "metadata": "root.ViewInBrowserCommand.loadPluginSettings", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 151 }, { "content": "\tdef loadProjectSettings(self, view):\n\t\treturn view.settings().get(\"sublime-view-in-browser\")", "metadata": "root.ViewInBrowserCommand.loadProjectSettings", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 179 }, { "content": "\tdef normalizePath(self, fileToOpen):\n\t\tfileToOpen = fileToOpen.replace(\"\\\\\", \"/\")\n\t\tfileToOpen = \"file:///%s\" % fileToOpen.replace(\" \", \"%20\").replace(\"(\", \"%28\").replace(\")\", \"%29\")\n\n\t\treturn fileToOpen", "metadata": "root.ViewInBrowserCommand.normalizePath", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 182 }, { "content": "\tdef openBrowser(self, command, osName):\n\t\tuseShell = False if osName != \"posix\" else True\n\t\tsubprocess.Popen(command, shell=useShell)", "metadata": "root.ViewInBrowserCommand.openBrowser", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 188 }, { "content": "\tdef run(self, edit, browser=None):\n\t\tprint(\"View In Browser plugin v{0}, Python {1}\".format(PLUGIN_VERSION, self._pythonVersion))\n\n\t\t#\n\t\t# Load plugin settings and project settings, if any. A project settings may\n\t\t# affect the file to open based on local server\n\t\t# environment settings.\n\t\t#\n\t\tpluginSettings = self.loadPluginSettings(browser)\n\t\tprojectSettings = self.loadProjectSettings(self.view)\n\n\t\tfileToOpen = self.view.file_name()\n\n\t\t#\n\t\t# If we've specified settings for a local server environment\n\t\t# use them\n\t\t#\n\t\tif projectSettings:\n\t\t\tfileToOpen = self.giveFileAProjectPath(fileToOpen, projectSettings[\"basePath\"], projectSettings[\"baseUrl\"])\n\n\t\t#\n\t\t# If the current view has not been saved, put it into\n\t\t# a temp file and open that instead. If the view\n\t\t# DOES have a name make sure it is save before\n\t\t# opening.\n\t\t#\n\t\tif fileToOpen == None:\n\t\t\tfileToOpen = self.normalizePath(self.saveCurrentViewInTempFile(self.view))\n\n\t\telse:\n\t\t\tif self.view.is_dirty():\n\t\t\t\tprint(\"File %s is dirty. Saving...\" % (fileToOpen,))\n\t\t\t\tself.view.window().run_command(\"save\")\n\n\t\t\tif not projectSettings:\n\t\t\t\tfileToOpen = self.normalizePath(fileToOpen)\n\n\t\t#\n\t\t# And open. If the settings file contains a valid selected browser use that\n\t\t# command to open this file. Otherwise use the system default.\n\t\t#\n\t\tif pluginSettings[\"baseCommand\"]:\n\t\t\tcommand = \"%s %s\" % (pluginSettings[\"baseCommand\"], fileToOpen.decode().encode(sys.getfilesystemencoding()) if self._pythonVersion < 3 else fileToOpen,)\n\n\t\t\tprint(command)\n\t\t\tself.openBrowser(command, self.getOsName())\n\n\t\telse:\n\t\t\tif self._pythonVersion < 3:\n\t\t\t\twebbrowser.open_new_tab(fileToOpen.encode(sys.getfilesystemencoding()))\n\t\t\telse:\n\t\t\t\twebbrowser.open_new_tab(fileToOpen)", "metadata": "root.ViewInBrowserCommand.run", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 192 }, { "content": "\tdef saveCurrentViewInTempFile(self, view):\n\t\t#\n\t\t# Create a temporary file to hold our contents\n\t\t#\n\t\ttempFile = tempfile.NamedTemporaryFile(suffix = \".htm\", delete = False)\n\n\t\t#\n\t\t# Get the contents of the current view\n\t\t#\n\t\tregion = sublime.Region(0, view.size())\n\t\ttext = view.substr(region)\n\n\t\ttempFile.write(text.encode(\"utf-8\"))\n\t\ttempFile.close()\n\n\t\treturn tempFile.name", "metadata": "root.ViewInBrowserCommand.saveCurrentViewInTempFile", "header": "['class', 'ViewInBrowserCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 245 } ]
[ { "span": "import json", "start_line": 46, "start_column": 0, "end_line": 46, "end_column": 11 }, { "span": "import urllib", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hist", "ory", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "03", "/", "11", "/", "2016", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Fix", " ", "issue", " ", "where", " ", "parenthes", "is", " ", "in", " ", "path", "s", " ", "wou", "ld", " ", "caus", "e", " ", "a", " ", "fail", "ure", " ", "to", " ", "load", ".", " ", "Solve", "s", " ", "#", "52_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "10", "/", "0", "6", "/", "2014", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Rewrite", " ", "for", " ", "version", " ", "2.0", ".0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Us", "ing", " ", "subproc", "ess", " ", "inst", "ead", " ", "of", " ", "web", "browse", "r", ".", " ", "See", "ms", " ", "to", " ", "solve", " ", "#", "19_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Small", "er", ",", " ", "simpli", "er", " ", "sublim", "e-", "settings", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "05", "/", "15", "/", "2014", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Curr", "ent", " ", "view", " ", "only", " ", "save", "s", " ", "if", " ", "there", " ", "are", " ", "modification", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "0", "7", "/", "03", "/", "2013", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Change", "s", " ", "to", " ", "support", " ", "Sub", "lim", "e", " ", "Text", " ", "3", " ", "and", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "0", "6", "/", "15", "/", "2013", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Forward", " ", "slash", "es", " ", "in", " ", "path", "s", " ", "on", " ", "Window", "s", " ", "are", " ", "now", " ", "convert", "ed", " ", "prior", " ", "to", " ", "opening", " ", "usi", "ng", " ", "local", " ", "server", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "03", "/", "0", "7", "/", "2013", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Change", "d", " ", "load", "ing", " ", "of", " ", "settings", " ", "so", " ", "tha", "t", " ", "getti", "ng", " ", "shell", " ", "folder", "s", " ", "for", " ", "Window", "s", " ", "is", " ", "only", " ", "call", "ed", " ", "on", " ", "a", " ", "Window", "s", " ", "platform_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "01", "/", "30", "/", "2013", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Change", "d", " ", "to", " ", "use", " ", "the", " ", "sublim", "e-", "setti", "ng", " ", "tier", "ed", " ", "load", "ing", " ", "sche", "me", ".", " ", "Thi", "s", " ", "allow", " ", "users", " ", "to", " ", "override_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", " ", " ", "settings", " ", "in", " ", "thei", "r", " ", "own", " ", "user", " ", "file", " ", "in", " ", "the", " ", "User", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "11", "/", "01", "/", "2012", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Alter", "ed", " ", "command", " ", "to", " ", "open", " ", "Saf", "ari", " ", "on", " ", "Mac", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Whe", "n", " ", "invoke", "d", " ", "the", " ", "current", " ", "view", " ", "is", " ", "auto", "-", "saved_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "10", "/", "25", "/", "2012", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "New", " ", "settings", ".", "json", " ", "file", " ", "to", " ", "map", " ", "browse", "r", "/", "command", "s", " ", "to", " ", "OS", "es_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Plug", "in", " ", "will", " ", "use", " ", "the", " ", "specified", " ", "browse", "r", " ", "to", " ", "open", " ", "files", ",", " ", "or", " ", "default", " ", "to", " ", "OS", " ", "default", " ", "whe", "n", " ", "browse", "r", " ", "is", " ", "unsup", "porte", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Address", "ed", " ", "encoding", " ", "issue", " ", "whe", "n", " ", "calling", " ", "open", "\\u", "new", "\\u", "tab_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Added", " ", "abilit", "y", " ", "to", " ", "speci", "fy", " ", "and", " ", "respec", "t", " ", "local", " ", "server", " ", "config", " ", "per", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "05", "/", "21", "/", "2012", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Temp", " ", "file", " ", "only", " ", "created", " ", "if", " ", "view", " ", "is", " ", "unsa", "ved", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "05", "/", "1", "8", "/", "2012", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "-", " ", "Initial", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sublime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sublim", "e\\u", "plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webbrowser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PLUGIN", "\\u", "VERSION_", "=_", "\"", "2.0", ".0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\\u", "python", "Version_", "=_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tak", "es", " ", "a", " ", "Window", "s", " ", "variab", "le", ",", " ", "suc", "h", " ", "as", " ", "%", "APP", "DATA", "%", " ", "and", " ", "get", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "proper", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", "s", " ", "the", " ", "correct", " ", "base", " ", "command", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "the", " ", "name", " ", "of", " ", "the", " ", "runn", "ing", " ", "operati", "ng", " ", "system", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "i", ".", "e", ".", " ", "dar", "win", ",", " ", "nt", ",", " ", "linux_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "current", " ", "runn", "ing", " ", "platform", ".", " ", "i", ".", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "posix", ",", " ", "win32", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thanks", " ", "to", " ", "the", " ", "Pyth", "on", " ", "for", " ", "Window", "s", " ", "site", " ", "for", " ", "this", " ", "snippet", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "win32", "com", ".", "go", "erm", "ez", "er", ".", "de", "/", "content", "/", "view", "/", "221", "/", "285", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "expand", "Window", "s", "User", "Shel", "l", "Folder_", "(_", "self_", ",_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "browse", "r", "Command_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "windows", "Folders", "_", "=_", "self_", "._", "get", "Window", "s", "User", "Shel", "l", "Folders", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "special", "Folder_", "=_", "re_", "._", "sub_", "(_", "r", "\"%", "([", "A", "-", "Za", "-", "z", "\\\\", "s", "]+)", "%", ".*\"_", ",_", "\"\\\\\\\\", "1", "\"_", ",_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "special", "Folder_", "!=_", "command_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "expand", "ed", "Folder_", "=_", "windows", "Folders", "_", "[_", "special", "Folder_", "]_", "._", "replace_", "(_", "\"\\\\\\\\\"_", ",_", "\"\\\\\\\\\\\\", "\\\\\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "browse", "r", "Command_", "=_", "re_", "._", "sub_", "(_", "r", "\"%", "[", "A", "-", "Za", "-", "z", "\\\\", "s", "]+", "%", "(.*)", "\"_", ",_", "\"%", "s", "\\\\\\\\", "1", "\"_", "%_", "expand", "ed", "Folder_", ",_", "command_", ")_", "\\u\\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_", "browse", "r", "Command_", "=_", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "browse", "r", "Command_", "._", "encode_", "(_", "\"", "ascii", "\"_", ",_", "\"", "ignore", "\"_", ")_", "if_", "self_", "._", "\\u", "python", "Version_", "<_", "3_", "else_", "browse", "r", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Base", "Command_", "(_", "self_", ",_", "command_", ",_", "os", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "base", "Command_", "=_", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os", "Name_", "==_", "\"", "nt", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "base", "Command_", "=_", "self_", "._", "expand", "Window", "s", "User", "Shel", "l", "Folder_", "(_", "base", "Command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "base", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Os", "Name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "os_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Platform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "sys_", "._", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Window", "s", "User", "Shel", "l", "Folders", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Routine", " ", "to", " ", "gra", "b", " ", "all", " ", "the", " ", "Window", "s", " ", "Shel", "l", " ", "Fold", "er", " ", "location", "s", " ", "from", " ", "the", " ", "registr", "y", ".", " ", " ", "If", " ", "success", "ful", ",", " ", "return", "s", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "shell", " ", "folder", " ", "location", "s", " ", "indexe", "d", " ", "on", " ", "Window", "s", " ", "keyw", "ord", " ", "for", " ", "each", ";", " ", "other", "wis", "e", ",", " ", "return", "s", " ", "an", " ", "empty", " ", "dictionar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "self_", "._", "\\u", "python", "Version_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "import_", "\\u", "winreg_", "\\u\\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_", "import_", "winreg_", "as_", "\\u", "winreg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "open", " ", "the", " ", "registr", "y", " ", "hive", "_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "Hi", "ve_", "=_", "\\u", "winreg_", "._", "Connect", "Registry_", "(_", "None_", ",_", "\\u", "winreg_", "._", "HKEY", "\\u", "CURREN", "T", "\\u", "USER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Window", "s", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "(_", "\"", "Can", "'", "t", " ", "connect", " ", "to", " ", "registr", "y", " ", "hive", " ", "HKEY", "\\u", "CURREN", "T", "\\u", "USER", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "return", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "n", " ", "open", " ", "the", " ", "registr", "y", " ", "key", " ", "where", " ", "Window", "s", " ", "store", "s", " ", "the", " ", "Shel", "l", " ", "Fold", "er", " ", "locations_", "\\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\t", "\t\t_", "Key_", "=_", "\\u", "winreg_", "._", "Open", "Key_", "(_", "Hi", "ve_", ",_", "\"", "Sof", "twa", "re", "\\\\", "Micro", "soft", "\\\\", "Window", "s", "\\\\", "Curr", "ent", "Version", "\\\\", "Explorer", "\\\\", "Shel", "l", " ", "Folders", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Window", "s", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "(_", "\"", "Can", "'", "t", " ", "open", " ", "registr", "y", " ", "key", " ", "Sof", "twa", "re", "\\\\", "Micro", "soft", "\\\\", "Window", "s", "\\\\", "Curr", "ent", "Version", "\\\\", "Explorer", "\\\\", "Shel", "l", " ", "Folders", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "winreg_", "._", "Clos", "e", "Key_", "(_", "Hi", "ve_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "return", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "hing", " ", "fail", "ed", " ", "above", ",", " ", "so", " ", "enumerate", " ", "through", " ", "all", " ", "the", " ", "Shel", "l", " ", "Fold", "er", " ", "values", " ", "and", " ", "return", " ", "in", " ", "a", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "relie", "s", " ", "on", " ", "error", " ", "at", " ", "end", " ", "of_", "\\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\t", "\t\t_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "\\u", "winreg_", "._", "Query", "Info", "Key_", "(_", "Key_", ")_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "name_", ",_", "value_", ",_", "val", "\\u", "type_", "=_", "\\u", "winreg_", "._", "Enum", "Value_", "(_", "Key_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "dict_", "[_", "name_", "]_", "=_", "value_", "._", "encode_", "(_", "\"", "ascii", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "winreg_", "._", "Clos", "e", "Key_", "(_", "Key_", ")_", "#", " ", "On", "ly", " ", "use", " ", "with", " ", "for", " ", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "winreg_", "._", "Clos", "e", "Key_", "(_", "Hi", "ve_", ")_", "#", " ", "On", "ly", " ", "use", " ", "with", " ", "for", " ", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "return", "\\u", "dict_", "#", " ", "On", "ly", " ", "use", " ", "with", " ", "for", " ", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Window", "s", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "case", " ", "of", " ", "fail", "ure", " ", "bef", "ore", " ", "read", " ", "complete", "d", ",", " ", "don", "'", "t", " ", "return", " ", "partial", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "\\u", "winreg_", "._", "Clos", "e", "Key_", "(_", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "winreg_", "._", "Clos", "e", "Key_", "(_", "Hi", "ve_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\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_", "give", "File", "AP", "roj", "ect", "Path_", "(_", "self_", ",_", "file", "To", "Open_", ",_", "base", "Path_", ",_", "base", "Url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "re_", "._", "sub_", "(_", "r", "\"\\\\\\\\\"_", ",_", "\"/\"_", ",_", "file", "To", "Open_", "._", "replace_", "(_", "base", "Path_", ",_", "base", "Url_", ")_", ")_", "._", "replace_", "(_", "\"", " ", "\"_", ",_", "\"%", "20", "\"_", ")_", "._", "replace_", "(_", "\"(\"_", ",_", "\"%", "2", "8", "\"_", ")_", "._", "replace_", "(_", "\")\"_", ",_", "\"%", "2", "9", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Plug", "in", "Settings_", "(_", "self_", ",_", "default", "Browser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "browse", "r", "\"_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "base", "Command", "\"_", ":_", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "default", "/", "user", " ", "settings", ".", " ", "The", " ", "browse", "r", " ", "choice", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "overrid", "den", " ", "by", " ", "custom", " ", "command", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "=_", "sublime_", "._", "load", "\\u", "settings_", "(_", "\"", "View", " ", "In", " ", "Brows", "er", ".", "sublim", "e-", "settings", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "default", "Browser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "result_", "[_", "\"", "browse", "r", "\"_", "]_", "=_", "settings_", "._", "get_", "(_", "\"", "browse", "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\t", "\t\t_", "result_", "[_", "\"", "browse", "r", "\"_", "]_", "=_", "default", "Browser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "correct", " ", "command", " ", "based", " ", "on", " ", "platform", " ", "and", " ", "OS_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os", "Name_", "=_", "self_", "._", "get", "Os", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "platform_", "=_", "self_", "._", "get", "Platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "selecte", "d", "Os", "_", "=_", "settings_", "._", "get_", "(_", "os", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "\"", "base", "Command", "\"_", "]_", "=_", "self_", "._", "get", "Base", "Command_", "(_", "selecte", "d", "Os", "_", "[_", "platform_", "]_", "[_", "result_", "[_", "\"", "browse", "r", "\"_", "]_", "]_", ",_", "os", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Project", "Settings_", "(_", "self_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "view_", "._", "settings_", "(_", ")_", "._", "get_", "(_", "\"", "sublim", "e-", "view", "-", "in", "-", "browse", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "normali", "ze", "Path_", "(_", "self_", ",_", "file", "To", "Open_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "file", "To", "Open_", "=_", "file", "To", "Open_", "._", "replace_", "(_", "\"\\\\\\\\\"_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "To", "Open_", "=_", "\"", "file", ":///", "%", "s", "\"_", "%_", "file", "To", "Open_", "._", "replace_", "(_", "\"", " ", "\"_", ",_", "\"%", "20", "\"_", ")_", "._", "replace_", "(_", "\"(\"_", ",_", "\"%", "2", "8", "\"_", ")_", "._", "replace_", "(_", "\")\"_", ",_", "\"%", "2", "9", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "file", "To", "Open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "Browser_", "(_", "self_", ",_", "command_", ",_", "os", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "use", "Shell_", "=_", "False_", "if_", "os", "Name_", "!=_", "\"", "posix", "\"_", "else_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "Popen_", "(_", "command_", ",_", "shell_", "=_", "use", "Shell_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "edit_", ",_", "browser_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "(_", "\"", "View", " ", "In", " ", "Brows", "er", " ", "plugin", " ", "v", "{", "0", "},", " ", "Pyth", "on", " ", "{", "1", "}\"_", "._", "format_", "(_", "PLUGIN", "\\u", "VERSION_", ",_", "self_", "._", "\\u", "python", "Version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "plugin", " ", "settings", " ", "and", " ", "project", " ", "settings", ",", " ", "if", " ", "any", ".", " ", "A", " ", "project", " ", "settings", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "affect", " ", "the", " ", "file", " ", "to", " ", "open", " ", "based", " ", "on", " ", "local", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "environ", "ment", " ", "settings", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "Settings_", "=_", "self_", "._", "load", "Plug", "in", "Settings_", "(_", "browser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "Settings_", "=_", "self_", "._", "load", "Project", "Settings_", "(_", "self_", "._", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "To", "Open_", "=_", "self_", "._", "view_", "._", "file", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", "'", "ve", " ", "specified", " ", "settings", " ", "for", " ", "a", " ", "local", " ", "server", " ", "environment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "project", "Settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "file", "To", "Open_", "=_", "self_", "._", "give", "File", "AP", "roj", "ect", "Path_", "(_", "file", "To", "Open_", ",_", "project", "Settings_", "[_", "\"", "base", "Path", "\"_", "]_", ",_", "project", "Settings_", "[_", "\"", "base", "Ur", "l", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "current", " ", "view", " ", "has", " ", "not", " ", "bee", "n", " ", "saved", ",", " ", "put", " ", "it", " ", "into_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "temp", " ", "file", " ", "and", " ", "open", " ", "tha", "t", " ", "inst", "ead", ".", " ", "If", " ", "the", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DO", "ES", " ", "have", " ", "a", " ", "name", " ", "make", " ", "sure", " ", "it", " ", "is", " ", "save", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "opening", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "file", "To", "Open_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "file", "To", "Open_", "=_", "self_", "._", "normali", "ze", "Path_", "(_", "self_", "._", "save", "Curr", "ent", "View", "In", "Temp", "File_", "(_", "self_", "._", "view_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "self_", "._", "view_", "._", "is", "\\u", "dirty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "print_", "(_", "\"", "File", " ", "%", "s", " ", "is", " ", "dir", "ty", ".", " ", "Sav", "ing", "...\"_", "%_", "(_", "file", "To", "Open_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "window_", "(_", ")_", "._", "run", "\\u", "command_", "(_", "\"", "save", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "project", "Settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "file", "To", "Open_", "=_", "self_", "._", "normali", "ze", "Path_", "(_", "file", "To", "Open_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "open", ".", " ", "If", " ", "the", " ", "settings", " ", "file", " ", "contain", "s", " ", "a", " ", "valid", " ", "selecte", "d", " ", "browse", "r", " ", "use", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "command", " ", "to", " ", "open", " ", "this", " ", "file", ".", " ", "Ot", "her", "wis", "e", " ", "use", " ", "the", " ", "system", " ", "default", "._", "\\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_", "plugin", "Settings_", "[_", "\"", "base", "Command", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "command_", "=_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "plugin", "Settings_", "[_", "\"", "base", "Command", "\"_", "]_", ",_", "file", "To", "Open_", "._", "decode_", "(_", ")_", "._", "encode_", "(_", "sys_", "._", "getfile", "system", "encoding_", "(_", ")_", ")_", "if_", "self_", "._", "\\u", "python", "Version_", "<_", "3_", "else_", "file", "To", "Open_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "open", "Browser_", "(_", "command_", ",_", "self_", "._", "get", "Os", "Name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "self_", "._", "\\u", "python", "Version_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "webbrowser_", "._", "open", "\\u", "new", "\\u", "tab_", "(_", "file", "To", "Open_", "._", "encode_", "(_", "sys_", "._", "getfile", "system", "encoding_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "webbrowser_", "._", "open", "\\u", "new", "\\u", "tab_", "(_", "file", "To", "Open_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "In", "Brows", "er", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\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_", "save", "Curr", "ent", "View", "In", "Temp", "File_", "(_", "self_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "temporar", "y", " ", "file", " ", "to", " ", "hold", " ", "our", " ", "contents_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "temp", "File_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", "suffix_", "=_", "\".", "ht", "m", "\"_", ",_", "delete_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "content", "s", " ", "of", " ", "the", " ", "current", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "region_", "=_", "sublime_", "._", "Region_", "(_", "0_", ",_", "view_", "._", "size_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "view_", "._", "substr_", "(_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "File_", "._", "write_", "(_", "text_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "temp", "File_", "._", "name_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
StackStorm/st2/st2common/st2common/transport/consumers.py
[ { "content": " def process(self, body, message):\n try:\n if not isinstance(body, self._handler.message_type):\n raise TypeError('Received an unexpected type \"%s\" for payload.' % type(body))\n\n self._dispatcher.dispatch(self._process_message, body)\n except:\n LOG.exception('%s failed to process message: %s', self.__class__.__name__, body)\n finally:\n # At this point we will always ack a message.\n message.ack()", "metadata": "root.QueueConsumer.process", "header": "['class', 'QueueConsumer', '(', 'ConsumerMixin', ')', ':', '___EOS___']", "index": 47 }, { "content": " def _process_message(self, body):\n try:\n self._handler.process(body)\n except:\n LOG.exception('%s failed to process message: %s', self.__class__.__name__, body)", "metadata": "root.QueueConsumer._process_message", "header": "['class', 'QueueConsumer', '(', 'ConsumerMixin', ')', ':', '___EOS___']", "index": 59 }, { "content": " def process(self, body, message):\n try:\n if not isinstance(body, self._handler.message_type):\n raise TypeError('Received an unexpected type \"%s\" for payload.' % type(body))\n response = self._handler.pre_ack_process(body)\n self._dispatcher.dispatch(self._process_message, response)\n except:\n LOG.exception('%s failed to process message: %s', self.__class__.__name__, body)\n finally:\n # At this point we will always ack a message.\n message.ack()", "metadata": "root.StagedQueueConsumer.process", "header": "['class', 'StagedQueueConsumer', '(', 'QueueConsumer', ')', ':', '___EOS___']", "index": 71 } ]
[ { "span": "except:", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 15 }, { "span": "except:", "start_line": 62, "start_column": 8, "end_line": 62, "end_column": 15 }, { "span": "except:", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Queue", "Consumer_", "(_", "Consume", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process_", "(_", "self_", ",_", "body_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "body_", ",_", "self_", "._", "\\u", "handler_", "._", "message", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Receive", "d", " ", "an", " ", "unexpected", " ", "type", " ", "\"%", "s", "\"", " ", "for", " ", "payload", ".'_", "%_", "type_", "(_", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "dispatcher_", "._", "dispatch_", "(_", "self_", "._", "\\u", "process", "\\u", "message_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "'%", "s", " ", "fail", "ed", " ", "to", " ", "process", " ", "message", ":", " ", "%", "s", "'_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "At", " ", "this", " ", "point", " ", "we", " ", "will", " ", "alw", "ay", "s", " ", "ack", " ", "a", " ", "message", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "._", "ack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Queue", "Consumer_", "(_", "Consume", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "\\u", "message_", "(_", "self_", ",_", "body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "handler_", "._", "process_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "'%", "s", " ", "fail", "ed", " ", "to", " ", "process", " ", "message", ":", " ", "%", "s", "'_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stage", "d", "Queue", "Consumer_", "(_", "Queue", "Consumer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process_", "(_", "self_", ",_", "body_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "body_", ",_", "self_", "._", "\\u", "handler_", "._", "message", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Receive", "d", " ", "an", " ", "unexpected", " ", "type", " ", "\"%", "s", "\"", " ", "for", " ", "payload", ".'_", "%_", "type_", "(_", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "handler_", "._", "pre", "\\u", "ack", "\\u", "process_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dispatcher_", "._", "dispatch_", "(_", "self_", "._", "\\u", "process", "\\u", "message_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "'%", "s", " ", "fail", "ed", " ", "to", " ", "process", " ", "message", ":", " ", "%", "s", "'_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "At", " ", "this", " ", "point", " ", "we", " ", "will", " ", "alw", "ay", "s", " ", "ack", " ", "a", " ", "message", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "._", "ack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
An assert statement has a side-effect
beetbox/beets/beets/dbcore/db.py
[ { "content": " def __exit__(self, exc_type, exc_value, traceback):\n \"\"\"Complete a transaction. This must be the most recently\n entered but not yet exited transaction. If it is the last active\n transaction, the database updates are committed.\n \"\"\"\n with self.db._tx_stack() as stack:\n assert stack.pop() is self\n empty = not stack\n if empty:\n # Ending a \"root\" transaction. End the SQLite transaction.\n self.db._connection().commit()\n self.db._db_lock.release()", "metadata": "root.Transaction.__exit__", "header": "['class', 'Transaction', '(', 'object', ')', ':', '___EOS___']", "index": 647 } ]
[ { "span": "assert stack.pop() is self", "start_line": 653, "start_column": 12, "end_line": 653, "end_column": 38 } ]
[]
1
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "class_", "Transaction_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "exit\\u\\u_", "(_", "self_", ",_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "traceback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Complete", " ", "a", " ", "transaction", ".", " ", "Thi", "s", " ", "must", " ", "be", " ", "the", " ", "most", " ", "recent", "ly", "\\", "10", ";", " ", " ", " ", " ", "enter", "ed", " ", "but", " ", "not", " ", "ye", "t", " ", "exit", "ed", " ", "transaction", ".", " ", "If", " ", "it", " ", "is", " ", "the", " ", "last", " ", "active", "\\", "10", ";", " ", " ", " ", " ", "transaction", ",", " ", "the", " ", "databa", "se", " ", "update", "s", " ", "are", " ", "committ", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "db_", "._", "\\u", "tx", "\\u", "stack_", "(_", ")_", "as_", "stack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "stack_", "._", "pop_", "(_", ")_", "is_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "empty_", "=_", "not_", "stack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Endi", "ng", " ", "a", " ", "\"", "root", "\"", " ", "transaction", ".", " ", "End", " ", "the", " ", "SQL", "ite", " ", "transaction", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "\\u", "connection_", "(_", ")_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "\\u", "db", "\\u", "lock_", "._", "release_", "(_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ask/ghettoq/setup.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport os\nimport codecs\n\ntry:\n from setuptools import setup, find_packages, Command\nexcept ImportError:\n from ez_setup import use_setuptools\n use_setuptools()\n from setuptools import setup, find_packages, Command\n\nfrom distutils.command.install_data import install_data\nfrom distutils.command.install import INSTALL_SCHEMES\nimport sys\n\nimport ghettoq\n\npackages, data_files = [], []\nroot_dir = os.path.dirname(__file__)\nif root_dir != '':\n os.chdir(root_dir)\nsrc_dir = \"ghettoq\"\n\ninstall_requires = []\n# Required for couchdb backend\nif sys.version_info < (2, 5):\n install_requires.append(\"uuid\")\n\n# We rely on a sorted dictionary implementation and use either Python's\n# built-in OrderedDict or the odict module.\nif sys.version_info < (2, 7):\n install_requires.append(\"odict\")\n\n\n\n\n\n\n\n\nfor scheme in INSTALL_SCHEMES.values():\n scheme['data'] = scheme['purelib']\n\nSKIP_EXTENSIONS = [\".pyc\", \".pyo\", \".swp\", \".swo\"]\n\n\n\n\nfor dirpath, dirnames, filenames in os.walk(src_dir):\n # Ignore dirnames that start with '.'\n for i, dirname in enumerate(dirnames):\n if dirname.startswith(\".\"):\n del dirnames[i]\n for filename in filenames:\n if filename.endswith(\".py\"):\n packages.append('.'.join(fullsplit(dirpath)))\n elif is_unwanted_file(filename):\n pass\n else:\n data_files.append([dirpath, [os.path.join(dirpath, f) for f in\n filenames]])\n\nsetup(\n name='ghettoq',\n version=ghettoq.__version__,\n description=ghettoq.__doc__,\n author=ghettoq.__author__,\n author_email=ghettoq.__contact__,\n url=ghettoq.__homepage__,\n platforms=[\"any\"],\n license='BSD',\n packages=packages,\n data_files=data_files,\n cmdclass = {\"test\": RunTests},\n zip_safe=False,\n test_suite=\"nose.collector\",\n install_requires=install_requires,\n classifiers=[\n \"Development Status :: 4 - Beta\",\n \"Operating System :: OS Independent\",\n \"Programming Language :: Python\",\n \"Intended Audience :: Developers\",\n \"Topic :: Software Development :: Libraries :: Python Modules\",\n ],\n long_description=codecs.open('README', \"r\", \"utf-8\").read(),\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def osx_install_data(install_data):\n\n def finalize_options(self):\n self.set_undefined_options(\"install\", (\"install_lib\", \"install_dir\"))\n install_data.finalize_options(self)", "metadata": "root.osx_install_data", "header": "['module', '___EOS___']", "index": 35 }, { "content": "class RunTests(Command):\n description = \"Run the django test suite from the testproj dir.\"\n\n user_options = []\n\n\n", "metadata": "root.RunTests", "header": "['module', '___EOS___']", "index": 42 }, { "content": " def initialize_options(self):\n pass", "metadata": "root.RunTests.initialize_options", "header": "['class', 'RunTests', '(', 'Command', ')', ':', '___EOS___']", "index": 47 }, { "content": " def finalize_options(self):\n pass", "metadata": "root.RunTests.finalize_options", "header": "['class', 'RunTests', '(', 'Command', ')', ':', '___EOS___']", "index": 50 }, { "content": " def run(self):\n this_dir = os.getcwd()\n testproj_dir = os.path.join(this_dir, \"testproj\")\n os.chdir(testproj_dir)\n sys.path.insert(0, testproj_dir)\n from django.core.management import execute_manager\n os.environ[\"DJANGO_SETTINGS_MODULE\"] = os.environ.get(\n \"DJANGO_SETTINGS_MODULE\", \"settings\")\n settings_file = os.environ[\"DJANGO_SETTINGS_MODULE\"]\n settings_mod = __import__(settings_file, {}, {}, [''])\n execute_manager(settings_mod, argv=[\n __file__, \"test\"])\n os.chdir(this_dir)", "metadata": "root.RunTests.run", "header": "['class', 'RunTests', '(', 'Command', ')', ':', '___EOS___']", "index": 53 }, { "content": "def fullsplit(path, result=None):\n if result is None:\n result = []\n head, tail = os.path.split(path)\n if head == '':\n return [tail] + result\n if head == path:\n return result\n return fullsplit(head, [tail] + result)", "metadata": "root.fullsplit", "header": "['module', '___EOS___']", "index": 68 }, { "content": "def is_unwanted_file(filename):\n for skip_ext in SKIP_EXTENSIONS:\n if filename.endswith(skip_ext):\n return True\n return False", "metadata": "root.is_unwanted_file", "header": "['module', '___EOS___']", "index": 85 } ]
[ { "span": "from setuptools import setup, find_packages, Command", "start_line": 6, "start_column": 4, "end_line": 6, "end_column": 56 }, { "span": "from setuptools import setup, find_packages, Command", "start_line": 10, "start_column": 4, "end_line": 10, "end_column": 56 }, { "span": "from distutils.command.install_data import install_data", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 55 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "codecs_", "\\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_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", ",_", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "ez", "\\u", "setup_", "import_", "use", "\\u", "setuptools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "setuptools_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", ",_", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "distutils_", "._", "command_", "._", "install", "\\u", "data_", "import_", "install", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "command_", "._", "install_", "import_", "INSTA", "LL", "\\u", "SCHEME", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ghe", "tto", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", ",_", "data\\u", "files_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "\\u", "dir_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "root", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src", "\\u", "dir_", "=_", "\"", "ghe", "tto", "q", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Requ", "ired", " ", "for", " ", "couchdb", " ", "backend_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "2_", ",_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install", "\\u", "requires_", "._", "append_", "(_", "\"", "uuid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "rely", " ", "on", " ", "a", " ", "sorte", "d", " ", "dictionar", "y", " ", "implementation", " ", "and", " ", "use", " ", "eit", "her", " ", "Pyth", "on", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", "-", "in", " ", "Order", "ed", "Dict", " ", "or", " ", "the", " ", "odi", "ct", " ", "module", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "2_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install", "\\u", "requires_", "._", "append_", "(_", "\"", "odi", "ct", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "scheme_", "in_", "INSTA", "LL", "\\u", "SCHEME", "S_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheme_", "[_", "'", "data", "'_", "]_", "=_", "scheme_", "[_", "'", "pure", "lib", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SKIP", "\\u", "EXTENSIONS_", "=_", "[_", "\".", "pyc", "\"_", ",_", "\".", "pyo", "\"_", ",_", "\".", "sw", "p", "\"_", ",_", "\".", "sw", "o", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "dirpath_", ",_", "dirnames_", ",_", "filenames_", "in_", "os_", "._", "walk_", "(_", "src", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "dir", "names", " ", "tha", "t", " ", "start", " ", "with", " ", "'.'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "dirname_", "in_", "enumerate_", "(_", "dirnames_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dirname_", "._", "startswith_", "(_", "\".\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "dirnames_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "filename_", "in_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "filename_", "._", "endswith_", "(_", "\".", "py", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "packages_", "._", "append_", "(_", "'.'_", "._", "join_", "(_", "fulls", "plit_", "(_", "dirpath_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "unwa", "nte", "d\\u", "file_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "files_", "._", "append_", "(_", "[_", "dirpath_", ",_", "[_", "os_", "._", "path_", "._", "join_", "(_", "dirpath_", ",_", "f_", ")_", "for_", "f_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "filenames_", "]_", "]_", ")_", "\\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_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "ghe", "tto", "q", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "ghe", "tto", "q_", "._", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "ghe", "tto", "q_", "._", "\\u\\u", "doc\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "ghe", "tto", "q_", "._", "\\u\\u", "author\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "ghe", "tto", "q_", "._", "\\u\\u", "contact", "\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "ghe", "tto", "q_", "._", "\\u\\u", "home", "page", "\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platforms_", "=_", "[_", "\"", "any", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "BS", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "packages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "files_", "=_", "data\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmdclass_", "=_", "{_", "\"", "test", "\"_", ":_", "Run", "Tests_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip", "\\u", "safe_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "suite_", "=_", "\"", "nose", ".", "collect", "or", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "install", "\\u", "requires_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "4", " ", "-", " ", "Beta", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", " ", "::", " ", "Libr", "aries", " ", "::", " ", "Pyth", "on", " ", "Modul", "es", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "codecs_", "._", "open_", "(_", "'", "READ", "ME", "'_", ",_", "\"", "r", "\"_", ",_", "\"", "utf", "-", "8", "\"_", ")_", "._", "read_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "os", "x", "\\u", "install", "\\u", "data_", "(_", "install", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "finalize", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "undefined", "\\u", "options_", "(_", "\"", "install", "\"_", ",_", "(_", "\"", "install", "\\u", "lib", "\"_", ",_", "\"", "install", "\\u", "dir", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "\\u", "data_", "._", "finalize", "\\u", "options_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Run", "Tests_", "(_", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "description_", "=_", "\"", "Run", " ", "the", " ", "django", " ", "test", " ", "suit", "e", " ", "from", " ", "the", " ", "testpro", "j", " ", "dir", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "options_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Run", "Tests_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "initialize", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "Tests_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "finalize", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "Tests_", "(_", "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 ", " _", "this", "\\u", "dir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testpro", "j", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "this", "\\u", "dir_", ",_", "\"", "testpro", "j", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "testpro", "j", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "testpro", "j", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "import_", "execute", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "\"", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "\"_", "]_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "\"_", ",_", "\"", "settings", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings", "\\u", "file_", "=_", "os_", "._", "environ_", "[_", "\"", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings", "\\u", "mod_", "=_", "\\u\\u", "import\\u\\u_", "(_", "settings", "\\u", "file_", ",_", "{_", "}_", ",_", "{_", "}_", ",_", "[_", "''_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "execute", "\\u", "manager_", "(_", "settings", "\\u", "mod_", ",_", "argv_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "file\\u\\u_", ",_", "\"", "test", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "this", "\\u", "dir_", ")_", "\\u\\u\\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_", "fulls", "plit_", "(_", "path_", ",_", "result_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "head_", ",_", "tail_", "=_", "os_", "._", "path_", "._", "split_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "head_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "tail_", "]_", "+_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "head_", "==_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fulls", "plit_", "(_", "head_", ",_", "[_", "tail_", "]_", "+_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "is", "\\u", "unwa", "nte", "d\\u", "file_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "skip", "\\u", "ext_", "in_", "SKIP", "\\u", "EXTENSIONS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "filename_", "._", "endswith_", "(_", "skip", "\\u", "ext_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uN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_shape, x2_shape, y_shape=None):\n # Setup layers sequentially\n if self._initialized:\n return\n next_shape = x1_shape\n for layer in self.layers:\n layer.setup(next_shape)\n next_shape = layer.y_shape(next_shape)\n next_shape = x2_shape\n for layer in self.layers2:\n layer.setup(next_shape)\n next_shape = layer.y_shape(next_shape)\n next_shape = self.loss.y_shape(next_shape)\n self._initialized = True", "metadata": "root.SiameseNetwork.setup", "header": "['class', 'SiameseNetwork', '(', 'Model', ',', 'CollectionMixin', ')', ':', '___EOS___']", "index": 23 } ]
[ { "span": "next_shape ", "start_line": 35, "start_column": 8, "end_line": 35, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Si", "ames", "e", "Network_", "(_", "Model_", ",_", "Collecti", "on", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "self_", ",_", "x1", "\\u", "shape_", ",_", "x2\\u", "shape_", ",_", "y", "\\u", "shape_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", "up", " ", "layer", "s", " ", "sequential", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "initialized_", ":_", "\\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_", "next", "\\u", "shape_", "=_", "x1", "\\u", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "layer_", "in_", "self_", "._", "layers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "._", "setup_", "(_", "next", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "shape_", "=_", "layer_", "._", "y", "\\u", "shape_", "(_", "next", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "next", "\\u", "shape_", "=_", "x2\\u", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "layer_", "in_", "self_", "._", "layer", "s2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "._", "setup_", "(_", "next", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "shape_", "=_", "layer_", "._", "y", "\\u", "shape_", "(_", "next", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "next", "\\u", "shape_", "=_", "self_", "._", "loss_", "._", "y", "\\u", "shape_", "(_", "next", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "initialized_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Suspicious unused loop iteration variable
rsms/smisk/tests/ipc/benchmark.py
[ { "content": "def main():\n from optparse import OptionParser\n parser = OptionParser()\n \n parser.add_option(\"-t\", \"--sync-time\", dest=\"sync_time\",\n help=\"Start benchmark at specified time, formatted HH:MM[:SS]. Disabled by default.\", \n metavar=\"TIME\", default=None)\n \n parser.add_option(\"-i\", \"--iterations\", dest=\"iterations\",\n help=\"Number of iterations to perform. Defaults to 100 000\", \n metavar=\"N\", default=100000, type='int')\n \n parser.add_option(\"-d\", \"--idle\", dest=\"idle\",\n help=\"Milliseconds to idle between operations. Defaults to 0 (disabled).\", \n metavar=\"MS\", default=0, type='int')\n \n parser.add_option(\"-r\", \"--read\",\n action=\"store_true\", dest=\"read\", default=False,\n help=\"Perform reading\")\n \n parser.add_option(\"-w\", \"--write\",\n action=\"store_true\", dest=\"write\", default=False,\n help=\"Perform writing\")\n \n parser.add_option(\"-c\", \"--cdb\",\n action=\"store_true\", dest=\"cdb\", default=False,\n help=\"Use lock-free CDB (one writer/multiple readers).\")\n \n (options, args) = parser.parse_args()\n \n if not options.read and not options.write:\n print >> sys.stderr, 'Neither --write nor --read was specified'\\\n ' -- automatically enabling both'\n options.read = True\n options.write = True\n \n store = smisk.ipc.bsddb.shared_dict()\n idle_sec = float(options.idle) / 1000.0\n \n if options.sync_time:\n timestr = time.strftime('%Y%d%m') + options.sync_time\n try:\n options.sync_time = time.strptime(timestr, '%Y%d%m%H:%M:%S')\n except ValueError:\n try:\n options.sync_time = time.strptime(timestr, '%Y%d%m%H:%M')\n except ValueError:\n raise ValueError('time does not match format: HH:MM[:SS]')\n sync_t = time.mktime(options.sync_time)\n \n if sync_t > time.time():\n print 'Waiting for time sync %s' % time.strftime('%H:%M:%S', options.sync_time)\n last_printed_second = 0\n while 1:\n t = time.time()\n if sync_t <= t:\n break\n ti = int(sync_t - t)\n if ti and ti != last_printed_second:\n last_printed_second = ti\n sys.stdout.write('%d ' % ti)\n sys.stdout.flush()\n time.sleep(0.01)\n sys.stdout.write('\\n')\n sys.stdout.flush()\n \n rw = 'write'\n if options.read and options.write:\n rw = 'write+read'\n elif options.read:\n rw = 'read'\n \n pid = os.getpid()\n time.sleep(0.1 * random.random())\n \n idle_msg = ''\n if idle_sec > 0.0:\n idle_msg = ' with a per-iteration idle time of %.0f ms' % (idle_sec * 1000.0)\n print 'Benchmarking %d iterations of %s#%d%s' % (options.iterations, rw, pid, idle_msg)\n \n if options.read and options.write:\n for x in benchmark('%s#%d' % (rw, pid), options.iterations, it_subtractor=idle_sec):\n store['pid'] = pid\n time.sleep(idle_sec)\n pid_found = store['pid']\n elif options.read:\n for x in benchmark('%s#%d' % (rw, pid), options.iterations, it_subtractor=idle_sec):\n time.sleep(idle_sec)\n pid_found = store['pid']\n else:\n for x in benchmark('%s#%d' % (rw, pid), options.iterations, it_subtractor=idle_sec):\n time.sleep(idle_sec)\n store['pid'] = pid", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 6 } ]
[ { "span": "for x in benchmark('%s#%d' % (rw, pid), options.iterations, it_subtractor=idle_sec):", "start_line": 87, "start_column": 4, "end_line": 87, "end_column": 88 }, { "span": "for x in benchmark('%s#%d' % (rw, pid), options.iterations, it_subtractor=idle_sec):", "start_line": 92, "start_column": 4, "end_line": 92, "end_column": 88 }, { "span": "for x in benchmark('%s#%d' % (rw, pid), options.iterations, it_subtractor=idle_sec):", "start_line": 96, "start_column": 4, "end_line": 96, "end_column": 88 } ]
[]
1
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "Optio", "n", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "t", "\"_", ",_", "\"--", "sync", "-", "time", "\"_", ",_", "dest_", "=_", "\"", "sync", "\\u", "time", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Start", " ", "bench", "mark", " ", "at", " ", "specified", " ", "time", ",", " ", "format", "ted", " ", "HH", ":", "MM", "[:", "SS", "].", " ", "Disa", "ble", "d", " ", "by", " ", "default", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "TIME", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "i", "\"_", ",_", "\"--", "iterati", "ons", "\"_", ",_", "dest_", "=_", "\"", "iterati", "ons", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Number", " ", "of", " ", "iterati", "ons", " ", "to", " ", "perform", ".", " ", "Default", "s", " ", "to", " ", "100", " ", "000", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "N", "\"_", ",_", "default_", "=_", "100000_", ",_", "type_", "=_", "'", "int", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "d", "\"_", ",_", "\"--", "idle", "\"_", ",_", "dest_", "=_", "\"", "idle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Milli", "second", "s", " ", "to", " ", "idle", " ", "bet", "ween", " ", "operati", "ons", ".", " ", "Default", "s", " ", "to", " ", "0", " ", "(", "disable", "d", ").\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "MS", "\"_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "'", "int", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "r", "\"_", ",_", "\"--", "read", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "dest_", "=_", "\"", "read", "\"_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Perform", " ", "readi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "w", "\"_", ",_", "\"--", "write", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "dest_", "=_", "\"", "write", "\"_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Perform", " ", "writ", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "c", "\"_", ",_", "\"--", "cdb", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "dest_", "=_", "\"", "cdb", "\"_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Us", "e", " ", "lock", "-", "free", " ", "CD", "B", " ", "(", "one", " ", "writer", "/", "multiple", " ", "reader", "s", ").\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "options_", "._", "read_", "and_", "not_", "options_", "._", "write_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "'", "Nei", "ther", " ", "--", "write", " ", "nor", " ", "--", "read", " ", "was", " ", "specified", "'_", "'", " ", "--", " ", "automati", "call", "y", " ", "ena", "blin", "g", " ", "bot", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "read_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "write_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "store_", "=_", "smi", "sk_", "._", "ipc", "_", "._", "bsd", "db_", "._", "shared", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idle", "\\u", "sec_", "=_", "float_", "(_", "options_", "._", "idle_", ")_", "/_", "1000.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "sync", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestr", "_", "=_", "time_", "._", "strftime_", "(_", "'%", "Y", "%", "d", "%", "m", "'_", ")_", "+_", "options_", "._", "sync", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "sync", "\\u", "time_", "=_", "time_", "._", "strptime_", "(_", "timestr", "_", ",_", "'%", "Y", "%", "d", "%", "m", "%", "H", ":", "%", "M", ":", "%", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "sync", "\\u", "time_", "=_", "time_", "._", "strptime_", "(_", "timestr", "_", ",_", "'%", "Y", "%", "d", "%", "m", "%", "H", ":", "%", "M", "'_", ")_", "\\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 ", " _", "raise_", "Value", "Error_", "(_", "'", "time", " ", "doe", "s", " ", "not", " ", "match", " ", "format", ":", " ", "HH", ":", "MM", "[:", "SS", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sync", "\\u", "t_", "=_", "time_", "._", "mktime_", "(_", "options_", "._", "sync", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sync", "\\u", "t_", ">_", "time_", "._", "time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Wait", "ing", " ", "for", " ", "time", " ", "sync", " ", "%", "s", "'_", "%_", "time_", "._", "strftime_", "(_", "'%", "H", ":", "%", "M", ":", "%", "S", "'_", ",_", "options_", "._", "sync", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "printed", "\\u", "second_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sync", "\\u", "t_", "<=_", "t_", ":_", "\\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_", "ti_", "=_", "int_", "(_", "sync", "\\u", "t_", "-_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ti_", "and_", "ti_", "!=_", "last", "\\u", "printed", "\\u", "second_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "printed", "\\u", "second_", "=_", "ti_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'%", "d", " ", "'_", "%_", "ti_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rw_", "=_", "'", "write", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "read_", "and_", "options_", "._", "write_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rw_", "=_", "'", "write", "+", "read", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "read_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rw_", "=_", "'", "read", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pid_", "=_", "os_", "._", "getpid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", "*_", "random_", "._", "random_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "idle", "\\u", "msg_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "idle", "\\u", "sec_", ">_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idle", "\\u", "msg_", "=_", "'", " ", "with", " ", "a", " ", "per", "-", "iterati", "on", " ", "idle", " ", "time", " ", "of", " ", "%", ".0", "f", " ", "ms", "'_", "%_", "(_", "idle", "\\u", "sec_", "*_", "1000.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Benchmark", "ing", " ", "%", "d", " ", "iterati", "ons", " ", "of", " ", "%", "s", "#", "%", "d", "%", "s", "'_", "%_", "(_", "options_", "._", "iterations_", ",_", "rw_", ",_", "pid_", ",_", "idle", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "read_", "and_", "options_", "._", "write_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "benchmark_", "(_", "'%", "s", "#", "%", "d", "'_", "%_", "(_", "rw_", ",_", "pid_", ")_", ",_", "options_", "._", "iterations_", ",_", "it", "\\u", "subtract", "or_", "=_", "idle", "\\u", "sec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "store_", "[_", "'", "pid", "'_", "]_", "=_", "pid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "idle", "\\u", "sec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pid", "\\u", "found_", "=_", "store_", "[_", "'", "pid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "read_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "benchmark_", "(_", "'%", "s", "#", "%", "d", "'_", "%_", "(_", "rw_", ",_", "pid_", ")_", ",_", "options_", "._", "iterations_", ",_", "it", "\\u", "subtract", "or_", "=_", "idle", "\\u", "sec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "idle", "\\u", "sec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pid", "\\u", "found_", "=_", "store_", "[_", "'", "pid", "'_", "]_", "\\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 ", " _", "for_", "x_", "in_", "benchmark_", "(_", "'%", "s", "#", "%", "d", "'_", "%_", "(_", "rw_", ",_", "pid_", ")_", ",_", "options_", "._", "iterations_", ",_",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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
Pylons/pylons/tests/test_webapps/filestotest/controller_sqlatest.py
[ { "content": " def i18n_index(self):\n locale_list = request.languages\n set_lang(request.languages)\n return unicode(_('basic index page'))", "metadata": "root.SampleController.i18n_index", "header": "['class', 'SampleController', '(', 'BaseController', ')', ':', '___EOS___']", "index": 47 } ]
[ { "span": "locale_list ", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sampl", "e", "Controller_", "(_", "Base", "Controller_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "i18n", "\\u", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locale", "\\u", "list_", "=_", "request_", "._", "languages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "lang_", "(_", "request_", "._", "languages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "unicode_", "(_", "\\u_", "(_", "'", "basic", " ", "index", " ", "page", "'_", ")_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
pyjs/pyjs/examples/addonsgallery/AddonsGallery.py
[ { "content": "import pyjd # dummy for pyjs\n\nfrom pyjamas.ui.Button import Button\nfrom pyjamas.ui.RootPanel import RootPanel\nfrom pyjamas.ui.HTML import HTML\nfrom pyjamas.ui.DockPanel import DockPanel\nfrom pyjamas.ui import HasAlignment\nfrom pyjamas.ui.Hyperlink import Hyperlink\nfrom pyjamas.ui.VerticalPanel import VerticalPanel\nfrom pyjamas import Window\nfrom pyjamas.ui.Sink import SinkList\nfrom pyjamas import History\nimport IntroTab\nimport TooltipTab\nimport AutoCompleteTab\nimport Canvas2DTab\nimport CanvasTab\n\n\n\n\n\n\nif __name__ == '__main__':\n pyjd.setup(\"./public/AddonsGallery.html\")\n app = AddonsGallery()\n app.onModuleLoad()\n pyjd.run()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AddonsGallery:\n\n\n\n\n", "metadata": "root.AddonsGallery", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def onHistoryChanged(self, token):\n info = self.sink_list.find(token)\n if info:\n self.show(info, False)\n else:\n self.showIntro()", "metadata": "root.AddonsGallery.onHistoryChanged", "header": "['class', 'AddonsGallery', ':', '___EOS___']", "index": 21 }, { "content": " def onModuleLoad(self):\n self.curInfo=''\n self.curSink=None\n self.description=HTML()\n self.sink_list=SinkList()\n self.panel=DockPanel()\n\n self.loadSinks()\n self.sinkContainer = DockPanel()\n self.sinkContainer.setStyleName(\"ks-Sink\")\n\n vp=VerticalPanel()\n vp.setWidth(\"100%\")\n vp.add(self.description)\n vp.add(self.sinkContainer)\n\n self.description.setStyleName(\"ks-Info\")\n\n self.panel.add(self.sink_list, DockPanel.WEST)\n self.panel.add(vp, DockPanel.CENTER)\n\n self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP)\n self.panel.setCellWidth(vp, \"100%\")\n\n History.addHistoryListener(self)\n RootPanel().add(self.panel)\n\n initToken = History.getToken()\n if len(initToken):\n self.onHistoryChanged(initToken)\n else:\n self.showIntro()", "metadata": "root.AddonsGallery.onModuleLoad", "header": "['class', 'AddonsGallery', ':', '___EOS___']", "index": 28 }, { "content": " def show(self, info, affectHistory=None):\n if info == self.curInfo: return\n self.curInfo = info\n\n if self.curSink <> None:\n self.curSink.onHide()\n self.sinkContainer.remove(self.curSink)\n\n self.curSink = info.getInstance()\n self.sink_list.setSinkSelection(info.getName())\n self.description.setHTML(info.getDescription())\n\n if (affectHistory):\n History.newItem(info.getName())\n\n self.sinkContainer.add(self.curSink, DockPanel.CENTER)\n self.sinkContainer.setCellWidth(self.curSink, \"100%\")\n self.sinkContainer.setCellHeight(self.curSink, \"100%\")\n self.sinkContainer.setCellVerticalAlignment(self.curSink, HasAlignment.ALIGN_TOP)\n self.curSink.onShow()", "metadata": "root.AddonsGallery.show", "header": "['class', 'AddonsGallery', ':', '___EOS___']", "index": 61 }, { "content": " def loadSinks(self):\n self.sink_list.add(IntroTab.init())\n self.sink_list.add(TooltipTab.init())\n self.sink_list.add(AutoCompleteTab.init())\n self.sink_list.add(Canvas2DTab.init())\n self.sink_list.add(CanvasTab.init())", "metadata": "root.AddonsGallery.loadSinks", "header": "['class', 'AddonsGallery', ':', '___EOS___']", "index": 82 }, { "content": " def showIntro(self):\n self.show(self.sink_list.find(\"Intro\"))", "metadata": "root.AddonsGallery.showIntro", "header": "['class', 'AddonsGallery', ':', '___EOS___']", "index": 89 } ]
[ { "span": "from pyjamas.ui.Button import Button", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 36 }, { "span": "from pyjamas.ui.Hyperlink import Hyperlink", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 42 }, { "span": "from pyjamas import Window", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 26 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "pyj", "d_", "#", " ", "dummy", " ", "for", " ", "pyj", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Button_", "import_", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Roo", "t", "Panel_", "import_", "Roo", "t", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "HTML_", "import_", "HTML_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Dock", "Panel_", "import_", "Dock", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "import_", "Has", "Alignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Hyperlink", "_", "import_", "Hyperlink", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Vertica", "l", "Panel_", "import_", "Vertica", "l", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "import_", "Window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Sink_", "import_", "Sin", "k", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "import_", "History_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Intro", "Tab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Tooltip", "Tab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Auto", "Complete", "Tab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Can", "vas", "2", "DT", "ab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Can", "vas", "Tab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "pyj", "d_", "._", "setup_", "(_", "\"./", "public", "/", "Add", "ons", "Gallery", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "Add", "ons", "Gallery", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "on", "Modul", "e", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyj", "d_", "._", "run_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Add", "ons", "Gallery", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Add", "ons", "Gallery", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "on", "Hist", "ory", "Changed_", "(_", "self_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "self_", "._", "sink", "\\u", "list_", "._", "find_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show_", "(_", "info_", ",_", "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 ", " _", "self_", "._", "show", "Intro", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "ons", "Gallery", "_", ":_", "\\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", "Modul", "e", "Load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cur", "Info_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cur", "Sink_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description_", "=_", "HTML_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "\\u", "list_", "=_", "Sin", "k", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "panel_", "=_", "Dock", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "load", "Sin", "ks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "Container_", "=_", "Dock", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "Container_", "._", "set", "Style", "Name_", "(_", "\"", "ks", "-", "Sin", "k", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vp_", "=_", "Vertica", "l", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vp_", "._", "set", "Width_", "(_", "\"", "100", "%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vp_", "._", "add_", "(_", "self_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vp_", "._", "add_", "(_", "self_", "._", "sink", "Container_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "description_", "._", "set", "Style", "Name_", "(_", "\"", "ks", "-", "Info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "panel_", "._", "add_", "(_", "self_", "._", "sink", "\\u", "list_", ",_", "Dock", "Panel_", "._", "WES", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "panel_", "._", "add_", "(_", "vp_", ",_", "Dock", "Panel_", "._", "CENTER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "panel_", "._", "set", "Cel", "l", "Vertica", "l", "Alignment_", "(_", "self_", "._", "sink", "\\u", "list_", ",_", "Has", "Alignment_", "._", "ALIGN", "\\u", "TOP_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "panel_", "._", "set", "Cel", "l", "Width_", "(_", "vp_", ",_", "\"", "100", "%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "History_", "._", "add", "Hist", "ory", "Listener_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Roo", "t", "Panel_", "(_", ")_", "._", "add_", "(_", "self_", "._", "panel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "init", "Token_", "=_", "History_", "._", "get", "Token_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "init", "Token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "on", "Hist", "ory", "Changed_", "(_", "init", "Token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Intro", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "ons", "Gallery", "_", ":_", "\\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_", "show_", "(_", "self_", ",_", "info_", ",_", "affect", "History_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "info_", "==_", "self_", "._", "cur", "Info_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cur", "Info_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "cur", "Sink_", "<_", ">_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cur", "Sink_", "._", "on", "Hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "Container_", "._", "remove_", "(_", "self_", "._", "cur", "Sink_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cur", "Sink_", "=_", "info_", "._", "get", "Instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "\\u", "list_", "._", "set", "Sin", "k", "Selection_", "(_", "info_", "._", "get", "Name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description_", "._", "set", "HTML_", "(_", "info_", "._", "get", "Description_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "affect", "History_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "History_", "._", "new", "Item_", "(_", "info_", "._", "get", "Name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sink", "Container_", "._", "add_", "(_", "self_", "._", "cur", "Sink_", ",_", "Dock", "Panel_", "._", "CENTER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "Container_", "._", "set", "Cel", "l", "Width_", "(_", "self_", "._", "cur", "Sink_", ",_", "\"", "100", "%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "Container_", "._", "set", "Cel", "l", "Height_", "(_", "self_", "._", "cur", "Sink_", ",_", "\"", "100", "%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "Container_", "._", "set", "Cel", "l", "Vertica", "l", "Alignment_", "(_", "self_", "._", "cur", "Sink_", ",_", "Has", "Alignment_", "._", "ALIGN", "\\u", "TOP_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cur", "Sink_", "._", "on", "Show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "ons", "Gallery", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Sin", "ks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sink", "\\u", "list_", "._", "add_", "(_", "Intro", "Tab_", "._", "init_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "\\u", "list_", "._", "add_", "(_", "Tooltip", "Tab_", "._", "init_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "\\u", "list_", "._", "add_", "(_", "Auto", "Complete", "Tab_", "._", "init_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "\\u", "list_", "._", "add_", "(_", "Can", "vas", "2", "DT", "ab_", "._", "init_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "\\u", "list_", "._", "add_", "(_", "Can", "vas", "Tab_", "._", "init_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "ons", "Gallery", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "Intro", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show_", "(_", "self_", "._", "sink", "\\u", "list_", "._", "find_", "(_", "\"", "Intro", "\"_", ")_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/reader/worksheet.py
[ { "content": "from __future__ import absolute_import\n# Copyright (c) 2010-2015 openpyxl\n\n\"\"\"Reader for a single worksheet.\"\"\"\nfrom io import BytesIO\nfrom warnings import warn\n\n# compatibility imports\nfrom openpyxl.xml.functions import iterparse\n\n# package imports\nfrom openpyxl.cell import Cell\nfrom openpyxl.cell.read_only import _cast_number\nfrom openpyxl.worksheet import Worksheet, ColumnDimension, RowDimension\nfrom openpyxl.worksheet.page import PageMargins, PrintOptions, PrintPageSetup\nfrom openpyxl.worksheet.protection import SheetProtection\nfrom openpyxl.worksheet.views import SheetView\nfrom openpyxl.worksheet.datavalidation import DataValidation\nfrom openpyxl.xml.constants import (\n SHEET_MAIN_NS,\n REL_NS,\n EXT_TYPES\n)\nfrom openpyxl.xml.functions import safe_iterator\nfrom openpyxl.styles import Color\nfrom openpyxl.formatting import ConditionalFormatting, Rule\nfrom openpyxl.formula.translate import Translator\nfrom openpyxl.worksheet.properties import WorksheetProperties\nfrom openpyxl.utils import (\n coordinate_from_string,\n get_column_letter,\n column_index_from_string,\n coordinate_to_tuple,\n )\nfrom openpyxl.descriptors.excel import ExtensionList, Extension\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _get_xml_iter(xml_source):\n \"\"\"\n Possible inputs: strings, bytes, members of zipfile, temporary file\n Always return a file like object\n \"\"\"\n if not hasattr(xml_source, 'read'):\n try:\n xml_source = xml_source.encode(\"utf-8\")\n except (AttributeError, UnicodeDecodeError):\n pass\n return BytesIO(xml_source)\n else:\n try:\n xml_source.seek(0)\n except:\n pass\n return xml_source", "metadata": "root._get_xml_iter", "header": "['module', '___EOS___']", "index": 37 }, { "content": "class WorkSheetParser(object):\n\n COL_TAG = '{%s}col' % SHEET_MAIN_NS\n ROW_TAG = '{%s}row' % SHEET_MAIN_NS\n CELL_TAG = '{%s}c' % SHEET_MAIN_NS\n VALUE_TAG = '{%s}v' % SHEET_MAIN_NS\n FORMULA_TAG = '{%s}f' % SHEET_MAIN_NS\n MERGE_TAG = '{%s}mergeCell' % SHEET_MAIN_NS\n INLINE_STRING = \"{%s}is/{%s}t\" % (SHEET_MAIN_NS, SHEET_MAIN_NS)\n INLINE_RICHTEXT = \"{%s}is/{%s}r/{%s}t\" % (SHEET_MAIN_NS, SHEET_MAIN_NS, SHEET_MAIN_NS)\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.WorkSheetParser", "header": "['module', '___EOS___']", "index": 56 }, { "content": " def __init__(self, wb, title, xml_source, shared_strings):\n self.ws = wb.create_sheet(title=title)\n self.source = xml_source\n self.shared_strings = shared_strings\n self.guess_types = wb._guess_types\n self.data_only = wb.data_only\n self.styles = self.ws.parent._cell_styles\n self.differential_styles = wb._differential_styles\n self.keep_vba = wb.vba_archive is not None\n self.shared_formula_masters = {} # {si_str: Translator()}", "metadata": "root.WorkSheetParser.__init__", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def parse(self):\n dispatcher = {\n '{%s}mergeCells' % SHEET_MAIN_NS: self.parse_merge,\n '{%s}col' % SHEET_MAIN_NS: self.parse_column_dimensions,\n '{%s}row' % SHEET_MAIN_NS: self.parse_row_dimensions,\n '{%s}printOptions' % SHEET_MAIN_NS: self.parse_print_options,\n '{%s}pageMargins' % SHEET_MAIN_NS: self.parse_margins,\n '{%s}pageSetup' % SHEET_MAIN_NS: self.parse_page_setup,\n '{%s}headerFooter' % SHEET_MAIN_NS: self.parse_header_footer,\n '{%s}conditionalFormatting' % SHEET_MAIN_NS: self.parser_conditional_formatting,\n '{%s}autoFilter' % SHEET_MAIN_NS: self.parse_auto_filter,\n '{%s}sheetProtection' % SHEET_MAIN_NS: self.parse_sheet_protection,\n '{%s}dataValidations' % SHEET_MAIN_NS: self.parse_data_validation,\n '{%s}sheetPr' % SHEET_MAIN_NS: self.parse_properties,\n '{%s}legacyDrawing' % SHEET_MAIN_NS: self.parse_legacy_drawing,\n '{%s}sheetViews' % SHEET_MAIN_NS: self.parse_sheet_views,\n '{%s}extLst' % SHEET_MAIN_NS: self.parse_extensions,\n }\n tags = dispatcher.keys()\n stream = _get_xml_iter(self.source)\n it = iterparse(stream, tag=tags)\n\n for _, element in it:\n tag_name = element.tag\n if tag_name in dispatcher:\n dispatcher[tag_name](element)\n element.clear()\n\n self.ws._current_row = self.ws.max_row", "metadata": "root.WorkSheetParser.parse", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 78 }, { "content": " def parse_cell(self, element):\n value = element.find(self.VALUE_TAG)\n if value is not None:\n value = value.text\n formula = element.find(self.FORMULA_TAG)\n data_type = element.get('t', 'n')\n coordinate = element.get('r')\n style_id = element.get('s')\n\n # assign formula to cell value unless only the data is desired\n if formula is not None and not self.data_only:\n data_type = 'f'\n if formula.text:\n value = \"=\" + formula.text\n else:\n value = \"=\"\n formula_type = formula.get('t')\n if formula_type:\n if formula_type != \"shared\":\n self.ws.formula_attributes[coordinate] = dict(formula.attrib)\n\n else:\n si = formula.get('si') # Shared group index for shared formulas\n\n # The spec (18.3.1.40) defines shared formulae in\n # terms of the following:\n #\n # `master`: \"The first formula in a group of shared\n # formulas\"\n # `ref`: \"Range of cells which the formula applies\n # to.\" It's a required attribute on the master\n # cell, forbidden otherwise.\n # `shared cell`: \"A cell is shared only when si is\n # used and t is `shared`.\"\n #\n # Whether to use the cell's given formula or the\n # master's depends on whether the cell is shared,\n # whether it's in the ref, and whether it defines its\n # own formula, as follows:\n #\n # Shared? Has formula? | In ref Not in ref\n # ========= ==============|======== ===============\n # Yes Yes | master impl. defined\n # No Yes | own own\n # Yes No | master impl. defined\n # No No | ?? N/A\n #\n # The ?? is because the spec is silent on this issue,\n # though my inference is that the cell does not\n # receive a formula at all.\n #\n # For this implementation, we are using the master\n # formula in the two \"impl. defined\" cases and no\n # formula in the \"??\" case. This choice of\n # implementation allows us to disregard the `ref`\n # parameter altogether, and does not require\n # computing expressions like `C5 in A1:D6`.\n # Presumably, Excel does not generate spreadsheets\n # with such contradictions.\n if si in self.shared_formula_masters:\n trans = self.shared_formula_masters[si]\n value = trans.translate_formula(coordinate)\n else:\n self.shared_formula_masters[si] = Translator(value, coordinate)\n\n\n style_array = None\n if style_id is not None:\n style_id = int(style_id)\n style_array = self.styles[style_id]\n\n row, column = coordinate_to_tuple(coordinate)\n cell = Cell(self.ws, row=row, col_idx=column, style_array=style_array)\n self.ws._cells[(row, column)] = cell\n\n if value is not None:\n if data_type == 'n':\n value = _cast_number(value)\n elif data_type == 'b':\n value = bool(int(value))\n elif data_type == 's':\n value = self.shared_strings[int(value)]\n elif data_type == 'str':\n data_type = 's'\n\n else:\n if data_type == 'inlineStr':\n data_type = 's'\n child = element.find(self.INLINE_STRING)\n if child is None:\n child = element.find(self.INLINE_RICHTEXT)\n if child is not None:\n value = child.text\n\n if self.guess_types or value is None:\n cell.value = value\n else:\n cell._value=value\n cell.data_type=data_type", "metadata": "root.WorkSheetParser.parse_cell", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 108 }, { "content": " def parse_merge(self, element):\n for mergeCell in safe_iterator(element, ('{%s}mergeCell' % SHEET_MAIN_NS)):\n self.ws.merge_cells(mergeCell.get('ref'))", "metadata": "root.WorkSheetParser.parse_merge", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 209 }, { "content": " def parse_column_dimensions(self, col):\n attrs = dict(col.attrib)\n column = get_column_letter(int(attrs['min']))\n attrs['index'] = column\n if 'style' in attrs:\n attrs['style'] = self.styles[int(attrs['style'])]\n dim = ColumnDimension(self.ws, **attrs)\n self.ws.column_dimensions[column] = dim", "metadata": "root.WorkSheetParser.parse_column_dimensions", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 213 }, { "content": " def parse_row_dimensions(self, row):\n attrs = dict(row.attrib)\n keys = set(attrs)\n for key in keys:\n if key == \"s\":\n attrs['s'] = self.styles[int(attrs['s'])]\n elif key.startswith('{'):\n del attrs[key]\n\n\n keys = set(attrs)\n if keys != set(['r', 'spans']) and keys != set(['r']):\n # don't create dimension objects unless they have relevant information\n dim = RowDimension(self.ws, **attrs)\n self.ws.row_dimensions[dim.index] = dim\n\n for cell in safe_iterator(row, self.CELL_TAG):\n self.parse_cell(cell)", "metadata": "root.WorkSheetParser.parse_row_dimensions", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 223 }, { "content": " def parse_print_options(self, element):\n self.ws.print_options = PrintOptions.from_tree(element)", "metadata": "root.WorkSheetParser.parse_print_options", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 243 }, { "content": " def parse_margins(self, element):\n self.page_margins = PageMargins.from_tree(element)", "metadata": "root.WorkSheetParser.parse_margins", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 246 }, { "content": " def parse_page_setup(self, element):\n self.ws.page_setup = PrintPageSetup.from_tree(element)", "metadata": "root.WorkSheetParser.parse_page_setup", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 249 }, { "content": " def parse_header_footer(self, element):\n oddHeader = element.find('{%s}oddHeader' % SHEET_MAIN_NS)\n if oddHeader is not None and oddHeader.text is not None:\n self.ws.header_footer.setHeader(oddHeader.text)\n oddFooter = element.find('{%s}oddFooter' % SHEET_MAIN_NS)\n if oddFooter is not None and oddFooter.text is not None:\n self.ws.header_footer.setFooter(oddFooter.text)", "metadata": "root.WorkSheetParser.parse_header_footer", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 252 }, { "content": " def parser_conditional_formatting(self, element):\n range_string = element.get('sqref')\n cfRules = element.findall('{%s}cfRule' % SHEET_MAIN_NS)\n self.ws.conditional_formatting.cf_rules[range_string] = []\n for node in cfRules:\n rule = Rule.from_tree(node)\n if rule.dxfId is not None:\n rule.dxf = self.differential_styles[rule.dxfId]\n self.ws.conditional_formatting.cf_rules[range_string].append(rule)", "metadata": "root.WorkSheetParser.parser_conditional_formatting", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 261 }, { "content": " def parse_auto_filter(self, element):\n self.ws.auto_filter.ref = element.get(\"ref\")\n for fc in safe_iterator(element, '{%s}filterColumn' % SHEET_MAIN_NS):\n filters = fc.find('{%s}filters' % SHEET_MAIN_NS)\n if filters is None:\n continue\n vals = [f.get(\"val\") for f in safe_iterator(filters, '{%s}filter' % SHEET_MAIN_NS)]\n blank = filters.get(\"blank\")\n self.ws.auto_filter.add_filter_column(fc.get(\"colId\"), vals, blank=blank)\n for sc in safe_iterator(element, '{%s}sortCondition' % SHEET_MAIN_NS):\n self.ws.auto_filter.add_sort_condition(sc.get(\"ref\"), sc.get(\"descending\"))", "metadata": "root.WorkSheetParser.parse_auto_filter", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 272 }, { "content": " def parse_sheet_protection(self, element):\n self.ws.protection = SheetProtection.from_tree(element)\n password = element.get(\"password\")\n if password is not None:\n self.ws.protection.set_password(password, True)", "metadata": "root.WorkSheetParser.parse_sheet_protection", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 284 }, { "content": " def parse_data_validation(self, element):\n for node in safe_iterator(element, \"{%s}dataValidation\" % SHEET_MAIN_NS):\n dv = DataValidation.from_tree(node)\n self.ws._data_validations.append(dv)", "metadata": "root.WorkSheetParser.parse_data_validation", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 290 }, { "content": " def parse_properties(self, element):\n self.ws.sheet_properties = WorksheetProperties.from_tree(element)", "metadata": "root.WorkSheetParser.parse_properties", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 296 }, { "content": " def parse_legacy_drawing(self, element):\n if self.keep_vba:\n # Create an id that will not clash with any other ids that will\n # be generated.\n self.ws.vba_controls = 'vbaControlId'", "metadata": "root.WorkSheetParser.parse_legacy_drawing", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 300 }, { "content": " def parse_sheet_views(self, element):\n for el in element.findall(\"{%s}sheetView\" % SHEET_MAIN_NS):\n # according to the specification the last view wins\n pass\n self.ws.sheet_view = SheetView.from_tree(el)", "metadata": "root.WorkSheetParser.parse_sheet_views", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 307 }, { "content": " def parse_extensions(self, element):\n extLst = ExtensionList.from_tree(element)\n for e in extLst.ext:\n ext_type = EXT_TYPES.get(e.uri.upper(), \"Unknown\")\n msg = \"{0} extension is not supported and will be removed\".format(ext_type)\n warn(msg)", "metadata": "root.WorkSheetParser.parse_extensions", "header": "['class', 'WorkSheetParser', '(', 'object', ')', ':', '___EOS___']", "index": 314 }, { "content": "def fast_parse(xml_source, parent, sheet_title, shared_strings):\n parser = WorkSheetParser(parent, sheet_title, xml_source, shared_strings)\n parser.parse()\n return parser.ws", "metadata": "root.fast_parse", "header": "['module', '___EOS___']", "index": 322 } ]
[ { "span": "from openpyxl.worksheet import Worksheet, ColumnDimension, RowDimension", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 71 }, { "span": "from openpyxl.xml.constants import (\n SHEET_MAIN_NS,\n REL_NS,\n EXT_TYPES\n)", "start_line": 18, "start_column": 0, "end_line": 22, "end_column": 1 }, { "span": "from openpyxl.styles import Color", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 33 }, { "span": "from openpyxl.formatting import ConditionalFormatting, Rule", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 59 }, { "span": "from openpyxl.utils import (\n coordinate_from_string,\n get_column_letter,\n column_index_from_string,\n coordinate_to_tuple,\n )", "start_line": 28, "start_column": 0, "end_line": 33, "end_column": 5 }, { "span": "from openpyxl.descriptors.excel import ExtensionList, Extension", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 63 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", "-", "201", "5", " ", "openp", "yx", "l_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Read", "er", " ", "for", " ", "a", " ", "single", " ", "worksheet", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "warnings_", "import_", "warn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compatibility", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "xml_", "._", "functions_", "import_", "iter", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "package", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "cell_", "import_", "Cell_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "cell_", "._", "read", "\\u", "only_", "import_", "\\u", "cast", "\\u", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "worksheet_", "import_", "Worksh", "eet", "_", ",_", "Colum", "n", "Dimension_", ",_", "Row", "Dimension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "worksheet_", "._", "page_", "import_", "Page", "Margins_", ",_", "Print", "Options_", ",_", "Print", "Page", "Setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "worksheet_", "._", "protection", "_", "import_", "She", "et", "Protect", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "worksheet_", "._", "views_", "import_", "She", "et", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "worksheet_", "._", "datav", "alid", "ation_", "import_", "Data", "Validation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "xml_", "._", "constants_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REL", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EXT", "\\u", "TYPES_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "xml_", "._", "functions_", "import_", "safe", "\\u", "iterator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "styles_", "import_", "Color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "formatting_", "import_", "Cond", "itional", "Formatt", "ing_", ",_", "Rule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "formula_", "._", "translate_", "import_", "Translator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "worksheet_", "._", "properties_", "import_", "Worksh", "eet", "Properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "utils_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "coordinate", "\\u", "from", "\\u", "string_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "column", "\\u", "letter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "column", "\\u", "index", "\\u", "from", "\\u", "string_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coordinate", "\\u", "to", "\\u", "tuple_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "descriptors_", "._", "excel_", "import_", "Ext", "ensi", "on", "List_", ",_", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u", "get", "\\u", "xml", "\\u", "iter_", "(_", "xml", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Poss", "ibl", "e", " ", "inputs", ":", " ", "string", "s", ",", " ", "bytes", ",", " ", "member", "s", " ", "of", " ", "zipfi", "le", ",", " ", "temporar", "y", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "Al", "way", "s", " ", "return", " ", "a", " ", "file", " ", "like", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "xml", "\\u", "source_", ",_", "'", "read", "'_", ")_", ":_", "\\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 ", " _", "xml", "\\u", "source_", "=_", "xml", "\\u", "source_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Attribute", "Error_", ",_", "Unic", "ode", "Decode", "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_", "Byte", "s", "IO_", "(_", "xml", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xml", "\\u", "source_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xml", "\\u", "source_", "\\u\\u\\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_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "COL", "\\u", "TAG_", "=_", "'{", "%", "s", "}", "col", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ROW", "\\u", "TAG_", "=_", "'{", "%", "s", "}", "row", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CELL", "\\u", "TAG_", "=_", "'{", "%", "s", "}", "c", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VALU", "E", "\\u", "TAG_", "=_", "'{", "%", "s", "}", "v", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FORM", "ULA", "\\u", "TAG_", "=_", "'{", "%", "s", "}", "f", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MERGE", "\\u", "TAG_", "=_", "'{", "%", "s", "}", "merge", "Cel", "l", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IN", "LINE", "\\u", "STRING_", "=_", "\"{", "%", "s", "}", "is", "/{", "%", "s", "}", "t", "\"_", "%_", "(_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ",_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IN", "LINE", "\\u", "RIC", "HT", "EXT_", "=_", "\"{", "%", "s", "}", "is", "/{", "%", "s", "}", "r", "/{", "%", "s", "}", "t", "\"_", "%_", "(_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ",_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ",_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "wb_", ",_", "title_", ",_", "xml", "\\u", "source_", ",_", "shared", "\\u", "strings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "=_", "wb_", "._", "create", "\\u", "sheet_", "(_", "title_", "=_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "xml", "\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shared", "\\u", "strings_", "=_", "shared", "\\u", "strings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "guess", "\\u", "types_", "=_", "wb_", "._", "\\u", "guess", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data\\u", "only_", "=_", "wb_", "._", "data\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "styles_", "=_", "self_", "._", "ws_", "._", "parent_", "._", "\\u", "cell", "\\u", "styles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "differential", "\\u", "styles_", "=_", "wb_", "._", "\\u", "differential", "\\u", "styles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "keep", "\\u", "vb", "a_", "=_", "wb_", "._", "vb", "a", "\\u", "archive_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shared", "\\u", "formula", "\\u", "masters_", "=_", "{_", "}_", "#", " ", "{", "si", "\\u", "str", ":", " ", "Translat", "or", "()}", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dispatcher_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "merge", "Cel", "ls", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "merge_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "col", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "column", "\\u", "dimensions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "row", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "row", "\\u", "dimensions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "print", "Optio", "ns", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "print", "\\u", "options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "page", "Marg", "ins", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "margins", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "page", "Set", "up", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "page", "\\u", "setup_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "header", "Footer", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "header", "\\u", "footer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "conditional", "Formatt", "ing", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parser", "\\u", "conditional", "\\u", "formatting_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "auto", "Filter", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "auto", "\\u", "filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "sheet", "Protect", "ion", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "sheet", "\\u", "protection", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "data", "Validat", "ion", "s", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "data\\u", "validation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "sheet", "Pr", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "properties_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "lega", "cy", "Draw", "ing", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "lega", "cy", "\\u", "drawing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "sheet", "View", "s", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "sheet", "\\u", "views_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "%", "s", "}", "ext", "Lst", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ":_", "self_", "._", "parse", "\\u", "extensions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "dispatcher_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "=_", "\\u", "get", "\\u", "xml", "\\u", "iter_", "(_", "self_", "._", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "it_", "=_", "iter", "parse_", "(_", "stream_", ",_", "tag_", "=_", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u_", ",_", "element_", "in_", "it_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag", "\\u", "name_", "=_", "element_", "._", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag", "\\u", "name_", "in_", "dispatcher_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dispatcher_", "[_", "tag", "\\u", "name_", "]_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "element_", "._", "clear_", "(_", ")_", "\\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_", "._", "ws_", "._", "\\u", "current", "\\u", "row_", "=_", "self_", "._", "ws_", "._", "max", "\\u", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "cell_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "element_", "._", "find_", "(_", "self_", "._", "VALU", "E", "\\u", "TAG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "formula_", "=_", "element_", "._", "find_", "(_", "self_", "._", "FORM", "ULA", "\\u", "TAG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "type_", "=_", "element_", "._", "get_", "(_", "'", "t", "'_", ",_", "'", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coordinate_", "=_", "element_", "._", "get_", "(_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style", "\\u", "id_", "=_", "element_", "._", "get_", "(_", "'", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assign", " ", "formula", " ", "to", " ", "cell", " ", "value", " ", "unl", "ess", " ", "only", " ", "the", " ", "data", " ", "is", " ", "desired_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "formula_", "is_", "not_", "None_", "and_", "not_", "self_", "._", "data\\u", "only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "type_", "=_", "'", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "formula_", "._", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\"=\"_", "+_", "formula_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\"=\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "formula", "\\u", "type_", "=_", "formula_", "._", "get_", "(_", "'", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "formula", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "formula", "\\u", "type_", "!=_", "\"", "shared", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "ws_", "._", "formula", "\\u", "attributes_", "[_", "coordinate_", "]_", "=_", "dict_", "(_", "formula_", "._", "attrib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "si_", "=_", "formula_", "._", "get_", "(_", "'", "si", "'_", ")_", "#", " ", "Share", "d", " ", "group", " ", "index", " ", "for", " ", "shared", " ", "formulas", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "spec", " ", "(", "18.", "3.1", ".4", "0", ")", " ", "defin", "es", " ", "shared", " ", "formula", "e", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "term", "s", " ", "of", " ", "the", " ", "follow", "ing", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`", "master", "`", ":", " ", "\"", "The", " ", "first", " ", "formula", " ", "in", " ", "a", " ", "group", " ", "of", " ", "shared_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "formulas", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`", "ref", "`", ":", " ", "\"", "Range", " ", "of", " ", "cells", " ", "whi", "ch", " ", "the", " ", "formula", " ", "appli", "es_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "to", ".\"", " ", "It", "'", "s", " ", "a", " ", "require", "d", " ", "attribute", " ", "on", " ", "the", " ", "master_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "cell", ",", " ", "forbidden", " ", "other", "wis", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`", "shared", " ", "cell", "`", ":", " ", "\"", "A", " ", "cell", " ", "is", " ", "shared", " ", "only", " ", "whe", "n", " ", "si", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "used", " ", "and", " ", "t", " ", "is", " ", "`", "shared", "`.", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "ther", " ", "to", " ", "use", " ", "the", " ", "cell", "'", "s", " ", "give", "n", " ", "formula", " ", "or", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "master", "'", "s", " ", "depend", "s", " ", "on", " ", "whe", "ther", " ", "the", " ", "cell", " ", "is", " ", "shared", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "ther", " ", "it", "'", "s", " ", "in", " ", "the", " ", "ref", ",", " ", "and", " ", "whe", "ther", " ", "it", " ", "defin", "es", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "own", " ", "formula", ",", " ", "as", " ", "follow", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Share", "d", "?", " ", " ", " ", "Has", " ", "formula", "?", " ", "|", " ", "In", " ", "ref", " ", " ", " ", " ", "Not", " ", "in", " ", "ref_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "=========", " ", "==============", "|", "=======", "=", " ", "==============", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Ye", "s", " ", " ", "Ye", "s", " ", " ", "|", " ", "master", " ", " ", " ", "impl", ".", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "No", " ", " ", "Ye", "s", " ", " ", "|", " ", " ", "own", " ", " ", " ", " ", " ", "own_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Ye", "s", " ", " ", " ", "No", " ", " ", "|", " ", "master", " ", " ", " ", "impl", ".", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "No", " ", " ", " ", "No", " ", " ", "|", " ", " ", "??", " ", " ", "N", "/", "A_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "??", " ", "is", " ", "bec", "aus", "e", " ", "the", " ", "spec", " ", "is", " ", "sile", "nt", " ", "on", " ", "this", " ", "issue", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tho", "ugh", " ", "my", " ", "infer", "ence", " ", "is", " ", "tha", "t", " ", "the", " ", "cell", " ", "doe", "s", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "receive", " ", "a", " ", "formula", " ", "at", " ", "all", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "this", " ", "implementation", ",", " ", "we", " ", "are", " ", "usi", "ng", " ", "the", " ", "master_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "formula", " ", "in", " ", "the", " ", "two", " ", "\"", "impl", ".", " ", "defin", "ed", "\"", " ", "case", "s", " ", "and", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "formula", " ", "in", " ", "the", " ", "\"?", "?\"", " ", "case", ".", " ", "Thi", "s", " ", "choice", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "implementation", " ", "allow", "s", " ", "us", " ", "to", " ", "dis", "rega", "rd", " ", "the", " ", "`", "ref", "`_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parameter", " ", "alt", "oge", "ther", ",", " ", "and", " ", "doe", "s", " ", "not", " ", "require_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compu", "ting", " ", "express", "ion", "s", " ", "like", " ", "`", "C5", " ", "in", " ", "A1", ":", "D6", "`.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pres", "uma", "bly", ",", " ", "Exce", "l", " ", "doe", "s", " ", "not", " ", "generat", "e", " ", "spreadsheet", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "suc", "h", " ", "contra", "diction", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "si_", "in_", "self_", "._", "shared", "\\u", "formula", "\\u", "masters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "trans_", "=_", "self_", "._", "shared", "\\u", "formula", "\\u", "masters_", "[_", "si_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "trans_", "._", "translat", "e\\u", "formula_", "(_", "coordinate_", ")_", "\\u\\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_", "._", "shared", "\\u", "formula", "\\u", "masters_", "[_", "si_", "]_", "=_", "Translator_", "(_", "value_", ",_", "coordinate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "style", "\\u", "array_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "style", "\\u", "id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "style", "\\u", "id_", "=_", "int_", "(_", "style", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style", "\\u", "array_", "=_", "self_", "._", "styles_", "[_", "style", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", ",_", "column_", "=_", "coordinate", "\\u", "to", "\\u", "tuple_", "(_", "coordinate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cell_", "=_", "Cell_", "(_", "self_", "._", "ws_", ",_", "row_", "=_", "row_", ",_", "col", "\\u", "idx_", "=_", "column_", ",_", "style", "\\u", "array_", "=_", "style", "\\u", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ws_", "._", "\\u", "cells_", "[_", "(_", "row_", ",_", "column_", ")_", "]_", "=_", "cell_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data\\u", "type_", "==_", "'", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\\u", "cast", "\\u", "number_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data\\u", "type_", "==_", "'", "b", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "bool_", "(_", "int_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data\\u", "type_", "==_", "'", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "shared", "\\u", "strings_", "[_", "int_", "(_", "value_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data\\u", "type_", "==_", "'", "str", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "type_", "=_", "'", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data\\u", "type_", "==_", "'", "inline", "Str", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "type_", "=_", "'", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child_", "=_", "element_", "._", "find_", "(_", "self_", "._", "IN", "LINE", "\\u", "STRING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "child_", "=_", "element_", "._", "find_", "(_", "self_", "._", "IN", "LINE", "\\u", "RIC", "HT", "EXT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "child_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "child_", "._", "text_", "\\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_", "._", "guess", "\\u", "types_", "or_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell_", "._", "\\u", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cell_", "._", "data\\u", "type_", "=_", "data\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "merge_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "merge", "Cell_", "in_", "safe", "\\u", "iterator_", "(_", "element_", ",_", "(_", "'{", "%", "s", "}", "merge", "Cel", "l", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "merge", "\\u", "cells_", "(_", "merge", "Cell_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "column", "\\u", "dimensions_", "(_", "self_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "dict_", "(_", "col_", "._", "attrib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column_", "=_", "get", "\\u", "column", "\\u", "letter_", "(_", "int_", "(_", "attrs_", "[_", "'", "min", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "[_", "'", "index", "'_", "]_", "=_", "column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "style", "'_", "in_", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "style", "'_", "]_", "=_", "self_", "._", "styles_", "[_", "int_", "(_", "attrs_", "[_", "'", "style", "'_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dim_", "=_", "Colum", "n", "Dimension_", "(_", "self_", "._", "ws_", ",_", "**_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ws_", "._", "column", "\\u", "dimensions_", "[_", "column_", "]_", "=_", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "row", "\\u", "dimensions_", "(_", "self_", ",_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "dict_", "(_", "row_", "._", "attrib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "set_", "(_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "==_", "\"", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "s", "'_", "]_", "=_", "self_", "._", "styles_", "[_", "int_", "(_", "attrs_", "[_", "'", "s", "'_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "._", "startswith_", "(_", "'{'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "attrs_", "[_", "key_", "]_", "\\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_", "keys_", "=_", "set_", "(_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "keys_", "!=_", "set_", "(_", "[_", "'", "r", "'_", ",_", "'", "span", "s", "'_", "]_", ")_", "and_", "keys_", "!=_", "set_", "(_", "[_", "'", "r", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "create", " ", "dimension", " ", "object", "s", " ", "unl", "ess", " ", "the", "y", " ", "have", " ", "rele", "van", "t", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "Row", "Dimension_", "(_", "self_", "._", "ws_", ",_", "**_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ws_", "._", "row", "\\u", "dimensions_", "[_", "dim_", "._", "index_", "]_", "=_", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cell_", "in_", "safe", "\\u", "iterator_", "(_", "row_", ",_", "self_", "._", "CELL", "\\u", "TAG_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parse", "\\u", "cell_", "(_", "cell_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "print", "\\u", "options_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "print", "\\u", "options_", "=_", "Print", "Options_", "._", "from", "\\u", "tree_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "margins", "_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "page", "\\u", "margins", "_", "=_", "Page", "Margins_", "._", "from", "\\u", "tree_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "page", "\\u", "setup_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "page", "\\u", "setup_", "=_", "Print", "Page", "Setup_", "._", "from", "\\u", "tree_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "header", "\\u", "footer_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "odd", "Header_", "=_", "element_", "._", "find_", "(_", "'{", "%", "s", "}", "odd", "Head", "er", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "odd", "Header_", "is_", "not_", "None_", "and_", "odd", "Header_", "._", "text_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "header", "\\u", "footer_", "._", "set", "Header_", "(_", "odd", "Header_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "odd", "Footer", "_", "=_", "element_", "._", "find_", "(_", "'{", "%", "s", "}", "odd", "Footer", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "odd", "Footer", "_", "is_", "not_", "None_", "and_", "odd", "Footer", "_", "._", "text_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "header", "\\u", "footer_", "._", "set", "Footer", "_", "(_", "odd", "Footer", "_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parser", "\\u", "conditional", "\\u", "formatting_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "range", "\\u", "string_", "=_", "element_", "._", "get_", "(_", "'", "sqr", "ef", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf", "Rules_", "=_", "element_", "._", "findall_", "(_", "'{", "%", "s", "}", "cf", "Rule", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ws_", "._", "conditional", "\\u", "formatting_", "._", "cf", "\\u", "rules_", "[_", "range", "\\u", "string_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "cf", "Rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "Rule_", "._", "from", "\\u", "tree_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rule_", "._", "dxf", "Id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "._", "dxf_", "=_", "self_", "._", "differential", "\\u", "styles_", "[_", "rule_", "._", "dxf", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ws_", "._", "conditional", "\\u", "formatting_", "._", "cf", "\\u", "rules_", "[_", "range", "\\u", "string_", "]_", "._", "append_", "(_", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "auto", "\\u", "filter_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "auto", "\\u", "filter_", "._", "ref_", "=_", "element_", "._", "get_", "(_", "\"", "ref", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fc_", "in_", "safe", "\\u", "iterator_", "(_", "element_", ",_", "'{", "%", "s", "}", "filter", "Colum", "n", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "=_", "fc_", "._", "find_", "(_", "'{", "%", "s", "}", "filter", "s", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filters_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vals_", "=_", "[_", "f_", "._", "get_", "(_", "\"", "val", "\"_", ")_", "for_", "f_", "in_", "safe", "\\u", "iterator_", "(_", "filters_", ",_", "'{", "%", "s", "}", "filter", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blank_", "=_", "filters_", "._", "get_", "(_", "\"", "blank", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ws_", "._", "auto", "\\u", "filter_", "._", "add", "\\u", "filter", "\\u", "column_", "(_", "fc_", "._", "get_", "(_", "\"", "col", "Id", "\"_", ")_", ",_", "vals_", ",_", "blank_", "=_", "blank_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sc_", "in_", "safe", "\\u", "iterator_", "(_", "element_", ",_", "'{", "%", "s", "}", "sort", "Cond", "ition", "'_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "auto", "\\u", "filter_", "._", "add", "\\u", "sort", "\\u", "condition_", "(_", "sc_", "._", "get_", "(_", "\"", "ref", "\"_", ")_", ",_", "sc_", "._", "get_", "(_", "\"", "descend", "ing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "sheet", "\\u", "protection", "_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "protection", "_", "=_", "She", "et", "Protect", "ion_", "._", "from", "\\u", "tree_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "element_", "._", "get_", "(_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "password_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "protection", "_", "._", "set\\u", "password_", "(_", "password_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "data\\u", "validation_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node_", "in_", "safe", "\\u", "iterator_", "(_", "element_", ",_", "\"{", "%", "s", "}", "data", "Validat", "ion", "\"_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dv_", "=_", "Data", "Validation_", "._", "from", "\\u", "tree_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ws_", "._", "\\u", "data\\u", "validation", "s_", "._", "append_", "(_", "dv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "properties_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "sheet", "\\u", "properties_", "=_", "Worksh", "eet", "Properties_", "._", "from", "\\u", "tree_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "lega", "cy", "\\u", "drawing_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "keep", "\\u", "vb", "a_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "id", " ", "tha", "t", " ", "will", " ", "not", " ", "clas", "h", " ", "with", " ", "any", " ", "other", " ", "ids", " ", "tha", "t", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ws_", "._", "vb", "a", "\\u", "controls_", "=_", "'", "vb", "a", "Control", "Id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "sheet", "\\u", "views_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "el_", "in_", "element_", "._", "findall_", "(_", "\"{", "%", "s", "}", "sheet", "View", "\"_", "%_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "according", " ", "to", " ", "the", " ", "specifica", "tion", " ", "the", " ", "last", " ", "view", " ", "wins_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ws_", "._", "sheet", "\\u", "view_", "=_", "She", "et", "View_", "._", "from", "\\u", "tree_", "(_", "el_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Work", "She", "et", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "extensions_", "(_", "self_", ",_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ext", "Lst_", "=_", "Ext", "ensi", "on", "List_", "._", "from", "\\u", "tree_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "ext", "Lst_", "._", "ext_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ext", "\\u", "type_", "=_", "EXT", "\\u", "TYPES_", "._", "get_", "(_", "e_", "._", "uri_", "._", "upper_", "(_", ")_", ",_", "\"", "Un", "know", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\"{", "0", "}", " ", "extensi", "on", " ", "is", " ", "not", " ", "support", "ed", " ", "and", " ", "will", " ", "be", " ", "remove", "d", "\"_", "._", "format_", "(_", "ext", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warn_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fast", "\\u", "parse_", "(_", "xml", "\\u", "source_", ",_", "parent_", ",_", "sheet", "\\u", "title_", ",_", "shared", "\\u", "strings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "Work", "She", "et", "Parser_", "(_", "parent_", ",_", "sheet", "\\u", "title_", ",_", "xml", "\\u", "source_", ",_", "shared", "\\u", "strings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parser_", "._", "ws_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
internetarchive/umbra/umbra/controller.py
[ { "content": " def _wait_for_and_browse_urls(self, conn, consumer, timeout):\n start = time.time()\n browser = None\n consumer.qos(prefetch_count=self.max_active_browsers)\n\n while not self._consumer_stop.is_set() and time.time() - start < timeout and not self._reconnect_requested:\n try:\n browser = self._browser_pool.acquire() # raises KeyError if none available\n browser.start()\n\n def callback(body, message):\n try:\n client_id = body.get('clientId')\n url = body['url']\n metadata = body.get('metadata')\n behavior_parameters = body.get('behaviorParameters')\n except:\n self.logger.error(\"unable to decipher message %s\",\n message, exc_info=True)\n self.logger.error(\"discarding bad message\")\n message.reject()\n browser.stop()\n self._browser_pool.release(browser)\n return\n self._start_browsing_page(browser, message, client_id, url,\n metadata, behavior_parameters)\n\n consumer.callbacks = [callback]\n\n while True:\n try:\n conn.drain_events(timeout=0.5)\n break # out of \"while True\" to acquire another browser\n except socket.timeout:\n pass\n except socket.error:\n self.logger.error(\"problem consuming messages from AMQP, will try reconnecting after active browsing finishes\", exc_info=True)\n self._reconnect_requested = True\n\n if self._consumer_stop.is_set() or time.time() - start >= timeout or self._reconnect_requested:\n browser.stop()\n self._browser_pool.release(browser)\n break\n\n except KeyError:\n # no browsers available\n time.sleep(0.5)\n except:\n self.logger.critical(\"problem with browser initialization\", exc_info=True)\n time.sleep(0.5)\n finally:\n consumer.callbacks = None", "metadata": "root.AmqpBrowserController._wait_for_and_browse_urls", "header": "['class', 'AmqpBrowserController', ':', '___EOS___']", "index": 93 }, { "content": " def _start_browsing_page(self, browser, message, client_id, url, parent_url_metadata, behavior_parameters):\n def on_response(chrome_msg):\n if (chrome_msg['params']['response']['url'].lower().startswith('data:')\n or chrome_msg['params']['response']['fromDiskCache']\n or not 'requestHeaders' in chrome_msg['params']['response']):\n return\n\n payload = {\n 'url': chrome_msg['params']['response']['url'],\n 'headers': chrome_msg['params']['response']['requestHeaders'],\n 'parentUrl': url,\n 'parentUrlMetadata': parent_url_metadata,\n }\n\n if ':method' in chrome_msg['params']['response']['requestHeaders']:\n # happens when http transaction is http 2.0\n payload['method'] = chrome_msg['params']['response']['requestHeaders'][':method']\n elif 'requestHeadersText' in chrome_msg['params']['response']:\n req = chrome_msg['params']['response']['requestHeadersText']\n payload['method'] = req[:req.index(' ')]\n else:\n self.logger.warn('unable to identify http method (assuming GET) chrome_msg=%s',\n chrome_msg)\n payload['method'] = 'GET'\n\n self.logger.debug(\n 'sending to amqp exchange=%s routing_key=%s payload=%s',\n self.exchange_name, client_id, payload)\n with self._producer_lock:\n publish = self._producer_conn.ensure(self._producer,\n self._producer.publish)\n publish(payload, exchange=self._exchange, routing_key=client_id)\n\n def browse_page_sync():\n self.logger.info(\n 'browser=%s client_id=%s url=%s behavior_parameters=%s',\n browser, client_id, url, behavior_parameters)\n try:\n browser.browse_page(url, on_response=on_response,\n behavior_parameters=behavior_parameters)\n message.ack()\n except BrowsingException as e:\n self.logger.warn(\"browsing did not complete normally, requeuing url {} - {}\".format(url, e))\n message.requeue()\n except:\n self.logger.critical(\"problem browsing page, requeuing url {}, may have lost browser process\".format(url), exc_info=True)\n message.requeue()\n finally:\n browser.stop()\n self._browser_pool.release(browser)\n\n def browse_thread_run_then_cleanup():\n browse_page_sync()\n with self._browsing_threads_lock:\n self._browsing_threads.remove(threading.current_thread())\n\n import random\n thread_name = \"BrowsingThread{}-{}\".format(browser.chrome_port,\n ''.join((random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') for _ in range(6))))\n th = threading.Thread(target=browse_thread_run_then_cleanup, name=thread_name)\n with self._browsing_threads_lock:\n self._browsing_threads.add(th)\n th.start()", "metadata": "root.AmqpBrowserController._start_browsing_page", "header": "['class', 'AmqpBrowserController', ':', '___EOS___']", "index": 183 } ]
[ { "span": "except:", "start_line": 109, "start_column": 20, "end_line": 109, "end_column": 27 }, { "span": "except:", "start_line": 140, "start_column": 12, "end_line": 140, "end_column": 19 }, { "span": "except:", "start_line": 227, "start_column": 12, "end_line": 227, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Am", "qp", "Brows", "er", "Controller_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "wait", "\\u", "for", "\\u", "and", "\\u", "browse", "\\u", "urls_", "(_", "self_", ",_", "conn_", ",_", "consumer_", ",_", "timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "browser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consumer_", "._", "qos_", "(_", "prefetch", "\\u", "count_", "=_", "self_", "._", "max", "\\u", "active", "\\u", "browsers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "self_", "._", "\\u", "consume", "r", "\\u", "stop_", "._", "is", "\\u", "set_", "(_", ")_", "and_", "time_", "._", "time_", "(_", ")_", "-_", "start_", "<_", "timeout_", "and_", "not_", "self_", "._", "\\u", "reconnect", "\\u", "requested_", ":_", "\\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 ", " _", "browser_", "=_", "self_", "._", "\\u", "browse", "r", "\\u", "pool_", "._", "acquire_", "(_", ")_", "#", " ", "raise", "s", " ", "Key", "Error", " ", "if", " ", "none", " ", "available_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "browser_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "callback_", "(_", "body_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "client", "\\u", "id_", "=_", "body_", "._", "get_", "(_", "'", "client", "Id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "body_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "body_", "._", "get_", "(_", "'", "metadata", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "behavior", "\\u", "parameters_", "=_", "body_", "._", "get_", "(_", "'", "behavior", "Parameter", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "logger_", "._", "error_", "(_", "\"", "una", "ble", " ", "to", " ", "deci", "pher", " ", "message", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "exc", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "error_", "(_", "\"", "discard", "ing", " ", "bad", " ", "message", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "reject_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "browser_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "browse", "r", "\\u", "pool_", "._", "release_", "(_", "browser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "start", "\\u", "brow", "sing", "\\u", "page_", "(_", "browser_", ",_", "message_", ",_", "client", "\\u", "id_", ",_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", ",_", "behavior", "\\u", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "consumer_", "._", "callbacks_", "=_", "[_", "callback_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "drain", "\\u", "events_", "(_", "timeout_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "#", " ", "out", " ", "of", " ", "\"", "whi", "le", " ", "Tru", "e", "\"", " ", "to", " ", "acquir", "e", " ", "anot", "her", " ", "browser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "logger_", "._", "error_", "(_", "\"", "problem", " ", "consum", "ing", " ", "message", "s", " ", "from", " ", "AMQ", "P", ",", " ", "will", " ", "try", " ", "reconnect", "ing", " ", "after", " ", "active", " ", "brow", "sing", " ", "finish", "es", "\"_", ",_", "exc", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "reconnect", "\\u", "requested_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "consume", "r", "\\u", "stop_", "._", "is", "\\u", "set_", "(_", ")_", "or_", "time_", "._", "time_", "(_", ")_", "-_", "start_", ">=_", "timeout_", "or_", "self_", "._", "\\u", "reconnect", "\\u", "requested_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "browser_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "browse", "r", "\\u", "pool_", "._", "release_", "(_", "browser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "browsers", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "critical_", "(_", "\"", "problem", " ", "with", " ", "browse", "r", " ", "initialization", "\"_", ",_", "exc", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "\\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 ", " _", "consumer_", "._", "callbacks_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Am", "qp", "Brows", "er", "Controller_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "start", "\\u", "brow", "sing", "\\u", "page_", "(_", "self_", ",_", "browser_", ",_", "message_", ",_", "client", "\\u", "id_", ",_", "url_", ",_", "parent", "\\u", "url", "\\u", "metadata_", ",_", "behavior", "\\u", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "on", "\\u", "response_", "(_", "chrome", "\\u", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "chrome", "\\u", "msg_", "[_", "'", "params", "'_", "]_", "[_", "'", "response", "'_", "]_", "[_", "'", "url", "'_", "]_", "._", "lower_", "(_", ")_", "._", "startswith_", "(_", "'", "data", ":'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "chrome", "\\u", "msg_", "[_", "'", "params", "'_", "]_", "[_", "'", "response", "'_", "]_", "[_", "'", "from", "Disk", "Cache", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "not_", "'", "request", "Head", "ers", "'_", "in_", "chrome", "\\u", "msg_", "[_", "'", "params", "'_", "]_", "[_", "'", "response", "'_", "]_", ")_", ":_", "\\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_", "payload_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "chrome", "\\u", "msg_", "[_", "'", "params", "'_", "]_", "[_", "'", "response", "'_", "]_", "[_", "'", "url", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "chrome", "\\u", "msg_", "[_", "'", "params", "'_", "]_", "[_", "'", "response", "'_", "]_", "[_", "'", "request", "Head", "ers", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "Ur", "l", "'_", ":_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "Ur", "l", "Meta", "data", "'_", ":_", "parent", "\\u", "url", "\\u", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "':", "method", "'_", "in_", "chrome", "\\u", "msg_", "[_", "'", "params", "'_", "]_", "[_", "'", "response", "'_", "]_", "[_", "'", "request", "Head", "ers", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "happ", "ens", " ", "whe", "n", " ", "http", " ", "transaction", " ", "is", " ", "http", " ", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "payload_", "[_", "'", "method", "'_", "]_", "=_", "chrome", "\\u", "msg_", "[_", "'", "params", "'_", "]_", "[_", "'", "response", "'_", "]_", "[_", "'", "request", "Head", "ers", "'_", "]_", "[_", "':", "method", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "request", "Head", "ers", "Text", "'_", "in_", "chrome", "\\u", "msg_", "[_", "'", "params", "'_", "]_", "[_", "'", "response", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "chrome", "\\u", "msg_", "[_", "'", "params", "'_", "]_", "[_", "'", "response", "'_", "]_", "[_", "'", "request", "Head", "ers", "Text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "[_", "'", "method", "'_", "]_", "=_", "req_", "[_", ":_", "req_", "._", "index_", "(_", "'", " ", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "warn_", "(_", "'", "una", "ble", " ", "to", " ", "identify", " ", "http", " ", "method", " ", "(", "ass", "umi", "ng", " ", "GET", ")", " ", "chrome", "\\u", "msg", "=", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chrome", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "[_", "'", "method", "'_", "]_", "=_", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sendin", "g", " ", "to", " ", "amqp", " ", "exchange", "=", "%", "s", " ", "routin", "g", "\\u", "key", "=", "%", "s", " ", "payload", "=", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "exchange", "\\u", "name_", ",_", "client", "\\u", "id_", ",_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "\\u", "producer", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "publish_", "=_", "self_", "._", "\\u", "producer", "\\u", "conn_", "._", "ensure", "_", "(_", "self_", "._", "\\u", "producer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "producer_", "._", "publish_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publish_", "(_", "payload_", ",_", "exchange_", "=_", "self_", "._", "\\u", "exchange_", ",_", "routin", "g", "\\u", "key_", "=_", "client", "\\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_", "def_", "browse", "\\u", "page", "\\u", "sync_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "browse", "r", "=", "%", "s", " ", "client", "\\u", "id", "=", "%", "s", " ", "url", "=", "%", "s", " ", "behavior", "\\u", "parameter", "s", "=", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "browser_", ",_", "client", "\\u", "id_", ",_", "url_", ",_", "behavior", "\\u", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "browser_", "._", "browse", "\\u", "page_", "(_", "url_", ",_", "on", "\\u", "response_", "=_", "on", "\\u", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "behavior", "\\u", "parameters_", "=_", "behavior", "\\u", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "ack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Brows", "ing", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "warn_", "(_", "\"", "brow", "sing", " ", "did", " ", "not", " ", "complete", " ", "normal", "ly", ",", " ", "reque", "uin", "g", " ", "url", " ", "{}", " ", "-", " ", "{}\"_", "._", "format_", "(_", "url_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "reque", "ue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "critical_", "(_", "\"", "problem", " ", "brow", "sing", " ", "page", ",", " ", "reque", "uin", "g", " ", "url", " ", "{}", ",", " ", "may", " ", "have", " ", "lost", " ", "browse", "r", " ", "process", "\"_", "._", "format_", "(_", "url_", ")_", ",_", "exc", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "reque", "ue_", "(_", ")_", "\\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 ", " _", "browser_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "browse", "r", "\\u", "pool_", "._", "release_", "(_", "browser_", ")_", "\\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_", "browse", "\\u", "thread", "\\u", "run", "\\u", "then", "\\u", "cleanup_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "browse", "\\u", "page", "\\u", "sync_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "\\u", "brow", "sing", "\\u", "thread", "s", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "brow", "sing", "\\u", "threads_", "._", "remove_", "(_", "threading_", "._", "current", "\\u", "thread_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread", "\\u", "name_", "=_", "\"", "Brows", "ing", "Thread", "{}", "-{}", "\"_", "._", "format_", "(_", "browser_", "._", "chrome", "\\u", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", "._", "join_", "(_", "(_", "random_", "._", "choice_", "(_", "'", "abcdefg", "hij", "kl", "mn", "op", "qr", "stu", "vw", "xyz", "ABCDE", "FG", "HI", "JK", "LM", "NOP", "QR", "STU", "VW", "XY", "Z", "0123456", "789", "'_", ")_", "for_", "\\u_", "in_", "range_", "(_", "6_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "th_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "browse", "\\u", "thread", "\\u", "run", "\\u", "then", "\\u", "cleanup_", ",_", "name_", "=_", "thread", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "\\u", "brow", "sing", "\\u", "thread", "s", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "brow", "sing", "\\u", "threads_", "._", "add_", "(_", "th_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "th_", "._", "start_", "(_", ")_" ]
[ 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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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
charanpald/APGL/apgl/graph/test/GraphUtilsTest.py
[ { "content": " def testShiftLaplacian(self):\n numVertices = 10\n numFeatures = 0\n\n vList = VertexList(numVertices, numFeatures)\n graph = SparseGraph(vList)\n\n ell = 2\n m = 2\n generator = BarabasiAlbertGenerator(ell, m)\n graph = generator.generate(graph)\n\n k = 10\n W = graph.getSparseWeightMatrix()\n L = GraphUtils.shiftLaplacian(W)\n\n L2 = 2*numpy.eye(numVertices) - graph.normalisedLaplacianSym()\n\n tol = 10**-6\n self.assertTrue(numpy.linalg.norm(L - L2) < tol)", "metadata": "root.AbstractMatrixGraphTest.testShiftLaplacian", "header": "['class', 'AbstractMatrixGraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 171 }, { "content": " def testNormalisedLaplacianSym(self):\n numVertices = 10\n numFeatures = 0\n\n vList = VertexList(numVertices, numFeatures)\n graph = SparseGraph(vList)\n\n ell = 2\n m = 2\n generator = BarabasiAlbertGenerator(ell, m)\n graph = generator.generate(graph)\n\n k = 10\n W = graph.getSparseWeightMatrix()\n L = GraphUtils.shiftLaplacian(W)\n\n L2 = graph.normalisedLaplacianSym()\n\n tol = 10**-6\n self.assertTrue(numpy.linalg.norm(L + L2 - 2*numpy.eye(numVertices)) < tol)\n\n #Test zero rows/cols \n W = scipy.sparse.csr_matrix((5, 5))\n W[1, 0] = 1\n W[0, 1] = 1\n L = GraphUtils.normalisedLaplacianSym(W)\n \n for i in range(2, 5): \n self.assertEquals(L[i, i], 0)", "metadata": "root.AbstractMatrixGraphTest.testNormalisedLaplacianSym", "header": "['class', 'AbstractMatrixGraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 194 }, { "content": " def testNormalisedLaplacianRw(self):\n numVertices = 10\n numFeatures = 0\n\n vList = VertexList(numVertices, numFeatures)\n graph = SparseGraph(vList)\n\n ell = 2\n m = 2\n generator = BarabasiAlbertGenerator(ell, m)\n graph = generator.generate(graph)\n\n k = 10\n W = graph.getSparseWeightMatrix()\n L = GraphUtils.normalisedLaplacianRw(W)\n\n L2 = graph.normalisedLaplacianRw()\n\n tol = 10**-6\n self.assertTrue(numpy.linalg.norm(L - L2) < tol)\n\n #Test zero rows/cols \n W = scipy.sparse.csr_matrix((5, 5))\n W[1, 0] = 1\n W[0, 1] = 1\n L = GraphUtils.normalisedLaplacianRw(W)\n \n for i in range(2, 5): \n self.assertEquals(L[i, i], 0)", "metadata": "root.AbstractMatrixGraphTest.testNormalisedLaplacianRw", "header": "['class', 'AbstractMatrixGraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 225 } ]
[ { "span": "k ", "start_line": 183, "start_column": 8, "end_line": 183, "end_column": 9 }, { "span": "k ", "start_line": 206, "start_column": 8, "end_line": 206, "end_column": 9 }, { "span": "k ", "start_line": 237, "start_column": 8, "end_line": 237, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Abstract", "Matrix", "Graph", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Shi", "ft", "Lap", "lac", "ian_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "Spar", "se", "Graph_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ell_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generator_", "=_", "Bar", "aba", "si", "Alb", "ert", "Generator_", "(_", "ell_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "generator_", "._", "generate_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "graph_", "._", "get", "Spar", "se", "Weig", "ht", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "shift", "Lap", "lac", "ian_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L2_", "=_", "2_", "*_", "numpy_", "._", "eye_", "(_", "num", "Vertices_", ")_", "-_", "graph_", "._", "normalise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "L_", "-_", "L2_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Matrix", "Graph", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Normal", "ise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "Spar", "se", "Graph_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ell_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generator_", "=_", "Bar", "aba", "si", "Alb", "ert", "Generator_", "(_", "ell_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "generator_", "._", "generate_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "graph_", "._", "get", "Spar", "se", "Weig", "ht", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "shift", "Lap", "lac", "ian_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L2_", "=_", "graph_", "._", "normalise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "L_", "+_", "L2_", "-_", "2_", "*_", "numpy_", "._", "eye_", "(_", "num", "Vertices_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "zero", " ", "rows", "/", "cols", " _", "\\u\\u\\uNL\\u\\u\\u_", "W_", "=_", "scipy_", "._", "sparse_", "._", "csr", "\\u", "matrix_", "(_", "(_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "[_", "1_", ",_", "0_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "[_", "0_", ",_", "1_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "normalise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", ",_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "L_", "[_", "i_", ",_", "i_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Matrix", "Graph", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Normal", "ise", "d", "Lap", "lac", "ian", "Rw", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "Spar", "se", "Graph_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ell_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generator_", "=_", "Bar", "aba", "si", "Alb", "ert", "Generator_", "(_", "ell_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "generator_", "._", "generate_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "graph_", "._", "get", "Spar", "se", "Weig", "ht", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "normalise", "d", "Lap", "lac", "ian", "Rw", "_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L2_", "=_", "graph_", "._", "normalise", "d", "Lap", "lac", "ian", "Rw", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "L_", "-_", "L2_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "zero", " ", "rows", "/", "cols", " _", "\\u\\u\\uNL\\u\\u\\u_", "W_", "=_", "scipy_", "._", "sparse_", "._", "csr", "\\u", "matrix_", "(_", "(_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "[_", "1_", ",_", "0_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "[_", "0_", ",_", "1_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "normalise", "d", "Lap", "lac", "ian", "Rw", "_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", ",_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "L_", "[_", "i_", ",_", "i_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
AppScale/appscale/AppServer/lib/protorpc/protorpc/protojson.py
[ { "content": "def decode_message(message_type, encoded_message):\n \"\"\"Merge JSON structure to Message instance.\n\n Args:\n message_type: Message to decode data to.\n encoded_message: JSON encoded version of message.\n\n Returns:\n Decoded instance of message_type.\n\n Raises:\n ValueError: If encoded_message is not valid JSON.\n messages.ValidationError if merged message is not initialized.\n \"\"\"\n if not encoded_message.strip():\n return message_type()\n\n dictionary = json.loads(encoded_message)\n\n def find_variant(value):\n \"\"\"Find the messages.Variant type that describes this value.\n\n Args:\n value: The value whose variant type is being determined.\n\n Returns:\n The messages.Variant value that best describes value's type, or None if\n it's a type we don't know how to handle.\n \"\"\"\n if isinstance(value, (int, long)):\n return messages.Variant.INT64\n elif isinstance(value, float):\n return messages.Variant.DOUBLE\n elif isinstance(value, basestring):\n return messages.Variant.STRING\n elif isinstance(value, (list, tuple)):\n # Find the most specific variant that covers all elements.\n variant_priority = [None, messages.Variant.INT64, messages.Variant.DOUBLE,\n messages.Variant.STRING]\n chosen_priority = 0\n for v in value:\n variant = find_variant(v)\n try:\n priority = variant_priority.index(variant)\n except IndexError:\n priority = -1\n if priority > chosen_priority:\n chosen_priority = priority\n return variant_priority[chosen_priority]\n # Unrecognized type.\n return None\n\n def decode_dictionary(message_type, dictionary):\n \"\"\"Merge dictionary in to message.\n\n Args:\n message: Message to merge dictionary in to.\n dictionary: Dictionary to extract information from. Dictionary\n is as parsed from JSON. Nested objects will also be dictionaries.\n \"\"\"\n message = message_type()\n for key, value in dictionary.iteritems():\n if value is None:\n message.reset(key)\n continue\n\n try:\n field = message.field_by_name(key)\n except KeyError:\n # Save unknown values.\n variant = find_variant(value)\n if variant:\n message.set_unrecognized_field(key, value, variant)\n else:\n logging.warning('No variant found for unrecognized field: %s', key)\n continue\n\n # Normalize values in to a list.\n if isinstance(value, list):\n if not value:\n continue\n else:\n value = [value]\n\n valid_value = []\n for item in value:\n if isinstance(field, messages.EnumField):\n try:\n item = field.type(item)\n except TypeError:\n raise messages.DecodeError('Invalid enum value \"%s\"' % value[0])\n elif isinstance(field, messages.BytesField):\n try:\n item = base64.b64decode(item)\n except TypeError, err:\n raise messages.DecodeError('Base64 decoding error: %s' % err)\n elif isinstance(field, message_types.DateTimeField):\n try:\n item = util.decode_datetime(item)\n except ValueError, err:\n raise messages.DecodeError(err)\n elif isinstance(field, messages.MessageField):\n item = decode_dictionary(field.type, item)\n elif (isinstance(field, messages.FloatField) and\n isinstance(item, (int, long, basestring))):\n try:\n item = float(item)\n except:\n pass\n elif (isinstance(field, messages.IntegerField) and\n isinstance(item, basestring)):\n try:\n item = int(item)\n except:\n pass\n valid_value.append(item)\n\n if field.repeated:\n existing_value = getattr(message, field.name)\n setattr(message, field.name, valid_value)\n else:\n setattr(message, field.name, valid_value[-1])\n return message\n\n message = decode_dictionary(message_type, dictionary)\n message.check_initialized()\n return message", "metadata": "root.decode_message", "header": "['module', '___EOS___']", "index": 162 } ]
[ { "span": "except:", "start_line": 269, "start_column": 10, "end_line": 269, "end_column": 17 }, { "span": "except:", "start_line": 275, "start_column": 10, "end_line": 275, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decode", "\\u", "message_", "(_", "message", "\\u", "type_", ",_", "encode", "d\\u", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Merge", " ", "JSO", "N", " ", "structure", " ", "to", " ", "Messag", "e", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "message", "\\u", "type", ":", " ", "Messag", "e", " ", "to", " ", "decode", " ", "data", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "encode", "d\\u", "message", ":", " ", "JSO", "N", " ", "encode", "d", " ", "version", " ", "of", " ", "message", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Decode", "d", " ", "instance", " ", "of", " ", "message", "\\u", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Value", "Error", ":", " ", "If", " ", "encode", "d\\u", "message", " ", "is", " ", "not", " ", "valid", " ", "JSO", "N", ".", "\\", "10", ";", " ", " ", " ", " ", "message", "s", ".", "Validat", "ion", "Error", " ", "if", " ", "merge", "d", " ", "message", " ", "is", " ", "not", " ", "initialize", "d", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "encode", "d\\u", "message_", "._", "strip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "message", "\\u", "type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dictionary_", "=_", "json_", "._", "loads_", "(_", "encode", "d\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "find", "\\u", "variant_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "the", " ", "message", "s", ".", "Varia", "nt", " ", "type", " ", "tha", "t", " ", "descri", "bes", " ", "this", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "value", ":", " ", "The", " ", "value", " ", "who", "se", " ", "variant", " ", "type", " ", "is", " ", "bei", "ng", " ", "dete", "rmin", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "message", "s", ".", "Varia", "nt", " ", "value", " ", "tha", "t", " ", "best", " ", "descri", "bes", " ", "value", "'", "s", " ", "type", ",", " ", "or", " ", "Non", "e", " ", "if", "\\", "10", ";", " ", " ", "it", "'", "s", " ", "a", " ", "type", " ", "we", " ", "don", "'", "t", " ", "know", " ", "how", " ", "to", " ", "handle", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "messages_", "._", "Variant_", "._", "INT", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "float_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "messages_", "._", "Variant_", "._", "DOUBLE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "messages_", "._", "Variant_", "._", "STRING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fin", "d", " ", "the", " ", "most", " ", "specific", " ", "variant", " ", "tha", "t", " ", "covers", " ", "all", " ", "element", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "variant", "\\u", "priority_", "=_", "[_", "None_", ",_", "messages_", "._", "Variant_", "._", "INT", "64_", ",_", "messages_", "._", "Variant_", "._", "DOUBLE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "messages_", "._", "Variant_", "._", "STRING_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chosen", "\\u", "priority_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "variant_", "=_", "find", "\\u", "variant_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "priority_", "=_", "variant", "\\u", "priority_", "._", "index_", "(_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "priority_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "priority_", ">_", "chosen", "\\u", "priority_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chosen", "\\u", "priority_", "=_", "priority_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "variant", "\\u", "priority_", "[_", "chosen", "\\u", "priority_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Unre", "cogni", "zed", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decode", "\\u", "dictionary_", "(_", "message", "\\u", "type_", ",_", "dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Merge", " ", "dictionar", "y", " ", "in", " ", "to", " ", "message", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "message", ":", " ", "Messag", "e", " ", "to", " ", "merge", " ", "dictionar", "y", " ", "in", " ", "to", ".", "\\", "10", ";", " ", " ", "dictionar", "y", ":", " ", "Dict", "ionar", "y", " ", "to", " ", "extract", " ", "informati", "on", " ", "from", ".", " ", " ", "Dict", "ionar", "y", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "as", " ", "parsed", " ", "from", " ", "JSO", "N", ".", " ", " ", "Nest", "ed", " ", "object", "s", " ", "will", " ", "als", "o", " ", "be", " ", "dictionar", "ies", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "message", "\\u", "type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "dictionary_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "._", "reset_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "=_", "message_", "._", "field", "\\u", "by", "\\u", "name_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Save", " ", "unknown", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "variant_", "=_", "find", "\\u", "variant_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "variant_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "._", "set\\u", "unre", "cogni", "zed", "\\u", "field_", "(_", "key_", ",_", "value_", ",_", "variant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "'", "No", " ", "variant", " ", "found", " ", "for", " ", "unre", "cogni", "zed", " ", "field", ":", " ", "%", "s", "'_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Normalize", " ", "values", " ", "in", " ", "to", " ", "a", " ", "list", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "[_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "valid", "\\u", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "field_", ",_", "messages_", "._", "Enum", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "field_", "._", "type_", "(_", "item_", ")_", "\\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 ", " _", "raise_", "messages_", "._", "Decode", "Error_", "(_", "'", "Inva", "lid", " ", "enum", " ", "value", " ", "\"%", "s", "\"'_", "%_", "value_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "field_", ",_", "messages_", "._", "Byte", "s", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "base64_", "._", "b64decode_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "messages_", "._", "Decode", "Error_", "(_", "'", "Base", "64", " ", "deco", "ding", " ", "error", ":", " ", "%", "s", "'_", "%_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "field_", ",_", "message", "\\u", "types_", "._", "Date", "Time", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "util_", "._", "decode", "\\u", "datetime_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "messages_", "._", "Decode", "Error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "field_", ",_", "messages_", "._", "Messag", "e", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "decode", "\\u", "dictionary_", "(_", "field_", "._", "type_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "field_", ",_", "messages_", "._", "Float", "Field_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "item_", ",_", "(_", "int_", ",_", "long_", ",_", "basestring_", ")_", ")_", ")_", ":_", "\\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 ", " _", "item_", "=_", "float_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "field_", ",_", "messages_", "._", "Integer", "Field_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "item_", ",_", "basestring_", ")_", ")_", ":_", "\\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 ", " _", "item_", "=_", "int_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "valid", "\\u", "value_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "field_", "._", "repeated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exist", "ing", "\\u", "value_", "=_", "getattr_", "(_", "message_", ",_", "field_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "message_", ",_", "field_", "._", "name_", ",_", "valid", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "message_", ",_", "field_", "._", "name_", ",_", "valid", "\\u", "value_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "decode", "\\u", "dictionary_", "(_", "message", "\\u", "type_", ",_", "dictionary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "check", "\\u", "initialized_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "message_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ejeschke/ginga/ginga/cvw/ImageViewCv.py
[ { "content": "#\n# ImageViewCv.py -- a backend for Ginga using OpenCv surfaces\n#\n# This is open-source software licensed under a BSD license.\n# Please see the file LICENSE.txt for details.\n\nimport numpy\nfrom io import BytesIO\n\nimport cv2\nfrom . import CvHelp\n\nfrom ginga import ImageView\nfrom ginga.cvw.CanvasRenderCv import CanvasRenderer\n\ntry:\n import PIL.Image as PILimage\n have_PIL = True\nexcept ImportError:\n have_PIL = False\n\n\n\n\n\n#END\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ImageViewCvError(ImageView.ImageViewError):\n pass", "metadata": "root.ImageViewCvError", "header": "['module', '___EOS___']", "index": 22 }, { "content": "class ImageViewCv(ImageView.ImageViewBase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ImageViewCv", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def __init__(self, logger=None, rgbmap=None, settings=None):\n ImageView.ImageViewBase.__init__(self, logger=logger,\n rgbmap=rgbmap,\n settings=settings)\n\n self.surface = None\n # According to OpenCV documentation:\n # \"If you are using your own image rendering and I/O functions,\n # you can use any channel ordering. The drawing functions process\n # each channel independently and do not depend on the channel\n # order or even on the used color space.\"\n #self._rgb_order = 'BGRA'\n self._rgb_order = 'RGBA'\n\n self.renderer = CanvasRenderer(self)\n\n self.message = None\n\n # cursors\n self.cursor = {}\n\n self.t_.setDefaults(show_pan_position=False,\n onscreen_ff='Sans Serif')", "metadata": "root.ImageViewCv.__init__", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def get_surface(self):\n return self.surface", "metadata": "root.ImageViewCv.get_surface", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def render_image(self, rgbobj, dst_x, dst_y):\n \"\"\"Render the image represented by (rgbobj) at dst_x, dst_y\n in the pixel space.\n \"\"\"\n if self.surface is None:\n return\n canvas = self.surface\n self.logger.debug(\"redraw surface\")\n\n # get window contents as an array and store it into the CV surface\n rgb_arr = self.getwin_array(order=self._rgb_order)\n # TODO: is there a faster way to copy this array in?\n canvas[:,:,:] = rgb_arr\n\n cr = CvHelp.CvContext(canvas)\n\n # Draw a cross in the center of the window in debug mode\n if self.t_['show_pan_position']:\n ctr_x, ctr_y = self.get_center()\n pen = cr.get_pen('red')\n cr.line((ctr_x - 10, ctr_y), (ctr_x + 10, ctr_y), pen)\n cr.line((ctr_x, ctr_y - 10), (ctr_x, ctr_y + 10), pen)\n\n # render self.message\n if self.message:\n font = cr.get_font(self.t_['onscreen_ff'], 14.0, self.img_fg,\n linewidth=2)\n wd, ht = cr.text_extents(self.message, font)\n imgwin_wd, imgwin_ht = self.get_window_size()\n y = ((imgwin_ht // 3) * 2) - (ht // 2)\n x = (imgwin_wd // 2) - (wd // 2)\n cr.text((x, y), self.message, font)\n\n # for debugging\n #self.save_rgb_image_as_file('/tmp/temp.png', format='png')", "metadata": "root.ImageViewCv.render_image", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 54 }, { "content": " def configure_surface(self, width, height):\n # create cv surface the size of the window\n # (cv just uses numpy arrays!)\n depth = len(self._rgb_order)\n self.surface = numpy.zeros((height, width, depth), numpy.uint8)\n\n # inform the base class about the actual window size\n self.configure(width, height)", "metadata": "root.ImageViewCv.configure_surface", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 90 }, { "content": " def get_image_as_array(self):\n if self.surface is None:\n raise ImageViewCvError(\"No OpenCv surface defined\")\n\n arr8 = self.get_surface()\n return numpy.copy(arr8)", "metadata": "root.ImageViewCv.get_image_as_array", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 99 }, { "content": " def get_image_as_buffer(self, output=None):\n obuf = output\n if obuf is None:\n obuf = BytesIO()\n\n arr8 = self.get_image_as_array()\n obuf.write(arr8.tostring(order='C'))\n\n if not (output is None):\n return None\n return obuf.getvalue()", "metadata": "root.ImageViewCv.get_image_as_buffer", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def get_rgb_image_as_buffer(self, output=None, format='png', quality=90):\n if not have_PIL:\n raise ImageViewCvError(\"Please install PIL to use this method\")\n\n if self.surface is None:\n raise ImageViewCvError(\"No CV surface defined\")\n\n ibuf = output\n if ibuf is None:\n ibuf = BytesIO()\n\n # make a PIL image\n image = PILimage.fromarray(self.surface)\n\n image.save(ibuf, format=format, quality=quality)\n if output is not None:\n return None\n return ibuf.getvalue()", "metadata": "root.ImageViewCv.get_rgb_image_as_buffer", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 118 }, { "content": " def get_rgb_image_as_bytes(self, format='png', quality=90):\n buf = self.get_rgb_image_as_buffer(format=format, quality=quality)\n return buf", "metadata": "root.ImageViewCv.get_rgb_image_as_bytes", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 137 }, { "content": " def save_rgb_image_as_file(self, filepath, format='png', quality=90):\n if not have_PIL:\n raise ImageViewCvError(\"Please install PIL to use this method\")\n if self.surface is None:\n raise ImageViewCvError(\"No CV surface defined\")\n\n with open(filepath, 'w') as out_f:\n self.get_rgb_image_as_buffer(output=out_f, format=format,\n quality=quality)\n self.logger.debug(\"wrote %s file '%s'\" % (format, filepath))", "metadata": "root.ImageViewCv.save_rgb_image_as_file", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 141 }, { "content": " def update_image(self):\n # subclass implements this method to actually update a widget\n # from the cv surface\n self.logger.warning(\"Subclass should override this method\")\n return False", "metadata": "root.ImageViewCv.update_image", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def set_cursor(self, cursor):\n # subclass implements this method to actually set a defined\n # cursor on a widget\n self.logger.warning(\"Subclass should override this method\")", "metadata": "root.ImageViewCv.set_cursor", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 158 }, { "content": " def define_cursor(self, ctype, cursor):\n self.cursor[ctype] = cursor", "metadata": "root.ImageViewCv.define_cursor", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 163 }, { "content": " def get_cursor(self, ctype):\n return self.cursor[ctype]", "metadata": "root.ImageViewCv.get_cursor", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 166 }, { "content": " def switch_cursor(self, ctype):\n self.set_cursor(self.cursor[ctype])", "metadata": "root.ImageViewCv.switch_cursor", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 169 }, { "content": " def get_rgb_order(self):\n return self._rgb_order", "metadata": "root.ImageViewCv.get_rgb_order", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 172 }, { "content": " def onscreen_message(self, text, delay=None):\n # subclass implements this method using a timer\n self.logger.warning(\"Subclass should override this method\")", "metadata": "root.ImageViewCv.onscreen_message", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 175 }, { "content": " def show_pan_mark(self, tf):\n self.t_.set(show_pan_position=tf)\n self.redraw(whence=3)", "metadata": "root.ImageViewCv.show_pan_mark", "header": "['class', 'ImageViewCv', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 179 } ]
[ { "span": "import cv2", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Image", "View", "Cv", ".", "py", " ", "--", " ", "a", " ", "back", "end", " ", "for", " ", "Gi", "nga", " ", "usi", "ng", " ", "Open", "Cv", " ", "surfaces", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "open", "-", "source", " ", "software", " ", "license", "d", " ", "under", " ", "a", " ", "BS", "D", " ", "license", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ple", "ase", " ", "see", " ", "the", " ", "file", " ", "LICENSE", ".", "txt", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cv2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "Cv", "Help_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ging", "a_", "import_", "Image", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ging", "a_", "._", "cv", "w_", "._", "Can", "vas", "Render", "Cv", "_", "import_", "Can", "vas", "Renderer_", "\\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_", "PIL_", "._", "Image_", "as_", "PI", "Lim", "age_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "have", "\\u", "PIL_", "=_", "True_", "\\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 ", " _", "have", "\\u", "PIL_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "#", "END_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Image", "View", "Cv", "Error_", "(_", "Image", "View_", "._", "Image", "View", "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_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "logger_", "=_", "None_", ",_", "rgb", "map_", "=_", "None_", ",_", "settings_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image", "View_", "._", "Image", "View", "Base_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "logger_", "=_", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rgb", "map_", "=_", "rgb", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "=_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "surface_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Acco", "rdin", "g", " ", "to", " ", "Open", "CV", " ", "documentation", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "If", " ", "you", " ", "are", " ", "usi", "ng", " ", "your", " ", "own", " ", "image", " ", "render", "ing", " ", "and", " ", "I", "/", "O", " ", "function", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "can", " ", "use", " ", "any", " ", "channel", " ", "orderi", "ng", ".", " ", "The", " ", "drawing", " ", "function", "s", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "each", " ", "channel", " ", "independent", "ly", " ", "and", " ", "do", " ", "not", " ", "depend", " ", "on", " ", "the", " ", "channel_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "order", " ", "or", " ", "even", " ", "on", " ", "the", " ", "used", " ", "color", " ", "space", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".\\u", "rgb", "\\u", "order", " ", "=", " ", "'", "BG", "RA", "'_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "rgb", "\\u", "order_", "=_", "'", "RGB", "A", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "renderer_", "=_", "Can", "vas", "Renderer_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cursors", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cursor_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "\\u_", "._", "set", "Defaults_", "(_", "show", "\\u", "pan", "\\u", "position_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ons", "creen", "\\u", "ff_", "=_", "'", "San", "s", " ", "Ser", "if", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "surface_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "surface_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "image_", "(_", "self_", ",_", "rgb", "obj_", ",_", "dst", "\\u", "x_", ",_", "dst", "\\u", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", " ", "the", " ", "image", " ", "represent", "ed", " ", "by", " ", "(", "rgb", "obj", ")", " ", "at", " ", "dst", "\\u", "x", ",", " ", "dst", "\\u", "y", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "pixel", " ", "space", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "surface_", "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_", "canvas_", "=_", "self_", "._", "surface_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "redraw", " ", "surf", "ace", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "window", " ", "content", "s", " ", "as", " ", "an", " ", "array", " ", "and", " ", "store", " ", "it", " ", "int", "o", " ", "the", " ", "CV", " ", "surface_", "\\u\\u\\uNL\\u\\u\\u_", "rgb", "\\u", "arr_", "=_", "self_", "._", "getw", "in", "\\u", "array_", "(_", "order_", "=_", "self_", "._", "\\u", "rgb", "\\u", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "is", " ", "there", " ", "a", " ", "faste", "r", " ", "way", " ", "to", " ", "copy", " ", "this", " ", "array", " ", "in", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "canvas_", "[_", ":_", ",_", ":_", ",_", ":_", "]_", "=_", "rgb", "\\u", "arr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cr_", "=_", "Cv", "Help_", "._", "Cv", "Context_", "(_", "canvas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Draw", " ", "a", " ", "cross", " ", "in", " ", "the", " ", "center", " ", "of", " ", "the", " ", "window", " ", "in", " ", "debug", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "t", "\\u_", "[_", "'", "show", "\\u", "pan", "\\u", "position", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctr", "\\u", "x_", ",_", "ctr", "\\u", "y_", "=_", "self_", "._", "get", "\\u", "center_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pen_", "=_", "cr_", "._", "get", "\\u", "pen_", "(_", "'", "red", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cr_", "._", "line_", "(_", "(_", "ctr", "\\u", "x_", "-_", "10_", ",_", "ctr", "\\u", "y_", ")_", ",_", "(_", "ctr", "\\u", "x_", "+_", "10_", ",_", "ctr", "\\u", "y_", ")_", ",_", "pen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cr_", "._", "line_", "(_", "(_", "ctr", "\\u", "x_", ",_", "ctr", "\\u", "y_", "-_", "10_", ")_", ",_", "(_", "ctr", "\\u", "x_", ",_", "ctr", "\\u", "y_", "+_", "10_", ")_", ",_", "pen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "render", " ", "self", ".", "message_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font_", "=_", "cr_", "._", "get", "\\u", "font_", "(_", "self_", "._", "t", "\\u_", "[_", "'", "ons", "creen", "\\u", "ff", "'_", "]_", ",_", "14.0", "_", ",_", "self_", "._", "img", "\\u", "fg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "linewidth_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wd_", ",_", "ht_", "=_", "cr_", "._", "text", "\\u", "extents_", "(_", "self_", "._", "message_", ",_", "font_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "win", "\\u", "wd_", ",_", "img", "win", "\\u", "ht_", "=_", "self_", "._", "get", "\\u", "window", "\\u", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "(_", "(_", "img", "win", "\\u", "ht_", "//_", "3_", ")_", "*_", "2_", ")_", "-_", "(_", "ht_", "//_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "(_", "img", "win", "\\u", "wd_", "//_", "2_", ")_", "-_", "(_", "wd_", "//_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cr_", "._", "text_", "(_", "(_", "x_", ",_", "y_", ")_", ",_", "self_", "._", "message_", ",_", "font_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "debugg", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "save", "\\u", "rgb", "\\u", "image", "\\u", "as", "\\u", "file", "('", "/", "tmp", "/", "temp", ".", "png", "',", " ", "format", "='", "png", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "configur", "e\\u", "surface_", "(_", "self_", ",_", "width_", ",_", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "cv", " ", "surf", "ace", " ", "the", " ", "size", " ", "of", " ", "the", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "cv", " ", "just", " ", "use", "s", " ", "nump", "y", " ", "arrays", "!)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "depth_", "=_", "len_", "(_", "self_", "._", "\\u", "rgb", "\\u", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "surface_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "height_", ",_", "width_", ",_", "depth_", ")_", ",_", "numpy_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inform", " ", "the", " ", "base", " ", "class", " ", "abo", "ut", " ", "the", " ", "actual", " ", "window", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "configure_", "(_", "width_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "image", "\\u", "as", "\\u", "array_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "surface_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Image", "View", "Cv", "Error_", "(_", "\"", "No", " ", "Open", "Cv", " ", "surf", "ace", " ", "defin", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arr", "8_", "=_", "self_", "._", "get", "\\u", "surface_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "copy_", "(_", "arr", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "image", "\\u", "as", "\\u", "buffer_", "(_", "self_", ",_", "output_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ob", "uf_", "=_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ob", "uf_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ob", "uf_", "=_", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arr", "8_", "=_", "self_", "._", "get", "\\u", "image", "\\u", "as", "\\u", "array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ob", "uf_", "._", "write_", "(_", "arr", "8_", "._", "tostring_", "(_", "order_", "=_", "'", "C", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "output_", "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_", "return_", "ob", "uf_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "rgb", "\\u", "image", "\\u", "as", "\\u", "buffer_", "(_", "self_", ",_", "output_", "=_", "None_", ",_", "format_", "=_", "'", "png", "'_", ",_", "quality_", "=_", "90_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "have", "\\u", "PIL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Image", "View", "Cv", "Error_", "(_", "\"", "Ple", "ase", " ", "install", " ", "PI", "L", " ", "to", " ", "use", " ", "this", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "surface_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Image", "View", "Cv", "Error_", "(_", "\"", "No", " ", "CV", " ", "surf", "ace", " ", "defin", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ibu", "f_", "=_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ibu", "f_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ibu", "f_", "=_", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "PI", "L", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "image_", "=_", "PI", "Lim", "age_", "._", "froma", "rray_", "(_", "self_", "._", "surface_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "image_", "._", "save_", "(_", "ibu", "f_", ",_", "format_", "=_", "format_", ",_", "quality_", "=_", "quality_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output_", "is_", "not_", "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_", "return_", "ibu", "f_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "rgb", "\\u", "image", "\\u", "as", "\\u", "bytes_", "(_", "self_", ",_", "format_", "=_", "'", "png", "'_", ",_", "quality_", "=_", "90_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "self_", "._", "get", "\\u", "rgb", "\\u", "image", "\\u", "as", "\\u", "buffer_", "(_", "format_", "=_", "format_", ",_", "quality_", "=_", "quality_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "buf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "rgb", "\\u", "image", "\\u", "as", "\\u", "file_", "(_", "self_", ",_", "filepath_", ",_", "format_", "=_", "'", "png", "'_", ",_", "quality_", "=_", "90_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "have", "\\u", "PIL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Image", "View", "Cv", "Error_", "(_", "\"", "Ple", "ase", " ", "install", " ", "PI", "L", " ", "to", " ", "use", " ", "this", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "surface_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Image", "View", "Cv", "Error_", "(_", "\"", "No", " ", "CV", " ", "surf", "ace", " ", "defin", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "filepath_", ",_", "'", "w", "'_", ")_", "as_", "out", "\\u", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "\\u", "rgb", "\\u", "image", "\\u", "as", "\\u", "buffer_", "(_", "output_", "=_", "out", "\\u", "f_", ",_", "format_", "=_", "format_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "quality_", "=_", "quality_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "wrote", " ", "%", "s", " ", "file", " ", "'%", "s", "'\"_", "%_", "(_", "format_", ",_", "filepath_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "image_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "subclass", " ", "implement", "s", " ", "this", " ", "method", " ", "to", " ", "actual", "ly", " ", "update", " ", "a", " ", "widget_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "the", " ", "cv", " ", "surface_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "warning_", "(_", "\"", "Subc", "lass", " ", "shou", "ld", " ", "override", " ", "this", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "cursor_", "(_", "self_", ",_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "subclass", " ", "implement", "s", " ", "this", " ", "method", " ", "to", " ", "actual", "ly", " ", "set", " ", "a", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cursor", " ", "on", " ", "a", " ", "widget_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "warning_", "(_", "\"", "Subc", "lass", " ", "shou", "ld", " ", "override", " ", "this", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "defin", "e\\u", "cursor_", "(_", "self_", ",_", "ctype_", ",_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cursor_", "[_", "ctype_", "]_", "=_", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cursor_", "(_", "self_", ",_", "ctype_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "cursor_", "[_", "ctype_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "switch", "\\u", "cursor_", "(_", "self_", ",_", "ctype_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "cursor_", "(_", "self_", "._", "cursor_", "[_", "ctype_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "rgb", "\\u", "order_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "rgb", "\\u", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ons", "creen", "\\u", "message_", "(_", "self_", ",_", "text_", ",_", "delay_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "subclass", " ", "implement", "s", " ", "this", " ", "method", " ", "usi", "ng", " ", "a", " ", "timer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "warning_", "(_", "\"", "Subc", "lass", " ", "shou", "ld", " ", "override", " ", "this", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Cv", "_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "pan", "\\u", "mark_", "(_", "self_", ",_", "tf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "t", "\\u_", "._", "set_", "(_", "show",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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 ]
Non-standard exception raised in special method
amrdraz/kodr/app/brython/www/src/Lib/_collections.py
[ { "content": " def __hash__(self):\n #raise TypeError, \"deque objects are unhashable\"\n raise TypeError(\"deque objects are unhashable\")", "metadata": "root.deque.__hash__", "header": "['class', 'deque', ':', '___EOS___']", "index": 324 } ]
[ { "span": "def __hash__(self):", "start_line": 324, "start_column": 4, "end_line": 324, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Non", "_", "-_", "standard_", "exception_", "raised_", "in_", "special_", "method_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Type", "Error", ",", " ", "\"", "deq", "ue", " ", "object", "s", " ", "are", " ", "unh", "ash", "able", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "deq", "ue", " ", "object", "s", " ", "are", " ", "unh", "ash", "able", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
benadida/helios-server/helios/crypto/electionalgs.py
[ { "content": " def __init__(self, **kwargs):\n self.set_from_args(**kwargs)\n \n # generate uuid if need be\n if 'uuid' in self.FIELDS and (not hasattr(self, 'uuid') or self.uuid == None):\n self.uuid = str(uuid.uuid4())", "metadata": "root.HeliosObject.__init__", "header": "['class', 'HeliosObject', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": "class EncryptedAnswer(HeliosObject):\n \"\"\"\n An encrypted answer to a single election question\n \"\"\"\n\n FIELDS = ['choices', 'individual_proofs', 'overall_proof', 'randomness', 'answer']\n\n # FIXME: remove this constructor and use only named-var constructor from HeliosObject\n \n\n \n \n \n", "metadata": "root.EncryptedAnswer", "header": "['module', '___EOS___']", "index": 121 }, { "content": " def __init__(self, choices=None, individual_proofs=None, overall_proof=None, randomness=None, answer=None):\n self.choices = choices\n self.individual_proofs = individual_proofs\n self.overall_proof = overall_proof\n self.randomness = randomness\n self.answer = answer", "metadata": "root.EncryptedAnswer.__init__", "header": "['class', 'EncryptedAnswer', '(', 'HeliosObject', ')', ':', '___EOS___']", "index": 129 } ]
[ { "span": "class EncryptedAnswer(HeliosObject):", "start_line": 121, "start_column": 0, "end_line": 121, "end_column": 36 } ]
[ { "span": "def __init__(self, **kwargs):", "start_line": 22, "start_column": 2, "end_line": 22, "end_column": 31 }, { "span": "def __init__(self, choices=None, individual_proofs=None, overall_proof=None, randomness=None, answer=None):", "start_line": 129, "start_column": 2, "end_line": 129, "end_column": 109 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Heli", "os", "Object_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "from", "\\u", "args_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "uuid", " ", "if", " ", "need", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "uuid", "'_", "in_", "self_", "._", "FIELDS_", "and_", "(_", "not_", "hasattr_", "(_", "self_", ",_", "'", "uuid", "'_", ")_", "or_", "self_", "._", "uuid_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "uuid_", "=_", "str_", "(_", "uuid_", "._", "uuid4_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Encrypt", "ed", "Answer_", "(_", "Heli", "os", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "An", " ", "encrypt", "ed", " ", "answer", " ", "to", " ", "a", " ", "single", " ", "election", " ", "question", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FIELDS_", "=_", "[_", "'", "choice", "s", "'_", ",_", "'", "individual", "\\u", "proof", "s", "'_", ",_", "'", "over", "all", "\\u", "proof", "'_", ",_", "'", "random", "ness", "'_", ",_", "'", "answer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "remove", " ", "this", " ", "construct", "or", " ", "and", " ", "use", " ", "only", " ", "named", "-", "var", " ", "construct", "or", " ", "from", " ", "Heli", "os", "Object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Encrypt", "ed", "Answer_", "(_", "Heli", "os", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "choices_", "=_", "None_", ",_", "individual", "\\u", "proof", "s_", "=_", "None_", ",_", "over", "all", "\\u", "proof", "_", "=_", "None_", ",_", "random", "ness_", "=_", "None_", ",_", "answer_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "choices_", "=_", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "individual", "\\u", "proof", "s_", "=_", "individual", "\\u", "proof", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "over", "all", "\\u", "proof", "_", "=_", "over", "all", "\\u", "proof", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "random", "ness_", "=_", "random", "ness_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "answer_", "=_", "answer_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
PyTables/PyTables/tables/tests/test_do_undo.py
[ { "content": "def populateTable(where, name):\n \"\"\"Create a table under where with name name\"\"\"\n\n class Indexed(IsDescription):\n var1 = StringCol(itemsize=4, dflt=b\"\", pos=1)\n var2 = BoolCol(dflt=0, pos=2)\n var3 = IntCol(dflt=0, pos=3)\n var4 = FloatCol(dflt=0, pos=4)\n\n nrows = minRowIndex\n table = where._v_file.create_table(where, name, Indexed, \"Indexed\",\n None, nrows)\n for i in range(nrows):\n table.row['var1'] = str(i)\n\n # table.row['var2'] = i > 2\n table.row['var2'] = i % 2\n table.row['var3'] = i\n table.row['var4'] = float(nrows - i - 1)\n table.row.append()\n table.flush()\n\n # Index all entries:\n indexrows = table.cols.var1.create_index()\n indexrows = table.cols.var2.create_index()\n indexrows = table.cols.var3.create_index()\n\n # Do not index the var4 column\n # indexrows = table.cols.var4.create_index()\n if common.verbose:\n print(\"Number of written rows:\", nrows)\n print(\"Number of indexed rows:\", table.cols.var1.index.nelements)\n print(\"Number of indexed rows(2):\", indexrows)", "metadata": "root.populateTable", "header": "['module', '___EOS___']", "index": 1320 }, { "content": " def test00b_copyTable(self):\n \"\"\"Checking copy_node (over Tables)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00b_copyTable...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # /table => /agroup/agroup3/\n warnings.filterwarnings(\"ignore\", category=UserWarning)\n table = self.h5file.copy_node(\n '/table', '/agroup/agroup3', propindexes=True)\n warnings.filterwarnings(\"default\", category=UserWarning)\n self.assertTrue(\"/agroup/agroup3/table\" in self.h5file)\n\n table = self.h5file.root.agroup.agroup3.table\n self.assertEqual(table.title, \"Indexed\")\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n self.assertTrue(table.cols.var4.index is None)\n\n # Now undo the past operation\n self.h5file.undo()\n table = self.h5file.root.table\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertTrue(table.cols.var4.index is None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n\n # Check that the copied node does not exist in the object tree.\n self.assertTrue(\"/agroup/agroup3/table\" not in self.h5file)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that table has come back to life in a sane state\n self.assertTrue(\"/table\" in self.h5file)\n self.assertTrue(\"/agroup/agroup3/table\" in self.h5file)\n table = self.h5file.root.agroup.agroup3.table\n self.assertEqual(table.title, \"Indexed\")\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n self.assertTrue(table.cols.var4.index is None)", "metadata": "root.CopyNodeTestCase.test00b_copyTable", "header": "['class', 'CopyNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2038 }, { "content": " def test00(self):\n \"\"\"Mix of create_array, create_group, renameNone, move_node,\n remove_node, copy_node and copy_children.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00...\" % self.__class__.__name__)\n\n # Enable undo/redo.\n self.h5file.enable_undo()\n\n # Create an array\n self.h5file.create_array(self.h5file.root, 'anarray3',\n [1], \"Array title 3\")\n # Create a group\n self.h5file.create_group(self.h5file.root, 'agroup3', \"Group title 3\")\n\n # /anarray => /agroup/agroup3/\n new_node = self.h5file.copy_node('/anarray3', '/agroup/agroup3')\n new_node = self.h5file.copy_children(\n '/agroup', '/agroup3', recursive=1)\n\n # rename anarray\n self.h5file.rename_node('/anarray', 'anarray4')\n\n # Move anarray\n new_node = self.h5file.copy_node('/anarray3', '/agroup')\n\n # Remove anarray4\n self.h5file.remove_node('/anarray4')\n\n # Undo the actions\n self.h5file.undo()\n self.assertTrue('/anarray4' not in self.h5file)\n self.assertTrue('/anarray3' not in self.h5file)\n self.assertTrue('/agroup/agroup3/anarray3' not in self.h5file)\n self.assertTrue('/agroup3' not in self.h5file)\n self.assertTrue('/anarray4' not in self.h5file)\n self.assertTrue('/anarray' in self.h5file)\n\n # Redo the actions\n self.h5file.redo()\n\n # Check that the copied node exists again in the object tree.\n self.assertTrue('/agroup/agroup3/anarray3' in self.h5file)\n self.assertTrue('/agroup/anarray3' in self.h5file)\n self.assertTrue('/agroup3/agroup3/anarray3' in self.h5file)\n self.assertTrue('/agroup3/anarray3' not in self.h5file)\n self.assertTrue(self.h5file.root.agroup.anarray3 is new_node)\n self.assertTrue('/anarray' not in self.h5file)\n self.assertTrue('/anarray4' not in self.h5file)", "metadata": "root.ComplexTestCase.test00", "header": "['class', 'ComplexTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2217 } ]
[ { "span": "indexrows ", "start_line": 1343, "start_column": 4, "end_line": 1343, "end_column": 13 }, { "span": "indexrows ", "start_line": 1344, "start_column": 4, "end_line": 1344, "end_column": 13 }, { "span": "table ", "start_line": 2050, "start_column": 8, "end_line": 2050, "end_column": 13 }, { "span": "new_node ", "start_line": 2235, "start_column": 8, "end_line": 2235, "end_column": 16 }, { "span": "new_node ", "start_line": 2236, "start_column": 8, "end_line": 2236, "end_column": 16 } ]
[ { "span": "indexrows ", "start_line": 1345, "start_column": 4, "end_line": 1345, "end_column": 13 }, { "span": "table ", "start_line": 2055, "start_column": 8, "end_line": 2055, "end_column": 13 }, { "span": "new_node ", "start_line": 2243, "start_column": 8, "end_line": 2243, "end_column": 16 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "populate", "Table_", "(_", "where_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "table", " ", "under", " ", "where", " ", "with", " ", "name", " ", "name", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Indexe", "d_", "(_", "Is", "Description_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var1_", "=_", "String", "Col_", "(_", "itemsize_", "=_", "4_", ",_", "dfl", "t_", "=_", "b", "\"\"_", ",_", "pos_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var2_", "=_", "Boo", "l", "Col_", "(_", "dfl", "t_", "=_", "0_", ",_", "pos_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "3_", "=_", "Int", "Col_", "(_", "dfl", "t_", "=_", "0_", ",_", "pos_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "4_", "=_", "Float", "Col_", "(_", "dfl", "t_", "=_", "0_", ",_", "pos_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nrows_", "=_", "min", "Row", "Index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "where_", "._", "\\u", "v", "\\u", "file_", "._", "create", "\\u", "table_", "(_", "where_", ",_", "name_", ",_", "Indexe", "d_", ",_", "\"", "Indexe", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "nrows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nrows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "._", "row_", "[_", "'", "var", "1", "'_", "]_", "=_", "str_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "table", ".", "row", "['", "var", "2", "']", " ", "=", " ", "i", " ", ">", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "._", "row_", "[_", "'", "var", "2", "'_", "]_", "=_", "i_", "%_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "row_", "[_", "'", "var", "3", "'_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "row_", "[_", "'", "var", "4", "'_", "]_", "=_", "float_", "(_", "nrows_", "-_", "i_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "row_", "._", "append_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Index", " ", "all", " ", "entri", "es", ":_", "\\u\\u\\uNL\\u\\u\\u_", "index", "rows_", "=_", "table_", "._", "cols_", "._", "var1_", "._", "create", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "rows_", "=_", "table_", "._", "cols_", "._", "var2_", "._", "create", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "rows_", "=_", "table_", "._", "cols_", "._", "var", "3_", "._", "create", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "not", " ", "index", " ", "the", " ", "var", "4", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "index", "rows", " ", "=", " ", "table", ".", "cols", ".", "var", "4", ".", "create", "\\u", "index", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Number", " ", "of", " ", "writt", "en", " ", "rows", ":\"_", ",_", "nrows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Number", " ", "of", " ", "indexe", "d", " ", "rows", ":\"_", ",_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Number", " ", "of", " ", "indexe", "d", " ", "rows", "(", "2", "):\"_", ",_", "index", "rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Copy", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0b", "\\u", "copy", "Table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "copy", "\\u", "node", " ", "(", "over", " ", "Table", "s", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0b", "\\u", "copy", "Table", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "table", " ", "=>", " ", "/", "agr", "oup", "/", "agr", "oup", "3", "/_", "\\u\\u\\uNL\\u\\u\\u_", "warnings_", "._", "filterw", "arnings", "_", "(_", "\"", "ignore", "\"_", ",_", "category_", "=_", "User", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "table", "'_", ",_", "'/", "agr", "oup", "/", "agr", "oup", "3", "'_", ",_", "prop", "indexes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "filterw", "arnings", "_", "(_", "\"", "default", "\"_", ",_", "category_", "=_", "User", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "/", "table", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "agr", "oup", "3_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "title_", ",_", "\"", "Indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "node", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "/", "table", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "table", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "table", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "/", "table", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "agr", "oup", "3_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "title_", ",_", "\"", "Indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comple", "x", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mix", " ", "of", " ", "create", "\\u", "array", ",", " ", "create", "\\u", "group", ",", " ", "rename", "Non", "e", ",", " ", "move", "\\u", "node", ",", "\\", "10", ";", " ", " ", " ", " ", "remove", "\\u", "node", ",", " ", "copy", "\\u", "node", " ", "and", " ", "copy", "\\u", "child", "ren", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0.", "..\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "undo", "/", "redo", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "ana", "rray", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "1_", "]_", ",_", "\"", "Array", " ", "title", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "agr", "oup", "3", "'_", ",_", "\"", "Group", " ", "title", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "ana", "rray", " ", "=>", " ", "/", "agr", "oup", "/", "agr", "oup", "3", "/_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "node_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "node_", "(_", "'/", "ana", "rray", "3", "'_", ",_", "'/", "agr", "oup", "/", "agr", "oup", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "node_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "children_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "agr", "oup", "'_", ",_", "'/", "agr", "oup", "3", "'_", ",_", "recursive_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rename", " ", "ana", "rray_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "rename", "\\u", "node_", "(_", "'/", "ana", "rray", "'_", ",_", "'", "ana", "rray", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Move", " ", "ana", "rray_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "node_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "node_", "(_", "'/", "ana", "rray", "3", "'_", ",_", "'/", "agr", "oup", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "ana", "rray", "4_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "ana", "rray", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Und", "o", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "4", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "3", "/", "ana", "rray", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "4", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "node", " ", "exist", "s", " ", "again", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "3", "/", "ana", "rray", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "ana", "rray", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "3", "/", "agr", "oup", "3", "/", "ana", "rray", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "3", "/", "ana", "rray", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "ana", "rray", "3_", "is_", "new", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "4", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\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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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 ]
Unused local variable
hacktoolkit/hacktoolkit/apis/forecast.io/forecast.py
[ { "content": "def main(argv = None):\n OPT_STR = 'ht:'\n OPT_LIST = [\n 'help',\n '--timestamp=',\n ]\n timestamp = None\n if argv is None:\n argv = sys.argv\n try:\n try:\n progname = argv[0]\n opts, args = getopt.getopt(argv[1:],\n OPT_STR,\n OPT_LIST)\n except getopt.error, msg:\n raise Usage(msg)\n # process options\n for o, a in opts:\n if o in ('-h', '--help'):\n print __doc__\n sys.exit(0)\n elif o in ('-t', '--timestamp='):\n timestamp = a\n # process arguments\n if len(args) == 2:\n forecast = get_forecast(args[0], args[1], timestamp=timestamp)\n print forecast\n else:\n raise Usage('Incorrect arguments')\n \n except Usage, err:\n print >> sys.stderr, err.msg\n print >> sys.stderr, \"for help use --help\"\n return 3.14159", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 31 } ]
[ { "span": "progname ", "start_line": 42, "start_column": 12, "end_line": 42, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", "argv_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "OPT", "\\u", "STR_", "=_", "'", "ht", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OPT", "\\u", "LIST_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "help", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "timestamp", "='_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "argv_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argv_", "=_", "sys_", "._", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prog", "name_", "=_", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "argv_", "[_", "1_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "OPT", "\\u", "STR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "OPT", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "error_", ",_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Usage_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "in_", "(_", "'-", "h", "'_", ",_", "'--", "help", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "in_", "(_", "'-", "t", "'_", ",_", "'--", "timestamp", "='_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forecast_", "=_", "get", "\\u", "forecast_", "(_", "args_", "[_", "0_", "]_", ",_", "args_", "[_", "1_", "]_", ",_", "timestamp_", "=_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "forecast_", "\\u\\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_", "Usage_", "(_", "'", "Inco", "rrect", " ", "argu", "ment", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Usage_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "err_", "._", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "for", " ", "help", " ", "use", " ", "--", "help", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "3.14", "159_", "\\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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
infinitezxc/kaggle-avazu/script/ftrl_2.py
[ { "content": " def update(self, x, p, y):\n ''' Update model using x, p, y\n\n INPUT:\n x: feature, a list of indices\n p: click probability prediction of our model\n y: answer\n\n MODIFIES:\n self.n: increase by squared gradient\n self.z: weights\n '''\n\n # parameter\n alpha = self.alpha\n\n # model\n n = self.n\n z = self.z\n w = self.w\n\n # gradient under logloss\n g = p - y\n\n # update z and n\n tmp = 0\n for i in self._indices(x):\n sigma = (sqrt(n[i] + g * g) - sqrt(n[i])) / alpha\n z[i] += g - sigma * w[i]\n n[i] += g * g\n sign = -1. if z[i] < 0 else 1. # get sign of z[i]\n # build w using z and n\n if sign * z[i] <= L1:\n # w[i] vanishes due to L1 regularization\n w[i] = 0.\n else:\n # apply prediction time L1, L2 regularization to z and get w\n w[i] = (sign * L1 - z[i]) / ((beta + sqrt(n[i])) / alpha + L2)", "metadata": "root.ftrl_proximal.update", "header": "['class', 'ftrl_proximal', '(', 'object', ')', ':', '___EOS___']", "index": 146 } ]
[ { "span": "tmp ", "start_line": 171, "start_column": 8, "end_line": 171, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "ftr", "l\\u", "proxim", "al_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "x_", ",_", "p_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Update", " ", "model", " ", "usi", "ng", " ", "x", ",", " ", "p", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "INPUT", ":", "\\", "10", ";", " ", " ", " ", " ", "x", ":", " ", "feature", ",", " ", "a", " ", "list", " ", "of", " ", "indice", "s", "\\", "10", ";", " ", " ", " ", " ", "p", ":", " ", "click", " ", "probabilit", "y", " ", "predicti", "on", " ", "of", " ", "our", " ", "model", "\\", "10", ";", " ", " ", " ", " ", "y", ":", " ", "answer", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "MODIFIE", "S", ":", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "n", ":", " ", "increase", " ", "by", " ", "square", "d", " ", "gradi", "ent", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "z", ":", " ", "weight", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parameter_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "self_", "._", "alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "self_", "._", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "self_", "._", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "self_", "._", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gradi", "ent", " ", "under", " ", "loglo", "ss_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "p_", "-_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "z", " ", "and", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "self_", "._", "\\u", "indices_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sigma_", "=_", "(_", "sqrt_", "(_", "n_", "[_", "i_", "]_", "+_", "g_", "*_", "g_", ")_", "-_", "sqrt_", "(_", "n_", "[_", "i_", "]_", ")_", ")_", "/_", "alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "[_", "i_", "]_", "+=_", "g_", "-_", "sigma_", "*_", "w_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "[_", "i_", "]_", "+=_", "g_", "*_", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sign_", "=_", "-_", "1._", "if_", "z_", "[_", "i_", "]_", "<_", "0_", "else_", "1._", "#", " ", "get", " ", "sign", " ", "of", " ", "z", "[", "i", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "w", " ", "usi", "ng", " ", "z", " ", "and", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sign_", "*_", "z_", "[_", "i_", "]_", "<=_", "L1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "w", "[", "i", "]", " ", "vani", "she", "s", " ", "due", " ", "to", " ", "L1", " ", "regularization", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "[_", "i_", "]_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "appl", "y", " ", "predicti", "on", " ", "time", " ", "L1", ",", " ", "L", "2", " ", "regularization", " ", "to", " ", "z", " ", "and", " ", "get", " ", "w_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "[_", "i_", "]_", "=_", "(_", "sign_", "*_", "L1_", "-_", "z_", "[_", "i_", "]_", ")_", "/_", "(_", "(_", "beta_", "+_", "sqrt_", "(_", "n_", "[_", "i_", "]_", ")_", ")_", "/_", "alpha_", "+_", "L2_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
open-cloud/xos/xos/core/admin.py
[ { "content": "def dollar_field(fieldName, short_description):\n def newFunc(self, obj):\n try:\n x = \"$ %0.2f\" % float(getattr(obj, fieldName, 0.0))\n except:\n x = getattr(obj, fieldName, 0.0)\n return x\n newFunc.short_description = short_description\n return newFunc", "metadata": "root.dollar_field", "header": "['module', '___EOS___']", "index": 2180 }, { "content": "def right_dollar_field(fieldName, short_description):\n def newFunc(self, obj):\n try:\n #x= '<div align=right style=\"width:6em\">$ %0.2f</div>' % float(getattr(obj, fieldName, 0.0))\n x = '<div align=right>$ %0.2f</div>' % float(\n getattr(obj, fieldName, 0.0))\n except:\n x = getattr(obj, fieldName, 0.0)\n return x\n newFunc.short_description = short_description\n newFunc.allow_tags = True\n return newFunc", "metadata": "root.right_dollar_field", "header": "['module', '___EOS___']", "index": 2191 } ]
[ { "span": "except:", "start_line": 2184, "start_column": 8, "end_line": 2184, "end_column": 15 }, { "span": "except:", "start_line": 2197, "start_column": 8, "end_line": 2197, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dollar", "\\u", "field_", "(_", "field", "Name_", ",_", "short", "\\u", "description_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "new", "Func_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "\"$", " ", "%", "0.", "2f", "\"_", "%_", "float_", "(_", "getattr_", "(_", "obj_", ",_", "field", "Name_", ",_", "0.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "getattr_", "(_", "obj_", ",_", "field", "Name_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Func_", "._", "short", "\\u", "description_", "=_", "short", "\\u", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new", "Func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "right", "\\u", "dollar", "\\u", "field_", "(_", "field", "Name_", ",_", "short", "\\u", "description_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "new", "Func_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "x", "=", " ", "'<", "div", " ", "align", "=", "right", " ", "style", "=\"", "widt", "h", ":", "6e", "m", "\">", "$", " ", "%", "0.", "2f", "</", "div", ">'", " ", "%", " ", "float", "(", "getattr", "(", "obj", ",", " ", "field", "Name", ",", " ", "0.", "0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "'<", "div", " ", "align", "=", "right", ">", "$", " ", "%", "0.", "2f", "</", "div", ">'_", "%_", "float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "getattr_", "(_", "obj_", ",_", "field", "Name_", ",_", "0.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "getattr_", "(_", "obj_", ",_", "field", "Name_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Func_", "._", "short", "\\u", "description_", "=_", "short", "\\u", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Func_", "._", "allow", "\\u", "tags_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new", "Func_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
nltk/nltk/nltk/sem/__init__.py
[ { "content": "# Natural Language Toolkit: Semantic Interpretation\n#\n# Copyright (C) 2001-2016 NLTK Project\n# Author: Ewan Klein <[email protected]>\n# URL: <http://nltk.org/>\n# For license information, see LICENSE.TXT\n\n\"\"\"\nNLTK Semantic Interpretation Package\n\nThis package contains classes for representing semantic structure in\nformulas of first-order logic and for evaluating such formulas in\nset-theoretic models.\n\n >>> from nltk.sem import logic\n >>> logic._counter._value = 0\n\nThe package has two main components:\n\n - ``logic`` provides support for analyzing expressions of First\n Order Logic (FOL).\n - ``evaluate`` allows users to recursively determine truth in a\n model for formulas of FOL.\n\nA model consists of a domain of discourse and a valuation function,\nwhich assigns values to non-logical constants. We assume that entities\nin the domain are represented as strings such as ``'b1'``, ``'g1'``,\netc. A ``Valuation`` is initialized with a list of (symbol, value)\npairs, where values are entities, sets of entities or sets of tuples\nof entities.\nThe domain of discourse can be inferred from the valuation, and model\nis then created with domain and valuation as parameters.\n\n >>> from nltk.sem import Valuation, Model\n >>> v = [('adam', 'b1'), ('betty', 'g1'), ('fido', 'd1'),\n ... ('girl', set(['g1', 'g2'])), ('boy', set(['b1', 'b2'])),\n ... ('dog', set(['d1'])),\n ... ('love', set([('b1', 'g1'), ('b2', 'g2'), ('g1', 'b1'), ('g2', 'b1')]))]\n >>> val = Valuation(v)\n >>> dom = val.domain\n >>> m = Model(dom, val)\n\"\"\"\n\nfrom nltk.sem.util import (parse_sents, interpret_sents, evaluate_sents,\n root_semrep)\nfrom nltk.sem.evaluate import (Valuation, Assignment, Model, Undefined,\n is_rel, set2rel, arity, read_valuation)\nfrom nltk.sem.logic import (boolean_ops, binding_ops, equality_preds,\n read_logic, Variable, Expression,\n ApplicationExpression, LogicalExpressionException)\nfrom nltk.sem.skolemize import skolemize\nfrom nltk.sem.lfg import FStructure\nfrom nltk.sem.relextract import (extract_rels, rtuple, clause)\nfrom nltk.sem.boxer import Boxer\nfrom nltk.sem.drt import DrtExpression, DRS\n\n# from nltk.sem.glue import Glue\n# from nltk.sem.hole import HoleSemantics\n# from nltk.sem.cooper_storage import CooperStore\n\n# don't import chat80 as its names are too generic\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from nltk.sem.util import (parse_sents, interpret_sents, evaluate_sents,\n root_semrep)", "start_line": 43, "start_column": 0, "end_line": 44, "end_column": 39 }, { "span": "from nltk.sem.logic import (boolean_ops, binding_ops, equality_preds,\n read_logic, Variable, Expression,\n ApplicationExpression, LogicalExpressionException)", "start_line": 47, "start_column": 0, "end_line": 49, "end_column": 77 }, { "span": "from nltk.sem.skolemize import skolemize", "start_line": 50, "start_column": 0, "end_line": 50, "end_column": 40 }, { "span": "from nltk.sem.lfg import FStructure", "start_line": 51, "start_column": 0, "end_line": 51, "end_column": 35 }, { "span": "from nltk.sem.relextract import (extract_rels, rtuple, clause)", "start_line": 52, "start_column": 0, "end_line": 52, "end_column": 62 }, { "span": "from nltk.sem.boxer import Boxer", "start_line": 53, "start_column": 0, "end_line": 53, "end_column": 32 }, { "span": "from nltk.sem.drt import DrtExpression, DRS", "start_line": 54, "start_column": 0, "end_line": 54, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Nat", "ural", " ", "Lang", "ua", "ge", " ", "Tool", "kit", ":", " ", "Semantic", " ", "Interpret", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "1", "-", "2016", " ", "NL", "TK", " ", "Project_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", ":", " ", "Ew", "an", " ", "Kl", "ein", " ", "<", "ewa", "n", "@", "inf", ".", "ed", ".", "ac", ".", "uk", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", ":", " ", "<", "http", "://", "nlt", "k", ".", "org", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "license", " ", "informati", "on", ",", " ", "see", " ", "LICENSE", ".", "TXT", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "NL", "TK", " ", "Semantic", " ", "Interpret", "ation", " ", "Packa", "ge", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "package", " ", "contain", "s", " ", "classe", "s", " ", "for", " ", "represent", "ing", " ", "sema", "ntic", " ", "structure", " ", "in", "\\", "10", ";", "formulas", " ", "of", " ", "first", "-", "order", " ", "logic", " ", "and", " ", "for", " ", "evaluat", "ing", " ", "suc", "h", " ", "formulas", " ", "in", "\\", "10", ";", "set", "-", "theore", "tic", " ", "model", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "nlt", "k", ".", "sem", " ", "import", " ", "logic", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "logic", ".\\u", "counter", ".\\u", "value", " ", "=", " ", "0", "\\", "10", ";", "\\", "10", ";", "The", " ", "package", " ", "has", " ", "two", " ", "main", " ", "component", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", "-", " ", "``", "logic", "``", " ", "provide", "s", " ", "support", " ", "for", " ", "analy", "zin", "g", " ", "express", "ion", "s", " ", "of", " ", "Fi", "rst", "\\", "10", ";", " ", " ", " ", "Order", " ", "Logi", "c", " ", "(", "FOL", ").", "\\", "10", ";", " ", "-", " ", "``", "evaluate", "``", " ", "allow", "s", " ", "users", " ", "to", " ", "recurs", "ively", " ", "dete", "rmin", "e", " ", "truth", " ", "in", " ", "a", "\\", "10", ";", " ", " ", " ", "model", " ", "for", " ", "formulas", " ", "of", " ", "FOL", ".", "\\", "10", ";", "\\", "10", ";", "A", " ", "model", " ", "consi", "sts", " ", "of", " ", "a", " ", "domain", " ", "of", " ", "discou", "rse", " ", "and", " ", "a", " ", "valuation", " ", "function", ",", "\\", "10", ";", "whi", "ch", " ", "assign", "s", " ", "values", " ", "to", " ", "non", "-", "logical", " ", "constant", "s", ".", " ", "We", " ", "assume", " ", "tha", "t", " ", "entit", "ies", "\\", "10", ";", "in", " ", "the", " ", "domain", " ", "are", " ", "represent", "ed", " ", "as", " ", "string", "s", " ", "suc", "h", " ", "as", " ", "``", "'", "b1", "'``", ",", " ", "``", "'", "g1", "'``", ",", "\\", "10", ";", "etc", ".", " ", "A", " ", "``", "Val", "uation", "``", " ", "is", " ", "initialize", "d", " ", "with", " ", "a", " ", "list", " ", "of", " ", "(", "symbol", ",", " ", "value", ")", "\\", "10", ";", "pair", "s", ",", " ", "where", " ", "values", " ", "are", " ", "entit", "ies", ",", " ", "sets", " ", "of", " ", "entit", "ies", " ", "or", " ", "sets", " ", "of", " ", "tuple", "s", "\\", "10", ";", "of", " ", "entit", "ies", ".", "\\", "10", ";", "The", " ", "domain", " ", "of", " ", "discou", "rse", " ", "can", " ", "be", " ", "inferred", " ", "from", " ", "the", " ", "valuation", ",", " ", "and", " ", "model", "\\", "10", ";", "is", " ", "then", " ", "created", " ", "with", " ", "domain", " ", "and", " ", "valuation", " ", "as", " ", "parameter", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "nlt", "k", ".", "sem", " ", "import", " ", "Val", "uation", ",", " ", "Model", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "v", " ", "=", " ", "[(", "'", "adam", "',", " ", "'", "b1", "')", ",", " ", "('", "bett", "y", "',", " ", "'", "g1", "')", ",", " ", "('", "fid", "o", "',", " ", "'", "d1", "')", ",", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "('", "girl", "',", " ", "set", "([", "'", "g1", "',", " ", "'", "g2", "'])", "),", " ", "('", "boy", "',", " ", "set", "([", "'", "b1", "',", " ", "'", "b2", "'])", "),", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "('", "dog", "',", " ", "set", "([", "'", "d1", "'])", "),", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "('", "love", "',", " ", "set", "([(", "'", "b1", "',", " ", "'", "g1", "')", ",", " ", "('", "b2", "',", " ", "'", "g2", "')", ",", " ", "('", "g1", "',", " ", "'", "b1", "')", ",", " ", "('", "g2", "',", " ", "'", "b1", "')]", "))", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "val", " ", "=", " ", "Val", "uation", "(", "v", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dom", " ", "=", " ", "val", ".", "domain", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "m", " ", "=", " ", "Model", "(", "dom", ",", " ", "val", ")", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nltk_", "._", "sem_", "._", "util_", "import_", "(_", "parse", "\\u", "sents_", ",_", "interpret", "\\u", "sents_", ",_", "evaluate", "\\u", "sents_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "root", "\\u", "sem", "rep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "sem_", "._", "evaluate_", "import_", "(_", "Val", "uation", "_", ",_", "Assignment_", ",_", "Model_", ",_", "Unde", "fined", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "rel_", ",_", "set", "2r", "el_", ",_", "arity_", ",_", "read", "\\u", "valuation", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "sem_", "._", "logic_", "import_", "(_", "boolean", "\\u", "ops_", ",_", "bindi", "ng", "\\u", "ops_", ",_", "equality", "\\u", "preds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "logic_", ",_", "Variable_", ",_", "Expression_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Applica", "tion", "Expression_", ",_", "Logi", "cal", "Expression", "Exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "sem_", "._", "sko", "lem", "ize_", "import_", "sko", "lem", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "sem_", "._", "lf", "g_", "import_", "FS", "truct", "ure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "sem_", "._", "rele", "xtra", "ct_", "import_", "(_", "extract", "\\u", "rels_", ",_", "rtu", "ple_", ",_", "clause_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "sem_", "._", "box", "er_", "import_", "Box", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "sem_", "._", "dr", "t_", "import_", "Dr", "t", "Expression_", ",_", "DR", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "nlt", "k", ".", "sem", ".", "glue", " ", "import", " ", "Glu", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "nlt", "k", ".", "sem", ".", "hole", " ", "import", " ", "Hole", "Semantic", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "nlt", "k", ".", "sem", ".", "coop", "er", "\\u", "storage", " ", "import", " ", "Coo", "per", "Store_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "import", " ", "chat", "80", " ", "as", " ", "its", " ", "names", " ", "are", " ", "too", " ", "generic_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
Kitware/minerva/plugin_tests/dataset_test.py
[ { "content": " def testDataset(self):\n \"\"\"\n Test the minerva dataset API enppoints.\n \"\"\"\n\n # at first the dataset folder is None\n\n path = '/minerva_dataset/folder'\n params = {\n 'userId': self._user['_id'],\n }\n response = self.request(path=path, method='GET', params=params)\n self.assertStatusOk(response)\n folder = response.json['folder']\n self.assertEquals(folder, None)\n\n # create a dataset folder\n\n response = self.request(path=path, method='POST', params=params)\n self.assertStatus(response, 401) # unauthorized\n\n response = self.request(path=path, method='POST', params=params, user=self._user)\n\n self.assertStatusOk(response)\n folder = response.json['folder']\n self.assertNotEquals(folder, None)\n self.assertEquals(folder['baseParentType'], 'user')\n self.assertEquals(folder['baseParentId'], str(self._user['_id']))\n\n # get the folder now that is has been created\n\n response = self.request(path=path, method='GET', params=params)\n self.assertStatusOk(response)\n # response should be Null b/c we don't have permissions to see anything\n # TODO is it better to always make it private and just throw a 401 in this case ?\n folder = response.json['folder']\n self.assertEquals(folder, None)\n\n # get the folder passing in the user\n\n response = self.request(path=path, method='GET', params=params, user=self._user)\n\n self.assertStatusOk(response)\n folder = response.json['folder']\n self.assertNotEquals(folder, None)\n self.assertEquals(folder['baseParentType'], 'user')\n self.assertEquals(folder['baseParentId'], str(self._user['_id']))\n\n # create some items in the dataset folder, even though these aren't real datasets\n # this exercises the endpoint to return datasets\n\n params = {\n 'name': 'item1',\n 'folderId': folder['_id']\n }\n response = self.request(path='/item', method='POST', params=params,\n user=self._user)\n item1Id = response.json['_id']\n params = {\n 'name': 'item2',\n 'folderId': folder['_id']\n }\n response = self.request(path='/item', method='POST', params=params,\n user=self._user)\n item2Id = response.json['_id']\n\n path = '/minerva_dataset'\n params = {\n 'userId': self._user['_id'],\n }\n\n # need to check with user and without\n\n response = self.request(path=path, method='GET', params=params)\n # should have no responses because we didn't pass in a user\n self.assertStatusOk(response)\n self.assertEquals(len(response.json), 0)\n\n response = self.request(path=path, method='GET', params=params, user=self._user)\n self.assertStatusOk(response)\n self.assertEquals(len(response.json), 2)\n datasetIds = [d['_id'] for d in response.json]\n self.assertTrue(item1Id in datasetIds, \"expected item1Id in datasets\")\n self.assertTrue(item2Id in datasetIds, \"expected item2Id in datasets\")\n\n #\n # Test minerva_dataset/id/item creating a dataset from uploads\n #\n\n def createDataset(itemname, files, error=None):\n # create the item\n params = {\n 'name': itemname,\n 'folderId': folder['_id']\n }\n response = self.request(path='/item', method='POST', params=params, user=self._user)\n self.assertStatusOk(response)\n itemId = response.json['_id']\n\n for itemfile in files:\n filename = itemfile['name']\n filepath = itemfile['path']\n mimeType = itemfile['mimeType']\n sizeBytes = os.stat(filepath).st_size\n\n # create the file\n response = self.request(\n path='/file',\n method='POST',\n user=self._user,\n params={\n 'parentType': 'item',\n 'parentId': itemId,\n 'name': filename,\n 'size': sizeBytes,\n 'mimeType': mimeType\n }\n )\n self.assertStatusOk(response)\n uploadId = response.json['_id']\n\n # upload the file contents\n with open(filepath, 'rb') as file:\n filedata = file.read()\n\n response = self.multipartRequest(\n path='/file/chunk',\n user=self._user,\n fields=[('offset', 0), ('uploadId', uploadId)],\n files=[('chunk', filename, filedata)]\n )\n\n # create a dataset from the item\n path = '/minerva_dataset/{}/item'.format(itemId)\n response = self.request(\n path=path,\n method='POST',\n user=self._user,\n )\n if error is not None:\n self.assertStatus(response, error)\n else:\n self.assertStatusOk(response)\n return response.json, itemId\n\n pluginTestDir = os.path.dirname(os.path.realpath(__file__))\n\n # geojson\n files = [{\n 'name': 'states.geojson',\n 'path': os.path.join(pluginTestDir, 'data', 'states.geojson'),\n 'mimeType': 'application/vnd.geo+json'\n }]\n geojsonDatasetItem, itemId = createDataset('geojson', files)\n minervaMetadata = geojsonDatasetItem['meta']['minerva']\n self.assertEquals(minervaMetadata['original_type'], 'geojson', 'Expected geojson dataset original_type')\n self.assertEquals(minervaMetadata['geojson_file']['name'], 'states.geojson', 'Expected geojson file to be set')\n\n # json array\n files = [{\n 'name': 'twopoints.json',\n 'path': os.path.join(pluginTestDir, 'data', 'twopoints.json'),\n 'mimeType': 'application/json'\n }]\n jsonDatasetItem, jsonItemId = createDataset('twopoints', files)\n jsonMinervaMetadata = jsonDatasetItem['meta']['minerva']\n self.assertEquals(jsonMinervaMetadata['original_type'], 'json', 'Expected json dataset original_type')\n\n # csv\n files = [{\n 'name': 'points.csv',\n 'path': os.path.join(pluginTestDir, 'data', 'points.csv'),\n 'mimeType': 'application/csv'\n }]\n csvDatasetItem, csvItemId = createDataset('csv', files)\n csvMinervaMetadata = csvDatasetItem['meta']['minerva']\n self.assertEquals(csvMinervaMetadata['original_type'], 'csv', 'Expected csv dataset original_type')\n\n # other type exception\n files = [{\n 'name': 'points.other',\n 'path': os.path.join(pluginTestDir, 'data', 'points.other'),\n 'mimeType': 'application/other'\n }]\n otherDatasetItem, itemId = createDataset('other', files)\n\n #\n # Test minerva_dataset/id/jsonrow creating an example row of json\n #\n\n path = '/minerva_dataset/{}/jsonrow'.format(jsonItemId)\n response = self.request(\n path=path,\n method='POST',\n user=self._user,\n )\n self.assertHasKeys(response.json, ['json_row'])\n self.assertHasKeys(response.json['json_row'], ['coordinates'])\n\n #\n # Test minerva_dataset/id/geojson creating geojson from json\n #\n\n # get the item metadata\n path = '/item/{}'.format(jsonItemId)\n response = self.request(\n path=path,\n method='GET',\n user=self._user,\n )\n metadata = response.json\n\n # update the minerva metadata with coordinate mapping\n jsonMinervaMetadata[\"mapper\"] = {\n \"latitudeKeypath\": \"$.coordinates.coordinates[1]\",\n \"longitudeKeypath\": \"$.coordinates.coordinates[0]\"\n }\n\n metadata['minerva'] = jsonMinervaMetadata\n path = '/item/{}/metadata'.format(jsonItemId)\n response = self.request(\n path=path,\n method='PUT',\n user=self._user,\n body=json.dumps(metadata),\n type='application/json'\n )\n metadata = response.json\n\n # create geojson in the dataset\n path = '/minerva_dataset/{}/geojson'.format(jsonItemId)\n response = self.request(\n path=path,\n method='POST',\n user=self._user,\n )\n self.assertHasKeys(response.json, ['geojson_file'])\n\n # download the file and test it is valid geojson\n geojsonFileId = response.json['geojson_file']['_id']\n path = '/file/{}/download'.format(geojsonFileId)\n response = self.request(\n path=path,\n method='GET',\n user=self._user,\n isJson=False\n )\n geojsonContents = self.getBody(response)\n twopointsGeojson = geojson.loads(geojsonContents)\n self.assertEquals(len(twopointsGeojson['features']), 2, 'geojson should have two features')\n # to ensure correct mapping, -85 < x < -80, 20 < y < 30\n features = twopointsGeojson['features']\n for feature in features:\n coordinates = feature['geometry']['coordinates']\n self.assertTrue(-85 < coordinates[0], 'x coordinate out of range')\n self.assertTrue(-80 > coordinates[0], 'x coordinate out of range')\n self.assertTrue(20 < coordinates[1], 'y coordinate out of range')\n self.assertTrue(30 > coordinates[1], 'y coordinate out of range')\n\n #\n # Test minerva_dataset/id/geojson creating geojson from csv\n # Currently should throw an exception as this conversion is\n # only implemented in javascript.\n #\n\n # get the item metadata\n path = '/item/{}'.format(csvItemId)\n response = self.request(\n path=path,\n method='GET',\n user=self._user,\n )\n metadata = response.json\n\n # update the minerva metadata with coordinate mapping\n csvMinervaMetadata[\"mapper\"] = {\n \"latitudeColumn\": \"2\",\n \"longitudeColumn\": \"1\"\n }\n\n metadata['minerva'] = csvMinervaMetadata\n path = '/item/{}/metadata'.format(csvItemId)\n response = self.request(\n path=path,\n method='PUT',\n user=self._user,\n body=json.dumps(metadata),\n type='application/json'\n )\n metadata = response.json\n\n # create geojson in the dataset\n path = '/minerva_dataset/{}/geojson'.format(csvItemId)\n response = self.request(\n path=path,\n method='POST',\n user=self._user,\n )\n self.assertStatus(response, 400)\n\n #\n # Test geocode_tweets endpoint\n #\n\n files = [{\n 'name': 'ungeocoded_tweet.json',\n 'path': os.path.join(pluginTestDir, 'data', 'ungeocoded_tweet.json'),\n 'mimeType': 'application/json'\n }]\n tweetDatasetItem, tweetItemId = createDataset('ungeocoded_tweet', files)\n tweetMinervaMetadata = tweetDatasetItem['meta']['minerva']\n self.assertEquals(tweetMinervaMetadata['original_type'], 'json', 'Expected json dataset original_type')\n\n # geocode the tweets, should replace the file with a new file\n path = '/minerva_dataset/{}/geocode_tweets'.format(tweetItemId)\n response = self.request(\n path=path,\n method='POST',\n user=self._user,\n )\n\n # download the file and test it is valid json with location info\n jsonFileId = response.json['original_files'][0]['_id']\n path = '/file/{}/download'.format(jsonFileId)\n response = self.request(\n path=path,\n method='GET',\n user=self._user,\n isJson=False\n )\n jsonContents = self.getBody(response)\n contents = json.loads(jsonContents)\n self.assertEquals(len(contents), 1, 'geocoded json should have one element')\n self.assertHasKeys(contents[0], ['location'])\n self.assertHasKeys(contents[0]['location'], ['latitude','longitude'])", "metadata": "root.DatasetTestCase.testDataset", "header": "['class', 'DatasetTestCase', '(', 'base', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 } ]
[ { "span": "response ", "start_line": 189, "start_column": 16, "end_line": 189, "end_column": 24 }, { "span": "metadata ", "start_line": 291, "start_column": 8, "end_line": 291, "end_column": 16 } ]
[ { "span": "response ", "start_line": 170, "start_column": 16, "end_line": 170, "end_column": 24 }, { "span": "response ", "start_line": 198, "start_column": 12, "end_line": 198, "end_column": 20 }, { "span": "metadata ", "start_line": 336, "start_column": 8, "end_line": 336, "end_column": 16 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Datas", "et", "Test", "Case_", "(_", "base_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Dataset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "the", " ", "miner", "va", " ", "dataset", " ", "API", " ", "en", "ppo", "ints", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "first", " ", "the", " ", "dataset", " ", "folder", " ", "is", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "miner", "va", "\\u", "dataset", "/", "folder", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "Id", "'_", ":_", "self_", "._", "\\u", "user_", "[_", "'\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "path_", "=_", "path_", ",_", "method_", "=_", "'", "GET", "'_", ",_", "params_", "=_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status", "Ok_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder_", "=_", "response_", "._", "json_", "[_", "'", "folder", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "folder_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "dataset", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "path_", "=_", "path_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "params_", "=_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status_", "(_", "response_", ",_", "401_", ")_", "#", " ", "unauthorized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "path_", "=_", "path_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "params_", "=_", "params_", ",_", "user_", "=_", "self_", "._", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Status", "Ok_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder_", "=_", "response_", "._", "json_", "[_", "'", "folder", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "folder_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "folder_", "[_", "'", "base", "Parent", "Type", "'_", "]_", ",_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "folder_", "[_", "'", "base", "Parent", "Id", "'_", "]_", ",_", "str_", "(_", "self_", "._", "\\u", "user_", "[_", "'\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "folder", " ", "now", " ", "tha", "t", " ", "is", " ", "has", " ", "bee", "n", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "path_", "=_", "path_", ",_", "method_", "=_", "'", "GET", "'_", ",_", "params_", "=_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status", "Ok_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "response", " ", "shou", "ld", " ", "be", " ", "Null", " ", "b", "/", "c", " ", "we", " ", "don", "'", "t", " ", "have", " ", "permissi", "ons", " ", "to", " ", "see", " ", "anyt", "hing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "is", " ", "it", " ", "bett", "er", " ", "to", " ", "alw", "ay", "s", " ", "make", " ", "it", " ", "private", " ", "and", " ", "just", " ", "throw", " ", "a", " ", "401", " ", "in", " ", "this", " ", "case", " ", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "response_", "._", "json_", "[_", "'", "folder", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "folder_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "folder", " ", "passi", "ng", " ", "in", " ", "the", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "path_", "=_", "path_", ",_", "method_", "=_", "'", "GET", "'_", ",_", "params_", "=_", "params_", ",_", "user_", "=_", "self_", "._", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Status", "Ok_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder_", "=_", "response_", "._", "json_", "[_", "'", "folder", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "folder_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "folder_", "[_", "'", "base", "Parent", "Type", "'_", "]_", ",_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "folder_", "[_", "'", "base", "Parent", "Id", "'_", "]_", ",_", "str_", "(_", "self_", "._", "\\u", "user_", "[_", "'\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "some", " ", "items", " ", "in", " ", "the", " ", "dataset", " ", "folder", ",", " ", "even", " ", "tho", "ugh", " ", "these", " ", "are", "n", "'", "t", " ", "real", " ", "datasets_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "exercise", "s", " ", "the", " ", "endpoint", " ", "to", " ", "return", " ", "datasets_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "item", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "folder", "Id", "'_", ":_", "folder_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "path_", "=_", "'/", "item", "'_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "1", "Id_", "=_", "response_", "._", "json_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "item", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "folder", "Id", "'_", ":_", "folder_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "path_", "=_", "'/", "item", "'_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "2", "Id_", "=_", "response_", "._", "json_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "miner", "va", "\\u", "dataset", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "Id", "'_", ":_", "self_", "._", "\\u", "user_", "[_", "'\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "check", " ", "with", " ", "user", " ", "and", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "path_", "=_", "path_", ",_", "method_", "=_", "'", "GET", "'_", ",_", "params_", "=_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "shou", "ld", " ", "have", " ", "no", " ", "response", "s", " ", "bec", "aus", "e", " ", "we", " ", "did", "n", "'", "t", " ", "pass", " ", "in", " ", "a", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Status", "Ok_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "response_", "._", "json_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "path_", "=_", "path_", ",_", "method_", "=_", "'", "GET", "'_", ",_", "params_", "=_", "params_", ",_", "user_", "=_", "self_", "._", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status", "Ok_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "response_", "._", "json_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "Ids_", "=_", "[_", "d_", "[_", "'\\u", "id", "'_", "]_", "for_", "d_", "in_", "response_", "._", "json_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "item", "1", "Id_", "in_", "dataset", "Ids_", ",_", "\"", "expected", " ", "item", "1", "Id", " ", "in", " ", "dataset", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "item", "2", "Id_", "in_", "dataset", "Ids_", ",_", "\"", "expected", " ", "item", "2", "Id", " ", "in", " ", "dataset", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "miner", "va", "\\u", "dataset", "/", "id", "/", "item", " ", "creati", "ng", " ", "a", " ", "dataset", " ", "from", " ", "uploads", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create", "Dataset_", "(_", "item", "name_", ",_", "files_", ",_", "error_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "item", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "folder", "Id", "'_", ":_", "folder_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "path_", "=_", "'/", "item", "'_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "params_", "=_", "params_", ",_", "user_", "=_", "self_", "._", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status", "Ok_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "Id_", "=_", "response_", "._", "json_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item", "file_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "item", "file_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filepath_", "=_", "item", "file_", "[_", "'", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mime", "Type_", "=_", "item", "file_", "[_", "'", "mime", "Type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size", "Bytes_", "=_", "os_", "._", "stat_", "(_", "filepath_", ")_", "._", "st", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "file", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "POST", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "Type", "'_", ":_", "'", "item", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "Id", "'_", ":_", "item", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "size", "Bytes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "Type", "'_", ":_", "mime", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status", "Ok_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload", "Id_", "=_", "response_", "._", "json_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upload", " ", "the", " ", "file", " ", "contents_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "filepath_", ",_", "'", "rb", "'_", ")_", "as_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "filedata_", "=_", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "multip", "art", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "file", "/", "chunk", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "(_", "'", "offset", "'_", ",_", "0_", ")_", ",_", "(_", "'", "upload", "Id", "'_", ",_", "upload", "Id_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "[_", "(_", "'", "chunk", "'_", ",_", "filename_", ",_", "filedata_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "dataset", " ", "from", " ", "the", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "'/", "miner", "va", "\\u", "dataset", "/{}/", "item", "'_", "._", "format_", "(_", "item", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "POST", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Status_", "(_", "response_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Status", "Ok_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "._", "json_", ",_", "item", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plugin", "Test", "Dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "geojson_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "state", "s", ".", "geo", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "os_", "._", "path_", "._", "join_", "(_", "plugin", "Test", "Dir_", ",_", "'", "data", "'_", ",_", "'", "state", "s", ".", "geo", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "Type", "'_", ":_", "'", "applica", "tion", "/", "vn", "d", ".", "geo", "+", "json", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo", "json", "Datas", "et", "Item_", ",_", "item", "Id_", "=_", "create", "Dataset_", "(_", "'", "geo", "json", "'_", ",_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "miner", "va", "Metadata_", "=_", "geo", "json", "Datas", "et", "Item_", "[_", "'", "meta", "'_", "]_", "[_", "'", "miner", "va", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "miner", "va", "Metadata_", "[_", "'", "original", "\\u", "type", "'_", "]_", ",_", "'", "geo", "json", "'_", ",_", "'", "Expect", "ed", " ", "geo", "json", " ", "dataset", " ", "original", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "miner", "va", "Metadata_", "[_", "'", "geo", "json", "\\u", "file", "'_", "]_", "[_", "'", "name", "'_", "]_", ",_", "'", "state", "s", ".", "geo", "json", "'_", ",_", "'", "Expect", "ed", " ", "geo", "json", " ", "file", " ", "to", " ", "be", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "json", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "two", "points", ".", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "os_", "._", "path_", "._", "join_", "(_", "plugin", "Test", "Dir_", ",_", "'", "data", "'_", ",_", "'", "two", "points", ".", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "Type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "Datas", "et", "Item_", ",_", "json", "Item", "Id_", "=_", "create", "Dataset_", "(_", "'", "two", "points", "'_", ",_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "Miner", "va", "Metadata_", "=_", "json", "Datas", "et", "Item_", "[_", "'", "meta", "'_", "]_", "[_", "'", "miner", "va", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "json", "Miner", "va", "Metadata_", "[_", "'", "original", "\\u", "type", "'_", "]_", ",_", "'", "json", "'_", ",_", "'", "Expect", "ed", " ", "json", " ", "dataset", " ", "original", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "csv_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "points", ".", "csv", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "os_", "._", "path_", "._", "join_", "(_", "plugin", "Test", "Dir_", ",_", "'", "data", "'_", ",_", "'", "points", ".", "csv", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "Type", "'_", ":_", "'", "applica", "tion", "/", "csv", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "Datas", "et", "Item_", ",_", "csv", "Item", "Id_", "=_", "create", "Dataset_", "(_", "'", "csv", "'_", ",_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "Miner", "va", "Metadata_", "=_", "csv", "Datas", "et", "Item_", "[_", "'", "meta", "'_", "]_", "[_", "'", "miner", "va", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "csv", "Miner", "va", "Metadata_", "[_", "'", "original", "\\u", "type", "'_", "]_", ",_", "'", "csv", "'_", ",_", "'", "Expect", "ed", " ", "csv", " ", "dataset", " ", "original", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "type", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "points", ".", "other", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "os_", "._", "path_", "._", "join_", "(_", "plugin", "Test", "Dir_", ",_", "'", "data", "'_", ",_", "'", "points", ".", "other", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "Type", "'_", ":_", "'", "applica", "tion", "/", "other", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "Datas", "et", "Item_", ",_", "item", "Id_", "=_", "create", "Dataset_", "(_", "'", "other", "'_", ",_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "miner", "va", "\\u", "dataset", "/", "id", "/", "json", "row", " ", "creati", "ng", " ", "an", " ", "example", " ", "row", " ", "of", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "miner", "va", "\\u", "dataset", "/{}/", "json", "row", "'_", "._", "format_", "(_", "json", "Item", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "POST", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Has", "Keys_", "(_", "response_", "._", "json_", ",_", "[_", "'", "json", "\\u", "row", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Has", "Keys_", "(_", "response_", "._", "json_", "[_", "'", "json", "\\u", "row", "'_", "]_", ",_", "[_", "'", "coordinate", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "miner", "va", "\\u", "dataset", "/", "id", "/", "geo", "json", " ", "creati", "ng", " ", "geo", "json", " ", "from", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "item", " ", "metadata_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "item", "/{}'_", "._", "format_", "(_", "json", "Item", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "response_", "._", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "the", " ", "miner", "va", " ", "metadata", " ", "with", " ", "coordinate", " ", "mapping_", "\\u\\u\\uNL\\u\\u\\u_", "json", "Miner", "va", "Metadata_", "[_", "\"", "mapper", "\"_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "latitude", "Keyp", "ath", "\"_", ":_", "\"$", ".", "coordinate", "s", ".", "coordinate", "s", "[", "1", "]\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "longitude", "Keyp", "ath", "\"_", ":_", "\"$", ".", "coordinate", "s", ".", "coordinate", "s", "[", "0", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "[_", "'", "miner", "va", "'_", "]_", "=_", "json", "Miner", "va", "Metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "'/", "item", "/{}/", "metadata", "'_", "._", "format_", "(_", "json", "Item", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "PU", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "json_", "._", "dumps_", "(_", "metadata_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "response_", "._", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "geo", "json", " ", "in", " ", "the", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "miner", "va", "\\u", "dataset", "/{}/", "geo", "json", "'_", "._", "format_", "(_", "json", "Item", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "POST", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Has", "Keys_", "(_", "response_", "._", "json_", ",_", "[_", "'", "geo", "json", "\\u", "file", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "download", " ", "the", " ", "file", " ", "and", " ", "test", " ", "it", " ", "is", " ", "valid", " ", "geojson_", "\\u\\u\\uNL\\u\\u\\u_", "geo", "json", "File", "Id_", "=_", "response_", "._", "json_", "[_", "'", "geo", "json", "\\u", "file", "'_", "]_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "'/", "file", "/{}/", "download", "'_", "._", "format_", "(_", "geo", "json", "File", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Json_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo", "json", "Contents_", "=_", "self_", "._", "get", "Body_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "two", "points", "Geo", "json_", "=_", "geojson_", "._", "loads_", "(_", "geo", "json", "Contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "two", "points", "Geo", "json_", "[_", "'", "features", "'_", "]_", ")_", ",_", "2_", ",_", "'", "geo", "json", " ", "shou", "ld", " ", "have", " ", "two", " ", "features", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "to", " ", "ensure", " ", "correct", " ", "mapping", ",", " ", "-", "85", " ", "<", " ", "x", " ", "<", " ", "-", "80", ",", " ", "20", " ", "<", " ", "y", " ", "<", " ", "30_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "two", "points", "Geo", "json_", "[_", "'", "features", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "feature_", "in_", "features_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coordinates_", "=_", "feature_", "[_", "'", "geom", "etry", "'_", "]_", "[_", "'", "coordinate", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "-_", "85_", "<_", "coordinates_", "[_", "0_", "]_", ",_", "'", "x", " ", "coordinate", " ", "out", " ", "of", " ", "range", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "-_", "80_", ">_", "coordinates_", "[_", "0_", "]_", ",_", "'", "x", " ", "coordinate", " ", "out", " ", "of", " ", "range", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "20_", "<_", "coordinates_", "[_", "1_", "]_", ",_", "'", "y", " ", "coordinate", " ", "out", " ", "of", " ", "range", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "30_", ">_", "coordinates_", "[_", "1_", "]_", ",_", "'", "y", " ", "coordinate", " ", "out", " ", "of", " ", "range", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "miner", "va", "\\u", "dataset", "/", "id", "/", "geo", "json", " ", "creati", "ng", " ", "geo", "json", " ", "from", " ", "csv_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Curr", "ent", "ly", " ", "shou", "ld", " ", "throw", " ", "an", " ", "exception", " ", "as", " ", "this", " ", "conve", "rsi", "on", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "implemented", " ", "in", " ", "javascript", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "item", " ", "metadata_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "'/", "item", "/{}'_", "._", "format_", "(_", "csv", "Item", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "response_", "._", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "the", " ", "miner", "va", " ", "metadata", " ", "with", " ", "coordinate", " ", "mapping_", "\\u\\u\\uNL\\u\\u\\u_", "csv", "Miner", "va", "Metadata_", "[_", "\"", "mapper", "\"_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "latitude", "Colum", "n", "\"_", ":_", "\"", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "longitude", "Colum", "n", "\"_", ":_", "\"", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "[_", "'", "miner", "va", "'_", "]_", "=_", "csv", "Miner", "va", "Metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "'/", "item", "/{}/", "metadata", "'_", "._", "format_", "(_", "csv", "Item", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "PU", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "json_", "._", "dumps_", "(_", "metadata_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "response_", "._", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "geo", "json", " ", "in", " ", "the", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "miner", "va", "\\u", "dataset", "/{}/", "geo", "json", "'_", "._", "format_", "(_", "csv", "Item", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "POST", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status_", "(_", "response_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "geocode", "\\u", "tweet", "s", " ", "endpoint_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "unge", "oco", "ded", "\\u", "tweet", ".", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "os_", "._", "path_", "._", "join_", "(_", "plugin", "Test", "Dir_", ",_", "'", "data", "'_", ",_", "'", "unge", "oco", "ded", "\\u", "tweet", ".", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "Type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tweet", "Datas", "et", "Item_", ",_", "tweet", "Item", "Id_", "=_", "create", "Dataset_", "(_", "'", "unge", "oco", "ded", "\\u", "tweet", "'_", ",_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tweet", "Miner", "va", "Metadata_", "=_", "tweet", "Datas", "et", "Item_", "[_", "'", "meta", "'_", "]_", "[_", "'", "miner", "va", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "tweet", "Miner", "va", "Metadata_", "[_", "'", "original", "\\u", "type", "'_", "]_", ",_", "'", "json", "'_", ",_", "'", "Expect", "ed", " ", "json", " ", "dataset", " ", "original", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "geocode", " ", "the", " ", "tweet", "s", ",", " ", "shou", "ld", " ", "replace", " ", "the", " ", "file", " ", "with", " ", "a", " ", "new", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "miner", "va", "\\u", "dataset", "/{}/", "geocode", "\\u", "tweet", "s", "'_", "._", "format_", "(_", "tweet", "Item", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "POST", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "download", " ", "the", " ", "file", " ", "and", " ", "test", " ", "it", " ", "is", " ", "valid", " ", "json", " ", "with", " ", "location", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "json", "File", "Id_", "=_", "response_", "._", "json_", "[_", "'", "original", "\\u", "files", "'_", "]_", "[_", "0_", "]_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "'/", "file", "/{}/", "download", "'_", "._", "format_", "(_", "json", "File", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Json_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "Contents_", "=_", "self_", "._", "get", "Body_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "json_", "._", "loads_", "(_", "json", "Contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "contents_", ")_", ",_", "1_", ",_", "'", "geocode", "d", " ", "json", " ", "shou", "ld", " ", "have", " ", "one", " ", "element", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Has", "Keys_", "(_", "contents_", "[_", "0_", "]_", ",_", "[_", "'", "location", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Has", "Keys_", "(_", "contents_", "[_", "0_", "]_", "[_", "'", "location", "'_", "]_", ",_", "[_", "'", "latitude", "'_", ",_", "'", "longitude", "'_", "]_", ")_" ]
[ 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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
jazzband/django-authority/authority/compat.py
[ { "content": "from django.conf import settings\n\n\n# Django 1.5 compatibility utilities, providing support for custom User models.\n# Since get_user_model() causes a circular import if called when app models are\n# being loaded, the user_model_label should be used when possible, with calls\n# to get_user_model deferred to execution time\nuser_model_label = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')\n\ntry:\n from django.contrib.auth import get_user_model\nexcept ImportError:\n from django.contrib.auth.models import User\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def get_user_model():\n return User", "metadata": "root.get_user_model", "header": "['module', '___EOS___']", "index": 14 } ]
[ { "span": "from django.contrib.auth import get_user_model", "start_line": 10, "start_column": 4, "end_line": 10, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dj", "ang", "o", " ", "1.5", " ", "compatibility", " ", "util", "iti", "es", ",", " ", "provi", "ding", " ", "support", " ", "for", " ", "custom", " ", "User", " ", "model", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "get", "\\u", "user", "\\u", "model", "()", " ", "caus", "es", " ", "a", " ", "circular", " ", "import", " ", "if", " ", "call", "ed", " ", "whe", "n", " ", "app", " ", "model", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bei", "ng", " ", "load", "ed", ",", " ", "the", " ", "user", "\\u", "model", "\\u", "label", " ", "shou", "ld", " ", "be", " ", "used", " ", "whe", "n", " ", "possib", "le", ",", " ", "with", " ", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "get", "\\u", "user", "\\u", "model", " ", "defer", "red", " ", "to", " ", "executi", "on", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "model", "\\u", "label_", "=_", "getattr_", "(_", "settings_", ",_", "'", "AUTH", "\\u", "USER", "\\u", "MODEL", "'_", ",_", "'", "auth", ".", "User", "'_", ")_", "\\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_", "._", "contrib_", "._", "auth_", "import_", "get", "\\u", "user", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\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_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "User_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 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
lipis/life-line/main/control/event.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom datetime import datetime\nimport random\nimport copy\n\nfrom flask.ext import wtf\nfrom flask.ext.babel import lazy_gettext as _\nfrom google.appengine.ext import ndb\nimport flask\nimport wtforms\n\nimport auth\nimport i18n\nimport model\nimport util\nimport iso\n\nfrom main import app\n\n\nHOURS = []\nfor hour in range(24):\n HOURS.append((str(hour), '%02d:00' % hour))\n\nHOURS[0] = ('0', '----')\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class EventUpdateForm(i18n.Form):\n search = wtforms.TextField(_('Search for a place'), [wtforms.validators.optional()])\n address = wtforms.TextField(_('Name / Address (Automatic)'), [wtforms.validators.required()])\n place = wtforms.TextField(_('Place / City (Automatic)'), [wtforms.validators.required()])\n country = wtforms.TextField(_('Country (Automatic)'), [wtforms.validators.required()])\n country_code = wtforms.HiddenField('Country Code', [wtforms.validators.required()])\n lat = wtforms.HiddenField('Latitude', [wtforms.validators.required()])\n lng = wtforms.HiddenField('Longtitude', [wtforms.validators.required()])\n timestamp = wtforms.TextField(_('Timestamp'), [wtforms.validators.optional()])\n notes = wtforms.TextAreaField(_('Notes'), [wtforms.validators.optional()])\n layover = wtforms.BooleanField(_('This place is a layover'), [wtforms.validators.optional()])\n add_more = wtforms.BooleanField(_('Add More'), [wtforms.validators.optional()])\n home = wtforms.BooleanField(model.Event.home._verbose_name, [wtforms.validators.optional()])\n\n year = wtforms.SelectField(_('Year'), [wtforms.validators.optional()])\n month = wtforms.TextField(_('Month'), [wtforms.validators.optional()])\n day = wtforms.TextField(_('Day'), [wtforms.validators.optional()])\n hour = wtforms.SelectField(_('Time'), [wtforms.validators.optional()], choices=HOURS)", "metadata": "root.EventUpdateForm", "header": "['module', '___EOS___']", "index": 28 }, { "content": "@app.route('/place/add/', methods=['GET', 'POST'])\[email protected]('/place/<int:event_id>/update/', methods=['GET', 'POST'], endpoint='event_update')\[email protected]_required\ndef event_create(event_id=0):\n if event_id == 0:\n event_db = model.Event(user_key=auth.current_user_key())\n else:\n event_db = model.Event.get_by_id(event_id)\n\n if not event_db or event_db.user_key != auth.current_user_key():\n return flask.abort(404)\n\n form = EventUpdateForm(obj=event_db)\n today = datetime.utcnow().date()\n today = datetime(today.year, today.month, today.day)\n form.year.choices = sorted([(str(y), y) for y in range(1900, today.year + 1)], reverse=True)\n\n if form.validate_on_submit():\n form.year.data = int(form.year.data)\n form.month.data = int(form.month.data)\n try:\n form.day.data = int(form.day.data)\n except:\n form.day.data = 1\n\n success = False\n\n if not form.year.data:\n form.timestamp.errors.append(_('You should at least enter a year'))\n else:\n month = 1\n day = 1\n\n if form.month.data and form.day.data:\n month = form.month.data\n day = form.day.data\n elif form.month.data:\n month = form.month.data\n day = 1\n else:\n month = 1\n day = 1\n\n hour = int(form.hour.data) or 0\n try:\n form.timestamp.data = datetime(form.year.data, month, day, hour)\n success = True\n except:\n form.timestamp.errors.append(_('Enter a valid date'))\n success = False\n\n if success:\n form.populate_obj(event_db)\n\n if form.month.data and form.day.data:\n event_db.accuracy = 'day'\n elif form.month.data:\n event_db.accuracy = 'month'\n else:\n event_db.accuracy = 'year'\n event_db.geo_pt = ndb.GeoPt(form.lat.data, form.lng.data)\n event_db.put()\n if event_id:\n flask.flash('\"%s\" is updated!' % event_db.address, category='success')\n else:\n flask.flash('\"%s\" is added!' % event_db.address, category='success')\n\n if form.add_more.data:\n timestamp = event_db.timestamp.strftime('%Y%H')\n if event_db.accuracy == 'month':\n timestamp = event_db.timestamp.strftime('%Y%m%H')\n if event_db.accuracy == 'day':\n timestamp = event_db.timestamp.strftime('%Y%m%d%H')\n\n return flask.redirect(flask.url_for('event_create', timestamp=timestamp))\n return flask.redirect('%s#%d' % (flask.url_for('trips'), event_db.key.id()))\n\n if not form.errors:\n form.add_more.data = event_id == 0\n form.lat.data = '0'\n form.lng.data = '0'\n\n if event_db.geo_pt:\n form.lat.data = event_db.geo_pt.lat\n form.lng.data = event_db.geo_pt.lon\n elif flask.request.city_lat_lng:\n form.lat.data = flask.request.city_lat_lng.split(',')[0]\n form.lng.data = flask.request.city_lat_lng.split(',')[1]\n\n try:\n if event_id == 0:\n timestamp = util.param('timestamp')\n form.year.data = timestamp[:4].lstrip('0')\n form.hour.data = timestamp[-2:].lstrip('0')\n if len(timestamp) == 8:\n form.month.data = timestamp[4:-2].lstrip('0')\n if len(timestamp) == 10:\n form.month.data = timestamp[4:-4].lstrip('0')\n form.day.data = timestamp[6:-2].lstrip('0')\n else:\n form.year.data = str(event_db.timestamp.year)\n if event_db.accuracy == 'month':\n form.month.data = str(event_db.timestamp.month)\n elif event_db.accuracy == 'day':\n form.month.data = str(event_db.timestamp.month)\n form.day.data = str(event_db.timestamp.day)\n form.hour.data = str(event_db.timestamp.hour)\n except:\n pass\n\n return flask.render_template(\n 'event/event_update.html',\n html_class='event-update',\n title=u'%s' % (_('Add Place') if event_id == 0 else '%s, %s' % (event_db.place, event_db.country)),\n form=form,\n today=today,\n event_db=event_db,\n )", "metadata": "root.event_create", "header": "['module', '___EOS___']", "index": 48 }, { "content": "@app.route('/user/<username>/countries/')\[email protected]('/countries/')\[email protected]_required\ndef countries(username=None):\n user_db = auth.current_user_db()\n if username and user_db.username != username:\n if not user_db.admin:\n return flask.abort(404)\n user_db = model.User.get_by('username', username)\n if not user_db:\n return flask.abort(404)\n\n event_dbs, next_cursor = user_db.get_event_dbs(\n order='timestamp,accuracy,created', limit=-1\n )\n\n country_dbs_ = {}\n country = {\n 'country_code': '',\n 'seconds': 0,\n 'current': False,\n }\n last_event_db = None\n\n for event_db in event_dbs:\n if event_db.layover:\n continue\n if last_event_db:\n if last_event_db.country_code not in country_dbs_:\n country_dbs_[last_event_db.country_code] = copy.copy(country)\n country_dbs_[last_event_db.country_code]['country_code'] = last_event_db.country_code\n country_dbs_[last_event_db.country_code]['seconds'] += (event_db.timestamp - last_event_db.timestamp).total_seconds()\n last_event_db = event_db\n\n # current country\n if last_event_db:\n if last_event_db.country_code not in country_dbs_:\n country_dbs_[last_event_db.country_code] = copy.copy(country)\n country_dbs_[last_event_db.country_code]['country_code'] = last_event_db.country_code\n country_dbs_[last_event_db.country_code]['seconds'] += (datetime.utcnow() - last_event_db.timestamp).total_seconds()\n country_dbs_[last_event_db.country_code]['current'] = True\n\n\n country_dbs = []\n total = 0\n\n for country_code in country_dbs_:\n country = country_dbs_[country_code]\n country['seconds'] = int(country['seconds'])\n country['hours'] = int(country['seconds'] / 60 / 60)\n country['days'] = int(round(country['seconds'] / 60 / 60 / 24))\n country['months'] = country['days'] / 30.0\n country['years'] = country['days'] / 365.0\n country['country'] = iso.ISO_3166[country['country_code']]\n country_dbs.append(country)\n total += country['seconds']\n\n country_dbs = sorted(country_dbs, key=lambda c: c['seconds'], reverse=True)\n return flask.render_template(\n 'event/stats.html',\n html_class='stats countries',\n title=_('My Stats'),\n event_dbs=event_dbs,\n country_dbs=country_dbs,\n total=total,\n next_url=util.generate_next_url(next_cursor),\n user_db=user_db,\n )", "metadata": "root.countries", "header": "['module', '___EOS___']", "index": 168 }, { "content": "@app.route('/user/<username>/trips/')\[email protected]('/trips/')\[email protected]_required\ndef trips(username=None):\n user_db = auth.current_user_db()\n if username and user_db.username != username:\n if not user_db.admin:\n return flask.abort(404)\n user_db = model.User.get_by('username', username)\n if not user_db:\n return flask.abort(404)\n\n event_dbs, next_cursor = user_db.get_event_dbs(limit=-1, order='timestamp,-accuracy,created')\n\n return flask.render_template(\n 'event/trips.html',\n html_class='trips',\n title=_('My Trips'),\n event_dbs=event_dbs,\n next_url=util.generate_next_url(next_cursor),\n user_db=user_db,\n )", "metadata": "root.trips", "header": "['module', '___EOS___']", "index": 238 }, { "content": "@app.route('/user/<username>/places/')\[email protected]('/places/')\[email protected]_required\ndef places(username=None):\n user_db = auth.current_user_db()\n if username and user_db.username != username:\n if not user_db.admin:\n return flask.abort(404)\n user_db = model.User.get_by('username', username)\n if not user_db:\n return flask.abort(404)\n\n event_dbs, next_cursor = user_db.get_event_dbs(\n order='timestamp,accuracy,created', limit=-1\n )\n\n place_dbs_ = {}\n country = {\n 'country_code': '',\n 'city': '',\n 'seconds': 0,\n 'current': False,\n }\n last_event_db = None\n\n for event_db in event_dbs:\n if event_db.layover:\n continue\n if last_event_db:\n if last_event_db.place not in place_dbs_:\n place_dbs_[last_event_db.place] = copy.copy(country)\n place_dbs_[last_event_db.place]['country_code'] = last_event_db.country_code\n place_dbs_[last_event_db.place]['place'] = last_event_db.place\n place_dbs_[last_event_db.place]['seconds'] += (event_db.timestamp - last_event_db.timestamp).total_seconds()\n last_event_db = event_db\n\n # current country\n if last_event_db:\n if last_event_db.place not in place_dbs_:\n place_dbs_[last_event_db.place] = copy.copy(country)\n place_dbs_[last_event_db.place]['country_code'] = last_event_db.country_code\n place_dbs_[last_event_db.place]['place'] = last_event_db.place\n place_dbs_[last_event_db.place]['seconds'] += (datetime.utcnow() - last_event_db.timestamp).total_seconds()\n place_dbs_[last_event_db.place]['current'] = True\n\n\n place_dbs = []\n total = 0\n\n for place in place_dbs_:\n place = place_dbs_[place]\n place['seconds'] = int(place['seconds'])\n place['hours'] = int(place['seconds'] / 60 / 60)\n place['days'] = int(round(place['seconds'] / 60 / 60 / 24))\n place['months'] = place['days'] / 30.0\n place['years'] = place['days'] / 365.0\n place['country'] = iso.ISO_3166[place['country_code']]\n place_dbs.append(place)\n total += place['seconds']\n\n place_dbs = sorted(place_dbs, key=lambda c: c['seconds'], reverse=True)\n return flask.render_template(\n 'event/stats2.html',\n html_class='stats places',\n title=_('My Stats'),\n event_dbs=event_dbs,\n place_dbs=place_dbs,\n total=total,\n next_url=util.generate_next_url(next_cursor),\n user_db=user_db,\n )", "metadata": "root.places", "header": "['module', '___EOS___']", "index": 262 } ]
[ { "span": "import random", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 13 }, { "span": "from flask.ext import wtf", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flask_", "._", "ext_", "import_", "wtf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "babel", "_", "import_", "lazy", "\\u", "gettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "ndb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "flask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wtforms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "i18n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "iso_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "main_", "import_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HOUR", "S_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "hour_", "in_", "range_", "(_", "24_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "HOUR", "S_", "._", "append_", "(_", "(_", "str_", "(_", "hour_", ")_", ",_", "'%", "02", "d", ":", "00", "'_", "%_", "hour_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "HOUR", "S_", "[_", "0_", "]_", "=_", "(_", "'", "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_", "\\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_", "Event", "Update", "Form_", "(_", "i18n_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search_", "=_", "wtforms_", "._", "Text", "Field_", "(_", "\\u_", "(_", "'", "Sear", "ch", " ", "for", " ", "a", " ", "place", "'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "optional_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address_", "=_", "wtforms_", "._", "Text", "Field_", "(_", "\\u_", "(_", "'", "Name", " ", "/", " ", "Address", " ", "(", "Automat", "ic", ")'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place_", "=_", "wtforms_", "._", "Text", "Field_", "(_", "\\u_", "(_", "'", "Place", " ", "/", " ", "Cit", "y", " ", "(", "Automat", "ic", ")'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "country_", "=_", "wtforms_", "._", "Text", "Field_", "(_", "\\u_", "(_", "'", "Count", "ry", " ", "(", "Automat", "ic", ")'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "countr", "y", "\\u", "code_", "=_", "wtforms_", "._", "Hi", "dde", "n", "Field_", "(_", "'", "Count", "ry", " ", "Code", "'_", ",_", "[_", "wtforms_", "._", "validators_", "._", "required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lat_", "=_", "wtforms_", "._", "Hi", "dde", "n", "Field_", "(_", "'", "Lat", "itu", "de", "'_", ",_", "[_", "wtforms_", "._", "validators_", "._", "required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lng_", "=_", "wtforms_", "._", "Hi", "dde", "n", "Field_", "(_", "'", "Long", "titu", "de", "'_", ",_", "[_", "wtforms_", "._", "validators_", "._", "required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamp_", "=_", "wtforms_", "._", "Text", "Field_", "(_", "\\u_", "(_", "'", "Timest", "amp", "'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "optional_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notes_", "=_", "wtforms_", "._", "Text", "Area", "Field_", "(_", "\\u_", "(_", "'", "Not", "es", "'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "optional_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lay", "over_", "=_", "wtforms_", "._", "Boo", "lean", "Field_", "(_", "\\u_", "(_", "'", "Thi", "s", " ", "place", " ", "is", " ", "a", " ", "lay", "over", "'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "optional_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "more_", "=_", "wtforms_", "._", "Boo", "lean", "Field_", "(_", "\\u_", "(_", "'", "Add", " ", "Mor", "e", "'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "optional_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home_", "=_", "wtforms_", "._", "Boo", "lean", "Field_", "(_", "model_", "._", "Event_", "._", "home_", "._", "\\u", "verbo", "se", "\\u", "name_", ",_", "[_", "wtforms_", "._", "validators_", "._", "optional_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "year_", "=_", "wtforms_", "._", "Select", "Field_", "(_", "\\u_", "(_", "'", "Year", "'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "optional_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month_", "=_", "wtforms_", "._", "Text", "Field_", "(_", "\\u_", "(_", "'", "Mont", "h", "'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "optional_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day_", "=_", "wtforms_", "._", "Text", "Field_", "(_", "\\u_", "(_", "'", "Day", "'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "optional_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hour_", "=_", "wtforms_", "._", "Select", "Field_", "(_", "\\u_", "(_", "'", "Time", "'_", ")_", ",_", "[_", "wtforms_", "._", "validators_", "._", "optional_", "(_", ")_", "]_", ",_", "choices_", "=_", "HOUR", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "place", "/", "add", "/'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "place", "/", "<", "int", ":", "event", "\\u", "id", ">/", "update", "/'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ",_", "endpoint_", "=_", "'", "event", "\\u", "update", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "auth_", "._", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "event", "\\u", "create_", "(_", "event", "\\u", "id_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event", "\\u", "id_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "db_", "=_", "model_", "._", "Event_", "(_", "user", "\\u", "key_", "=_", "auth_", "._", "current", "\\u", "user", "\\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 ", " _", "event", "\\u", "db_", "=_", "model_", "._", "Event_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "event", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "event", "\\u", "db_", "or_", "event", "\\u", "db_", "._", "user", "\\u", "key_", "!=_", "auth_", "._", "current", "\\u", "user", "\\u", "key_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "flask_", "._", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "=_", "Event", "Update", "Form_", "(_", "obj_", "=_", "event", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "today_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "today_", "=_", "datetime_", "(_", "today_", "._", "year_", ",_", "today_", "._", "month_", ",_", "today_", "._", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "year_", "._", "choices_", "=_", "sorted_", "(_", "[_", "(_", "str_", "(_", "y_", ")_", ",_", "y_", ")_", "for_", "y_", "in_", "range_", "(_", "1900", "_", ",_", "today_", "._", "year_", "+_", "1_", ")_", "]_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "form_", "._", "validat", "e\\u", "on", "\\u", "submit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "year_", "._", "data_", "=_", "int_", "(_", "form_", "._", "year_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "month_", "._", "data_", "=_", "int_", "(_", "form_", "._", "month_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "day_", "._", "data_", "=_", "int_", "(_", "form_", "._", "day_", "._", "data_", ")_", "\\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 ", " _", "form_", "._", "day_", "._", "data_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "form_", "._", "year_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "timestamp_", "._", "errors_", "._", "append_", "(_", "\\u_", "(_", "'", "You", " ", "shou", "ld", " ", "at", " ", "leas", "t", " ", "enter", " ", "a", " ", "year", "'_", ")_", ")_", "\\u\\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_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "form_", "._", "month_", "._", "data_", "and_", "form_", "._", "day_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "month_", "=_", "form_", "._", "month_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day_", "=_", "form_", "._", "day_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "form_", "._", "month_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "month_", "=_", "form_", "._", "month_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day_", "=_", "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 ", " _", "month_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hour_", "=_", "int_", "(_", "form_", "._", "hour_", "._", "data_", ")_", "or_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "timestamp_", "._", "data_", "=_", "datetime_", "(_", "form_", "._", "year_", "._", "data_", ",_", "month_", ",_", "day_", ",_", "hour_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "timestamp_", "._", "errors_", "._", "append_", "(_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "date", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "populate", "\\u", "obj_", "(_", "event", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "form_", "._", "month_", "._", "data_", "and_", "form_", "._", "day_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "db_", "._", "accuracy_", "=_", "'", "day", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "form_", "._", "month_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "db_", "._", "accuracy_", "=_", "'", "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 ", " _", "event", "\\u", "db_", "._", "accuracy_", "=_", "'", "year", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event", "\\u", "db_", "._", "geo", "\\u", "pt_", "=_", "ndb_", "._", "Geo", "Pt_", "(_", "form_", "._", "lat_", "._", "data_", ",_", "form_", "._", "lng_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "\\u", "db_", "._", "put_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flask_", "._", "flash_", "(_", "'\"", "%", "s", "\"", " ", "is", " ", "update", "d", "!'_", "%_", "event", "\\u", "db_", "._", "address_", ",_", "category_", "=_", "'", "success", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flask_", "._", "flash_", "(_", "'\"", "%", "s", "\"", " ", "is", " ", "adde", "d", "!'_", "%_", "event", "\\u", "db_", "._", "address_", ",_", "category_", "=_", "'", "success", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "form_", "._", "add", "\\u", "more_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp_", "=_", "event", "\\u", "db_", "._", "timestamp_", "._", "strftime_", "(_", "'%", "Y", "%", "H", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event", "\\u", "db_", "._", "accuracy_", "==_", "'", "month", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp_", "=_", "event", "\\u", "db_", "._", "timestamp_", "._", "strftime_", "(_", "'%", "Y", "%", "m", "%", "H", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event", "\\u", "db_", "._", "accuracy_", "==_", "'", "day", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp_", "=_", "event", "\\u", "db_", "._", "timestamp_", "._", "strftime_", "(_", "'%", "Y", "%", "m", "%", "d", "%", "H", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "flask_", "._", "redirect_", "(_", "flask_", "._", "url", "\\u", "for_", "(_", "'", "event", "\\u", "create", "'_", ",_", "timestamp_", "=_", "timestamp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "flask_", "._", "redirect_", "(_", "'%", "s", "#", "%", "d", "'_", "%_", "(_", "flask_", "._", "url", "\\u", "for_", "(_", "'", "trips", "'_", ")_", ",_", "event", "\\u", "db_", "._", "key_", "._", "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_", "if_", "not_", "form_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "add", "\\u", "more_", "._", "data_", "=_", "event", "\\u", "id_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "lat_", "._", "data_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "lng_", "._", "data_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "event", "\\u", "db_", "._", "geo", "\\u", "pt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "lat_", "._", "data_", "=_", "event", "\\u", "db_", "._", "geo", "\\u", "pt_", "._", "lat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "lng_", "._", "data_", "=_", "event", "\\u", "db_", "._", "geo", "\\u", "pt_", "._", "lon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flask_", "._", "request_", "._", "city", "\\u", "lat", "\\u", "lng_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "lat_", "._", "data_", "=_", "flask_", "._", "request_", "._", "city", "\\u", "lat", "\\u", "lng_", "._", "split_", "(_", "','_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "lng_", "._", "data_", "=_", "flask_", "._", "request_", "._", "city", "\\u", "lat", "\\u", "lng_", "._", "split_", "(_", "','_", ")_", "[_", "1_", "]_", "\\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 ", " _", "if_", "event", "\\u", "id_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp_", "=_", "util_", "._", "param_", "(_", "'", "timestamp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "year_", "._", "data_", "=_", "timestamp_", "[_", ":_", "4_", "]_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "hour_", "._", "data_", "=_", "timestamp_", "[_", "-_", "2_", ":_", "]_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "timestamp_", ")_", "==_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "month_", "._", "data_", "=_", "timestamp_", "[_", "4_", ":_", "-_", "2_", "]_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "timestamp_", ")_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "month_", "._", "data_", "=_", "timestamp_", "[_", "4_", ":_", "-_", "4_", "]_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "day_", "._", "data_", "=_", "timestamp_", "[_", "6_", ":_", "-_", "2_", "]_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "\\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 ", " _", "form_", "._", "year_", "._", "data_", "=_", "str_", "(_", "event", "\\u", "db_", "._", "timestamp_", "._", "year_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event", "\\u", "db_", "._", "accuracy_", "==_", "'", "month", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "month_", "._", "data_", "=_", "str_", "(_", "event", "\\u", "db_", "._", "timestamp_", "._", "month_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event", "\\u", "db_", "._", "accuracy_", "==_", "'", "day", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "month_", "._", "data_", "=_", "str_", "(_", "event", "\\u", "db_", "._", "timestamp_", "._", "month_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "day_", "._", "data_", "=_", "str_", "(_", "event", "\\u", "db_", "._", "timestamp_", "._", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "._", "hour_", "._", "data_", "=_", "str_", "(_", "event", "\\u", "db_", "._", "timestamp_", "._", "hour_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "flask_", "._", "render", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "event", "/", "event", "\\u", "update", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "class_", "=_", "'", "event", "-", "update", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "u", "'%", "s", "'_", "%_", "(_", "\\u_", "(_", "'", "Add", " ", "Place", "'_", ")_", "if_", "event", "\\u", "id_", "==_", "0_", "else_", "'%", "s", ",", " ", "%", "s", "'_", "%_", "(_", "event", "\\u", "db_", "._", "place_", ",_", "event", "\\u", "db_", "._", "country_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "today_", "=_", "today_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "db_", "=_", "event", "\\u", "db_", ",_", "\\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_", "@_", "app_", "._", "route_", "(_", "'/", "user", "/", "<", "user", "name", ">/", "countr", "ies", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "countr", "ies", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "auth_", "._", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "countries_", "(_", "username_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "db_", "=_", "auth_", "._", "current", "\\u", "user", "\\u", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "username_", "and_", "user", "\\u", "db_", "._", "username_", "!=_", "username_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "user", "\\u", "db_", "._", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "flask_", "._", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "db_", "=_", "model_", "._", "User_", "._", "get", "\\u", "by_", "(_", "'", "user", "name", "'_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "flask_", "._", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event", "\\u", "dbs_", ",_", "next", "\\u", "cursor_", "=_", "user", "\\u", "db_", "._", "get", "\\u", "event", "\\u", "dbs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "'", "timestamp", ",", "accu", "rac", "y", ",", "created", "'_", ",_", "limit_", "=_", "-_", "1_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "countr", "y", "\\u", "dbs", "\\u_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "country_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "countr", "y", "\\u", "code", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "second", "s", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "event", "\\u", "db_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "event", "\\u", "db_", "in_", "event", "\\u", "dbs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event", "\\u", "db_", "._", "lay", "over_", ":_", "\\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_", "last", "\\u", "event", "\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "not_", "in_", "countr", "y", "\\u", "dbs", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "countr", "y", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "]_", "=_", "copy_", "._", "copy_", "(_", "country_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "countr", "y", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "]_", "[_", "'", "countr", "y", "\\u", "code", "'_", "]_", "=_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "countr", "y", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "]_", "[_", "'", "second", "s", "'_", "]_", "+=_", "(_", "event", "\\u", "db_", "._", "timestamp_", "-_", "last", "\\u", "event", "\\u", "db_", "._", "timestamp_", ")_", "._", "total", "\\u", "seconds_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "event", "\\u", "db_", "=_", "event", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "current", " ", "country_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "last", "\\u", "event", "\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "not_", "in_", "countr", "y", "\\u", "dbs", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "countr", "y", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "]_", "=_", "copy_", "._", "copy_", "(_", "country_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "countr", "y", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "]_", "[_", "'", "countr", "y", "\\u", "code", "'_", "]_", "=_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "countr", "y", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "]_", "[_", "'", "second", "s", "'_", "]_", "+=_", "(_", "datetime_", "._", "utcnow_", "(_", ")_", "-_", "last", "\\u", "event", "\\u", "db_", "._", "timestamp_", ")_", "._", "total", "\\u", "seconds_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "countr", "y", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "]_", "[_", "'", "current", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "countr", "y", "\\u", "dbs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "countr", "y", "\\u", "code_", "in_", "countr", "y", "\\u", "dbs", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "country_", "=_", "countr", "y", "\\u", "dbs", "\\u_", "[_", "countr", "y", "\\u", "code_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "country_", "[_", "'", "second", "s", "'_", "]_", "=_", "int_", "(_", "country_", "[_", "'", "second", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "country_", "[_", "'", "hour", "s", "'_", "]_", "=_", "int_", "(_", "country_", "[_", "'", "second", "s", "'_", "]_", "/_", "60_", "/_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "country_", "[_", "'", "day", "s", "'_", "]_", "=_", "int_", "(_", "round_", "(_", "country_", "[_", "'", "second", "s", "'_", "]_", "/_", "60_", "/_", "60_", "/_", "24_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "country_", "[_", "'", "month", "s", "'_", "]_", "=_", "country_", "[_", "'", "day", "s", "'_", "]_", "/_", "30.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "country_", "[_", "'", "year", "s", "'_", "]_", "=_", "country_", "[_", "'", "day", "s", "'_", "]_", "/_", "365", ".0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "country_", "[_", "'", "countr", "y", "'_", "]_", "=_", "iso_", "._", "ISO", "\\u", "3166", "_", "[_", "country_", "[_", "'", "countr", "y", "\\u", "code", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "countr", "y", "\\u", "dbs_", "._", "append_", "(_", "country_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "+=_", "country_", "[_", "'", "second", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "countr", "y", "\\u", "dbs_", "=_", "sorted_", "(_", "countr", "y", "\\u", "dbs_", ",_", "key_", "=_", "lambda_", "c_", ":_", "c_", "[_", "'", "second", "s", "'_", "]_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "flask_", "._", "render", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "event", "/", "stats", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "class_", "=_", "'", "stats", " ", "countr", "ies", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "\\u_", "(_", "'", "My", " ", "Stat", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "dbs_", "=_", "event", "\\u", "dbs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "countr", "y", "\\u", "dbs_", "=_", "countr", "y", "\\u", "dbs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "total_", "=_", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "url_", "=_", "util_", "._", "generat", "e\\u", "next", "\\u", "url_", "(_", "next", "\\u", "cursor_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "user", "\\u", "db_", ",_", "\\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_", "@_", "app_", "._", "route_", "(_", "'/", "user", "/", "<", "user", "name", ">/", "trips", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "trips", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "auth_", "._", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trips", "_", "(_", "username_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "db_", "=_", "auth_", "._", "current", "\\u", "user", "\\u", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "username_", "and_", "user", "\\u", "db_", "._", "username_", "!=_", "username_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "user", "\\u", "db_", "._", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "flask_", "._", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "db_", "=_", "model_", "._", "User_", "._", "get", "\\u", "by_", "(_", "'", "user", "name", "'_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "flask_", "._", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event", "\\u", "dbs_", ",_", "next", "\\u", "cursor_", "=_", "user", "\\u", "db_", "._", "get", "\\u", "event", "\\u", "dbs_", "(_", "limit_", "=_", "-_", "1_", ",_", "order_", "=_", "'", "timestamp", ",-", "accu", "rac", "y", ",", "created", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "flask_", "._", "render", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "event", "/", "trips", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "class_", "=_", "'", "trips", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "\\u_", "(_", "'", "My", " ", "Tri", "ps", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "dbs_", "=_", "event", "\\u", "dbs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "url_", "=_", "util_", "._", "generat", "e\\u", "next", "\\u", "url_", "(_", "next", "\\u", "cursor_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "user", "\\u", "db_", ",_", "\\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_", "@_", "app_", "._", "route_", "(_", "'/", "user", "/", "<", "user", "name", ">/", "place", "s", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "place", "s", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "auth_", "._", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "places_", "(_", "username_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "db_", "=_", "auth_", "._", "current", "\\u", "user", "\\u", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "username_", "and_", "user", "\\u", "db_", "._", "username_", "!=_", "username_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "user", "\\u", "db_", "._", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "flask_", "._", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "db_", "=_", "model_", "._", "User_", "._", "get", "\\u", "by_", "(_", "'", "user", "name", "'_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "flask_", "._", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event", "\\u", "dbs_", ",_", "next", "\\u", "cursor_", "=_", "user", "\\u", "db_", "._", "get", "\\u", "event", "\\u", "dbs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "'", "timestamp", ",", "accu", "rac", "y", ",", "created", "'_", ",_", "limit_", "=_", "-_", "1_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "place", "\\u", "dbs", "\\u_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "country_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "countr", "y", "\\u", "code", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "city", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "second", "s", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "event", "\\u", "db_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "event", "\\u", "db_", "in_", "event", "\\u", "dbs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event", "\\u", "db_", "._", "lay", "over_", ":_", "\\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_", "last", "\\u", "event", "\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "not_", "in_", "place", "\\u", "dbs", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "place", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "]_", "=_", "copy_", "._", "copy_", "(_", "country_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "]_", "[_", "'", "countr", "y", "\\u", "code", "'_", "]_", "=_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "]_", "[_", "'", "place", "'_", "]_", "=_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "place", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "]_", "[_", "'", "second", "s", "'_", "]_", "+=_", "(_", "event", "\\u", "db_", "._", "timestamp_", "-_", "last", "\\u", "event", "\\u", "db_", "._", "timestamp_", ")_", "._", "total", "\\u", "seconds_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "event", "\\u", "db_", "=_", "event", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "current", " ", "country_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "last", "\\u", "event", "\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "not_", "in_", "place", "\\u", "dbs", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "place", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "]_", "=_", "copy_", "._", "copy_", "(_", "country_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "]_", "[_", "'", "countr", "y", "\\u", "code", "'_", "]_", "=_", "last", "\\u", "event", "\\u", "db_", "._", "countr", "y", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "]_", "[_", "'", "place", "'_", "]_", "=_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "place", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "]_", "[_", "'", "second", "s", "'_", "]_", "+=_", "(_", "datetime_", "._", "utcnow_", "(_", ")_", "-_", "last", "\\u", "event", "\\u", "db_", "._", "timestamp_", ")_", "._", "total", "\\u", "seconds_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place", "\\u", "dbs", "\\u_", "[_", "last", "\\u", "event", "\\u", "db_", "._", "place_", "]_", "[_", "'", "current", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "place", "\\u", "dbs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "place_", "in_", "place", "\\u", "dbs", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "place_", "=_", "place", "\\u", "dbs", "\\u_", "[_", "place_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place_", "[_", "'", "second", "s", "'_", "]_", "=_", "int_", "(_", "place_", "[_", "'", "second", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place_", "[_", "'", "hour", "s", "'_", "]_", "=_", "int_", "(_", "place_", "[_", "'", "second", "s", "'_", "]_", "/_", "60_", "/_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place_", "[_", "'", "day", "s", "'_", "]_", "=_", "int_", "(_", "round_", "(_", "place_", "[_", "'", "second", "s", "'_", "]_", "/_", "60_", "/_", "60_", "/_", "24_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place_", "[_", "'", "month", "s", "'_", "]_", "=_", "place_", "[_", "'", "day", "s", "'_", "]_", "/_", "30.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place_", "[_", "'", "year", "s", "'_", "]_", "=_", "place_", "[_", "'", "day", "s", "'_", "]_", "/_", "365", ".0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place_", "[_", "'", "countr", "y", "'_", "]_", "=_", "iso_", "._", "ISO", "\\u", "3166", "_", "[_", "place_", "[_", "'", "countr", "y", "\\u", "code", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place", "\\u", "dbs_", "._", "append_", "(_", "place_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "+=_", "place_", "[_", "'", "second", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "place", "\\u", "dbs_", "=_", "sorted_", "(_", "place", "\\u", "dbs_", ",_", "key_", "=_", "lambda_", "c_", ":_", "c_", "[_", "'", "second", "s", "'_", "]_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "flask_", "._", "render", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "event", "/", "stats", "2", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "class_", "=_", "'", "stats", " ", "place", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "\\u_", "(_", "'", "My", " ", "Stat", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "dbs_", "=_", "event", "\\u", "dbs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "place", "\\u", "dbs_", "=_", "place", "\\u", "dbs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "total_", "=_", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "url_", "=_", "util_", "._", "generat", "e\\u", "next", "\\u", "url_", "(_", "next", "\\u", "cursor_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "db_", "=_", "user", "\\u", "db_", ",_", "\\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, 0, 1, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
chromaway/ngcccbase/ngcccbase/services/chroma.py
[ { "content": " def connected(self):\n try:\n return bool(self.get_block_count())\n except:\n return False", "metadata": "root.ChromaBlockchainState.connected", "header": "['class', 'ChromaBlockchainState', '(', 'BlockchainStateBase', ')', ':', '___EOS___']", "index": 75 } ]
[ { "span": "except:", "start_line": 78, "start_column": 8, "end_line": 78, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Chrom", "a", "Block", "chain", "State_", "(_", "Block", "chain", "State", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connected_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "(_", "self_", "._", "get", "\\u", "block", "\\u", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused local variable
PyHDI/veriloggen/tests/core/instance_/multiple_instances/multiple_instances.py
[ { "content": "def mkTop():\n m = Module('top')\n led = mkLed()\n\n clk = m.Input('CLK')\n rst = m.Input('RST')\n \n params = m.copy_params(led, prefix='A_')\n ports = m.copy_ports(led, prefix='A_', exclude=('CLK', 'RST'))\n \n params = m.copy_params(led, prefix='B_')\n ports = m.copy_ports(led, prefix='B_', exclude=('CLK', 'RST'))\n \n m.Instance(led, 'inst_blinkled_a',\n m.connect_params(led, prefix='A_'),\n m.connect_ports(led, prefix='') + m.connect_ports(led, prefix='A_'))\n \n m.Instance(led, 'inst_blinkled_b',\n m.connect_params(led, prefix='B_'),\n m.connect_ports(led, prefix='') + m.connect_ports(led, prefix='B_'))\n\n return m", "metadata": "root.mkTop", "header": "['module', '___EOS___']", "index": 41 } ]
[ { "span": "clk ", "start_line": 45, "start_column": 4, "end_line": 45, "end_column": 7 }, { "span": "rst ", "start_line": 46, "start_column": 4, "end_line": 46, "end_column": 7 }, { "span": "params ", "start_line": 51, "start_column": 4, "end_line": 51, "end_column": 10 }, { "span": "ports ", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mk", "Top_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "Module_", "(_", "'", "top", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "led_", "=_", "mk", "Led", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clk_", "=_", "m_", "._", "Input_", "(_", "'", "CLK", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rst_", "=_", "m_", "._", "Input_", "(_", "'", "RST", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "m_", "._", "copy", "\\u", "params_", "(_", "led_", ",_", "prefix_", "=_", "'", "A", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ports_", "=_", "m_", "._", "copy", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "'", "A", "\\u'_", ",_", "exclude_", "=_", "(_", "'", "CLK", "'_", ",_", "'", "RST", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "m_", "._", "copy", "\\u", "params_", "(_", "led_", ",_", "prefix_", "=_", "'", "B", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ports_", "=_", "m_", "._", "copy", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "'", "B", "\\u'_", ",_", "exclude_", "=_", "(_", "'", "CLK", "'_", ",_", "'", "RST", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "Instance_", "(_", "led_", ",_", "'", "inst", "\\u", "blink", "led", "\\u", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "connect", "\\u", "params_", "(_", "led_", ",_", "prefix_", "=_", "'", "A", "\\u'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "connect", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "''_", ")_", "+_", "m_", "._", "connect", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "'", "A", "\\u'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "Instance_", "(_", "led_", ",_", "'", "inst", "\\u", "blink", "led", "\\u", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "connect", "\\u", "params_", "(_", "led_", ",_", "prefix_", "=_", "'", "B", "\\u'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "connect", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "''_", ")_", "+_", "m_", "._", "connect", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "'", "B", "\\u'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "m_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
albatrossandco/brubeck_cms/brubeck/core/emailing/views.py
[ { "content": "\"\"\"\nProvides an assortment of functions to help with general e-mail forms.\nThere are only two form fields with special meanings, and both are optional:\n 'self_email' should always be the sender's own e-mail address.\n 'cc_self' is a BooleanField asking whether or not the person wants to be\n sent a copy of the e-mail being generated.\n\"\"\"\n\n# Imports from standard libraries\nimport mimetools\n\n# Imports from Django\nfrom django import forms\nfrom django.conf import settings\nfrom django.contrib.auth.decorators import user_passes_test\nfrom django.contrib.auth.views import redirect_to_login\nfrom django.contrib.sites.models import Site\nfrom django.core.exceptions import ObjectDoesNotExist\n# from django.core.mail import send_mail\nfrom django.core.mail import EmailMessage, SMTPConnection\nfrom django.http import Http404, HttpResponseRedirect\nfrom django.shortcuts import render_to_response\nfrom django.template import Context, loader, RequestContext\nfrom django.utils.html import strip_tags\n\n# Imports from brubeck\nfrom brubeck.core.decorators import is_editor\nfrom brubeck.core.emailing.forms import *\n\n\n\nfrom brubeck.articles.models import Article\n#from brubeck.blogs.models import Entry\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def render_email_and_send(context=None, message_template='', subject='', recipients=None, sender=None):\n \"\"\"\n Sends an e-mail based on the given parameters.\n \n Takes a context (as a dictionary), a template path (as a string), a subject\n (as a string) and recipients (as a list or tuple). E-mail templates SHOULD\n (see RFC 2119 for the meaning of SHOULD) be plain text. (I have no idea\n what will happen if you pass HTML.)\n \"\"\"\n t = loader.get_template(message_template)\n c = Context(context)\n message = t.render(c)\n \n # Not sure why, but there's a random bug somewhere that causes e-mail\n # socket errors. It's puzzled some other people, but this line seems to\n # more or less fix it:\n # http://mail.python.org/pipermail/python-list/2006-December/420357.html\n mimetools._prefix = 'x'\n \n if not sender:\n sender = settings.SERVER_EMAIL\n \n # send_mail(subject, message, sender, recipients)\n \n connection = SMTPConnection(fail_silently=True)\n email_to_send = EmailMessage(\n subject = subject,\n body = message,\n from_email = sender,\n to = recipients,\n connection = connection\n )\n email_to_send.send(fail_silently=True)\n connection.close()", "metadata": "root.render_email_and_send", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def handle_form_and_email(request, form=None, form_template='', message_template='', subject='', recipients=None, redirect_to='/thanks/', sender=None, uses_captcha=True, *args, **kwargs):\n \"\"\"\n Abstracts the rendering and processing of e-mail forms.\n \"\"\"\n if uses_captcha:\n remote_ip = request.META['REMOTE_ADDR']\n if request.method == 'POST':\n if uses_captcha:\n form = form(remote_ip, request.POST)\n else:\n form = form(request.POST)\n \n if form.is_valid():\n # Handle special field names and possibly set sender address.\n try:\n if form.cleaned_data['cc_self']:\n recipients.append(form.cleaned_data['self_email'])\n if sender == 'self':\n sender = form.cleaned_data['self_email']\n except:\n pass\n # Send the e-mail.\n render_email_and_send(message_template=message_template, context=form.cleaned_data, subject=subject, recipients=recipients, sender=sender)\n return HttpResponseRedirect('/thanks/')\n else:\n if uses_captcha:\n form = form(remote_ip)\n else:\n form = form()\n \n page = {\n 'form': form\n }\n \n return render_to_response(form_template, page, context_instance=RequestContext(request))", "metadata": "root.handle_form_and_email", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def captcha_form_and_email(request, form=None, form_template='', message_template='', subject='', recipients=None, redirect_to='/thanks/', sender=None, *args, **kwargs):\n \"\"\"\n Abstracts the rendering and processing of e-mail forms.\n \"\"\"\n remote_ip = request.META['REMOTE_ADDR']\n if request.method == 'POST':\n form = form(remote_ip, request.POST)\n if form.is_valid():\n # Handle special field names and possibly set sender address.\n try:\n if form.cleaned_data['cc_self']:\n recipients.append(form.cleaned_data['self_email'])\n if sender == 'self':\n sender = form.cleaned_data['self_email']\n except:\n pass\n # Send the e-mail.\n render_email_and_send(message_template=message_template, context=form.cleaned_data, subject=subject, recipients=recipients, sender=sender)\n return HttpResponseRedirect('/thanks/')\n else:\n form = form(remote_ip)\n \n page = {\n 'form': form\n }\n \n return render_to_response(form_template, page, context_instance=RequestContext(request))", "metadata": "root.captcha_form_and_email", "header": "['module', '___EOS___']", "index": 103 }, { "content": "@user_passes_test(lambda u: u.is_staff or u.is_superuser)\ndef restricted_email(request, form=None, form_template='', message_template='', subject='', recipients=None, redirect_to='/thanks/', uses_captcha=False, editor_required=False):\n \"\"\"\n Wraps handle_form_and_email() to require users to be staff members (or\n editors, if you'd prefer).\n \"\"\"\n if is_editor(request.user) or not editor_required:\n return handle_form_and_email(request, form=form, form_template=form_template, message_template=message_template, subject=subject, recipients=recipients, redirect_to=redirect_to, uses_captcha=uses_captcha)\n else:\n # Make the user log in first.\n redirect_to_login(next=request.META['PATH_INFO'])", "metadata": "root.restricted_email", "header": "['module', '___EOS___']", "index": 131 }, { "content": "def email_content(request, content_type=None, content_id=None):\n \"\"\"\n Allows users to e-mail content to other people.\n \"\"\"\n site = Site.objects.get_current()\n \n if request.method == 'POST':\n form = ContentEmailForm(request.POST)\n else:\n form = ContentEmailForm({\n 'content_type': content_type,\n 'content_id': content_id,\n 'sender_email': '[email protected]',\n 'recipient_email': '[email protected]'\n })\n if form.is_valid():\n try:\n if form.cleaned_data['content_type'] == 'article':\n object = Article.get_published.filter(section__publication__site=site).get(id=form.cleaned_data['content_id']) \n# elif form.cleaned_data['content_type'] == 'blog_entry':\n# object = Entry.get_published.filter(blog__section__publication__site=site).get(id=form.cleaned_data['content_id'])\n else:\n raise Http404\n except ObjectDoesNotExist:\n raise Http404\n\n if request.method == 'POST':\n # Check to make sure they filled in addresses instead of using our\n # placeholders.\n if form.cleaned_data['sender_email'] == '[email protected]':\n # Return the form with everything still filled in except\n # sender_email. This will cause an error message to show up next to\n # that field asking for a valid address.\n form = ContentEmailForm({\n 'sender_name': form.cleaned_data['sender_name'],\n 'recipient_name': form.cleaned_data['recipient_name'],\n 'recipient_email': form.cleaned_data['recipient_email'],\n 'note': form.cleaned_data['note'],\n 'content_type': form.cleaned_data['content_type'],\n 'content_id': form.cleaned_data['content_id']\n })\n elif form.cleaned_data['recipient_email'] == '[email protected]':\n # Return the form with everything still filled in except\n # recipient_email. This will cause an error message to show up next\n # to that field asking for a valid address.\n form = ContentEmailForm({\n 'sender_name': form.cleaned_data['sender_name'],\n 'sender_email': form.cleaned_data['sender_email'],\n 'recipient_name': form.cleaned_data['recipient_name'],\n 'note': form.cleaned_data['note'], \n 'content_type': form.cleaned_data['content_type'],\n 'content_id': form.cleaned_data['content_id']\n })\n else:\n email_context = {\n 'sender_name': form.cleaned_data['sender_name'],\n 'sender_email': form.cleaned_data['sender_email'],\n 'recipient_name': form.cleaned_data['recipient_name'],\n 'recipient_email': form.cleaned_data['recipient_email'],\n 'note': form.cleaned_data['note'],\n 'object': object\n }\n render_email_and_send(context=email_context, message_template='core/email_content.txt', subject='%s: E-mail from themaneater.com' % strip_tags(object.title), recipients=[email_context['recipient_email']], sender=email_context['sender_email'])\n return HttpResponseRedirect('/thanks/')\n \n page = {\n 'form': form,\n 'object': object\n }\n\n return render_to_response('core/email_content.html', page, context_instance=RequestContext(request))", "metadata": "root.email_content", "header": "['module', '___EOS___']", "index": 143 } ]
[ { "span": "from django import forms", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 24 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Prov", "ides", " ", "an", " ", "ass", "ort", "ment", " ", "of", " ", "function", "s", " ", "to", " ", "help", " ", "with", " ", "genera", "l", " ", "e-", "mail", " ", "forms", ".", "\\", "10", ";", "There", " ", "are", " ", "only", " ", "two", " ", "form", " ", "fields", " ", "with", " ", "special", " ", "meaning", "s", ",", " ", "and", " ", "bot", "h", " ", "are", " ", "option", "al", ":", "\\", "10", ";", " ", " ", " ", " ", "'", "self", "\\u", "email", "'", " ", "shou", "ld", " ", "alw", "ay", "s", " ", "be", " ", "the", " ", "sender", "'", "s", " ", "own", " ", "e-", "mail", " ", "address", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "cc", "\\u", "self", "'", " ", "is", " ", "a", " ", "Boo", "lean", "Field", " ", "ask", "ing", " ", "whe", "ther", " ", "or", " ", "not", " ", "the", " ", "person", " ", "want", "s", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "sent", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "e-", "mail", " ", "bei", "ng", " ", "generat", "ed", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Imports", " ", "from", " ", "standard", " ", "libraries_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mime", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Imports", " ", "from", " ", "Dj", "ang", "o_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "user", "\\u", "pass", "es", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "views_", "import_", "redirec", "t", "\\u", "to", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "sites_", "._", "models_", "import_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Object", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "from", " ", "django", ".", "core", ".", "mail", " ", "import", " ", "send", "\\u", "mail_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "mail_", "import_", "Ema", "il", "Message_", ",_", "SMT", "PC", "onnect", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http404_", ",_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Context_", ",_", "loader_", ",_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "html_", "import_", "strip", "\\u", "tags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Imports", " ", "from", " ", "bru", "bec", "k_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bru", "bec", "k_", "._", "core_", "._", "decorators_", "import_", "is", "\\u", "editor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bru", "bec", "k_", "._", "core_", "._", "email", "ing_", "._", "forms_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "bru", "bec", "k_", "._", "articles_", "._", "models_", "import_", "Article_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "bru", "bec", "k", ".", "blogs", ".", "model", "s", " ", "import", " ", "Entry_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "render", "\\u", "email", "\\u", "and", "\\u", "send_", "(_", "context_", "=_", "None_", ",_", "message", "\\u", "template_", "=_", "''_", ",_", "subject_", "=_", "''_", ",_", "recipients_", "=_", "None_", ",_", "sender_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sen", "ds", " ", "an", " ", "e-", "mail", " ", "based", " ", "on", " ", "the", " ", "give", "n", " ", "parameter", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Tak", "es", " ", "a", " ", "context", " ", "(", "as", " ", "a", " ", "dictionar", "y", "),", " ", "a", " ", "template", " ", "path", " ", "(", "as", " ", "a", " ", "string", "),", " ", "a", " ", "subject", "\\", "10", ";", " ", " ", " ", " ", "(", "as", " ", "a", " ", "string", ")", " ", "and", " ", "recip", "ients", " ", "(", "as", " ", "a", " ", "list", " ", "or", " ", "tuple", ").", " ", "E-", "mail", " ", "template", "s", " ", "SHO", "UL", "D", "\\", "10", ";", " ", " ", " ", " ", "(", "see", " ", "RF", "C", " ", "211", "9", " ", "for", " ", "the", " ", "meaning", " ", "of", " ", "SHO", "UL", "D", ")", " ", "be", " ", "plain", " ", "text", ".", " ", "(", "I", " ", "have", " ", "no", " ", "idea", "\\", "10", ";", " ", " ", " ", " ", "what", " ", "will", " ", "happ", "en", " ", "if", " ", "you", " ", "pass", " ", "HTM", "L", ".)", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "loader_", "._", "get", "\\u", "template_", "(_", "message", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Context_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "t_", "._", "render_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "sure", " ", "wh", "y", ",", " ", "but", " ", "there", "'", "s", " ", "a", " ", "random", " ", "bug", " ", "some", "where", " ", "tha", "t", " ", "caus", "es", " ", "e-", "mail_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "socket", " ", "error", "s", ".", " ", "It", "'", "s", " ", "puzzle", "d", " ", "some", " ", "other", " ", "people", ",", " ", "but", " ", "this", " ", "line", " ", "see", "ms", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "more", " ", "or", " ", "less", " ", "fix", " ", "it", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "mail", ".", "python", ".", "org", "/", "pipe", "rma", "il", "/", "python", "-", "list", "/", "2006", "-", "Dece", "mber", "/", "420", "357", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "mime", "tools_", "._", "\\u", "prefix_", "=_", "'", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "sender_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sender_", "=_", "settings_", "._", "SERVER", "\\u", "EMAIL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "send", "\\u", "mail", "(", "subject", ",", " ", "message", ",", " ", "sender", ",", " ", "recip", "ients", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "connection_", "=_", "SMT", "PC", "onnect", "ion_", "(_", "fail", "\\u", "silently", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email", "\\u", "to", "\\u", "send_", "=_", "Ema", "il", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "subject_", "=_", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from", "\\u", "email_", "=_", "sender_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "to_", "=_", "recipients_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "connection_", "=_", "connection_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email", "\\u", "to", "\\u", "send_", "._", "send_", "(_", "fail", "\\u", "silently", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "form", "\\u", "and", "\\u", "email_", "(_", "request_", ",_", "form_", "=_", "None_", ",_", "form", "\\u", "template_", "=_", "''_", ",_", "message", "\\u", "template_", "=_", "''_", ",_", "subject_", "=_", "''_", ",_", "recipients_", "=_", "None_", ",_", "redirec", "t", "\\u", "to_", "=_", "'/", "thanks", "/'_", ",_", "sender_", "=_", "None_", ",_", "use", "s", "\\u", "captcha", "_", "=_", "True_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Abstract", "s", " ", "the", " ", "render", "ing", " ", "and", " ", "process", "ing", " ", "of", " ", "e-", "mail", " ", "forms", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "use", "s", "\\u", "captcha", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "ip_", "=_", "request_", "._", "META_", "[_", "'", "REMO", "TE", "\\u", "ADDR", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "use", "s", "\\u", "captcha", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "form_", "(_", "remote", "\\u", "ip_", ",_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "special", " ", "field", " ", "names", " ", "and", " ", "possib", "ly", " ", "set", " ", "sender", " ", "address", "._", "\\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 ", " _", "if_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "cc", "\\u", "self", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "recipients_", "._", "append_", "(_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "self", "\\u", "email", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sender_", "==_", "'", "self", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sender_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "self", "\\u", "email", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "the", " ", "e-", "mail", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "render", "\\u", "email", "\\u", "and", "\\u", "send_", "(_", "message", "\\u", "template_", "=_", "message", "\\u", "template_", ",_", "context_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", ",_", "subject_", "=_", "subject_", ",_", "recipients_", "=_", "recipients_", ",_", "sender_", "=_", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/", "thanks", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "use", "s", "\\u", "captcha", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "form_", "(_", "remote", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "form", "\\u", "template_", ",_", "page_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "captcha", "\\u", "form", "\\u", "and", "\\u", "email_", "(_", "request_", ",_", "form_", "=_", "None_", ",_", "form", "\\u", "template_", "=_", "''_", ",_", "message", "\\u", "template_", "=_", "''_", ",_", "subject_", "=_", "''_", ",_", "recipients_", "=_", "None_", ",_", "redirec", "t", "\\u", "to_", "=_", "'/", "thanks", "/'_", ",_", "sender_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Abstract", "s", " ", "the", " ", "render", "ing", " ", "and", " ", "process", "ing", " ", "of", " ", "e-", "mail", " ", "forms", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "ip_", "=_", "request_", "._", "META_", "[_", "'", "REMO", "TE", "\\u", "ADDR", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "form_", "(_", "remote", "\\u", "ip_", ",_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "special", " ", "field", " ", "names", " ", "and", " ", "possib", "ly", " ", "set", " ", "sender", " ", "address", "._", "\\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 ", " _", "if_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "cc", "\\u", "self", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "recipients_", "._", "append_", "(_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "self", "\\u", "email", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sender_", "==_", "'", "self", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sender_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "self", "\\u", "email", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "the", " ", "e-", "mail", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "render", "\\u", "email", "\\u", "and", "\\u", "send_", "(_", "message", "\\u", "template_", "=_", "message", "\\u", "template_", ",_", "context_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", ",_", "subject_", "=_", "subject_", ",_", "recipients_", "=_", "recipients_", ",_", "sender_", "=_", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/", "thanks", "/'_", ")_", "\\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 ", " _", "form_", "=_", "form_", "(_", "remote", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "form", "\\u", "template_", ",_", "page_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "user", "\\u", "pass", "es", "\\u", "test_", "(_", "lambda_", "u_", ":_", "u_", "._", "is", "\\u", "staff_", "or_", "u_", "._", "is", "\\u", "superuser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "restrict", "ed", "\\u", "email_", "(_", "request_", ",_", "form_", "=_", "None_", ",_", "form", "\\u", "template_", "=_", "''_", ",_", "message", "\\u", "template_", "=_", "''_", ",_", "subject_", "=_", "''_", ",_", "recipients_", "=_", "None_", ",_", "redirec", "t", "\\u", "to_", "=_", "'/", "thanks", "/'_", ",_", "use", "s", "\\u", "captcha", "_", "=_", "False_", ",_", "editor", "\\u", "required_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Wra", "ps", " ", "handle", "\\u", "form", "\\u", "and", "\\u", "email", "()", " ", "to", " ", "require", " ", "users", " ", "to", " ", "be", " ", "sta", "ff", " ", "member", "s", " ", "(", "or", "\\", "10", ";", " ", " ", " ", " ", "editors", ",", " ", "if", " ", "you", "'", "d", " ", "prefer", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "editor_", "(_", "request_", "._", "user_", ")_", "or_", "not_", "editor", "\\u", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "handle", "\\u", "form", "\\u", "and", "\\u", "email_", "(_", "request_", ",_", "form_", "=_", "form_", ",_", "form", "\\u", "template_", "=_", "form", "\\u", "template_", ",_", "message", "\\u", "template_", "=_", "message", "\\u", "template_", ",_", "subject_", "=_", "subject_", ",_", "recipients_", "=_", "recipients_", ",_", "redirec", "t", "\\u", "to_", "=_", "redirec", "t", "\\u", "to_", ",_", "use", "s", "\\u", "captcha", "_", "=_", "use", "s", "\\u", "captcha", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "the", " ", "user", " ", "log", " ", "in", " ", "first", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redirec", "t", "\\u", "to", "\\u", "login_", "(_", "next_", "=_", "request_", "._", "META_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "email", "\\u", "content_", "(_", "request_", ",_", "content", "\\u", "type_", "=_", "None_", ",_", "content", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "All", "ow", "s", " ", "users", " ", "to", " ", "e-", "mail", " ", "content", " ", "to", " ", "other", " ", "people", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "Site_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Conten", "t", "Ema", "il", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Conten", "t", "Ema", "il", "Form_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "content", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "id", "'_", ":_", "content", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "\\u", "email", "'_", ":_", "'", "from", "@", "email", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "recip", "ient", "\\u", "email", "'_", ":_", "'", "to", "@", "email", ".", "com", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "content", "\\u", "type", "'_", "]_", "==_", "'", "article", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Article_", "._", "get", "\\u", "published_", "._", "filter_", "(_", "section", "\\u\\u", "publicat", "ion", "\\u\\u", "site_", "=_", "site_", ")_", "._", "get_", "(_", "id_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "content", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "eli", "f", " ", "form", ".", "clean", "ed", "\\u", "data", "['", "content", "\\u", "type", "']", " ", "==", " ", "'", "blog", "\\u", "entry", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "object", " ", "=", " ", "Entr", "y", ".", "get", "\\u", "publi", "shed", ".", "filter", "(", "blog", "\\u\\u", "section", "\\u\\u", "publicat", "ion", "\\u\\u", "site", "=", "site", ").", "get", "(", "id", "=", "form", ".", "clean", "ed", "\\u", "data", "['", "content", "\\u", "id", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\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_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "to", " ", "make", " ", "sure", " ", "the", "y", " ", "filled", " ", "in", " ", "addresse", "s", " ", "inst", "ead", " ", "of", " ", "usi", "ng", " ", "our_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "placehold", "ers", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "sender", "\\u", "email", "'_", "]_", "==_", "'", "from", "@", "email", ".", "com", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Return", " ", "the", " ", "form", " ", "with", " ", "every", "thing", " ", "still", " ", "filled", " ", "in", " ", "except_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sender", "\\u", "email", ".", " ", "Thi", "s", " ", "will", " ", "caus", "e", " ", "an", " ", "error", " ", "message", " ", "to", " ", "show", " ", "up", " ", "next", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "field", " ", "ask", "ing", " ", "for", " ", "a", " ", "valid", " ", "address", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Conten", "t", "Ema", "il", "Form_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "\\u", "name", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "sender", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "recip", "ient", "\\u", "name", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "recip", "ient", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "recip", "ient", "\\u", "email", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "recip", "ient", "\\u", "email", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "note", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "note", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "content", "\\u", "type", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "id", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "content", "\\u", "id", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "recip", "ient", "\\u", "email", "'_", "]_", "==_", "'", "to", "@", "email", ".", "com", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Return", " ", "the", " ", "form", " ", "with", " ", "every", "thing", " ", "still", " ", "filled", " ", "in", " ", "except_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recip", "ient", "\\u", "email", ".", " ", "Thi", "s", " ", "will", " ", "caus", "e", " ", "an", " ", "error", " ", "message", " ", "to", " ", "show", " ", "up", " ", "next_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "tha", "t", " ", "field", " ", "ask", "ing", " ", "for", " ", "a", " ", "valid", " ", "address", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Conten", "t", "Ema", "il", "Form_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "\\u", "name", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "sender", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "\\u", "email", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "sender", "\\u", "email", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "recip", "ient", "\\u", "name", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "recip", "ient", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "note", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "note", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "content", "\\u", "type", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "id", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "content", "\\u", "id", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "email", "\\u", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "\\u", "name", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "sender", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sender", "\\u", "email", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "sender", "\\u", "email", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "recip", "ient", "\\u", "name", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "recip", "ient", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "recip", "ient", "\\u", "email", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "recip", "ient", "\\u", "email", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "note", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "note", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "'_", ":_", "object_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "render", "\\u", "email", "\\u", "and", "\\u", "send_", "(_", "context_", "=_", "email", "\\u", "context_", ",_", "message", "\\u", "template_", "=_", "'", "core", "/", "email", "\\u", "content", ".", "txt", "'_", ",_", "subject_", "=_", "'%", "s", ":", " ", "E-", "mail", " ", "from", " ", "them", "ane", "ater", ".", "com", "'_", "%_", "strip", "\\u", "tags_", "(_", "object_", "._", "title_", ")_", ",_", "recipients_", "=_", "[_", "email", "\\u", "context_", "[_", "'", "recip", "ient", "\\u", "email", "'_", "]_", "]_", ",_", "sender_", "=_", "email", "\\u", "context_", "[_", "'", "sender", "\\u", "email", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/", "thanks", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "'_", ":_", "object_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "core", "/", "email", "\\u", "content", ".", "html", "'_", ",_", "page_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
OpenMDAO/OpenMDAO-Framework/openmdao.devtools/src/openmdao/devtools/push_release.py
[ { "content": "def _push_release(release_dir, destination, obj, py='python'):\n \"\"\"Take a directory containing release files (openmdao package\n distributions, install scripts, etc., and place the files in the\n proper locations on the server.\n\n release_dir: str\n where the release file are located\n\n destination: str\n the location where the release files are to be placed. It can be a URL\n or a local directory\n\n obj: _CommObj\n an object to wrap the behaviors of run, put, etc. so calls are the\n same for local or remote release areas\n\n py: str\n python version to use to build index files\n \"\"\"\n files = os.listdir(release_dir)\n f = fnmatch.filter(files, 'go-openmdao-*.py')\n try:\n f.remove('go-openmdao-dev.py')\n except:\n pass\n if len(f) < 1:\n raise RuntimeError(\"can't find go-openmdao-*.py file in release directory\")\n elif len(f) > 1:\n raise RuntimeError(\"more than one file in release dir matches 'go-openmdao-*.py'\")\n script = f[0]\n\n # determine version from the form of the go-openmdao-?.?.py file\n version = os.path.splitext(script)[0].split('-', 2)[2]\n\n # the following will barf if the version already exists on the server\n obj.run('mkdir %s/downloads/%s' % (destination, version))\n obj.run('chmod 755 %s/downloads/%s' % (destination, version))\n\n # push new distribs to the server\n for f in os.listdir(release_dir):\n if (f.endswith('.tar.gz') and f != 'docs.tar.gz') or f.endswith('.egg'):\n obj.put(os.path.join(release_dir,f), '%s/dists/%s' % (destination, f))\n obj.run('chmod 644 %s/dists/%s' % (destination, f))\n\n obj.put(os.path.join(release_dir, 'go-openmdao-%s.py' % version),\n '%s/downloads/%s/go-openmdao-%s.py' % (destination, version, version))\n obj.run('chmod 755 %s/downloads/%s/go-openmdao-%s.py' % (destination, version, version))\n\n # put the docs on the server\n obj.put_dir(os.path.join(release_dir, 'docs'),\n '%s/downloads/%s/docs' % (destination, version))\n\n obj.put(os.path.join(repo_top(),'scripts','mkdlversionindex.py'),\n '%s/downloads/%s/mkdlversionindex.py' % (destination, version))\n\n obj.put(os.path.join(repo_top(),'scripts','mkegglistindex.py'),\n '%s/dists/mkegglistindex.py' % destination)\n\n obj.put(os.path.join(repo_top(),'scripts','mkdownloadindex.py'),\n '%s/downloads/mkdownloadindex.py' % destination)\n\n cdir = os.getcwd()\n\n # update the index.html for the version download directory on the server\n dpath = '%s/downloads/%s' % (destination, version)\n obj.run('cd %s && %s mkdlversionindex.py' % (dpath, py))\n\n os.chdir(cdir)\n\n # update the index.html for the dists directory on the server\n dpath = '%s/dists' % destination\n obj.run('cd %s && %s mkegglistindex.py' % (dpath, py))\n\n os.chdir(cdir)\n\n # update the 'latest' link\n obj.run('rm -f %s/downloads/latest' % destination)\n obj.run('ln -s -f %s %s/downloads/latest' % (version, destination))\n\n os.chdir(cdir)\n\n # update the index.html for the downloads directory on the server\n dpath = '%s/downloads' % destination\n obj.run('cd %s && %s mkdownloadindex.py' % (dpath, py))", "metadata": "root._push_release", "header": "['module', '___EOS___']", "index": 10 } ]
[ { "span": "except:", "start_line": 33, "start_column": 4, "end_line": 33, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "push", "\\u", "release_", "(_", "release", "\\u", "dir_", ",_", "destination_", ",_", "obj_", ",_", "py_", "=_", "'", "python", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Tak", "e", " ", "a", " ", "director", "y", " ", "contain", "ing", " ", "release", " ", "files", " ", "(", "openm", "dao", " ", "package", "\\", "10", ";", " ", " ", " ", " ", "distribu", "tion", "s", ",", " ", "install", " ", "scripts", ",", " ", "etc", ".,", " ", "and", " ", "place", " ", "the", " ", "files", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "proper", " ", "location", "s", " ", "on", " ", "the", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "release", "\\u", "dir", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "the", " ", "release", " ", "file", " ", "are", " ", "located", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "destinat", "ion", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "location", " ", "where", " ", "the", " ", "release", " ", "files", " ", "are", " ", "to", " ", "be", " ", "place", "d", ".", " ", "It", " ", "can", " ", "be", " ", "a", " ", "URL", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "a", " ", "local", " ", "director", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "obj", ":", " ", "\\u", "Comm", "Obj", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "object", " ", "to", " ", "wrap", " ", "the", " ", "behavior", "s", " ", "of", " ", "run", ",", " ", "put", ",", " ", "etc", ".", " ", "so", " ", "calls", " ", "are", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "same", " ", "for", " ", "local", " ", "or", " ", "remote", " ", "release", " ", "area", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "py", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "version", " ", "to", " ", "use", " ", "to", " ", "build", " ", "index", " ", "files", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "os_", "._", "listdir_", "(_", "release", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "fnmatch_", "._", "filter_", "(_", "files_", ",_", "'", "go", "-", "openm", "dao", "-*", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "remove_", "(_", "'", "go", "-", "openm", "dao", "-", "dev", ".", "py", "'_", ")_", "\\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_", "if_", "len_", "(_", "f_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "can", "'", "t", " ", "find", " ", "go", "-", "openm", "dao", "-*", ".", "py", " ", "file", " ", "in", " ", "release", " ", "director", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "f_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "more", " ", "than", " ", "one", " ", "file", " ", "in", " ", "release", " ", "dir", " ", "matche", "s", " ", "'", "go", "-", "openm", "dao", "-*", ".", "py", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "script_", "=_", "f_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "version", " ", "from", " ", "the", " ", "form", " ", "of", " ", "the", " ", "go", "-", "openm", "dao", "-?", ".", "?", ".", "py", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "script_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'-'_", ",_", "2_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "follow", "ing", " ", "will", " ", "bar", "f", " ", "if", " ", "the", " ", "version", " ", "alr", "ead", "y", " ", "exist", "s", " ", "on", " ", "the", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "run_", "(_", "'", "mkd", "ir", " ", "%", "s", "/", "download", "s", "/", "%", "s", "'_", "%_", "(_", "destination_", ",_", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "run_", "(_", "'", "chm", "od", " ", "755", " ", "%", "s", "/", "download", "s", "/", "%", "s", "'_", "%_", "(_", "destination_", ",_", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "push", " ", "new", " ", "distri", "bs", " ", "to", " ", "the", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "os_", "._", "listdir_", "(_", "release", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "f_", "._", "endswith_", "(_", "'.", "tar", ".", "gz", "'_", ")_", "and_", "f_", "!=_", "'", "docs", ".", "tar", ".", "gz", "'_", ")_", "or_", "f_", "._", "endswith_", "(_", "'.", "egg", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "put_", "(_", "os_", "._", "path_", "._", "join_", "(_", "release", "\\u", "dir_", ",_", "f_", ")_", ",_", "'%", "s", "/", "dists", "/", "%", "s", "'_", "%_", "(_", "destination_", ",_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "run_", "(_", "'", "chm", "od", " ", "644", " ", "%", "s", "/", "dists", "/", "%", "s", "'_", "%_", "(_", "destination_", ",_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "._", "put_", "(_", "os_", "._", "path_", "._", "join_", "(_", "release", "\\u", "dir_", ",_", "'", "go", "-", "openm", "dao", "-%", "s", ".", "py", "'_", "%_", "version_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "download", "s", "/", "%", "s", "/", "go", "-", "openm", "dao", "-%", "s", ".", "py", "'_", "%_", "(_", "destination_", ",_", "version_", ",_", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "run_", "(_", "'", "chm", "od", " ", "755", " ", "%", "s", "/", "download", "s", "/", "%", "s", "/", "go", "-", "openm", "dao", "-%", "s", ".", "py", "'_", "%_", "(_", "destination_", ",_", "version_", ",_", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "put", " ", "the", " ", "docs", " ", "on", " ", "the", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "put", "\\u", "dir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "release", "\\u", "dir_", ",_", "'", "docs", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "download", "s", "/", "%", "s", "/", "docs", "'_", "%_", "(_", "destination_", ",_", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "put_", "(_", "os_", "._", "path_", "._", "join_", "(_", "repo", "\\u", "top_", "(_", ")_", ",_", "'", "scripts", "'_", ",_", "'", "mkd", "lver", "sion", "index", ".", "py", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "download", "s", "/", "%", "s", "/", "mkd", "lver", "sion", "index", ".", "py", "'_", "%_", "(_", "destination_", ",_", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "put_", "(_", "os_", "._", "path_", "._", "join_", "(_", "repo", "\\u", "top_", "(_", ")_", ",_", "'", "scripts", "'_", ",_", "'", "mke", "gg", "listi", "nde", "x", ".", "py", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "dists", "/", "mke", "gg", "listi", "nde", "x", ".", "py", "'_", "%_", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "put_", "(_", "os_", "._", "path_", "._", "join_", "(_", "repo", "\\u", "top_", "(_", ")_", ",_", "'", "scripts", "'_", ",_", "'", "mkd", "own", "load", "index", ".", "py", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "download", "s", "/", "mkd", "own", "load", "index", ".", "py", "'_", "%_", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cdi", "r_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "the", " ", "index", ".", "html", " ", "for", " ", "the", " ", "version", " ", "download", " ", "director", "y", " ", "on", " ", "the", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "dpath_", "=_", "'%", "s", "/", "download", "s", "/", "%", "s", "'_", "%_", "(_", "destination_", ",_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "run_", "(_", "'", "cd", " ", "%", "s", " ", "&&", " ", "%", "s", " ", "mkd", "lver", "sion", "index", ".", "py", "'_", "%_", "(_", "dpath_", ",_", "py_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "cdi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "the", " ", "index", ".", "html", " ", "for", " ", "the", " ", "dists", " ", "director", "y", " ", "on", " ", "the", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "dpath_", "=_", "'%", "s", "/", "dists", "'_", "%_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "run_", "(_", "'", "cd", " ", "%", "s", " ", "&&", " ", "%", "s", " ", "mke", "gg", "listi", "nde", "x", ".", "py", "'_", "%_", "(_", "dpath_", ",_", "py_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "cdi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "the", " ", "'", "late", "st", "'", " ", "link_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "run_", "(_", "'", "rm", " ", "-", "f", " ", "%", "s", "/", "download", "s", "/", "late", "st", "'_", "%_", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "run_", "(_", "'", "ln", " ", "-", "s", " ", "-", "f", " ", "%", "s", " ", "%", "s", "/", "download", "s", "/", "late", "st", "'_", "%_", "(_", "version_", ",_", "destination_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "cdi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "the", " ", "index", ".", "html", " ", "for", " ", "the", " ", "download", "s", " ", "director", "y", " ", "on", " ", "the", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "dpath_", "=_", "'%", "s", "/", "download", "s", "'_", "%_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "run_", "(_", "'", "cd", " ", "%", "s", " ", "&&", " ", "%", "s", " ", "mkd", "own", "load", "index", ".", "py", "'_", "%_", "(_", "dpath_", ",_", "py_", ")_", ")_", "\\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,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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 ]
Unreachable code
coddingtonbear/jirafs/jirafs/ticketfolder.py
[ { "content": " def status(self):\n status = {\n 'ready': self.get_ready_changes(),\n 'local_uncommitted': self.get_local_uncommitted_changes(),\n 'uncommitted': self.get_uncommitted_changes(),\n 'up_to_date': self.is_up_to_date(),\n }\n\n return self.execute_plugin_method_series(\n 'alter_status_dict',\n args=(status, ),\n single_response=True,\n )\n\n return status", "metadata": "root.TicketFolder.status", "header": "['class', 'TicketFolder', '(', 'object', ')', ':', '___EOS___']", "index": 873 } ]
[ { "span": "return status", "start_line": 887, "start_column": 8, "end_line": 887, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Ticke", "t", "Folder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "read", "y", "'_", ":_", "self_", "._", "get", "\\u", "read", "y", "\\u", "changes_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "uncomm", "itte", "d", "'_", ":_", "self_", "._", "get", "\\u", "local", "\\u", "uncomm", "itte", "d\\u", "changes_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uncomm", "itte", "d", "'_", ":_", "self_", "._", "get", "\\u", "uncomm", "itte", "d\\u", "changes_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "up", "\\u", "to", "\\u", "date", "'_", ":_", "self_", "._", "is", "\\u", "up", "\\u", "to", "\\u", "date_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "execute", "\\u", "plugin", "\\u", "method", "\\u", "series_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alter", "\\u", "status", "\\u", "dict", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "status_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "single", "\\u", "response_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2 ]
Imprecise assert
mission-liao/pyswagger/pyswagger/tests/v2_0/test_prim.py
[ { "content": " def test_with_bool_false(self):\n d = self.app.resolve('#/definitions/add_prop_false')\n m = self.app.prim_factory.produce(\n d,\n dict(\n name='test_bool',\n category1=1,\n category2='test_qoo'\n )\n )\n\n self.assertTrue(isinstance(m, primitives.Model))\n self.assertEqual(m.name, 'test_bool')\n self.assertTrue('category1' not in m)\n self.assertTrue('category2' not in m)", "metadata": "root.AdditionalPropertiesTestCase.test_with_bool_false", "header": "['class', 'AdditionalPropertiesTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 353 } ]
[ { "span": "self.assertTrue('category1' not in m)", "start_line": 366, "start_column": 8, "end_line": 366, "end_column": 45 }, { "span": "self.assertTrue('category2' not in m)", "start_line": 367, "start_column": 8, "end_line": 367, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Addition", "al", "Proper", "ties", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "bool\\u", "false_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "app_", "._", "resolve_", "(_", "'#", "/", "definit", "ion", "s", "/", "add", "\\u", "prop", "\\u", "fal", "se", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "self_", "._", "app_", "._", "prim", "\\u", "factory_", "._", "produce", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "test\\u", "bool", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "category", "1_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "category", "2_", "=_", "'", "test\\u", "qo", "o", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "m_", ",_", "primitives_", "._", "Model_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m_", "._", "name_", ",_", "'", "test\\u", "bool", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "category", "1", "'_", "not_", "in_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "category", "2", "'_", "not_", "in_", "m_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
Esri/ops-server-config/Publish/Server/StartStopServices.py
[ { "content": "#!/usr/bin/env python\n#------------------------------------------------------------------------------\n# Copyright 2014 Esri\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#==============================================================================\n#Name: StartStopServices.py\n# \n#Purpose: Starts or stops ArcGIS Server services.\n#\n#==============================================================================\nimport sys, os, time, traceback\nfrom datetime import datetime\ntotalSuccess = True\n\n# Add \"Root folder\"\\SupportFiles to sys path inorder to import\n# modules in subfolder\nsys.path.append(os.path.join(os.path.dirname(\n os.path.dirname(os.path.dirname(sys.argv[0]))), \"SupportFiles\"))\n\nfrom AGSRestFunctions import getServiceList\nfrom AGSRestFunctions import stopStartServices\nfrom AGSRestFunctions import getServiceStatus\n\nvalidTypes = [\"MapServer\", \"ImageServer\", \"GeometryServer\", \"GeocodeServer\",\n \"GPServer\", \"FeatureServer\", \"GlobeServer\", \"GeoDataServer\"]\nuserServiceStr = None\nserviceList = None\nscriptName = os.path.basename(sys.argv[0])\n\n# ---------------------------------------------------------------------\n# Check arguments\n# ---------------------------------------------------------------------\n\nif len(sys.argv) < 7:\n print '\\n' + scriptName + ' <Server_Name> <Server_Port> <User_Name> <Password> <Use_SSL: Yes|No> <Start|Stop> {{folder/}service.type,...| Service_List_File}'\n print '\\nWhere:'\n print '\\n\\t<Server_Name> (required) server name.'\n print '\\n\\t<Server_Port> (required) server port; if not using server port enter #'\n print '\\n\\t<User_Name> (required) user with admin or publisher permission.'\n print '\\n\\t<Password> (required) user password.'\n print '\\n\\t<Use_SSL: Yes|No> (required) Flag indicating if ArcGIS Server requires HTTPS.'\n print '\\n\\t<Start|Stop> (required) action to perform.'\n \n print '\\n\\t{{folder/}service.type,...| Service_List_File} (optional) to Start|Stop specific services, specify'\n print '\\t\\tcomma delimited list of services or specify a path to a file containing {{folder/}service.type entries.'\n print '\\t\\tIf specifying file, each {{folder/}service.type entry must be on a separate line.'\n \n print '\\n\\t\\tWhere:'\n print '\\t\\t\\t{:<8}{}'.format('folder', '- (optional) is name of folder service resides')\n print '\\t\\t\\t{:<8}{}'.format('service', '- (required) is name of service')\n print '\\t\\t\\t{:<8}{}'.format('type', '- (required) is the type of of service; valid values are:')\n print '\\t\\t\\t\\t' + str(validTypes)\n print '\\n\\t\\t\\tNOTE: To include spaces in this list, surround with double-quotes.'\n \n print '\\n\\t\\tExamples:'\n print '\\t\\t\\tMyServices.MapServer'\n print '\\t\\t\\tUtilities/Geometry.GeometryServer'\n print '\\t\\t\\tMyServices.MapServer,Utilities/Geometry.GeometryServer'\n print '\\t\\t\\t\"MyServices.MapServer, Utilities/Geometry.GeometryServer\"\\n'\n sys.exit(1)\n\nserverName = sys.argv[1]\nserverPort = sys.argv[2]\nuserName = sys.argv[3]\npassWord = sys.argv[4]\nuseSSL = sys.argv[5]\nserviceAction = sys.argv[6]\nif len(sys.argv) == 8:\n userServiceStr = sys.argv[7]\n\nif useSSL.strip().lower() in ['yes', 'ye', 'y']:\n useSSL = True\nelse:\n useSSL = False\n \n# Perform some checks on the user specified service list\nif userServiceStr is not None:\n \n serviceList = []\n \n # Read in the user specified serivces\n if os.path.exists(userServiceStr):\n # User has specified a path; make sure it's a file\n if not os.path.isfile(userServiceStr):\n print \"Error: The specified Service_List_File \" + userServiceStr + \" is not a file.\\n\"\n sys.exit(1)\n\n f = open(userServiceStr, 'r')\n for service in f:\n serviceList.append(service.strip())\n f.close()\n if len(serviceList) == 0:\n print \"Error: The specfied Service_List_File \" + userServiceStr + \" is empty.\\n\"\n sys.exit(1)\n else:\n serviceList = userServiceStr.replace(\" \", \",\").split(\",\")\n \n # if userServiceStr had more than one space between service values then there\n # will be 0-length string elements, so remove any elements with\n # 0-length strings.\n serviceList = [x for x in serviceList if len(x) > 0]\n \n # Make sure each service element has \".\" separator\n if len(serviceList) <> str(serviceList).count(\".\"):\n print \"Error: There are missing '.' delimiters between service name and type.\\n\"\n sys.exit(1)\n\n # Make sure each service element has a valid service \"type\"\n notValidTypes = []\n for x in [x.split(\".\")[1].lower() for x in serviceList]:\n if x not in [y.lower() for y in validTypes]:\n notValidTypes.append(x)\n if len(notValidTypes) > 0:\n print \"Error: You have specified invalid 'type' values: \" + str(notValidTypes)\n print \"Valid values are: \" + str(validTypes) + \"\\n\"\n sys.exit(1)\n\nif serverPort.strip() == '#':\n serverPort = None\n \nvalidActionList = [\"stop\", \"start\"]\nisActionValid = False\n\n# Check if user specific valid actions\nfor validAction in validActionList:\n if validAction.lower() == serviceAction.lower():\n isActionValid = True\n break\nif not isActionValid:\n print \"User specified action '\" + serviceAction + \" is not valid.\"\n print \"Valid actions are:\" + str(validActionList) + \"\\n\"\n sys.exit(1)\n\ntry:\n startTime = datetime.now()\n \n # ---------------------------------------------------------------------\n # Get list of all services/or user specified list\n # ---------------------------------------------------------------------\n if not serviceList:\n serviceList = getServiceList(serverName, serverPort, userName, passWord, useSSL)\n\n # Remove hosted services from list since these can't be started/stopped\n print '\\nRemoving \"Hosted\" services from service list; these services can not be started/stopped.'\n serviceList = [x for x in serviceList if x.find('Hosted/') == -1]\n \n if len(serviceList) == 0:\n print \"\\t*ERROR: No services to \" + serviceAction.title() + \".\"\n \n # ---------------------------------------------------------------------\n # Filter the service list and remove services that are already at the requested state\n # ---------------------------------------------------------------------\n \n if len(serviceList) > 0:\n \n actionStatusMap = {\"STOP\":\"STOPPED\", \"START\":\"STARTED\"}\n modServiceList = []\n \n print \"\\n{}\".format(\"-\" * 110)\n print \"- Check status of specified services...\\n\"\n \n for service in serviceList:\n folder = None\n serviceNameAndType = service\n service = service.replace(\"//\", \"/\")\n if service.find(\"/\") > 0:\n folder = service.split(\"/\")[0]\n serviceNameAndType = service.split(\"/\")[1]\n \n serviceStatus = getServiceStatus(serverName, serverPort, userName, passWord, folder, serviceNameAndType, useSSL)\n realTimeState = serviceStatus.get(\"realTimeState\")\n if realTimeState:\n if realTimeState.upper() == actionStatusMap[serviceAction.upper()]:\n print \"{:.<70}already at requested state '{}'.\".format(service, realTimeState)\n else:\n print \"{:.<70}will {} the service.\".format(service, serviceAction.lower())\n modServiceList.append(service)\n else:\n print \"{:.<70}{}\".format(service, serviceStatus)\n\n \n # ---------------------------------------------------------------------\n # Start/Stop all services\n # ---------------------------------------------------------------------\n if len(modServiceList) > 0:\n print \"\\n{}\".format(\"-\" * 110)\n print \"- Will attempt to \" + serviceAction.lower() + \" the specified services...\\n\"\n \n stopStartServices(serverName, serverPort, userName, passWord, \\\n serviceAction.title(), modServiceList, useSSL)\n \n \nexcept:\n totalSuccess = False\n \n # Get the traceback object\n tb = sys.exc_info()[2]\n tbinfo = traceback.format_tb(tb)[0]\n \n # Concatenate information together concerning the error into a message string\n pymsg = \"PYTHON ERRORS:\\nTraceback info:\\n\" + tbinfo + \"\\nError Info:\\n\" + str(sys.exc_info()[1])\n \n # Print Python error messages for use in Python / Python Window\n print\n print \"***** ERROR ENCOUNTERED *****\"\n print pymsg + \"\\n\"\n\nfinally:\n endTime = datetime.now()\n print\n print \"Done.\"\n print\n print \"Start time: \" + str(startTime)\n print \"End time: \" + str(endTime)\n if totalSuccess:\n sys.exit(0)\n else:\n sys.exit(1)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys, os, time, traceback", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Es", "ri_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Name", ":", " ", " ", "Start", "Sto", "p", "Service", "s", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "Pur", "pose", ":", " ", " ", " ", "Start", "s", " ", "or", " ", "stop", "s", " ", "Arc", "GI", "S", " ", "Server", " ", "service", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", ",_", "time_", ",_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "Success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "\"", "Roo", "t", " ", "folder", "\"\\\\", "Supp", "ort", "Files", " ", "to", " ", "sys", " ", "path", " ", "inor", "der", " ", "to", " ", "import_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "module", "s", " ", "in", " ", "subfolder", "_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", ")_", ")_", ",_", "\"", "Supp", "ort", "Files", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "AG", "SR", "est", "Functions_", "import_", "get", "Service", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "AG", "SR", "est", "Functions_", "import_", "stop", "Start", "Services_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "AG", "SR", "est", "Functions_", "import_", "get", "Service", "Status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "Types_", "=_", "[_", "\"", "Map", "Server", "\"_", ",_", "\"", "Image", "Server", "\"_", ",_", "\"", "Geometr", "y", "Server", "\"_", ",_", "\"", "Geoc", "ode", "Server", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "GPS", "erver", "\"_", ",_", "\"", "Feature", "Server", "\"_", ",_", "\"", "Glob", "e", "Server", "\"_", ",_", "\"", "Geo", "Data", "Server", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Service", "Str_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "List_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script", "Name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "<_", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "'_", "+_", "script", "Name_", "+_", "'", " ", "<", "Server", "\\u", "Name", ">", " ", "<", "Server", "\\u", "Port", ">", " ", "<", "User", "\\u", "Name", ">", " ", "<", "Passw", "ord", ">", " ", "<", "Us", "e\\u", "SS", "L", ":", " ", "Ye", "s", "|", "No", ">", " ", "<", "Start", "|", "Sto", "p", ">", " ", "{{", "folder", "/", "}", "service", ".", "type", ",...", "|", " ", "Service", "\\u", "List", "\\u", "File", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "n", "Whe", "re", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "<", "Server", "\\u", "Name", ">", " ", "(", "require", "d", ")", " ", "server", " ", "name", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "<", "Server", "\\u", "Port", ">", " ", "(", "require", "d", ")", " ", "server", " ", "port", ";", " ", "if", " ", "not", " ", "usi", "ng", " ", "server", " ", "port", " ", "enter", " ", "#'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "<", "User", "\\u", "Name", ">", " ", "(", "require", "d", ")", " ", "user", " ", "with", " ", "admin", " ", "or", " ", "publi", "sher", " ", "permissi", "on", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "<", "Passw", "ord", ">", " ", "(", "require", "d", ")", " ", "user", " ", "password", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "<", "Us", "e\\u", "SS", "L", ":", " ", "Ye", "s", "|", "No", ">", " ", "(", "require", "d", ")", " ", "Fla", "g", " ", "indicati", "ng", " ", "if", " ", "Arc", "GI", "S", " ", "Server", " ", "require", "s", " ", "HTTP", "S", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "<", "Start", "|", "Sto", "p", ">", " ", "(", "require", "d", ")", " ", "action", " ", "to", " ", "perform", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "{{", "folder", "/", "}", "service", ".", "type", ",...", "|", " ", "Service", "\\u", "List", "\\u", "File", "}", " ", "(", "option", "al", ")", " ", "to", " ", "Start", "|", "Sto", "p", " ", "specific", " ", "service", "s", ",", " ", "speci", "fy", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "tco", "mma", " ", "delim", "ited", " ", "list", " ", "of", " ", "service", "s", " ", "or", " ", "speci", "fy", " ", "a", " ", "path", " ", "to", " ", "a", " ", "file", " ", "contain", "ing", " ", "{{", "folder", "/", "}", "service", ".", "type", " ", "entri", "es", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "If", " ", "speci", "fy", "ing", " ", "file", ",", " ", "each", " ", "{{", "folder", "/", "}", "service", ".", "type", " ", "entry", " ", "must", " ", "be", " ", "on", " ", "a", " ", "separate", " ", "line", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "\\\\", "t", "Whe", "re", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", "{:", "<", "8", "}{", "}'_", "._", "format_", "(_", "'", "folder", "'_", ",_", "'-", " ", "(", "option", "al", ")", " ", "is", " ", "name", " ", "of", " ", "folder", " ", "service", " ", "reside", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", "{:", "<", "8", "}{", "}'_", "._", "format_", "(_", "'", "service", "'_", ",_", "'-", " ", "(", "require", "d", ")", " ", "is", " ", "name", " ", "of", " ", "service", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", "{:", "<", "8", "}{", "}'_", "._", "format_", "(_", "'", "type", "'_", ",_", "'-", " ", "(", "require", "d", ")", " ", "is", " ", "the", " ", "type", " ", "of", " ", "of", " ", "service", ";", " ", "valid", " ", "values", " ", "are", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", "\\\\", "t", "'_", "+_", "str_", "(_", "valid", "Types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "\\\\", "t", "\\\\", "t", "NOTE", ":", " ", "To", " ", "include", " ", "space", "s", " ", "in", " ", "this", " ", "list", ",", " ", "surround", " ", "with", " ", "double", "-", "quote", "s", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "\\\\", "t", "Exam", "ples", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", "My", "Service", "s", ".", "Map", "Server", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", "Utili", "ties", "/", "Geometr", "y", ".", "Geometr", "y", "Server", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", "My", "Service", "s", ".", "Map", "Server", ",", "Utili", "ties", "/", "Geometr", "y", ".", "Geometr", "y", "Server", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", "\"", "My", "Service", "s", ".", "Map", "Server", ",", " ", "Utili", "ties", "/", "Geometr", "y", ".", "Geometr", "y", "Server", "\"\\\\", "n", "'_", "\\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_", "server", "Name_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Port_", "=_", "sys_", "._", "argv_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Name_", "=_", "sys_", "._", "argv_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass", "Word_", "=_", "sys_", "._", "argv_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "SSL_", "=_", "sys_", "._", "argv_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "Action_", "=_", "sys_", "._", "argv_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "==_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "Service", "Str_", "=_", "sys_", "._", "argv_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "SSL_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "in_", "[_", "'", "ye", "s", "'_", ",_", "'", "ye", "'_", ",_", "'", "y", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "use", "SSL_", "=_", "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 ", " _", "use", "SSL_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Perform", " ", "some", " ", "checks", " ", "on", " ", "the", " ", "user", " ", "specified", " ", "service", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "user", "Service", "Str_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "in", " ", "the", " ", "user", " ", "specified", " ", "seri", "vc", "es_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "user", "Service", "Str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "User", " ", "has", " ", "specified", " ", "a", " ", "path", ";", " ", "make", " ", "sure", " ", "it", "'", "s", " ", "a", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "user", "Service", "Str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Error", ":", " ", "The", " ", "specified", " ", "Service", "\\u", "List", "\\u", "File", " ", "\"_", "+_", "user", "Service", "Str_", "+_", "\"", " ", "is", " ", "not", " ", "a", " ", "file", ".\\\\", "n", "\"_", "\\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_", "f_", "=_", "open_", "(_", "user", "Service", "Str_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "service_", "in_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "List_", "._", "append_", "(_", "service_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "service", "List_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Error", ":", " ", "The", " ", "specf", "ied", " ", "Service", "\\u", "List", "\\u", "File", " ", "\"_", "+_", "user", "Service", "Str_", "+_", "\"", " ", "is", " ", "empty", ".\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "List_", "=_", "user", "Service", "Str_", "._", "replace_", "(_", "\"", " ", "\"_", ",_", "\",\"_", ")_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "user", "Service", "Str", " ", "had", " ", "more", " ", "than", " ", "one", " ", "space", " ", "bet", "ween", " ", "service", " ", "values", " ", "then", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "be", " ", "0", "-", "length", " ", "string", " ", "element", "s", ",", " ", "so", " ", "remove", " ", "any", " ", "element", "s", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0", "-", "length", " ", "string", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "service", "List_", "=_", "[_", "x_", "for_", "x_", "in_", "service", "List_", "if_", "len_", "(_", "x_", ")_", ">_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "each", " ", "service", " ", "element", " ", "has", " ", "\".", "\"", " ", "separator_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "service", "List_", ")_", "<_", ">_", "str_", "(_", "service", "List_", ")_", "._", "count_", "(_", "\".\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Error", ":", " ", "There", " ", "are", " ", "missi", "ng", " ", "'.'", " ", "delimiter", "s", " ", "bet", "ween", " ", "service", " ", "name", " ", "and", " ", "type", ".\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "each", " ", "service", " ", "element", " ", "has", " ", "a", " ", "valid", " ", "service", " ", "\"", "type", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "not", "Valid", "Types_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "[_", "x_", "._", "split_", "(_", "\".\"_", ")_", "[_", "1_", "]_", "._", "lower_", "(_", ")_", "for_", "x_", "in_", "service", "List_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "not_", "in_", "[_", "y_", "._", "lower_", "(_", ")_", "for_", "y_", "in_", "valid", "Types_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "not", "Valid", "Types_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "not", "Valid", "Types_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Error", ":", " ", "You", " ", "have", " ", "specified", " ", "invalid", " ", "'", "type", "'", " ", "values", ":", " ", "\"_", "+_", "str_", "(_", "not", "Valid", "Types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Valid", " ", "values", " ", "are", ":", " ", "\"_", "+_", "str_", "(_", "valid", "Types_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "server", "Port_", "._", "strip_", "(_", ")_", "==_", "'#'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server", "Port_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "valid", "Action", "List_", "=_", "[_", "\"", "stop", "\"_", ",_", "\"", "start", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Action", "Valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "user", " ", "specific", " ", "valid", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "valid", "Action_", "in_", "valid", "Action", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "valid", "Action_", "._", "lower_", "(_", ")_", "==_", "service", "Action_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Action", "Valid_", "=_", "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_", "is", "Action", "Valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "User", " ", "specified", " ", "action", " ", "'\"_", "+_", "service", "Action_", "+_", "\"", " ", "is", " ", "not", " ", "valid", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Valid", " ", "action", "s", " ", "are", ":\"_", "+_", "str_", "(_", "valid", "Action", "List_", ")_", "+_", "\"\\\\", "n", "\"_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Time_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "list", " ", "of", " ", "all", " ", "service", "s", "/", "or", " ", "user", " ", "specified", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "service", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "List_", "=_", "get", "Service", "List_", "(_", "server", "Name_", ",_", "server", "Port_", ",_", "user", "Name_", ",_", "pass", "Word_", ",_", "use", "SSL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "hoste", "d", " ", "service", "s", " ", "from", " ", "list", " ", "sinc", "e", " ", "these", " ", "can", "'", "t", " ", "be", " ", "start", "ed", "/", "stopped_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'\\\\", "n", "Remo", "ving", " ", "\"", "Hoste", "d", "\"", " ", "service", "s", " ", "from", " ", "service", " ", "list", ";", " ", "these", " ", "service", "s", " ", "can", " ", "not", " ", "be", " ", "start", "ed", "/", "stopp", "ed", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "List_", "=_", "[_", "x_", "for_", "x_", "in_", "service", "List_", "if_", "x_", "._", "find_", "(_", "'", "Hoste", "d", "/'_", ")_", "==_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "service", "List_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", "*", "ERROR", ":", " ", "No", " ", "service", "s", " ", "to", " ", "\"_", "+_", "service", "Action_", "._", "title_", "(_", ")_", "+_", "\".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Filter", " ", "the", " ", "service", " ", "list", " ", "and", " ", "remove", " ", "service", "s", " ", "tha", "t", " ", "are", " ", "alr", "ead", "y", " ", "at", " ", "the", " ", "request", "ed", " ", "state_", "\\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_", "len_", "(_", "service", "List_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "Status", "Map_", "=_", "{_", "\"", "STOP", "\"_", ":_", "\"", "STOPPED", "\"_", ",_", "\"", "START", "\"_", ":_", "\"", "START", "ED", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "Service", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "{}\"_", "._", "format_", "(_", "\"-\"_", "*_", "110_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"-", " ", "Check", " ", "status", " ", "of", " ", "specified", " ", "service", "s", "...", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "service_", "in_", "service", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "Name", "And", "Type_", "=_", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service_", "=_", "service_", "._", "replace_", "(_", "\"//", "\"_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "service_", "._", "find_", "(_", "\"/\"_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder_", "=_", "service_", "._", "split_", "(_", "\"/\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "Name", "And", "Type_", "=_", "service_", "._", "split_", "(_", "\"/\"_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "service", "Status_", "=_", "get", "Service", "Status_", "(_", "server", "Name_", ",_", "server", "Port_", ",_", "user", "Name_", ",_", "pass", "Word_", ",_", "folder_", ",_", "service", "Name", "And", "Type_", ",_", "use", "SSL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "real", "Time", "State_", "=_", "service", "Status_", "._", "get_", "(_", "\"", "real", "Time", "State", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "real", "Time", "State_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "real", "Time", "State_", "._", "upper_", "(_", ")_", "==_", "action", "Status", "Map_", "[_", "service", "Action_", "._", "upper_", "(_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"{:", ".", "<", "7", "0", "}", "alr", "ead", "y", " ", "at", " ", "request", "ed", " ", "state", " ", "'{}'", ".\"_", "._", "format_", "(_", "service_", ",_", "real", "Time", "State_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"{:", ".", "<", "7", "0", "}", "will", " ", "{}", " ", "the", " ", "service", ".\"_", "._", "format_", "(_", "service_", ",_", "service", "Action_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "Service", "List_", "._", "append_", "(_", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"{:", ".", "<", "7", "0", "}{", "}\"_", "._", "format_", "(_", "service_", ",_", "service", "Status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", "/", "Sto", "p", " ", "all", " ", "services_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "mod", "Service", "List_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "n", "{}\"_", "._", "format_", "(_", "\"-\"_", "*_", "110_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"-", " ", "Wil", "l", " ", "atte", "mpt", " ", "to", " ", "\"_", "+_", "service", "Action_", "._", "lower_", "(_", ")_", "+_", "\"", " ", "the", " ", "specified", " ", "service", "s", "...", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "Start", "Services_", "(_", "server", "Name_", ",_", "server", "Port_", ",_", "user", "Name_", ",_", "pass", "Word_", ",_", "service", "Action_", "._", "title_", "(_", ")_", ",_", "mod", "Service", "List_", ",_", "use", "SSL_", ")_", "\\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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "traceback", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "info_", "=_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Concat", "enat", "e", " ", "informati", "on", " ", "tog", "ether", " ", "concern", "ing", " ", "the", " ", "error", " ", "int", "o", " ", "a", " ", "message", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "pym", "sg_", "=_", "\"", "PYTHON", " ", "ERRORS", ":\\\\", "n", "Trace", "back", " ", "info", ":\\\\", "n", "\"_", "+_", "tb", "info_", "+_", "\"\\\\", "n", "Error", " ", "Info", ":\\\\", "n", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "Pyth", "on", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "Pyth", "on", " ", "/", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"****", "*", " ", "ERROR", " ", "ENC", "OUN", "TER", "ED", " ", "*****", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "pym", "sg_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "Time_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Don", "e", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Start", " ", "time", ":", " ", "\"_", "+_", "str_", "(_", "start", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "End", " ", "time", ":", " ", "\"_", "+_", "str_", "(_", "end", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "total", "Success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "1_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
rvanlaar/easy-transifex/src/transifex/transifex/projects/tests/private_projects.py
[ { "content": "import os\n\nfrom django.conf import settings\nfrom django.contrib.auth import models\nfrom django.contrib.auth.models import User, Group, Permission\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.core import management\nfrom django.core.urlresolvers import reverse\nfrom django.db.models import get_model\nfrom django.test import TestCase\nfrom django.test.client import Client\n\nfrom authority.models import Permission\nfrom django_addons.autodiscover import autodiscover_notifications\n\nfrom transifex.txcommon.tests.base import BaseTestCase, USER_ROLES, NoticeTypes\nfrom transifex.txcommon.log import logger\nfrom transifex.languages.models import Language\nfrom transifex.projects.models import Project\nfrom transifex.projects.permissions.project import ProjectPermission\nfrom transifex.teams.models import Team\nfrom django.utils import unittest\n\n# TODO: POST requests should also be tested everywhere (teams, tr. actions etc.)\n\nWatch = get_model('repowatch', 'Watch')\nPOFileLock = get_model('locks', 'POFileLock')\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def skip(func):\n func_name = func.__name__\n def decorator(func):\n msg = \"%s skipped. Please implement it in your project path.\"%func_name\n if settings.TX_ROOT != settings.PROJECT_PATH:\n logger.debug(msg)\n return unittest.skipUnless(settings.TX_ROOT == settings.PROJECT_PATH, msg)\n return decorator", "metadata": "root.skip", "header": "['module', '___EOS___']", "index": 28 }, { "content": "class PrivateProjectTest(BaseTestCase):\n \"\"\"\n Test private projects overall.\n\n Permissions, get, post return codes etc.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n #def test_submit_file(self):\n #\"\"\"\n #Check access to submit pofile in a component of a private project.\n #\"\"\"\n #URL = reverse('component_edit_file', kwargs={'project_slug':self.project_private.slug,\n # 'component_slug':'priv_component',\n # 'filename': self.FILEPATHS[0] })\n #\n ## POST Requests\n ## Anonymous user should not have access to submit files!\n #response = self.client.post(URL, follow=True)\n ## Login required will redirect use to the login page\n #self.failUnlessEqual(response.status_code, 200)\n #self.failUnlessEqual(('http://testserver/accounts/login/?next=%s' %\n # (URL), 302), response.redirect_chain[0])\n #\n ## Logged in user without permissions should not have acces too!\n #test_user = User.objects.create_user('test_login', '[email protected]',\n # 'test_login')\n #self.assertTrue(self.client.login(username='test_login',\n # password='test_login'))\n #response = self.client.post(URL)\n #self.failUnlessEqual(response.status_code, 403)\n #self.client.logout()\n #\n ## Maintainer should have permission to submit files\n ## (Owner should have been put to maintainers!)\n #self.assertTrue(self.client.login(username='priv_owner',\n # password='priv_owner'))\n #response = self.client.post(URL, follow=True)\n #self.failUnlessEqual(response.status_code, 200)\n #self.client.logout()\n #\n ## Check that a submitter (writer) has access to submit file.\n #self.assertTrue(self.client.login(username='priv_submitter',\n # password='priv_submitter'))\n #response = self.client.post(URL, follow=True)\n #self.failUnlessEqual(response.status_code, 200)\n #self.client.logout()\n #\n ##TODO: ONLY team members and coordinators of the specific team where\n ## the file belongs to must have access to it.\n #\n ## Check that a team coordinator (writer) has access to submit a file of his team\n #self.assertTrue(self.client.login(username='priv_coordinator',\n # password='priv_coordinator'))\n #response = self.client.post(URL, follow=True)\n #self.failUnlessEqual(response.status_code, 200)\n #self.client.logout()\n #\n ## Check that a team member (writer) has access to submit a file of his team.\n #self.assertTrue(self.client.login(username='priv_member',\n # password='priv_member'))\n #response = self.client.post(URL, follow=True)\n #self.failUnlessEqual(response.status_code, 200)\n #self.client.logout()\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.PrivateProjectTest", "header": "['module', '___EOS___']", "index": 37 }, { "content": " @skip\n def test_project_list_with_anonymous_user(self):\n \"\"\"\n Test that project list pages contain only the public project and not\n the private, if the user is anonymous.\n \"\"\"\n\n ### project list ALL\n # Issue a GET request.\n response = self.client['anonymous'].get(reverse('project_list'))\n\n # Check that the response is 200 OK.\n self.failUnlessEqual(response.status_code, 200)\n\n # Check that the rendered context contains all public projects (see setup)\n self.failUnlessEqual(len(response.context['project_list']),\n Project.objects.filter(private=False).count())\n\n # Ensure that private project does NOT appear\n for project in response.context['project_list']:\n self.failIfEqual(project.slug, self.project_private.slug)\n\n ### project list RECENT\n # Issue a GET request.\n response = self.client['anonymous'].get(reverse('project_list_recent'))\n\n # Check that the response is 200 OK.\n self.failUnlessEqual(response.status_code, 200)\n\n # Check that the rendered context contains all (public) projects (see setup)\n self.failUnlessEqual(len(response.context['project_list']),\n Project.objects.filter(private=False).count())\n\n # Ensure that private project does NOT appear\n self.failIfEqual(response.context['project_list'][0].slug, self.project_private.slug)\n\n #TODO: FEATURED, OPEN TRANSLATIONS list testing", "metadata": "root.PrivateProjectTest.test_project_list_with_anonymous_user", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " @skip\n def test_project_list_with_logged_in_user(self):\n \"\"\"\n Test that project list pages contain only the public project and not\n the private, if the user is logged in.\n \"\"\"\n\n ### project list ALL\n # Issue a GET request.\n response = self.client['registered'].get(reverse('project_list'))\n\n # Check that the response is 200 OK.\n self.failUnlessEqual(response.status_code, 200)\n\n # Check that the rendered context contains all public projects (see setup)\n self.failUnlessEqual(len(response.context['project_list']),\n Project.objects.filter(private=False).count())\n\n # Ensure that private project does NOT appear\n for project in response.context['project_list']:\n self.failIfEqual(project.slug, self.project_private.slug)\n\n ### project list RECENT\n # Issue a GET request.\n response = self.client['registered'].get(reverse('project_list_recent'))\n\n # Check that the response is 200 OK.\n self.failUnlessEqual(response.status_code, 200)\n\n # Check that the rendered context contains all (public) projects (see setup)\n self.failUnlessEqual(len(response.context['project_list']),\n Project.objects.filter(private=False).count())\n\n # Ensure that private project does NOT appear\n for project in response.context['project_list']:\n self.failIfEqual(project.slug, self.project_private.slug)", "metadata": "root.PrivateProjectTest.test_project_list_with_logged_in_user", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": " def test_project_detail(self):\n \"\"\"\n Check private project details access.\n \"\"\"\n\n # Check anonymous user and logged in user with no permissions\n for user in ['anonymous', 'registered']:\n response = self.client[user].get(self.urls['project_private'])\n self.failUnlessEqual(response.status_code, 403)\n\n # Check people who should have access to the private project\n for user in ['maintainer', 'team_coordinator', 'team_member']: # 'writer',\n response = self.client[user].get(self.urls['project_private'])\n self.failUnlessEqual(response.status_code, 200)", "metadata": "root.PrivateProjectTest.test_project_detail", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 119 }, { "content": " def test_resource_details(self):\n \"\"\"\n Check private project components' detail access.\n \"\"\"\n\n # Check anonymous user and logged in user with no permissions\n for user in ['anonymous', 'registered']:\n response = self.client[user].get(self.urls['resource_private'])\n self.failUnlessEqual(response.status_code, 403)\n\n # Check people who should have access to the private project\n for user in ['maintainer', 'team_coordinator', 'team_member']: # 'writer',\n response = self.client[user].get(self.urls['resource_private'])\n self.failUnlessEqual(response.status_code, 200)", "metadata": "root.PrivateProjectTest.test_resource_details", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 134 }, { "content": " def test_widgets(self):\n \"\"\"\n Test if the permissions to project widgets page are the correct ones.\n \"\"\"\n #'/projects/p/priv_test/''/projects/p/priv_test/widgets/'\n url = reverse('project_widgets', kwargs={'project_slug':self.project_private.slug})\n\n # Check anonymous user and logged in user with no permissions\n for user in ['anonymous', 'registered']:\n response = self.client[user].get(url)\n self.failUnlessEqual(response.status_code, 403)\n\n # Check people who should have access to the private project\n for user in ['maintainer', 'writer', 'team_coordinator', 'team_member']:\n response = self.client[user].get(url)\n self.failUnlessEqual(response.status_code, 403)", "metadata": "root.PrivateProjectTest.test_widgets", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 149 }, { "content": " def test_search_project(self):\n \"\"\"\n Test that searching for the private project does not return it.\n\n We also check the appearance of the public project\n \"\"\"\n URL = reverse('search')\n TERMS_1_1 = {'q': self.project_private.slug}\n TERMS_1_2 = {'q': self.resource_private.slug}\n TERMS_1_3 = {'q': self.project_private.name}\n\n\n # All type of users should not see private projects in search results!\n for user in USER_ROLES:\n response = self.client[user].get(URL, TERMS_1_1)\n self.failUnlessEqual(response.status_code, 200)\n self.assertFalse(self.project_private in response.context['results'])\n\n response = self.client[user].get(URL, TERMS_1_2)\n self.failUnlessEqual(response.status_code, 200)\n self.assertFalse(self.project_private in response.context['results'])\n\n response = self.client[user].get(URL, TERMS_1_3)\n self.failUnlessEqual(response.status_code, 200)\n self.assertFalse(self.project_private in response.context['results'])", "metadata": "root.PrivateProjectTest.test_search_project", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 166 }, { "content": " def test_teams_access(self):\n \"\"\"\n Check private project teams' pages access.\n \"\"\"\n URLs = {\n 'anonymous' : {\n 403 : [\n '/projects/p/%s/teams/' % self.project_private.slug,\n '/projects/p/%s/team/%s/' % (self.project_private.slug,\n self.language.code)\n ],\n 302 : [\n '/projects/p/%s/teams/add/' % self.project_private.slug,\n '/projects/p/%s/team/%s/edit/' % (self.project_private.slug,\n self.language.code),\n '/projects/p/%s/team/%s/delete/' % (self.project_private.slug,\n self.language.code),\n '/projects/p/%s/team/%s/request/' % (self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/approve/%s/' % (self.project_private.slug, self.language.code,\n self.user['team_member'].username),\n '/projects/p/%s/team/%s/deny/%s/' % (self.project_private.slug, self.language.code,\n self.user['team_member'].username),\n '/projects/p/%s/team/%s/withdraw/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/leave/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/teams/request/' % self.project_private.slug,\n '/projects/p/%s/team/%s/approve/' % (self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/deny/' %(self.project_private.slug, self.language.code),\n ]\n },\n 'registered' : {\n 403 : [\n '/projects/p/%s/teams/' % self.project_private.slug, # FIXME: returns 200\n '/projects/p/%s/team/%s/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/teams/add/' % self.project_private.slug,\n '/projects/p/%s/team/%s/edit/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/delete/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/request/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/approve/%s/' % (self.project_private.slug, self.language.code,\n self.user['team_member'].username),\n '/projects/p/%s/team/%s/deny/%s/' % (self.project_private.slug, self.language.code,\n self.user['team_member'].username),\n '/projects/p/%s/team/%s/withdraw/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/leave/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/teams/request/' % self.project_private.slug,\n '/projects/p/%s/team/%s/approve/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/deny/' %(self.project_private.slug, self.language.code)\n ]\n },\n 'maintainer' : {\n 200 : [\n '/projects/p/%s/teams/' % self.project_private.slug, #200\n '/projects/p/%s/team/%s/' %(self.project_private.slug, self.language.code), #200\n '/projects/p/%s/teams/add/' % self.project_private.slug, #200\n '/projects/p/%s/team/%s/edit/' %(self.project_private.slug, self.language.code), #200\n '/projects/p/%s/team/%s/delete/' %(self.project_private.slug, self.language.code) #200\n ],\n 302 : [\n '/projects/p/%s/team/%s/request/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/leave/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/teams/request/' % self.project_private.slug\n ],\n 404 : [\n '/projects/p/%s/team/%s/approve/%s/' % (self.project_private.slug, self.language.code,\n self.user['team_member'].username),\n '/projects/p/%s/team/%s/deny/%s/' % (self.project_private.slug, self.language.code,\n self.user['team_member'].username),\n '/projects/p/%s/team/%s/withdraw/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/approve/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/deny/' %(self.project_private.slug, self.language.code)\n ],\n },\n #'writer' : {\n # 200 : [\n # '/projects/p/%s/teams/',\n # '/projects/p/%s/team/%s/' %(self.project_private.slug, self.language.code)\n # ],\n # 302 : [\n # '/projects/p/%s/team/%s/request/' %(self.project_private.slug, self.language.code),\n # '/projects/p/%s/team/%s/leave/' %(self.project_private.slug, self.language.code),\n # '/projects/p/%s/teams/request/'\n # ],\n # 404 : [\n # '/projects/p/%s/team/%s/withdraw/' %(self.project_private.slug, self.language.code)\n # ],\n # 403 : [\n # '/projects/p/%s/teams/add/',\n # '/projects/p/%s/team/%s/edit/' %(self.project_private.slug, self.language.code),\n # '/projects/p/%s/team/%s/delete/' %(self.project_private.slug, self.language.code),\n # '/projects/p/%s/team/%s/approve/%s/' % (self.project_private.slug, self.language.code,\n # self.user['team_member'].username),\n # '/projects/p/%s/team/%s/deny/%s/' % (self.project_private.slug, self.language.code,\n # self.user['team_member'].username),\n # '/projects/p/%s/team/%s/approve/' %(self.project_private.slug, self.language.code),\n # '/projects/p/%s/team/%s/deny/' %(self.project_private.slug, self.language.code)\n # ]\n #},\n 'team_coordinator' : {\n 200 : [\n '/projects/p/%s/teams/' % self.project_private.slug,\n '/projects/p/%s/team/%s/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/edit/' %(self.project_private.slug, self.language.code)\n ],\n 302 : [\n '/projects/p/%s/team/%s/request/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/leave/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/teams/request/' % self.project_private.slug\n ],\n 404 : [\n '/projects/p/%s/team/%s/withdraw/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/approve/%s/' % (self.project_private.slug, self.language.code,\n self.user['team_member'].username),\n '/projects/p/%s/team/%s/deny/%s/' % (self.project_private.slug, self.language.code,\n self.user['team_member'].username)\n ],\n 403 : [\n '/projects/p/%s/teams/add/' % self.project_private.slug,\n '/projects/p/%s/team/%s/delete/' %(self.project_private.slug, self.language.code),\n # TODO: Add a second team to check if coordinator has access too.\n '/projects/p/%s/team/%s/approve/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/deny/' %(self.project_private.slug, self.language.code)\n ]\n },\n 'team_member' : {\n 200 : [\n '/projects/p/%s/teams/' % self.project_private.slug,\n '/projects/p/%s/team/%s/' %(self.project_private.slug, self.language.code)\n ],\n 302 : [\n '/projects/p/%s/team/%s/request/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/leave/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/teams/request/' % self.project_private.slug\n ],\n 404 : [\n '/projects/p/%s/team/%s/withdraw/' %(self.project_private.slug, self.language.code),\n ],\n 403 : [\n '/projects/p/%s/teams/add/' % self.project_private.slug,\n '/projects/p/%s/team/%s/edit/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/delete/' %(self.project_private.slug, self.language.code),\n # TODO: Add a second team to check if coordinator has access too.\n '/projects/p/%s/team/%s/approve/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/deny/' %(self.project_private.slug, self.language.code),\n '/projects/p/%s/team/%s/approve/%s/' % (self.project_private.slug, self.language.code,\n self.user['team_member'].username),\n '/projects/p/%s/team/%s/deny/%s/' % (self.project_private.slug, self.language.code,\n self.user['team_member'].username)\n ]\n }\n }\n\n for user in URLs.keys():\n for status_code in URLs[user].keys():\n for url in URLs[user][status_code]:\n response = self.client[user].get(url)\n self.failUnlessEqual(response.status_code, status_code,\n \"Wrong status code for user '%s' and url '%s' ( %s != %s)\" % (\n user, url, response.status_code,status_code))", "metadata": "root.PrivateProjectTest.test_teams_access", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 192 }, { "content": " def test_view_strings(self):\n \"\"\"\n Check access to view lotte for a resource in a private project (read\n only access)\n \"\"\"\n\n # Check access to lotte for a language with a team.\n URL = self.urls['translate_private']\n\n for user in ['anonymous']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 302)\n\n for user in ['registered']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer', 'team_coordinator', 'team_member']:# 'writer',\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 200)\n\n # Check access to lotte for a language without a team.\n URL = reverse('translate_resource', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug':self.resource_private.slug,\n 'lang_code': self.language_ar.code })\n\n for user in ['anonymous']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 302)\n\n for user in ['registered', 'team_coordinator', 'team_member']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer']: #'writer',\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 200)", "metadata": "root.PrivateProjectTest.test_view_strings", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 350 }, { "content": " def test_edit_strings(self):\n \"\"\"\n Check access to view lotte for a resource in a private project\n \"\"\"\n\n # Check access to lotte for a language with a team.\n URL = self.urls['translate_private']\n\n for user in ['anonymous']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 302)\n\n # Maybe this should be 404?\n for user in ['registered']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer', 'team_coordinator', 'team_member']: # 'writer'?\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 200)\n\n # Check access to lotte for a language without a team.\n URL = reverse('translate_resource', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug':self.resource_private.slug,\n 'lang_code': self.language_ar.code })\n\n for user in ['anonymous']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 302)\n\n for user in ['registered']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['team_coordinator', 'team_member']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer']: # 'writer'?\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 200)", "metadata": "root.PrivateProjectTest.test_edit_strings", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 388 }, { "content": " def test_download_file(self):\n \"\"\"\n Check access to download translation file for a resource in a private\n project.\n \"\"\"\n\n # Check who has access to download pofile for language with team\n URL = reverse('download_translation', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug':self.resource_private.slug,\n 'lang_code': self.language.code })\n\n for user in ['anonymous']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 302)\n\n for user in ['registered']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 403) # better 404?\n\n for user in ['maintainer', 'team_coordinator', 'team_member']: #'writer'?\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 302) # why not 200?\n\n # Check who has access to download pofile for language without team\n URL = reverse('translate_resource', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug':self.resource_private.slug,\n 'lang_code': self.language_ar.code })\n\n for user in ['anonymous']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 302)\n\n for user in ['team_coordinator', 'team_member', 'registered']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer']: # 'writer'?\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 200)", "metadata": "root.PrivateProjectTest.test_download_file", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 430 }, { "content": " def test_lock_unlock_file(self):\n \"\"\"\n Check access to lock and unlock pofile in a component of a private project.\n \"\"\"\n URL = reverse('resource_language_lock', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug': self.resource_private.slug,\n 'language_code': self.language.code} )\n\n # POST Requests\n for user in ['anonymous']:\n # the redirect works for the login page but we get 200 status? how\n # come?? XXX! FIXME\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 200)\n\n for user in ['registered']:\n # Anonymous and registered user should not have access to lock the files!\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer', 'team_coordinator', 'team_member']: #'writer',\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 200)\n\n URL = reverse('resource_language_lock', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug': self.resource_private.slug,\n 'language_code': self.language_ar.code})\n\n for user in ['anonymous']: #, 'writer'\n # the redirect works for the login page but we get 200 status? how\n # come?? XXX! FIXME\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 200)\n\n # Why do team_co && team_member return 200? XXX ! FIXME\n for user in ['registered']:# 'team_coordinator','team_member'\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer']: #, 'writer'\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 200)", "metadata": "root.PrivateProjectTest.test_lock_unlock_file", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 528 }, { "content": " def test_watch_unwatch_file(self):\n \"\"\"\n Check access to watch/unwatch file in a component of a private project.\n \"\"\"\n from notification.models import NoticeType\n\n URL = reverse('resource_translation_toggle_watch',\n kwargs={ 'project_slug':self.project_private.slug,\n 'resource_slug': self.resource_private.slug,\n 'language_code': self.language.code })\n\n # POST Requests\n for user in ['anonymous']:\n response = self.client[user].post(URL)\n self.failUnlessEqual(response.status_code, 302)\n\n for user in ['registered']:\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer', 'team_coordinator', 'team_member']: #'writer',\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 200)\n\n URL = reverse('resource_language_lock', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug': self.resource_private.slug,\n 'language_code': self.language_ar.code})\n\n for user in ['anonymous']:\n response = self.client[user].post(URL)\n self.failUnlessEqual(response.status_code, 302)\n\n # Why do team_co && team_member return 200? XXX ! FIXME\n for user in ['registered']: # , 'team_coordinator', 'team_member'\n # Anonymous and registered user should not have access to lock the files!\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer']: # , 'writer'\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 200)", "metadata": "root.PrivateProjectTest.test_watch_unwatch_file", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 572 }, { "content": " def test_watch_unwatch_project(self):\n \"\"\"\n Check access to watch/unwatch project in a component of a private project.\n \"\"\"\n from notification.models import NoticeType\n\n URL = reverse('project_toggle_watch',\n kwargs={ 'project_slug':self.project_private.slug})\n\n # POST Requests\n for user in ['anonymous']:\n response = self.client[user].post(URL)\n self.failUnlessEqual(response.status_code, 302)\n\n for user in ['registered']:\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer', 'team_coordinator', 'team_member']: # 'writer',\n response = self.client[user].post(URL, follow=True)\n self.failUnlessEqual(response.status_code, 200)", "metadata": "root.PrivateProjectTest.test_watch_unwatch_project", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 615 }, { "content": " def test_charts(self):\n \"\"\"\n Check access to component charts.\n \"\"\"\n # images and charts urls\n URLs = [\n reverse('chart_resource_image', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug': self.resource_private.slug}),\n reverse('chart_resource_js', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug': self.resource_private.slug}),\n reverse('chart_resource_html', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug': self.resource_private.slug}),\n reverse('chart_resource_json', kwargs={'project_slug':self.project_private.slug,\n 'resource_slug': self.resource_private.slug})\n ]\n\n for user in ['anonymous', 'registered']:\n for url in URLs:\n response = self.client[user].get(url)\n self.failUnlessEqual(response.status_code, 403)\n\n # For now charts are disabled for private projects\n for user in ['maintainer', 'writer', 'team_coordinator', 'team_member']:\n for url in URLs:\n response = self.client[user].get(url)\n self.failUnlessEqual(response.status_code, 403)", "metadata": "root.PrivateProjectTest.test_charts", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 637 }, { "content": " def test_timeline(self):\n \"\"\"\n Check access to component charts.\n \"\"\"\n URL = reverse('project_timeline', kwargs={'project_slug':self.project_private.slug,})\n\n # Only maintainers have access to the project timeline ???\n\n for user in ['anonymous']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 302)\n\n for user in ['registered', 'writer']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 403)\n\n for user in ['maintainer', 'team_coordinator', 'team_member']:\n response = self.client[user].get(URL)\n self.failUnlessEqual(response.status_code, 200)", "metadata": "root.PrivateProjectTest.test_timeline", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 664 }, { "content": " def test_public_to_private(self):\n \"\"\"\n Test the process of transforming a public project to private.\n \"\"\"\n pass", "metadata": "root.PrivateProjectTest.test_public_to_private", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 684 }, { "content": " def test_private_to_public(self):\n \"\"\"\n Test the process of transforming a public project to private.\n \"\"\"\n pass", "metadata": "root.PrivateProjectTest.test_private_to_public", "header": "['class', 'PrivateProjectTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 691 }, { "content": "class ProjectLookupsTests(BaseTestCase):\n", "metadata": "root.ProjectLookupsTests", "header": "['module', '___EOS___']", "index": 698 }, { "content": " def test_private_projects_ajax_lookup(self):\n \"\"\"Test that a private project isn't present in lookups.\n\n This AJAX lookup/dropdown is present in the Team Outsource form.\n \"\"\"\n\n public_project = \"Test Project\"\n private_project = \"Test Private Project\"\n\n # Test that a private project is not visible to a random user\n self.assertTrue(self.user['registered'] not in self.project_private.maintainers.all())\n resp = self.client['registered'].get('/ajax/ajax_lookup/projects', {'q': 'p', 'limit': '150', })\n self.assertContains(resp, public_project, status_code=200)\n self.assertNotContains(resp, private_project, status_code=200)\n\n # Test that a private project is visible to its maintainer\n self.assertTrue(self.user['maintainer'] in self.project_private.maintainers.all())\n resp = self.client['maintainer'].get('/ajax/ajax_lookup/projects', {'q': 'p', 'limit': '150', })\n self.assertContains(resp, public_project, status_code=200)\n self.assertContains(resp, private_project, status_code=200)\n\n # Test that a private project is visible to a member of its teams\n self.assertTrue(self.user['team_member'] in self.team_private.members.all())\n self.assertFalse(self.user['team_member'] in self.project_private.maintainers.all())\n resp = self.client['team_member'].get('/ajax/ajax_lookup/projects', {'q': 'p', 'limit': '150', })\n self.assertContains(resp, public_project, status_code=200)\n self.assertContains(resp, private_project, status_code=200)", "metadata": "root.ProjectLookupsTests.test_private_projects_ajax_lookup", "header": "['class', 'ProjectLookupsTests', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 700 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 }, { "span": "from django.contrib.auth import models", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 38 }, { "span": "from django.contrib.auth.models import User, Group, Permission", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 62 }, { "span": "from django.contrib.contenttypes.models import ContentType", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 58 }, { "span": "from django.core import management", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 34 }, { "span": "from django.test import TestCase", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 32 }, { "span": "from django.test.client import Client", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 37 }, { "span": "from authority.models import Permission", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 39 }, { "span": "from django_addons.autodiscover import autodiscover_notifications", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 65 }, { "span": "from transifex.txcommon.tests.base import BaseTestCase, USER_ROLES, NoticeTypes", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 79 }, { "span": "from transifex.languages.models import Language", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 47 }, { "span": "from transifex.projects.permissions.project import ProjectPermission", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 68 }, { "span": "from transifex.teams.models import Team", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", ",_", "Group_", ",_", "Permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "management_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "get", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "client_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "authority_", "._", "models_", "import_", "Permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "\\u", "addons_", "._", "autodiscover", "_", "import_", "autodiscover", "\\u", "notifications_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "tx", "common_", "._", "tests_", "._", "base_", "import_", "Base", "Test", "Case_", ",_", "USER", "\\u", "ROLE", "S_", ",_", "Noti", "ce", "Types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "tx", "common_", "._", "log_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "languages_", "._", "models_", "import_", "Language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "projects_", "._", "models_", "import_", "Project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "projects_", "._", "permissions_", "._", "project_", "import_", "Project", "Permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "teams_", "._", "models_", "import_", "Team_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "POST", " ", "request", "s", " ", "shou", "ld", " ", "als", "o", " ", "be", " ", "tested", " ", "every", "where", " ", "(", "team", "s", ",", " ", "tr", ".", " ", "action", "s", " ", "etc", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Watch", "_", "=_", "get", "\\u", "model_", "(_", "'", "repo", "watch", "'_", ",_", "'", "Watch", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PO", "File", "Lock_", "=_", "get", "\\u", "model_", "(_", "'", "lock", "s", "'_", ",_", "'", "PO", "File", "Lock", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "skip_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "name_", "=_", "func_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decorator_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"%", "s", " ", "skip", "ped", ".", " ", "Ple", "ase", " ", "implement", " ", "it", " ", "in", " ", "your", " ", "project", " ", "path", ".\"_", "%_", "func", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "settings_", "._", "TX", "\\u", "ROOT_", "!=_", "settings_", "._", "PROJECT", "\\u", "PATH_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "unittest_", "._", "skip", "Unless_", "(_", "settings_", "._", "TX", "\\u", "ROOT_", "==_", "settings_", "._", "PROJECT", "\\u", "PATH_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorator_", "\\u\\u\\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_", "Priva", "te", "Project", "Test_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "private", " ", "project", "s", " ", "over", "all", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Permi", "ssion", "s", ",", " ", "get", ",", " ", "post", " ", "return", " ", "codes", " ", "etc", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "test\\u", "submit", "\\u", "file", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Check", " ", "access", " ", "to", " ", "submit", " ", "pof", "ile", " ", "in", " ", "a", " ", "component", " ", "of", " ", "a", " ", "private", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "URL", " ", "=", " ", "reverse", "('", "component", "\\u", "edit", "\\u", "file", "',", " ", "kwarg", "s", "={", "'", "project", "\\u", "slug", "':", "self", ".", "project", "\\u", "private", ".", "slug", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "component", "\\u", "slug", "':", "'", "priv", "\\u", "component", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "filename", "':", " ", "self", ".", "FILE", "PATH", "S", "[", "0", "]", " ", "})", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "POST", " ", "Requests_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Ano", "nym", "ous", " ", "user", " ", "shou", "ld", " ", "not", " ", "have", " ", "access", " ", "to", " ", "submit", " ", "files", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "response", " ", "=", " ", "self", ".", "client", ".", "post", "(", "URL", ",", " ", "follow", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Logi", "n", " ", "require", "d", " ", "will", " ", "redirec", "t", " ", "use", " ", "to", " ", "the", " ", "login", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "fail", "Un", "less", "Equal", "(", "response", ".", "status", "\\u", "code", ",", " ", "200", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "fail", "Un", "less", "Equal", "((", "'", "http", "://", "testserver", "/", "account", "s", "/", "login", "/?", "next", "=", "%", "s", "'", " ", "%_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "(", "URL", "),", " ", "302", "),", " ", "response", ".", "redirec", "t", "\\u", "chain", "[", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Log", "ged", " ", "in", " ", "user", " ", "with", "out", " ", "permissi", "ons", " ", "shou", "ld", " ", "not", " ", "have", " ", "acc", "es", " ", "too", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "test\\u", "user", " ", "=", " ", "User", ".", "object", "s", ".", "create", "\\u", "user", "('", "test\\u", "login", "',", " ", "'", "test", "@", "trans", "ife", "x", ".", "net", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "test\\u", "login", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Tru", "e", "(", "self", ".", "client", ".", "login", "(", "user", "name", "='", "test\\u", "login", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "password", "='", "test\\u", "login", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "response", " ", "=", " ", "self", ".", "client", ".", "post", "(", "URL", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "fail", "Un", "less", "Equal", "(", "response", ".", "status", "\\u", "code", ",", " ", "403", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "client", ".", "logo", "ut", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Maint", "aine", "r", " ", "shou", "ld", " ", "have", " ", "permissi", "on", " ", "to", " ", "submit", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "(", "Owne", "r", " ", "shou", "ld", " ", "have", " ", "bee", "n", " ", "put", " ", "to", " ", "maintainer", "s", "!)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Tru", "e", "(", "self", ".", "client", ".", "login", "(", "user", "name", "='", "priv", "\\u", "owner", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "password", "='", "priv", "\\u", "owner", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "response", " ", "=", " ", "self", ".", "client", ".", "post", "(", "URL", ",", " ", "follow", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "fail", "Un", "less", "Equal", "(", "response", ".", "status", "\\u", "code", ",", " ", "200", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "client", ".", "logo", "ut", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Check", " ", "tha", "t", " ", "a", " ", "submitter", " ", "(", "writer", ")", " ", "has", " ", "access", " ", "to", " ", "submit", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Tru", "e", "(", "self", ".", "client", ".", "login", "(", "user", "name", "='", "priv", "\\u", "submitter", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "password", "='", "priv", "\\u", "submitter", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "response", " ", "=", " ", "self", ".", "client", ".", "post", "(", "URL", ",", " ", "follow", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "fail", "Un", "less", "Equal", "(", "response", ".", "status", "\\u", "code", ",", " ", "200", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "client", ".", "logo", "ut", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "TOD", "O", ":", " ", "ONL", "Y", " ", "team", " ", "member", "s", " ", "and", " ", "coordinator", "s", " ", "of", " ", "the", " ", "specific", " ", "team", " ", "where_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "the", " ", "file", " ", "belo", "ngs", " ", "to", " ", "must", " ", "have", " ", "access", " ", "to", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Check", " ", "tha", "t", " ", "a", " ", "team", " ", "coordinator", " ", "(", "writer", ")", " ", "has", " ", "access", " ", "to", " ", "submit", " ", "a", " ", "file", " ", "of", " ", "his", " ", "team_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Tru", "e", "(", "self", ".", "client", ".", "login", "(", "user", "name", "='", "priv", "\\u", "coordinator", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "password", "='", "priv", "\\u", "coordinator", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "response", " ", "=", " ", "self", ".", "client", ".", "post", "(", "URL", ",", " ", "follow", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "fail", "Un", "less", "Equal", "(", "response", ".", "status", "\\u", "code", ",", " ", "200", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "client", ".", "logo", "ut", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Check", " ", "tha", "t", " ", "a", " ", "team", " ", "member", " ", "(", "writer", ")", " ", "has", " ", "access", " ", "to", " ", "submit", " ", "a", " ", "file", " ", "of", " ", "his", " ", "team", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Tru", "e", "(", "self", ".", "client", ".", "login", "(", "user", "name", "='", "priv", "\\u", "member", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "password", "='", "priv", "\\u", "member", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "response", " ", "=", " ", "self", ".", "client", ".", "post", "(", "URL", ",", " ", "follow", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "fail", "Un", "less", "Equal", "(", "response", ".", "status", "\\u", "code", ",", " ", "200", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "client", ".", "logo", "ut", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "skip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "project", "\\u", "list", "\\u", "with", "\\u", "anonym", "ous", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "project", " ", "list", " ", "page", "s", " ", "contain", " ", "only", " ", "the", " ", "public", " ", "project", " ", "and", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "private", ",", " ", "if", " ", "the", " ", "user", " ", "is", " ", "anonym", "ous", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "project", " ", "list", " ", "ALL_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Issue", " ", "a", " ", "GET", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "[_", "'", "anonym", "ous", "'_", "]_", "._", "get_", "(_", "reverse_", "(_", "'", "project", "\\u", "list", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "response", " ", "is", " ", "200", " ", "OK", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "render", "ed", " ", "context", " ", "contain", "s", " ", "all", " ", "public", " ", "project", "s", " ", "(", "see", " ", "setup", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "len_", "(_", "response_", "._", "context_", "[_", "'", "project", "\\u", "list", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Project_", "._", "objects_", "._", "filter_", "(_", "private_", "=_", "False_", ")_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "private", " ", "project", " ", "doe", "s", " ", "NOT", " ", "appear", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "project_", "in_", "response_", "._", "context_", "[_", "'", "project", "\\u", "list", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "If", "Equal_", "(_", "project_", "._", "slug_", ",_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "project", " ", "list", " ", "REC", "ENT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Issue", " ", "a", " ", "GET", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "[_", "'", "anonym", "ous", "'_", "]_", "._", "get_", "(_", "reverse_", "(_", "'", "project", "\\u", "list", "\\u", "recent", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "response", " ", "is", " ", "200", " ", "OK", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "render", "ed", " ", "context", " ", "contain", "s", " ", "all", " ", "(", "public", ")", " ", "project", "s", " ", "(", "see", " ", "setup", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "len_", "(_", "response_", "._", "context_", "[_", "'", "project", "\\u", "list", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Project_", "._", "objects_", "._", "filter_", "(_", "private_", "=_", "False_", ")_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "private", " ", "project", " ", "doe", "s", " ", "NOT", " ", "appear", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "If", "Equal_", "(_", "response_", "._", "context_", "[_", "'", "project", "\\u", "list", "'_", "]_", "[_", "0_", "]_", "._", "slug_", ",_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "FEATURE", "D", ",", " ", "OPEN", " ", "TRANSLATIO", "NS", " ", "list", " ", "testing_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "skip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "project", "\\u", "list", "\\u", "with", "\\u", "logged", "\\u", "in", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "project", " ", "list", " ", "page", "s", " ", "contain", " ", "only", " ", "the", " ", "public", " ", "project", " ", "and", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "private", ",", " ", "if", " ", "the", " ", "user", " ", "is", " ", "logged", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "project", " ", "list", " ", "ALL_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Issue", " ", "a", " ", "GET", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "get_", "(_", "reverse_", "(_", "'", "project", "\\u", "list", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "response", " ", "is", " ", "200", " ", "OK", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "render", "ed", " ", "context", " ", "contain", "s", " ", "all", " ", "public", " ", "project", "s", " ", "(", "see", " ", "setup", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "len_", "(_", "response_", "._", "context_", "[_", "'", "project", "\\u", "list", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Project_", "._", "objects_", "._", "filter_", "(_", "private_", "=_", "False_", ")_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "private", " ", "project", " ", "doe", "s", " ", "NOT", " ", "appear", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "project_", "in_", "response_", "._", "context_", "[_", "'", "project", "\\u", "list", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "If", "Equal_", "(_", "project_", "._", "slug_", ",_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "project", " ", "list", " ", "REC", "ENT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Issue", " ", "a", " ", "GET", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "get_", "(_", "reverse_", "(_", "'", "project", "\\u", "list", "\\u", "recent", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "response", " ", "is", " ", "200", " ", "OK", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "render", "ed", " ", "context", " ", "contain", "s", " ", "all", " ", "(", "public", ")", " ", "project", "s", " ", "(", "see", " ", "setup", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "len_", "(_", "response_", "._", "context_", "[_", "'", "project", "\\u", "list", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Project_", "._", "objects_", "._", "filter_", "(_", "private_", "=_", "False_", ")_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "private", " ", "project", " ", "doe", "s", " ", "NOT", " ", "appear", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "project_", "in_", "response_", "._", "context_", "[_", "'", "project", "\\u", "list", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "If", "Equal_", "(_", "project_", "._", "slug_", ",_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "project", "\\u", "detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "private", " ", "project", " ", "deta", "il", "s", " ", "access", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "anonym", "ous", " ", "user", " ", "and", " ", "logged", " ", "in", " ", "user", " ", "with", " ", "no", " ", "permissions_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", ",_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "self_", "._", "urls_", "[_", "'", "project", "\\u", "private", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "people", " ", "who", " ", "shou", "ld", " ", "have", " ", "access", " ", "to", " ", "the", " ", "private", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "#", " ", "'", "writer", "',", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "self_", "._", "urls_", "[_", "'", "project", "\\u", "private", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "resource", "\\u", "details_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "private", " ", "project", " ", "component", "s", "'", " ", "deta", "il", " ", "access", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "anonym", "ous", " ", "user", " ", "and", " ", "logged", " ", "in", " ", "user", " ", "with", " ", "no", " ", "permissions_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", ",_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "self_", "._", "urls_", "[_", "'", "resource", "\\u", "private", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "people", " ", "who", " ", "shou", "ld", " ", "have", " ", "access", " ", "to", " ", "the", " ", "private", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "#", " ", "'", "writer", "',", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "self_", "._", "urls_", "[_", "'", "resource", "\\u", "private", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "widgets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "if", " ", "the", " ", "permissi", "ons", " ", "to", " ", "project", " ", "widget", "s", " ", "page", " ", "are", " ", "the", " ", "correct", " ", "ones", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#'", "/", "project", "s", "/", "p", "/", "priv", "\\u", "test", "/'", "'/", "project", "s", "/", "p", "/", "priv", "\\u", "test", "/", "widget", "s", "/'_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "'", "project", "\\u", "widget", "s", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "anonym", "ous", " ", "user", " ", "and", " ", "logged", " ", "in", " ", "user", " ", "with", " ", "no", " ", "permissions_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", ",_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "people", " ", "who", " ", "shou", "ld", " ", "have", " ", "access", " ", "to", " ", "the", " ", "private", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "writer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "search", "\\u", "project_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "search", "ing", " ", "for", " ", "the", " ", "private", " ", "project", " ", "doe", "s", " ", "not", " ", "return", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "als", "o", " ", "check", " ", "the", " ", "appearance", " ", "of", " ", "the", " ", "public", " ", "project", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "search", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TERM", "S", "\\u", "1", "\\u", "1_", "=_", "{_", "'", "q", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TERM", "S", "\\u", "1", "\\u", "2_", "=_", "{_", "'", "q", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TERM", "S", "\\u", "1", "\\u", "3_", "=_", "{_", "'", "q", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "type", " ", "of", " ", "users", " ", "shou", "ld", " ", "not", " ", "see", " ", "private", " ", "project", "s", " ", "in", " ", "search", " ", "results", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "USER", "\\u", "ROLE", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ",_", "TERM", "S", "\\u", "1", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "project", "\\u", "private_", "in_", "response_", "._", "context_", "[_", "'", "results", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ",_", "TERM", "S", "\\u", "1", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "project", "\\u", "private_", "in_", "response_", "._", "context_", "[_", "'", "results", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ",_", "TERM", "S", "\\u", "1", "\\u", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "project", "\\u", "private_", "in_", "response_", "._", "context_", "[_", "'", "results", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "team", "s", "\\u", "access_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "private", " ", "project", " ", "team", "s", "'", " ", "page", "s", " ", "access", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "URL", "s_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "anonym", "ous", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "403_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "language_", "._", "code_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "302_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "add", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "edit", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "delete", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "request", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "withdraw", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "lea", "ve", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "request", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "register", "ed", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "403_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "#", " ", "FIX", "ME", ":", " ", "return", "s", " ", "200_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "add", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "edit", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "delete", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "request", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "withdraw", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "lea", "ve", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "request", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "maintainer", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "200_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "#", "200_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "#", "200_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "add", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "#", "200_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "edit", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "#", "200_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "delete", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", "#", "200_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "302_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "request", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "lea", "ve", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "request", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "404_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "withdraw", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "writer", "'", " ", ":", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "200", " ", ":", " ", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/'", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/'", " ", "%", "(", "self", ".", "project", "\\u", "private", ".", "slug", ",", " ", "self", ".", "language", ".", "code", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "302", " ", ":", " ", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "request", "/'", " ", "%", "(", "self", ".", "project", "\\u", "private", ".", "slug", ",", " ", "self", ".", "language", ".", "code", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "lea", "ve", "/'", " ", "%", "(", "self", ".", "project", "\\u", "private", ".", "slug", ",", " ", "self", ".", "language", ".", "code", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "request", "/'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "404", " ", ":", " ", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "withdraw", "/'", " ", "%", "(", "self", ".", "project", "\\u", "private", ".", "slug", ",", " ", "self", ".", "language", ".", "code", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "403", " ", ":", " ", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "add", "/'", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "edit", "/'", " ", "%", "(", "self", ".", "project", "\\u", "private", ".", "slug", ",", " ", "self", ".", "language", ".", "code", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "delete", "/'", " ", "%", "(", "self", ".", "project", "\\u", "private", ".", "slug", ",", " ", "self", ".", "language", ".", "code", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/", "%", "s", "/'", " ", "%", " ", "(", "self", ".", "project", "\\u", "private", ".", "slug", ",", " ", "self", ".", "language", ".", "code", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "user", "['", "team", "\\u", "member", "']", ".", "user", "name", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/", "%", "s", "/'", " ", "%", " ", "(", "self", ".", "project", "\\u", "private", ".", "slug", ",", " ", "self", ".", "language", ".", "code", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "user", "['", "team", "\\u", "member", "']", ".", "user", "name", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/'", " ", "%", "(", "self", ".", "project", "\\u", "private", ".", "slug", ",", " ", "self", ".", "language", ".", "code", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/'", " ", "%", "(", "self", ".", "project", "\\u", "private", ".", "slug", ",", " ", "self", ".", "language", ".", "code", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#}", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "team", "\\u", "coordinator", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "200_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "edit", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "302_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "request", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "lea", "ve", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "request", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "404_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "withdraw", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "username_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "403_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "add", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "delete", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Add", " ", "a", " ", "second", " ", "team", " ", "to", " ", "check", " ", "if", " ", "coordinator", " ", "has", " ", "access", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "team", "\\u", "member", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "200_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "302_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "request", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "lea", "ve", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "request", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "404_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "withdraw", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "403_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "s", "/", "add", "/'_", "%_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "edit", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "delete", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Add", " ", "a", " ", "second", " ", "team", " ", "to", " ", "check", " ", "if", " ", "coordinator", " ", "has", " ", "access", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "approve", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "project", "s", "/", "p", "/", "%", "s", "/", "team", "/", "%", "s", "/", "deny", "/", "%", "s", "/'_", "%_", "(_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "self_", "._", "language_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "username_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "URL", "s_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "status", "\\u", "code_", "in_", "URL", "s_", "[_", "user_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "url_", "in_", "URL", "s_", "[_", "user_", "]_", "[_", "status", "\\u", "code_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "status", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Wro", "ng", " ", "status", " ", "code", " ", "for", " ", "user", " ", "'%", "s", "'", " ", "and", " ", "url", " ", "'%", "s", "'", " ", "(", " ", "%", "s", " ", "!=", " ", "%", "s", ")\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "url_", ",_", "response_", "._", "status", "\\u", "code_", ",_", "status", "\\u", "code_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "view", "\\u", "strings_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "access", " ", "to", " ", "view", " ", "lot", "te", " ", "for", " ", "a", " ", "resource", " ", "in", " ", "a", " ", "private", " ", "project", " ", "(", "read", "\\", "10", ";", " ", " ", " ", " ", "only", " ", "access", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "access", " ", "to", " ", "lot", "te", " ", "for", " ", "a", " ", "language", " ", "with", " ", "a", " ", "team", "._", "\\u\\u\\uNL\\u\\u\\u_", "URL_", "=_", "self_", "._", "urls_", "[_", "'", "translat", "e\\u", "private", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "#", " ", "'", "writer", "',", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "access", " ", "to", " ", "lot", "te", " ", "for", " ", "a", " ", "language", " ", "with", "out", " ", "a", " ", "team", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "translat", "e\\u", "resource", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lang", "\\u", "code", "'_", ":_", "self_", "._", "language", "\\u", "ar_", "._", "code_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", "]_", ":_", "#'", "writer", "',", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "edit", "\\u", "strings_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "access", " ", "to", " ", "view", " ", "lot", "te", " ", "for", " ", "a", " ", "resource", " ", "in", " ", "a", " ", "private", " ", "project", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "access", " ", "to", " ", "lot", "te", " ", "for", " ", "a", " ", "language", " ", "with", " ", "a", " ", "team", "._", "\\u\\u\\uNL\\u\\u\\u_", "URL_", "=_", "self_", "._", "urls_", "[_", "'", "translat", "e\\u", "private", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ma", "yb", "e", " ", "this", " ", "shou", "ld", " ", "be", " ", "404", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "#", " ", "'", "writer", "'?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "access", " ", "to", " ", "lot", "te", " ", "for", " ", "a", " ", "language", " ", "with", "out", " ", "a", " ", "team", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "translat", "e\\u", "resource", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lang", "\\u", "code", "'_", ":_", "self_", "._", "language", "\\u", "ar_", "._", "code_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", "]_", ":_", "#", " ", "'", "writer", "'?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "download", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "access", " ", "to", " ", "download", " ", "translatio", "n", " ", "file", " ", "for", " ", "a", " ", "resource", " ", "in", " ", "a", " ", "private", "\\", "10", ";", " ", " ", " ", " ", "project", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "who", " ", "has", " ", "access", " ", "to", " ", "download", " ", "pof", "ile", " ", "for", " ", "language", " ", "with", " ", "team_", "\\u\\u\\uNL\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "download", "\\u", "translatio", "n", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lang", "\\u", "code", "'_", ":_", "self_", "._", "language_", "._", "code_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "#", " ", "bett", "er", " ", "404", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "#'", "writer", "'?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "#", " ", "wh", "y", " ", "not", " ", "200", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "who", " ", "has", " ", "access", " ", "to", " ", "download", " ", "pof", "ile", " ", "for", " ", "language", " ", "with", "out", " ", "team_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "translat", "e\\u", "resource", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lang", "\\u", "code", "'_", ":_", "self_", "._", "language", "\\u", "ar_", "._", "code_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", ",_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", "]_", ":_", "#", " ", "'", "writer", "'?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "lock", "\\u", "unlock", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "access", " ", "to", " ", "lock", " ", "and", " ", "unlock", " ", "pof", "ile", " ", "in", " ", "a", " ", "component", " ", "of", " ", "a", " ", "private", " ", "project", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "resource", "\\u", "language", "\\u", "lock", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "\\u", "code", "'_", ":_", "self_", "._", "language_", "._", "code_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POST", " ", "Requests_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "redirec", "t", " ", "works", " ", "for", " ", "the", " ", "login", " ", "page", " ", "but", " ", "we", " ", "get", " ", "200", " ", "status", "?", " ", "how_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "come", "??", " ", "XX", "X", "!", " ", "FIX", "ME_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ano", "nym", "ous", " ", "and", " ", "register", "ed", " ", "user", " ", "shou", "ld", " ", "not", " ", "have", " ", "access", " ", "to", " ", "lock", " ", "the", " ", "files", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "#'", "writer", "',", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "resource", "\\u", "language", "\\u", "lock", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "\\u", "code", "'_", ":_", "self_", "._", "language", "\\u", "ar_", "._", "code_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "#", ",", " ", "'", "writer", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "redirec", "t", " ", "works", " ", "for", " ", "the", " ", "login", " ", "page", " ", "but", " ", "we", " ", "get", " ", "200", " ", "status", "?", " ", "how_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "come", "??", " ", "XX", "X", "!", " ", "FIX", "ME_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wh", "y", " ", "do", " ", "team", "\\u", "co", " ", "&&", " ", "team", "\\u", "member", " ", "return", " ", "200", "?", " ", "XX", "X", " ", "!", " ", "FIX", "ME_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", "]_", ":_", "#", " ", "'", "team", "\\u", "coordinator", "','", "team", "\\u", "member", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", "]_", ":_", "#", ",", " ", "'", "writer", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "watch", "\\u", "unwa", "tch", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "access", " ", "to", " ", "watch", "/", "unwa", "tch", " ", "file", " ", "in", " ", "a", " ", "component", " ", "of", " ", "a", " ", "private", " ", "project", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "notification_", "._", "models_", "import_", "Noti", "ce", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "resource", "\\u", "translatio", "n", "\\u", "toggle", "\\u", "watch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "\\u", "code", "'_", ":_", "self_", "._", "language_", "._", "code_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POST", " ", "Requests_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "#'", "writer", "',", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "resource", "\\u", "language", "\\u", "lock", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "\\u", "code", "'_", ":_", "self_", "._", "language", "\\u", "ar_", "._", "code_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wh", "y", " ", "do", " ", "team", "\\u", "co", " ", "&&", " ", "team", "\\u", "member", " ", "return", " ", "200", "?", " ", "XX", "X", " ", "!", " ", "FIX", "ME_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", "]_", ":_", "#", " ", ",", " ", "'", "team", "\\u", "coordinator", "',", " ", "'", "team", "\\u", "member", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ano", "nym", "ous", " ", "and", " ", "register", "ed", " ", "user", " ", "shou", "ld", " ", "not", " ", "have", " ", "access", " ", "to", " ", "lock", " ", "the", " ", "files", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", "]_", ":_", "#", " ", ",", " ", "'", "writer", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "watch", "\\u", "unwa", "tch", "\\u", "project_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "access", " ", "to", " ", "watch", "/", "unwa", "tch", " ", "project", " ", "in", " ", "a", " ", "component", " ", "of", " ", "a", " ", "private", " ", "project", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "notification_", "._", "models_", "import_", "Noti", "ce", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "project", "\\u", "toggle", "\\u", "watch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POST", " ", "Requests_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "#", " ", "'", "writer", "',", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "post_", "(_", "URL_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "charts", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "access", " ", "to", " ", "component", " ", "charts", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "images", " ", "and", " ", "charts", " ", "urls_", "\\u\\u\\uNL\\u\\u\\u_", "URL", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "chart", "\\u", "resource", "\\u", "image", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "chart", "\\u", "resource", "\\u", "js", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "chart", "\\u", "resource", "\\u", "html", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "chart", "\\u", "resource", "\\u", "json", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u", "slug", "'_", ":_", "self_", "._", "resource", "\\u", "private_", "._", "slug_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", ",_", "'", "register", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "url_", "in_", "URL", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "now", " ", "charts", " ", "are", " ", "disable", "d", " ", "for", " ", "private", " ", "projects_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "writer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "url_", "in_", "URL", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "timeline_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "access", " ", "to", " ", "component", " ", "charts", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "URL_", "=_", "reverse_", "(_", "'", "project", "\\u", "timeline", "'_", ",_", "kwargs_", "=_", "{_", "'", "project", "\\u", "slug", "'_", ":_", "self_", "._", "project", "\\u", "private_", "._", "slug_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "maintainer", "s", " ", "have", " ", "access", " ", "to", " ", "the", " ", "project", " ", "timeline", " ", "???", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "anonym", "ous", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "register", "ed", "'_", ",_", "'", "writer", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "[_", "'", "maintainer", "'_", ",_", "'", "team", "\\u", "coordinator", "'_", ",_", "'", "team", "\\u", "member", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "[_", "user_", "]_", "._", "get_", "(_", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "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", "public", "\\u", "to", "\\u", "private_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "the", " ", "process", " ", "of", " ", "transform", "ing", " ", "a", " ", "public", " ", "project", " ", "to", " ", "private", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Priva", "te", "Project", "Test_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "private", "\\u", "to", "\\u", "public_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "the", " ", "process", " ", "of", " ", "transform", "ing", " ", "a", " ", "public", " ", "project", " ", "to", " ", "private", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Project", "Look", "ups", "Tests_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Project", "Look", "ups", "Tests_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "private", "\\u", "project", "s", "\\u", "aja", "x", "\\u", "lookup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "a", " ", "private", " ", "project", " ", "isn", "'", "t", " ", "presen", "t", " ", "in", " ", "lookups", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "AJ", "AX", " ", "look", "up", "/", "dropdown", " ", "is", " ", "presen", "t", " ", "in", " ", "the", " ", "Tea", "m", " ", "Outs", "ource", " ", "form", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "project_", "=_", "\"", "Test", " ", "Project", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "private", "\\u", "project_", "=_", "\"", "Test", " ", "Priva", "te", " ", "Project", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "a", " ", "private", " ", "project", " ", "is", " ", "not", " ", "visi", "ble", " ", "to", " ", "a", " ", "random", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "user_", "[_", "'", "register", "ed", "'_", "]_", "not_", "in_", "self_", "._", "project", "\\u", "private_", "._", "maintainer", "s_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "get_", "(_", "'/", "aja", "x", "/", "aja", "x", "\\u", "look", "up", "/", "project", "s", "'_", ",_", "{_", "'", "q", "'_", ":_", "'", "p", "'_", ",_", "'", "limit", "'_", ":_", "'", "150", "'_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "public", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Contains_", "(_", "resp_", ",_", "private", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "a", " ", "private", " ", "project", " ", "is", " ", "visi", "ble", " ", "to", " ", "its", " ", "maintainer_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "user_", "[_", "'", "maintainer", "'_", "]_", "in_", "self_", "._", "project", "\\u", "private_", "._", "maintainer", "s_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "'/", "aja", "x", "/", "aja", "x", "\\u", "look", "up", "/", "project", "s", "'_", ",_", "{_", "'", "q", "'_", ":_", "'", "p", "'_", ",_", "'", "limit", "'_", ":_", "'", "150", "'_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "public", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "private", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "a", " ", "private", " ", "project", " ", "is", " ", "visi", "ble", " ", "to", " ", "a", " ", "member", " ", "of", " ", "its", " ", "teams_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "in_", "self_", "._", "team", "\\u", "private_", "._", "members_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "user_", "[_", "'", "team", "\\u", "member", "'_", "]_", "in_", "self_", "._", "project", "\\u", "private_", "._", "maintainer", "s_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "get_", "(_", "'/", "aja", "x", "/", "aja", "x", "\\u", "look", "up", "/", "project", "s", "'_", ",_", "{_", "'", "q", "'_", ":_", "'", "p", "'_", ",_", "'", "limit", "'_", ":_", "'", "150", "'_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "public", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "private", "\\u", "project_", ",_", "status", "\\u", "code_", "=_", "200_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
EverythingMe/teleport/tools/gen_ipv_hosts.py
[ { "content": "#!/usr/bin/env python\n\nimport zipfile\nimport yaml\nimport sys\nimport os\nimport requests\nfrom collections import defaultdict\nfrom StringIO import StringIO\n\n\nIPV_CONFIG_URL = \"https://www.ipvanish.com/software/configs/configs.zip\"\n\n\n\n\n\n\n \nif __name__ == \"__main__\":\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_country_to_hosts(ipvanish_zip):\n res = defaultdict(list)\n\n for f in ipvanish_zip.namelist():\n if not f.endswith(\".ovpn\"):\n continue\n\n country_code = f.split(\"-\")[1].lower()\n\n if country_code == 'uk':\n country_code = 'gb'\n\n ovpn = ipvanish_zip.open(f)\n\n for line in ovpn.readlines():\n if line.startswith(\"remote\"):\n res[country_code].append(line.split(\" \")[1])\n\n return dict(res)", "metadata": "root.get_country_to_hosts", "header": "['module', '___EOS___']", "index": 14 }, { "content": "def get_ipvanish_zip():\n zipdata = StringIO()\n zipdata.write(requests.get(IPV_CONFIG_URL).content)\n return zipfile.ZipFile(zipdata)", "metadata": "root.get_ipvanish_zip", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def main():\n print(yaml.dump(\n get_country_to_hosts(get_ipvanish_zip()),\n default_flow_style=False\n ))", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 41 } ]
[ { "span": "import sys", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 10 }, { "span": "import os", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "yaml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "IP", "V", "\\u", "CONFIG", "\\u", "URL_", "=_", "\"", "https", "://", "www", ".", "ipv", "ani", "sh", ".", "com", "/", "software", "/", "configs", "/", "configs", ".", "zip", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "countr", "y", "\\u", "to", "\\u", "hosts_", "(_", "ipv", "ani", "sh", "\\u", "zip_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "ipv", "ani", "sh", "\\u", "zip_", "._", "namelist_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "endswith_", "(_", "\".", "ov", "pn", "\"_", ")_", ":_", "\\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_", "countr", "y", "\\u", "code_", "=_", "f_", "._", "split_", "(_", "\"-\"_", ")_", "[_", "1_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "countr", "y", "\\u", "code_", "==_", "'", "uk", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "countr", "y", "\\u", "code_", "=_", "'", "gb", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ov", "pn_", "=_", "ipv", "ani", "sh", "\\u", "zip_", "._", "open_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "ov", "pn_", "._", "readlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "startswith_", "(_", "\"", "remote", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "[_", "countr", "y", "\\u", "code_", "]_", "._", "append_", "(_", "line_", "._", "split_", "(_", "\"", " ", "\"_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dict_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "ipv", "ani", "sh", "\\u", "zip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zip", "data_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip", "data_", "._", "write_", "(_", "requests_", "._", "get_", "(_", "IP", "V", "\\u", "CONFIG", "\\u", "URL_", ")_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "zipfile_", "._", "Zip", "File_", "(_", "zip", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "yaml_", "._", "dump_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "countr", "y", "\\u", "to", "\\u", "hosts_", "(_", "get", "\\u", "ipv", "ani", "sh", "\\u", "zip_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "flow", "\\u", "style_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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aleev/flask-sijax/examples/comet.py
[ { "content": "# -*- coding: utf-8 -*-\n\n\"\"\"A demonstration of Comet streaming functionality using Sijax.\"\"\"\n\nimport os, sys\n\npath = os.path.join('.', os.path.dirname(__file__), '../')\nsys.path.append(path)\n\nfrom flask import Flask, g, render_template\nimport flask_sijax\n\napp = Flask(__name__)\n\n# The path where you want the extension to create the needed javascript files\n# DON'T put any of your files in this directory, because they'll be deleted!\napp.config[\"SIJAX_STATIC_PATH\"] = os.path.join('.', os.path.dirname(__file__), 'static/js/sijax/')\n\n# You need to point Sijax to the json2.js library if you want to support\n# browsers that don't support JSON natively (like IE <= 7)\napp.config[\"SIJAX_JSON_URI\"] = '/static/js/sijax/json2.js'\n\nflask_sijax.Sijax(app)\n\n\n\n\nif __name__ == '__main__':\n app.run(debug=True, port=8080)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "app.run(debug=True, port=8080)", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Flask_", "app_", "is_", "run_", "in_", "debug_", "mode_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "A", " ", "demonstrat", "ion", " ", "of", " ", "Come", "t", " ", "stream", "ing", " ", "functional", "it", "y", " ", "usi", "ng", " ", "Si", "jax", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'.'_", ",_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'../", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", ",_", "g_", ",_", "render", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fla", "sk", "\\u", "si", "jax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "path", " ", "where", " ", "you", " ", "want", " ", "the", " ", "extensi", "on", " ", "to", " ", "create", " ", "the", " ", "need", "ed", " ", "javascript", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DON", "'", "T", " ", "put", " ", "any", " ", "of", " ", "your", " ", "files", " ", "in", " ", "this", " ", "director", "y", ",", " ", "bec", "aus", "e", " ", "the", "y", "'", "ll", " ", "be", " ", "delete", "d", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "config_", "[_", "\"", "SI", "JA", "X", "\\u", "STATI", "C", "\\u", "PATH", "\"_", "]_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'.'_", ",_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "static", "/", "js", "/", "si", "jax", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "need", " ", "to", " ", "point", " ", "Si", "jax", " ", "to", " ", "the", " ", "json", "2", ".", "js", " ", "librar", "y", " ", "if", " ", "you", " ", "want", " ", "to", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "browsers", " ", "tha", "t", " ", "don", "'", "t", " ", "support", " ", "JSO", "N", " ", "nativ", "el", "y", " ", "(", "like", " ", "IE", " ", "<=", " ", "7", ")_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "config_", "[_", "\"", "SI", "JA", "X", "\\u", "JSO", "N", "\\u", "URI", "\"_", "]_", "=_", "'/", "static", "/", "js", "/", "si", "jax", "/", "json", "2", ".", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fla", "sk", "\\u", "si", "jax_", "._", "Si", "jax_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "run_", "(_", "debug_", "=_", "True_", ",_", "port_", "=_", "8080_", ")_", "\\u\\u\\uDEDENT\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
`__eq__` not overridden when adding attributes
behave/behave/behave/matchers.py
[ { "content": "class Match(Replayable):\n \"\"\"An parameter-matched *feature file* step name extracted using\n step decorator `parameters`_.\n\n .. attribute:: func\n\n The step function that this match will be applied to.\n\n .. attribute:: arguments\n\n A list of :class:`~behave.model_core.Argument` instances containing the\n matched parameters from the step name.\n \"\"\"\n type = \"match\"\n\n\n\n\n\n", "metadata": "root.Match", "header": "['module', '___EOS___']", "index": 47 }, { "content": " def __init__(self, func, arguments=None):\n super(Match, self).__init__()\n self.func = func\n self.arguments = arguments\n self.location = None\n if func:\n self.location = self.make_location(func)", "metadata": "root.Match.__init__", "header": "['class', 'Match', '(', 'Replayable', ')', ':', '___EOS___']", "index": 62 }, { "content": " def __repr__(self):\n if self.func:\n func_name = self.func.__name__\n else:\n func_name = '<no function>'\n return '<Match %s, %s>' % (func_name, self.location)", "metadata": "root.Match.__repr__", "header": "['class', 'Match', '(', 'Replayable', ')', ':', '___EOS___']", "index": 70 }, { "content": " def __eq__(self, other):\n if not isinstance(other, Match):\n return False\n return (self.func, self.location) == (other.func, other.location)", "metadata": "root.Match.__eq__", "header": "['class', 'Match', '(', 'Replayable', ')', ':', '___EOS___']", "index": 77 }, { "content": " def with_arguments(self, arguments):\n match = copy.copy(self)\n match.arguments = arguments\n return match", "metadata": "root.Match.with_arguments", "header": "['class', 'Match', '(', 'Replayable', ')', ':', '___EOS___']", "index": 82 }, { "content": " def run(self, context):\n args = []\n kwargs = {}\n for arg in self.arguments:\n if arg.name is not None:\n kwargs[arg.name] = arg.value\n else:\n args.append(arg.value)\n\n with context.use_with_user_mode():\n self.func(context, *args, **kwargs)", "metadata": "root.Match.run", "header": "['class', 'Match', '(', 'Replayable', ')', ':', '___EOS___']", "index": 87 }, { "content": " @staticmethod\n def make_location(step_function):\n \"\"\"Extracts the location information from the step function and\n builds a FileLocation object with (filename, line_number) info.\n\n :param step_function: Function whose location should be determined.\n :return: FileLocation object for step function.\n \"\"\"\n return FileLocation.for_function(step_function)", "metadata": "root.Match.make_location", "header": "['class', 'Match', '(', 'Replayable', ')', ':', '___EOS___']", "index": 99 }, { "content": "class NoMatch(Match):\n \"\"\"Used for an \"undefined step\" when it can not be matched with a\n step definition.\n \"\"\"\n", "metadata": "root.NoMatch", "header": "['module', '___EOS___']", "index": 110 }, { "content": " def __init__(self):\n Match.__init__(self, func=None)\n self.func = None\n self.arguments = []\n self.location = None", "metadata": "root.NoMatch.__init__", "header": "['class', 'NoMatch', '(', 'Match', ')', ':', '___EOS___']", "index": 115 }, { "content": "class MatchWithError(Match):\n \"\"\"Match class when error occur during step-matching\n\n REASON:\n * Type conversion error occured.\n * ...\n \"\"\"\n", "metadata": "root.MatchWithError", "header": "['module', '___EOS___']", "index": 122 }, { "content": " def __init__(self, func, error):\n if not ExceptionUtil.has_traceback(error):\n ExceptionUtil.set_traceback(error)\n Match.__init__(self, func=func)\n self.stored_error = error", "metadata": "root.MatchWithError.__init__", "header": "['class', 'MatchWithError', '(', 'Match', ')', ':', '___EOS___']", "index": 129 }, { "content": " def run(self, context):\n \"\"\"Raises stored error from step matching phase (type conversion).\"\"\"\n raise StepParseError(exc_cause=self.stored_error)", "metadata": "root.MatchWithError.run", "header": "['class', 'MatchWithError', '(', 'Match', ')', ':', '___EOS___']", "index": 135 } ]
[ { "span": "class NoMatch(Match):", "start_line": 110, "start_column": 0, "end_line": 110, "end_column": 21 }, { "span": "class MatchWithError(Match):", "start_line": 122, "start_column": 0, "end_line": 122, "end_column": 28 } ]
[ { "span": "def __eq__(self, other):", "start_line": 77, "start_column": 4, "end_line": 77, "end_column": 28 }, { "span": "self.arguments ", "start_line": 118, "start_column": 8, "end_line": 118, "end_column": 22 }, { "span": "self.stored_error ", "start_line": 133, "start_column": 8, "end_line": 133, "end_column": 25 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "eq\\u\\u_", "`_", "not_", "overrid", "den_", "when_", "addin", "g_", "attributes_", "[SEP]_", "module_", "\\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_", "Match_", "(_", "Repl", "aya", "ble_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "parameter", "-", "matche", "d", " ", "*", "feature", " ", "file", "*", " ", "step", " ", "name", " ", "extracted", " ", "usi", "ng", "\\", "10", ";", " ", " ", " ", " ", "step", " ", "decorat", "or", " ", "`", "parameter", "s", "`\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "attribute", "::", " ", "func", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "The", " ", "step", " ", "function", " ", "tha", "t", " ", "this", " ", "match", " ", "will", " ", "be", " ", "applied", " ", "to", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "attribute", "::", " ", "argu", "ment", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "A", " ", "list", " ", "of", " ", ":", "class", ":`", "~", "behave", ".", "model", "\\u", "core", ".", "Arg", "ument", "`", " ", "instance", "s", " ", "contain", "ing", " ", "the", "\\", "10", ";", " ", " ", " ", "matche", "d", " ", "parameter", "s", " ", "from", " ", "the", " ", "step", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", "=_", "\"", "match", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Match_", "(_", "Repl", "aya", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "func_", ",_", "arguments_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Match_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "=_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "arguments_", "=_", "arguments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "location_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "func_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "location_", "=_", "self_", "._", "make", "\\u", "location_", "(_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Match_", "(_", "Repl", "aya", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "func_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "name_", "=_", "self_", "._", "func_", "._", "\\u\\u", "name\\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 ", " _", "func", "\\u", "name_", "=_", "'<", "no", " ", "function", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'<", "Match", " ", "%", "s", ",", " ", "%", "s", ">'_", "%_", "(_", "func", "\\u", "name_", ",_", "self_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Match_", "(_", "Repl", "aya", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "other_", ",_", "Match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "self_", "._", "func_", ",_", "self_", "._", "location_", ")_", "==_", "(_", "other_", "._", "func_", ",_", "other_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Match_", "(_", "Repl", "aya", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "with", "\\u", "arguments_", "(_", "self_", ",_", "arguments_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "copy_", "._", "copy_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "._", "arguments_", "=_", "arguments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Match_", "(_", "Repl", "aya", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "self_", "._", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "._", "name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "arg_", "._", "name_", "]_", "=_", "arg_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "append_", "(_", "arg_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "context_", "._", "use", "\\u", "with", "\\u", "user", "\\u", "mode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "func_", "(_", "context_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Match_", "(_", "Repl", "aya", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "make", "\\u", "location_", "(_", "step", "\\u", "function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Extract", "s", " ", "the", " ", "location", " ", "informati", "on", " ", "from", " ", "the", " ", "step", " ", "function", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "builds", " ", "a", " ", "File", "Locat", "ion", " ", "object", " ", "with", " ", "(", "filename", ",", " ", "line", "\\u", "number", ")", " ", "info", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "step", "\\u", "function", ":", " ", "Function", " ", "who", "se", " ", "location", " ", "shou", "ld", " ", "be", " ", "dete", "rmin", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "File", "Locat", "ion", " ", "object", " ", "for", " ", "step", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "File", "Location_", "._", "for", "\\u", "function_", "(_", "step", "\\u", "function_", ")_", "\\u\\u\\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_", "No", "Match_", "(_", "Match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "ed", " ", "for", " ", "an", " ", "\"", "undefined", " ", "step", "\"", " ", "whe", "n", " ", "it", " ", "can", " ", "not", " ", "be", " ", "matche", "d", " ", "with", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "step", " ", "definit", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "No", "Match_", "(_", "Match_", ")_", ":_", "\\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 ", " _", "Match_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "func_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "arguments_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "location_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Match", "With", "Error_", "(_", "Match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Match", " ", "class", " ", "whe", "n", " ", "error", " ", "occur", " ", "dur", "ing", " ", "step", "-", "matchi", "ng", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "REASON", ":", "\\", "10", ";", " ", " ", "*", " ", "Type", " ", "conve", "rsi", "on", " ", "error", " ", "occure", "d", ".", "\\", "10", ";", " ", " ", "*", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Match", "With", "Error_", "(_", "Match_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "func_", ",_", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "Except", "ion", "Util_", "._", "has", "\\u", "traceback_", "(_", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Except", "ion", "Util_", "._", "set\\u", "traceback_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Match_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "func_", "=_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "store", "d\\u", "error_", "=_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Match", "With", "Error_", "(_", "Match_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Rai", "ses", " ", "store", "d", " ", "error", " ", "from", " ", "step", " ", "matchi", "ng", " ", "phase", " ", "(", "type", " ", "conve", "rsi", "on", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Step", "Pars", "e", "Error_", "(_", "exc", "\\u", "cause_", "=_", "self_", "._", "store", "d\\u", "error_", ")_", "\\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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 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 ]
Unused local variable
saltstack/salt/salt/utils/vault.py
[ { "content": "def write_(path, key, value, profile=None):\n '''\n Set a key/value pair in the vault service\n '''\n result = _query(\n 'POST',\n path,\n profile=profile,\n data=json.dumps({key: value}),\n )\n\n return read_(path, key, profile)", "metadata": "root.write_", "header": "['module', '___EOS___']", "index": 72 } ]
[ { "span": "result ", "start_line": 76, "start_column": 4, "end_line": 76, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u_", "(_", "path_", ",_", "key_", ",_", "value_", ",_", "profile_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "a", " ", "key", "/", "value", " ", "pair", " ", "in", " ", "the", " ", "vau", "lt", " ", "service", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "\\u", "query_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "POST", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "profile_", "=_", "profile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "json_", "._", "dumps_", "(_", "{_", "key_", ":_", "value_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "read", "\\u_", "(_", "path_", ",_", "key_", ",_", "profile_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
fp7-ofelia/ocf/vt_manager/src/python/agent/settings/staticSettings.py
[ { "content": "import logging\n'''\n\t@author: msune\n\n\tOfelia XEN Agent settings file (Static settings) \n'''\n##General Parameters\n\n'''Base folder where vms and logs will be store.\nAll the rest of folder must be inside this folder'''\nOXA_PATH=\"/opt/ofelia/oxa/\"\n\n\n'''Log folder. Must exist!'''\nOXA_LOG=\"/opt/ofelia/oxa/log/\"\n\n#Log level. Should be: 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'\n#Default warning\nLOG_LEVEL=\"WARNING\"\n\n'''XMLRPC over HTTPS server parameters'''\n#XMLRPC_SERVER_LISTEN_HOST='127.0.0.1' # You should not use '' here, unless you have a real FQDN.\nXMLRPC_SERVER_LISTEN_HOST='0.0.0.0' # You should not use '' here, unless you have a real FQDN.\nXMLRPC_SERVER_LISTEN_PORT=9229\n\nXMLRPC_SERVER_KEYFILE='security/certs/agent.key' # Replace with your PEM formatted key file\nXMLRPC_SERVER_CERTFILE='security/certs/agent.crt' # Replace with your PEM formatted certificate file\n\n#HDs\nOXA_DEFAULT_SWAP_SIZE_MB=512\n\n##FileHD driver settings\n'''Enable/disable file-type Hdmanager Cache FS'''\nOXA_FILEHD_USE_CACHE=True\n\n'''Cache folder to store VMs (if cache mechanism is used)'''\nOXA_FILEHD_CACHE_VMS=\"/opt/ofelia/oxa/cache/vms/\"\n\n'''Remote folder to store VMs'''\nOXA_FILEHD_REMOTE_VMS=\"/opt/ofelia/oxa/remote/vms/\"\n\n'''Cache folder for templates (if cache is enabled)'''\nOXA_FILEHD_CACHE_TEMPLATES=\"/opt/ofelia/oxa/cache/templates/\"\n\n'''Remote folder for templates'''\nOXA_FILEHD_REMOTE_TEMPLATES=\"/opt/ofelia/oxa/remote/templates/\"\n\n'''Use sparse disks while cloning'''\nOXA_FILEHD_CREATE_SPARSE_DISK=False\n\n'''Nice priority for Copy&untar operations'''\nOXA_FILEHD_NICE_PRIORITY=15\n\n'''IONice copy&untar operations class'''\nOXA_FILEHD_IONICE_CLASS=2\n'''IONice copy&untar operations priority'''\nOXA_FILEHD_IONICE_PRIORITY=5\n'''/bin/dd block size(bs) for copy operations'''\nOXA_FILEHD_DD_BS_KB=32\n\n##Ofelia Debian VM configurator parameters\n'''Kernel and initrd that will be used by machines'''\nOXA_XEN_SERVER_KERNEL=\"/boot/vmlinuz-2.6.32-5-xen-amd64\"\nOXA_XEN_SERVER_INITRD=\"/boot/initrd.img-2.6.32-5-xen-amd64\"\n\n'''Debian-family usual file locations'''\nOXA_DEBIAN_INTERFACES_FILE_LOCATION = \"/etc/network/interfaces\"\nOXA_DEBIAN_UDEV_FILE_LOCATION = \"/etc/udev/rules.d/70-persistent-net.rules\"\nOXA_DEBIAN_HOSTNAME_FILE_LOCATION=\"/etc/hostname\"\nOXA_DEBIAN_SECURITY_ACCESS_FILE_LOCATION=\"/etc/security/access.conf\"\n\n'''RedHat-family usual file locations'''\nOXA_REDHAT_INTERFACES_FILE_LOCATION = \"/etc/sysconfig/network-scripts/\"\nOXA_REDHAT_UDEV_FILE_LOCATION = \"/etc/udev/rules.d/70-persistent-net.rules\"\nOXA_REDHAT_HOSTNAME_FILE_LOCATION=\"/etc/hostname\"\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import logging", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", "\t", "@", "author", ":", " ", "ms", "une", "\\", "10", ";", "\\", "10", ";", "\t", "Of", "eli", "a", " ", "XE", "N", " ", "Agent", " ", "settings", " ", "file", " ", "(", "Static", " ", "settings", ")", " ", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "General", " ", "Parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Base", " ", "folder", " ", "where", " ", "vms", " ", "and", " ", "logs", " ", "will", " ", "be", " ", "store", ".", "\\", "10", ";", "All", " ", "the", " ", "rest", " ", "of", " ", "folder", " ", "must", " ", "be", " ", "insi", "de", " ", "this", " ", "folder", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "PATH_", "=_", "\"/", "opt", "/", "of", "eli", "a", "/", "ox", "a", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Log", " ", "folder", ".", " ", "Mus", "t", " ", "exist", "!'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "LOG_", "=_", "\"/", "opt", "/", "of", "eli", "a", "/", "ox", "a", "/", "log", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Log", " ", "level", ".", " ", "Sho", "ul", "d", " ", "be", ":", " ", "'", "DEBU", "G", "',", " ", "'", "INFO", "',", " ", "'", "WARN", "ING", "',", " ", "'", "ERROR", "',", " ", "'", "CRIT", "ICAL", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Default", " ", "warning_", "\\u\\u\\uNL\\u\\u\\u_", "LOG", "\\u", "LEVEL_", "=_", "\"", "WARN", "ING", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "XMLRPC", " ", "over", " ", "HTTP", "S", " ", "server", " ", "parameter", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "XMLRPC", "\\u", "SERVER", "\\u", "LISTEN", "\\u", "HOST", "='", "127", ".0", ".0", ".1", "'", " ", "#", " ", "You", " ", "shou", "ld", " ", "not", " ", "use", " ", "''", " ", "here", ",", " ", "unl", "ess", " ", "you", " ", "have", " ", "a", " ", "real", " ", "FQ", "DN", "._", "\\u\\u\\uNL\\u\\u\\u_", "XMLRPC", "\\u", "SERVER", "\\u", "LISTEN", "\\u", "HOST_", "=_", "'", "0.", "0.", "0.", "0", "'_", "#", " ", "You", " ", "shou", "ld", " ", "not", " ", "use", " ", "''", " ", "here", ",", " ", "unl", "ess", " ", "you", " ", "have", " ", "a", " ", "real", " ", "FQ", "DN", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XMLRPC", "\\u", "SERVER", "\\u", "LISTEN", "\\u", "PORT_", "=_", "922", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "XMLRPC", "\\u", "SERVER", "\\u", "KEY", "FILE_", "=_", "'", "security", "/", "cert", "s", "/", "agent", ".", "key", "'_", "#", " ", "Replace", " ", "with", " ", "your", " ", "PEM", " ", "format", "ted", " ", "key", " ", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XMLRPC", "\\u", "SERVER", "\\u", "CERT", "FILE_", "=_", "'", "security", "/", "cert", "s", "/", "agent", ".", "crt", "'_", "#", " ", "Replace", " ", "with", " ", "your", " ", "PEM", " ", "format", "ted", " ", "certifica", "te", " ", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "HD", "s_", "\\u\\u\\uNL\\u\\u\\u_", "OX", "A", "\\u", "DEF", "AUL", "T", "\\u", "SWA", "P", "\\u", "SIZE", "\\u", "MB_", "=_", "512_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "File", "HD", " ", "driver", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Enable", "/", "disable", " ", "file", "-", "type", " ", "Hd", "manage", "r", " ", "Cache", " ", "FS", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "FILE", "HD", "\\u", "USE", "\\u", "CACHE_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Cache", " ", "folder", " ", "to", " ", "store", " ", "VM", "s", " ", "(", "if", " ", "cache", " ", "mechanism", " ", "is", " ", "used", ")'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "FILE", "HD", "\\u", "CACHE", "\\u", "VM", "S_", "=_", "\"/", "opt", "/", "of", "eli", "a", "/", "ox", "a", "/", "cache", "/", "vms", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Remo", "te", " ", "folder", " ", "to", " ", "store", " ", "VM", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "FILE", "HD", "\\u", "REMO", "TE", "\\u", "VM", "S_", "=_", "\"/", "opt", "/", "of", "eli", "a", "/", "ox", "a", "/", "remote", "/", "vms", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Cache", " ", "folder", " ", "for", " ", "template", "s", " ", "(", "if", " ", "cache", " ", "is", " ", "enable", "d", ")'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "FILE", "HD", "\\u", "CACHE", "\\u", "TEMPLATES_", "=_", "\"/", "opt", "/", "of", "eli", "a", "/", "ox", "a", "/", "cache", "/", "template", "s", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Remo", "te", " ", "folder", " ", "for", " ", "template", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "FILE", "HD", "\\u", "REMO", "TE", "\\u", "TEMPLATES_", "=_", "\"/", "opt", "/", "of", "eli", "a", "/", "ox", "a", "/", "remote", "/", "template", "s", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Us", "e", " ", "spars", "e", " ", "disks", " ", "whi", "le", " ", "clo", "ning", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "FILE", "HD", "\\u", "CREATE", "\\u", "SPAR", "SE", "\\u", "DISK", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Nic", "e", " ", "priorit", "y", " ", "for", " ", "Copy", "&", "unta", "r", " ", "operati", "ons", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "FILE", "HD", "\\u", "NIC", "E", "\\u", "PRIORITY", "_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "ION", "ice", " ", "copy", "&", "unta", "r", " ", "operati", "ons", " ", "class", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "FILE", "HD", "\\u", "ION", "ICE", "\\u", "CLASS_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "ION", "ice", " ", "copy", "&", "unta", "r", " ", "operati", "ons", " ", "priorit", "y", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "FILE", "HD", "\\u", "ION", "ICE", "\\u", "PRIORITY", "_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "/", "bin", "/", "dd", " ", "block", " ", "size", "(", "bs", ")", " ", "for", " ", "copy", " ", "operati", "ons", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "FILE", "HD", "\\u", "DD", "\\u", "BS", "\\u", "KB", "_", "=_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "Of", "eli", "a", " ", "Deb", "ian", " ", "VM", " ", "configurator", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Kern", "el", " ", "and", " ", "initrd", " ", "tha", "t", " ", "will", " ", "be", " ", "used", " ", "by", " ", "machine", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "XE", "N", "\\u", "SERVER", "\\u", "KERN", "EL_", "=_", "\"/", "boot", "/", "vm", "lin", "uz", "-", "2.6", ".3", "2", "-", "5", "-", "xen", "-", "am", "d6", "4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "XE", "N", "\\u", "SERVER", "\\u", "INIT", "RD", "_", "=_", "\"/", "boot", "/", "initrd", ".", "img", "-", "2.6", ".3", "2", "-", "5", "-", "xen", "-", "am", "d6", "4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Deb", "ian", "-", "famil", "y", " ", "usual", " ", "file", " ", "location", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "DEB", "IAN", "\\u", "INTERFACE", "S", "\\u", "FILE", "\\u", "LOCATION_", "=_", "\"/", "etc", "/", "network", "/", "interface", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "DEB", "IAN", "\\u", "UD", "EV", "\\u", "FILE", "\\u", "LOCATION_", "=_", "\"/", "etc", "/", "udev", "/", "rule", "s", ".", "d", "/", "7", "0", "-", "persiste", "nt", "-", "net", ".", "rule", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "DEB", "IAN", "\\u", "HOSTNAME", "\\u", "FILE", "\\u", "LOCATION_", "=_", "\"/", "etc", "/", "host", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "DEB", "IAN", "\\u", "SECURITY", "\\u", "ACCESS", "\\u", "FILE", "\\u", "LOCATION_", "=_", "\"/", "etc", "/", "security", "/", "access", ".", "conf", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Red", "Hat", "-", "famil", "y", " ", "usual", " ", "file", " ", "location", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "RED", "HAT", "\\u", "INTERFACE", "S", "\\u", "FILE", "\\u", "LOCATION_", "=_", "\"/", "etc", "/", "sysconfig", "/", "network", "-", "scripts", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "RED", "HAT", "\\u", "UD", "EV", "\\u", "FILE", "\\u", "LOCATION_", "=_", "\"/", "etc", "/", "udev", "/", "rule", "s", ".", "d", "/", "7", "0", "-", "persiste", "nt", "-", "net", ".", "rule", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OX", "A", "\\u", "RED", "HAT", "\\u", "HOSTNAME", "\\u", "FILE", "\\u", "LOCATION_", "=_", "\"/", "etc", "/", "host", "name", "\"_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
kdart/pycopia/QA/pycopia/QA/core.py
[ { "content": " def __call__(self, *args, **kwargs):\n \"\"\"Invoke the test.\n\n The test is \"kicked-off\" by calling this. Any arguments are passed to\n the test implementation (`execute` method).\n \"\"\"\n self.config.register_testcase(self.test_name)\n self._report.add_heading(self.test_name, 2)\n if args or kwargs:\n self._report.add_message(\"TESTARGUMENTS\", repr_args(args, kwargs), 2)\n self.starttime = timelib.now() # saved starttime in case initializer\n # needs to create the log file.\n self._initialize()\n # test elapsed time does not include initializer time.\n teststarttime = timelib.now()\n # run the execute() method and check for exceptions.\n try:\n rv = self.execute(*args, **kwargs)\n except KeyboardInterrupt:\n if self._debug:\n ex, val, tb = sys.exc_info()\n debugger.post_mortem(tb, ex, val)\n rv = self.incomplete(\"%s: aborted by user.\" % self.test_name)\n self._finalize(rv)\n raise\n except TestFailError, errval:\n rv = self.failed(\"Caught Fail exception: %s\" % (errval,))\n except TestIncompleteError, errval:\n rv = self.incomplete(\"Caught incomplete exception: %s\" % (errval,))\n # Test asserts and validation errors are based on this.\n except AssertionError as errval:\n rv = self.failed(\"failed assertion: %s\" % (errval,))\n except TestSuiteAbort:\n self.config.register_testcase(None)\n raise # pass this one up to suite\n except debugger.DebuggerQuit: # set_trace \"leaks\" BdbQuit\n rv = self.incomplete(\"%s: Debugger exit.\" % (self.test_name, ))\n except ConfigError as cerr:\n rv = self.incomplete(\"Configuration error: {}\".format(cerr))\n self.config.register_testcase(None)\n if self._debug:\n ex, val, tb = sys.exc_info()\n debugger.post_mortem(tb, ex, val)\n tb = None\n raise TestSuiteAbort(cerr)\n except:\n ex, val, tb = sys.exc_info()\n if self._debug:\n debugger.post_mortem(tb, ex, val)\n tb = None\n rv = self.incomplete(\"%s: Exception: (%s: %s)\" % (self.test_name, ex, val))\n endtime = timelib.now()\n self.config.register_testcase(None)\n self._report.add_message(\"STARTTIME\", teststarttime, 2)\n self._report.add_message(\"ENDTIME\", endtime, 2)\n minutes, seconds = divmod(endtime - teststarttime, 60.0)\n hours, minutes = divmod(minutes, 60.0)\n self.info(\"Time elapsed: %02.0f:%02.0f:%02.2f\" % (hours, minutes, seconds))\n return self._finalize(rv)", "metadata": "root.Test.__call__", "header": "['class', 'Test', '(', 'object', ')', ':', '___EOS___']", "index": 173 }, { "content": " def assertRaises(self, exception, method, args=None, kwargs=None, msg=None):\n \"\"\"Assert that a method and the given args will raise the given\n exception.\n\n Args:\n exception: The exception class the method should raise.\n method: the method to call with the given arguments.\n args: a tuple of positional arguments.\n kwargs: a dictionary of keyword arguments\n msg: optional message string to be used if assertion fails.\n \"\"\"\n args = args or ()\n kwargs = kwargs or {}\n try:\n rv = method(*args, **kwargs)\n except exception:\n return\n # it might raise another exception, which is marked INCOMPLETE\n raise TestFailError, msg or \"%r did not raise %r.\" % (method, exception)", "metadata": "root.Test.assertRaises", "header": "['class', 'Test', '(', 'object', ')', ':', '___EOS___']", "index": 653 }, { "content": " def _run_tests(self):\n for i, entry in enumerate(self._tests):\n if self._debug < 2 and not self.check_prerequisites(entry, i):\n continue\n # Add a note to the logfile to delimit test cases there.\n if self.config.flags.VERBOSE:\n self.config.logfile.note(\"%s: %r\" % (timelib.localtimestamp(), entry))\n try:\n rv = entry.run()\n except KeyboardInterrupt:\n if self._nested:\n raise TestSuiteAbort(\"Sub-suite aborted by user.\")\n else:\n if self.config.UI.yes_no(\"Test interrupted. Abort suite?\"):\n self.info(\"Test suite aborted by user.\")\n break\n except TestSuiteAbort, err:\n self.info(\"Suite aborted by test %s (%s).\" % (entry.test_name, err))\n entry.result = TestResult(constants.INCOMPLETE)\n rv = constants.ABORT\n break\n # This should only happen with an incorrectly written execute() method.\n if rv is None:\n self.report.diagnostic(\n \"warning: test returned None, assuming INCOMPLETE. \"\n \"Please fix the %s.execute() method.\" % (entry.test_name))\n rv = constants.INCOMPLETE\n # check for abort condition and break the loop if so\n if rv == constants.ABORT:\n break", "metadata": "root.TestSuite._run_tests", "header": "['class', 'TestSuite', '(', 'object', ')', ':', '___EOS___']", "index": 1271 } ]
[ { "span": "rv ", "start_line": 211, "start_column": 12, "end_line": 211, "end_column": 14 }, { "span": "tb ", "start_line": 216, "start_column": 16, "end_line": 216, "end_column": 18 }, { "span": "tb ", "start_line": 222, "start_column": 16, "end_line": 222, "end_column": 18 }, { "span": "rv ", "start_line": 667, "start_column": 12, "end_line": 667, "end_column": 14 }, { "span": "rv ", "start_line": 1290, "start_column": 16, "end_line": 1290, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test_", "(_", "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_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Invok", "e", " ", "the", " ", "test", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "test", " ", "is", " ", "\"", "kick", "ed", "-", "off", "\"", " ", "by", " ", "calling", " ", "this", ".", " ", "Any", " ", "argu", "ment", "s", " ", "are", " ", "pass", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "test", " ", "implementation", " ", "(", "`", "execute", "`", " ", "method", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "._", "register", "\\u", "testcase_", "(_", "self_", "._", "test\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "report_", "._", "add", "\\u", "heading_", "(_", "self_", "._", "test\\u", "name_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "or_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "report_", "._", "add", "\\u", "message_", "(_", "\"", "TEST", "ARGUMENT", "S", "\"_", ",_", "repr", "\\u", "args_", "(_", "args_", ",_", "kwargs_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "starttime_", "=_", "timeli", "b_", "._", "now_", "(_", ")_", "#", " ", "saved", " ", "startt", "ime", " ", "in", " ", "case", " ", "initializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "need", "s", " ", "to", " ", "create", " ", "the", " ", "log", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "ela", "pse", "d", " ", "time", " ", "doe", "s", " ", "not", " ", "include", " ", "initializer", " ", "time", "._", "\\u\\u\\uNL\\u\\u\\u_", "tests", "tart", "time_", "=_", "timeli", "b_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "run", " ", "the", " ", "execute", "()", " ", "method", " ", "and", " ", "check", " ", "for", " ", "exception", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "execute_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", ",_", "val_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debugger_", "._", "post", "\\u", "mort", "em_", "(_", "tb_", ",_", "ex_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rv_", "=_", "self_", "._", "incomplete", "_", "(_", "\"%", "s", ":", " ", "abort", "ed", " ", "by", " ", "user", ".\"_", "%_", "self_", "._", "test\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "finalize_", "(_", "rv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Test", "Fail", "Error_", ",_", "err", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "failed_", "(_", "\"", "Cau", "ght", " ", "Fail", " ", "exception", ":", " ", "%", "s", "\"_", "%_", "(_", "err", "val_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Test", "Incomp", "lete", "Error_", ",_", "err", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "incomplete", "_", "(_", "\"", "Cau", "ght", " ", "incomplete", " ", "exception", ":", " ", "%", "s", "\"_", "%_", "(_", "err", "val_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "asserts", " ", "and", " ", "validation", " ", "error", "s", " ", "are", " ", "based", " ", "on", " ", "this", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assert", "ion", "Error_", "as_", "err", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "failed_", "(_", "\"", "fail", "ed", " ", "assertion", ":", " ", "%", "s", "\"_", "%_", "(_", "err", "val_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Test", "Suit", "e", "Abort_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "._", "register", "\\u", "testcase_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "#", " ", "pass", " ", "this", " ", "one", " ", "up", " ", "to", " ", "suite_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "debugger_", "._", "Debugger", "Quit_", ":_", "#", " ", "set\\u", "trace", " ", "\"", "leak", "s", "\"", " ", "Bd", "b", "Quit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "incomplete", "_", "(_", "\"%", "s", ":", " ", "Debugger", " ", "exit", ".\"_", "%_", "(_", "self_", "._", "test\\u", "name_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Error_", "as_", "cer", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "incomplete", "_", "(_", "\"", "Configura", "tion", " ", "error", ":", " ", "{}\"_", "._", "format_", "(_", "cer", "r_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "._", "register", "\\u", "testcase_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", ",_", "val_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debugger_", "._", "post", "\\u", "mort", "em_", "(_", "tb_", ",_", "ex_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Test", "Suit", "e", "Abort_", "(_", "cer", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", ",_", "val_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debugger_", "._", "post", "\\u", "mort", "em_", "(_", "tb_", ",_", "ex_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rv_", "=_", "self_", "._", "incomplete", "_", "(_", "\"%", "s", ":", " ", "Except", "ion", ":", " ", "(%", "s", ":", " ", "%", "s", ")\"_", "%_", "(_", "self_", "._", "test\\u", "name_", ",_", "ex_", ",_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endtime_", "=_", "timeli", "b_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "._", "register", "\\u", "testcase_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "report_", "._", "add", "\\u", "message_", "(_", "\"", "START", "TIME", "\"_", ",_", "tests", "tart", "time_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "report_", "._", "add", "\\u", "message_", "(_", "\"", "END", "TIME", "\"_", ",_", "endtime_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "minutes_", ",_", "seconds_", "=_", "divmod_", "(_", "endtime_", "-_", "tests", "tart", "time_", ",_", "60.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hours_", ",_", "minutes_", "=_", "divmod_", "(_", "minutes_", ",_", "60.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info_", "(_", "\"", "Time", " ", "ela", "pse", "d", ":", " ", "%", "02", ".0", "f", ":", "%", "02", ".0", "f", ":", "%", "02", ".2", "f", "\"_", "%_", "(_", "hours_", ",_", "minutes_", ",_", "seconds_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "finalize_", "(_", "rv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test_", "(_", "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_", "assert", "Raises_", "(_", "self_", ",_", "exception_", ",_", "method_", ",_", "args_", "=_", "None_", ",_", "kwargs_", "=_", "None_", ",_", "msg_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Assert", " ", "tha", "t", " ", "a", " ", "method", " ", "and", " ", "the", " ", "give", "n", " ", "args", " ", "will", " ", "raise", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "exception", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "exception", ":", " ", "The", " ", "exception", " ", "class", " ", "the", " ", "method", " ", "shou", "ld", " ", "raise", ".", "\\", "10", ";", " ", " ", " ", " ", "method", ":", " ", " ", " ", " ", "the", " ", "method", " ", "to", " ", "call", " ", "with", " ", "the", " ", "give", "n", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "a", " ", "tuple", " ", "of", " ", "positional", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", " ", "a", " ", "dictionar", "y", " ", "of", " ", "keyw", "ord", " ", "argu", "ment", "s", "\\", "10", ";", " ", " ", " ", " ", "msg", ":", " ", "option", "al", " ", "message", " ", "string", " ", "to", " ", "be", " ", "used", " ", "if", " ", "assertion", " ", "fail", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "args_", "or_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "kwargs_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "method_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", " ", "mig", "ht", " ", "raise", " ", "anot", "her", " ", "exception", ",", " ", "whi", "ch", " ", "is", " ", "marked", " ", "INCOM", "PLE", "TE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Test", "Fail", "Error_", ",_", "msg_", "or_", "\"%", "r", " ", "did", " ", "not", " ", "raise", " ", "%", "r", ".\"_", "%_", "(_", "method_", ",_", "exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Suite_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "tests_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "entry_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "tests_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "debug_", "<_", "2_", "and_", "not_", "self_", "._", "check", "\\u", "prerequisite", "s_", "(_", "entry_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "a", " ", "note", " ", "to", " ", "the", " ", "logfile", " ", "to", " ", "delim", "it", " ", "test", " ", "case", "s", " ", "there", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "config_", "._", "flags_", "._", "VERBOSE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "._", "logfile_", "._", "note_", "(_", "\"%", "s", ":", " ", "%", "r", "\"_", "%_", "(_", "timeli", "b_", "._", "localt", "imes", "tamp", "_", "(_", ")_", ",_", "entry_", ")_", ")_", "\\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 ", " _", "rv_", "=_", "entry_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "nested_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Test", "Suit", "e", "Abort_", "(_", "\"", "Sub", "-", "suit", "e", " ", "abort", "ed", " ", "by", " ", "user", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "config_", "._", "UI_", "._", "ye", "s", "\\u", "no_", "(_", "\"", "Test", " ", "interrupted", ".", " ", "Abo", "rt", " ", "suit", "e", "?\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "info_", "(_", "\"", "Test", " ", "suit", "e", " ", "abort", "ed", " ", "by", " ", "user", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Test", "Suit", "e", "Abort_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "(_", "\"", "Suit", "e", " ", "abort", "ed", " ", "by", " ", "test", " ", "%", "s", " ", "(%", "s", ").\"_", "%_", "(_", "entry_", "._", "test\\u", "name_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry_", "._", "result_", "=_", "Test", "Result_", "(_", "constants_", "._", "INCOM", "PLE", "TE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rv_", "=_", "constants_", "._", "ABORT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "only", " ", "happ", "en", " ", "with", " ", "an", " ", "incorrect", "ly", " ", "writt", "en", " ", "execute", "()", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rv_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report_", "._", "diagnostic", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "warn", "ing", ":", " ", "test", " ", "return", "ed", " ", "Non", "e", ",", " ", "ass", "umi", "ng", " ", "INCOM", "PLE", "TE", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ple", "ase", " ", "fix", " ", "the", " ", "%", "s", ".", "execute", "()", " ", "method", ".\"_", "%_", "(_", "entry_", "._", "test\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rv_", "=_", "constants_", "._", "INCOM", "PLE", "TE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "abort", " ", "condition", " ", "and", " ", "break", " ", "the", " ", "loop", " ", "if", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rv_", "==_", "constants_", "._", "ABORT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\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,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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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
samuel/python-bert/bert/__init__.py
[ { "content": "\n\"\"\"BERT-RPC Library\"\"\"\n\nfrom bert.codec import BERTDecoder, BERTEncoder\nfrom erlastic import Atom\n\nencode = BERTEncoder().encode\ndecode = BERTDecoder().decode\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from erlastic import Atom", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "BER", "T", "-", "RP", "C", " ", "Libr", "ary", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bert", "_", "._", "codec_", "import_", "BER", "TD", "ecode", "r_", ",_", "BER", "TE", "ncode", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "erl", "asti", "c_", "import_", "Atom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "encode_", "=_", "BER", "TE", "ncode", "r_", "(_", ")_", "._", "encode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decode_", "=_", "BER", "TD", "ecode", "r_", "(_", ")_", "._", "decode_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
PythonCharmers/python-future/tests/test_future/test_pasteurize.py
[ { "content": " def test_urllib_refactor2(self):\n before = \"\"\"\n import urllib.request, urllib.parse\n\n f = urllib.request.urlopen(url, timeout=15)\n filename = urllib.parse.urlparse(url)[2].split('/')[-1]\n \"\"\"\n\n after = \"\"\"\n from future.standard_library.urllib import request as urllib_request\n from future.standard_library.urllib import parse as urllib_parse\n\n f = urllib_request.urlopen(url, timeout=15)\n filename = urllib_parse.urlparse(url)[2].split('/')[-1]\n \"\"\"", "metadata": "root.TestPasteurize.test_urllib_refactor2", "header": "['class', 'TestPasteurize', '(', 'CodeHandler', ')', ':', '___EOS___']", "index": 124 } ]
[ { "span": "before ", "start_line": 125, "start_column": 8, "end_line": 125, "end_column": 14 }, { "span": "after ", "start_line": 132, "start_column": 8, "end_line": 132, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Past", "eur", "ize_", "(_", "Code", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "url", "lib", "\\u", "refactor", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "before_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "url", "lib", ".", "request", ",", " ", "url", "lib", ".", "parse", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "f", " ", "=", " ", "url", "lib", ".", "request", ".", "urlo", "pen", "(", "url", ",", " ", "timeo", "ut", "=", "15", ")", "\\", "10", ";", " ", " ", " ", " ", "filename", " ", "=", " ", "url", "lib", ".", "parse", ".", "urlpa", "rse", "(", "url", ")[", "2", "].", "split", "('", "/'", ")[", "-1", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "after_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "future", ".", "standard", "\\u", "librar", "y", ".", "url", "lib", " ", "import", " ", "request", " ", "as", " ", "url", "lib", "\\u", "request", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "future", ".", "standard", "\\u", "librar", "y", ".", "url", "lib", " ", "import", " ", "parse", " ", "as", " ", "url", "lib", "\\u", "parse", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "f", " ", "=", " ", "url", "lib", "\\u", "request", ".", "urlo", "pen", "(", "url", ",", " ", "timeo", "ut", "=", "15", ")", "\\", "10", ";", " ", " ", " ", " ", "filename", " ", "=", " ", "url", "lib", "\\u", "parse", ".", "urlpa", "rse", "(", "url", ")[", "2", "].", "split", "('", "/'", ")[", "-1", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
hgascon/pulsar/pulsar/core/lens.py
[ { "content": " def create_message(self, previousTemplates, previousFields, next_template):\n \"\"\" Craft a message according to previous templates\n and new selected template.\n \"\"\"\n transition = self.generateTransitionLabel(previousTemplates,\n next_template)\n # we fill the ids according to neg. index\n # in the transitions, for instance:\n # 23;12;15\n # -3 -2 -1\n # so \"-1\" is the current message, -2 the previous message and so on.\n fields = dict(zip([str(ind) for ind in range(-len(previousFields)-1,\n -1)], previousFields))\n # Find rules matching current transition\n if transition not in self.rules:\n if not next_template.has_fields():\n current_rules = []\n else:\n return (None, None, None)\n else:\n current_rules = self.rules[transition]\n # Find new fields content according to rules\n dst_fields = {}\n # this is a bit sick... model.py generates the rules in the right\n # sequence, such that all fields in the current message are already\n #filled, if their values are referenced by rules; i.e. we can just\n #add a reference to dst_fields as the \"-1\" (=current) fields\n fields[\"-1\"] = dst_fields\n for rule in current_rules:\n src_id = rule.src_id\n dst = rule.dst_field\n src = rule.src_field\n if rule.typ == \"rule.ExactRule\":\n dst_fields[dst] = fields[src_id][src]\n continue\n if rule.typ == \"rule.DataRule\":\n dst_fields[dst] = random.choice(rule.data[5:].split(\",\"))\n continue\n if rule.typ == \"rule.CopyCompleteRule\":\n # Copy the exact content of a field \n if rule.data[6:20] == \"COPY_AS_PREFIX\":\n dst_fields[dst] = fields[src_id][src]+random.choice(rule.data[26:].split(\",\"))\n else:\n dst_fields[dst] = random.choice(rule.data[26:].split(\",\"))+fields[src_id][src]\n continue\n if rule.typ == \"rule.CopyPartialRule\":\n # Copy the front or back part of a field splitted\n # by a separator s\n split_data = fields[src_id][src].split(rule.data[26:], 1)\n if rule.data[6:20] == \"COPY_THE_PREFIX\":\n if len(split_data) == 2:\n dst_fields[dst] = split_data[0]\n else:\n # we could not split the data with the seperator...\n # ... so we cannot enter anything at this point\n dst_fields[dst] = \"\"\n else:\n if len(split_data) == 2:\n dst_fields[dst] = split_data[1]\n else:\n # we could not split the data with the seperator...\n # ... so we cannot enter anything at this point\n dst_fields[dst] = \"\"\n continue\n if rule.typ == \"rule.SeqRule\":\n try:\n dst_fields[dst] = int(fields[src_id][src])+int(rule.data[5:])\n except:\n dst_fields[dst] = 0\n continue\n\n # Fill new template fields with new content\n message = next_template.fillFields(dst_fields)\n fields = dst_fields.items()\n fields.sort(key=operator.itemgetter(0))\n msg = urllib.unquote(''.join(str(n) for n in message))\n return (msg, [f[1] for f in fields], transition)", "metadata": "root.RuleList.create_message", "header": "['class', 'RuleList', ':', '___EOS___']", "index": 559 }, { "content": " def create_fuzzed_message(self, previousTemplates, previousFields,\n next_template, fuzzer):\n \"\"\" Craft a fuzzed message according to previous templates\n and new selected template or a forced transition if a similarity\n based transition has been triggered.\n \"\"\"\n try:\n transition = self.generateTransitionLabel(previousTemplates,\n next_template)\n except:\n transition = None\n\n fields = dict(zip([str(ind) for ind in range(-len(previousFields)-1,\n -1)], previousFields))\n\n template_rules = [r for t, r in self.rules.items() if t.endswith(next_template.ID)]\n rules = [item for sublist in template_rules for item in sublist]\n dst_fields = {}\n fields[\"-1\"] = dst_fields\n fuzz_fields = fuzzer.get_fuzz_fields(next_template.ID)\n non_fuzzed_values = []\n\n for rule in rules:\n src_id = rule.src_id\n dst = rule.dst_field\n src = rule.src_field\n if rule.typ == \"rule.ExactRule\":\n try:\n data = fields[src_id][src]\n except:\n data = \"\"\n dst_fields[dst] = fuzzer.fuzz(rule, data, fuzz_fields)\n continue\n if rule.typ == \"rule.DataRule\":\n try:\n data = random.choice(rule.data[5:].split(\",\"))\n except:\n data = \"\"\n dst_fields[dst] = fuzzer.fuzz(rule, data, fuzz_fields)\n continue\n if rule.typ == \"rule.CopyCompleteRule\":\n try:\n if rule.data[6:20] == \"COPY_AS_PREFIX\":\n data = fields[src_id][src]+random.choice(rule.data[26:].split(\",\"))\n else:\n data = random.choice(rule.data[26:].split(\",\"))+fields[src_id][src]\n except:\n data = \"\"\n dst_fields[dst] = fuzzer.fuzz(rule, data, fuzz_fields)\n continue\n if rule.typ == \"rule.CopyPartialRule\":\n try:\n split_data = fields[src_id][src].split(rule.data[26:], 1)\n if rule.data[6:20] == \"COPY_THE_PREFIX\":\n if len(split_data) == 2:\n data = split_data[0]\n else:\n # we could not split the data with the seperator...\n # ... so we cannot enter anything at this point\n data = \"\"\n else:\n if len(split_data) == 2:\n data = split_data[1]\n else:\n # we could not split the data with the seperator...\n # ... so we cannot enter anything at this point\n data = \"\"\n except:\n data = \"\"\n dst_fields[dst] = fuzzer.fuzz(rule, data, fuzz_fields)\n continue\n if rule.typ == \"rule.SeqRule\":\n try:\n data = int(fields[src_id][src])+int(rule.data[5:])\n except:\n data = 0\n dst_fields[dst] = fuzzer.fuzz(rule, data, fuzz_fields)\n continue\n\n #save original not fuzzed values for the log trace\n if dst_fields[dst] == data:\n non_fuzzed_values += [data]\n\n # Fill new template fields with new content\n message = next_template.fillFields(dst_fields)\n fields = dst_fields.items()\n fields.sort(key=operator.itemgetter(0))\n\n #update tracker\n fuzzer.update_tracker(next_template.ID)\n fuzzer.trace = list(fuzz_fields), non_fuzzed_values\n print \"fields_to_fuzz: \", fuzz_fields\n print \">>> FUZZING msg...\"\n\n return (urllib.unquote(''.join(str(n) for n in message)),\n [f[1] for f in fields], transition)", "metadata": "root.RuleList.create_fuzzed_message", "header": "['class', 'RuleList', ':', '___EOS___']", "index": 637 } ]
[ { "span": "except:", "start_line": 626, "start_column": 16, "end_line": 626, "end_column": 23 }, { "span": "except:", "start_line": 646, "start_column": 8, "end_line": 646, "end_column": 15 }, { "span": "except:", "start_line": 666, "start_column": 16, "end_line": 666, "end_column": 23 }, { "span": "except:", "start_line": 673, "start_column": 16, "end_line": 673, "end_column": 23 }, { "span": "except:", "start_line": 683, "start_column": 16, "end_line": 683, "end_column": 23 }, { "span": "except:", "start_line": 704, "start_column": 16, "end_line": 704, "end_column": 23 }, { "span": "except:", "start_line": 711, "start_column": 16, "end_line": 711, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Rule", "List_", ":_", "\\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_", "create", "\\u", "message_", "(_", "self_", ",_", "previ", "ous", "Templates_", ",_", "previ", "ous", "Fields_", ",_", "next", "\\u", "template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Cra", "ft", " ", "a", " ", "message", " ", "according", " ", "to", " ", "previ", "ous", " ", "template", "s", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "new", " ", "selecte", "d", " ", "template", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transition_", "=_", "self_", "._", "generat", "e", "Transiti", "on", "Label_", "(_", "previ", "ous", "Templates_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "fill", " ", "the", " ", "ids", " ", "according", " ", "to", " ", "neg", ".", " ", "index_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "transiti", "ons", ",", " ", "for", " ", "instance", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "23", ";", "1", "2", ";", "15_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "3", " ", "-", "2", " ", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "\"-", "1", "\"", " ", "is", " ", "the", " ", "current", " ", "message", ",", " ", "-", "2", " ", "the", " ", "previ", "ous", " ", "message", " ", "and", " ", "so", " ", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "dict_", "(_", "zip_", "(_", "[_", "str_", "(_", "ind_", ")_", "for_", "ind_", "in_", "range_", "(_", "-_", "len_", "(_", "previ", "ous", "Fields_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1_", ")_", "]_", ",_", "previ", "ous", "Fields_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fin", "d", " ", "rule", "s", " ", "matchi", "ng", " ", "current", " ", "transition_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "transition_", "not_", "in_", "self_", "._", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "next", "\\u", "template_", "._", "has", "\\u", "fields_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "rules_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", "\\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 ", " _", "current", "\\u", "rules_", "=_", "self_", "._", "rules_", "[_", "transition_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fin", "d", " ", "new", " ", "fields", " ", "content", " ", "according", " ", "to", " ", "rules_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dst", "\\u", "fields_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "a", " ", "bit", " ", "sick", "...", " ", "model", ".", "py", " ", "generat", "es", " ", "the", " ", "rule", "s", " ", "in", " ", "the", " ", "right_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sequence", ",", " ", "suc", "h", " ", "tha", "t", " ", "all", " ", "fields", " ", "in", " ", "the", " ", "current", " ", "message", " ", "are", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filled", ",", " ", "if", " ", "thei", "r", " ", "values", " ", "are", " ", "referenced", " ", "by", " ", "rule", "s", ";", " ", "i", ".", "e", ".", " ", "we", " ", "can", " ", "just", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", " ", "a", " ", "reference", " ", "to", " ", "dst", "\\u", "fields", " ", "as", " ", "the", " ", "\"-", "1", "\"", " ", "(", "=", "current", ")", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "[_", "\"-", "1", "\"_", "]_", "=_", "dst", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rule_", "in_", "current", "\\u", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "\\u", "id_", "=_", "rule_", "._", "src", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst_", "=_", "rule_", "._", "dst", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "rule_", "._", "src", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rule_", "._", "typ_", "==_", "\"", "rule", ".", "Exa", "ct", "Rule", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "fields_", "[_", "src", "\\u", "id_", "]_", "[_", "src_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule_", "._", "typ_", "==_", "\"", "rule", ".", "Data", "Rule", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "random_", "._", "choice_", "(_", "rule_", "._", "data_", "[_", "5_", ":_", "]_", "._", "split_", "(_", "\",\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule_", "._", "typ_", "==_", "\"", "rule", ".", "Copy", "Complete", "Rule", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "the", " ", "exact", " ", "content", " ", "of", " ", "a", " ", "field", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "rule_", "._", "data_", "[_", "6_", ":_", "20_", "]_", "==_", "\"", "COPY", "\\u", "AS", "\\u", "PREF", "IX", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "fields_", "[_", "src", "\\u", "id_", "]_", "[_", "src_", "]_", "+_", "random_", "._", "choice_", "(_", "rule_", "._", "data_", "[_", "26_", ":_", "]_", "._", "split_", "(_", "\",\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "random_", "._", "choice_", "(_", "rule_", "._", "data_", "[_", "26_", ":_", "]_", "._", "split_", "(_", "\",\"_", ")_", ")_", "+_", "fields_", "[_", "src", "\\u", "id_", "]_", "[_", "src_", "]_", "\\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_", "rule_", "._", "typ_", "==_", "\"", "rule", ".", "Copy", "Parti", "al", "Rule", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "the", " ", "front", " ", "or", " ", "back", " ", "part", " ", "of", " ", "a", " ", "field", " ", "splitted_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "a", " ", "separator", " ", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "split", "\\u", "data_", "=_", "fields_", "[_", "src", "\\u", "id_", "]_", "[_", "src_", "]_", "._", "split_", "(_", "rule_", "._", "data_", "[_", "26_", ":_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rule_", "._", "data_", "[_", "6_", ":_", "20_", "]_", "==_", "\"", "COPY", "\\u", "THE", "\\u", "PREF", "IX", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "len_", "(_", "split", "\\u", "data_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "split", "\\u", "data_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "coul", "d", " ", "not", " ", "split", " ", "the", " ", "data", " ", "with", " ", "the", " ", "seperat", "or", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", " ", "so", " ", "we", " ", "cann", "ot", " ", "enter", " ", "anyt", "hing", " ", "at", " ", "this", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "len_", "(_", "split", "\\u", "data_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "split", "\\u", "data_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "coul", "d", " ", "not", " ", "split", " ", "the", " ", "data", " ", "with", " ", "the", " ", "seperat", "or", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", " ", "so", " ", "we", " ", "cann", "ot", " ", "enter", " ", "anyt", "hing", " ", "at", " ", "this", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule_", "._", "typ_", "==_", "\"", "rule", ".", "Seq", "Rule", "\"_", ":_", "\\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 ", " ", "_", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "int_", "(_", "fields_", "[_", "src", "\\u", "id_", "]_", "[_", "src_", "]_", ")_", "+_", "int_", "(_", "rule_", "._", "data_", "[_", "5_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fil", "l", " ", "new", " ", "template", " ", "fields", " ", "with", " ", "new", " ", "content_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "next", "\\u", "template_", "._", "fill", "Fields_", "(_", "dst", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "dst", "\\u", "fields_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "._", "sort_", "(_", "key_", "=_", "operator_", "._", "itemgetter_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "urllib_", "._", "unquote_", "(_", "''_", "._", "join_", "(_", "str_", "(_", "n_", ")_", "for_", "n_", "in_", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "msg_", ",_", "[_", "f_", "[_", "1_", "]_", "for_", "f_", "in_", "fields_", "]_", ",_", "transition_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rule", "List_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "fuzz", "ed", "\\u", "message_", "(_", "self_", ",_", "previ", "ous", "Templates_", ",_", "previ", "ous", "Fields_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "template_", ",_", "fuzzer", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Cra", "ft", " ", "a", " ", "fuzz", "ed", " ", "message", " ", "according", " ", "to", " ", "previ", "ous", " ", "template", "s", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "new", " ", "selecte", "d", " ", "template", " ", "or", " ", "a", " ", "forced", " ", "transiti", "on", " ", "if", " ", "a", " ", "similar", "it", "y", "\\", "10", ";", " ", " ", " ", " ", "based", " ", "transiti", "on", " ", "has", " ", "bee", "n", " ", "trigger", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transition_", "=_", "self_", "._", "generat", "e", "Transiti", "on", "Label_", "(_", "previ", "ous", "Templates_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "template_", ")_", "\\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 ", " _", "transition_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fields_", "=_", "dict_", "(_", "zip_", "(_", "[_", "str_", "(_", "ind_", ")_", "for_", "ind_", "in_", "range_", "(_", "-_", "len_", "(_", "previ", "ous", "Fields_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1_", ")_", "]_", ",_", "previ", "ous", "Fields_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "rules_", "=_", "[_", "r_", "for_", "t_", ",_", "r_", "in_", "self_", "._", "rules_", "._", "items_", "(_", ")_", "if_", "t_", "._", "endswith_", "(_", "next", "\\u", "template_", "._", "ID_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rules_", "=_", "[_", "item_", "for_", "sublist_", "in_", "template", "\\u", "rules_", "for_", "item_", "in_", "sublist_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst", "\\u", "fields_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "[_", "\"-", "1", "\"_", "]_", "=_", "dst", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fuzz", "\\u", "fields_", "=_", "fuzzer", "_", "._", "get", "\\u", "fuzz", "\\u", "fields_", "(_", "next", "\\u", "template_", "._", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "non", "\\u", "fuzz", "ed", "\\u", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rule_", "in_", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "\\u", "id_", "=_", "rule_", "._", "src", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst_", "=_", "rule_", "._", "dst", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "rule_", "._", "src", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rule_", "._", "typ_", "==_", "\"", "rule", ".", "Exa", "ct", "Rule", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "fields_", "[_", "src", "\\u", "id_", "]_", "[_", "src_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "fuzzer", "_", "._", "fuzz", "_", "(_", "rule_", ",_", "data_", ",_", "fuzz", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule_", "._", "typ_", "==_", "\"", "rule", ".", "Data", "Rule", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "random_", "._", "choice_", "(_", "rule_", "._", "data_", "[_", "5_", ":_", "]_", "._", "split_", "(_", "\",\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "fuzzer", "_", "._", "fuzz", "_", "(_", "rule_", ",_", "data_", ",_", "fuzz", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule_", "._", "typ_", "==_", "\"", "rule", ".", "Copy", "Complete", "Rule", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "rule_", "._", "data_", "[_", "6_", ":_", "20_", "]_", "==_", "\"", "COPY", "\\u", "AS", "\\u", "PREF", "IX", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "fields_", "[_", "src", "\\u", "id_", "]_", "[_", "src_", "]_", "+_", "random_", "._", "choice_", "(_", "rule_", "._", "data_", "[_", "26_", ":_", "]_", "._", "split_", "(_", "\",\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "random_", "._", "choice_", "(_", "rule_", "._", "data_", "[_", "26_", ":_", "]_", "._", "split_", "(_", "\",\"_", ")_", ")_", "+_", "fields_", "[_", "src", "\\u", "id_", "]_", "[_", "src_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "fuzzer", "_", "._", "fuzz", "_", "(_", "rule_", ",_", "data_", ",_", "fuzz", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule_", "._", "typ_", "==_", "\"", "rule", ".", "Copy", "Parti", "al", "Rule", "\"_", ":_", "\\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 ", " ", "_", "split", "\\u", "data_", "=_", "fields_", "[_", "src", "\\u", "id_", "]_", "[_", "src_", "]_", "._", "split_", "(_", "rule_", "._", "data_", "[_", "26_", ":_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rule_", "._", "data_", "[_", "6_", ":_", "20_", "]_", "==_", "\"", "COPY", "\\u", "THE", "\\u", "PREF", "IX", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "len_", "(_", "split", "\\u", "data_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "split", "\\u", "data_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "coul", "d", " ", "not", " ", "split", " ", "the", " ", "data", " ", "with", " ", "the", " ", "seperat", "or", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", " ", "so", " ", "we", " ", "cann", "ot", " ", "enter", " ", "anyt", "hing", " ", "at", " ", "this", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "len_", "(_", "split", "\\u", "data_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "split", "\\u", "data_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "coul", "d", " ", "not", " ", "split", " ", "the", " ", "data", " ", "with", " ", "the", " ", "seperat", "or", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", " ", "so", " ", "we", " ", "cann", "ot", " ", "enter", " ", "anyt", "hing", " ", "at", " ", "this", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "fuzzer", "_", "._", "fuzz", "_", "(_", "rule_", ",_", "data_", ",_", "fuzz", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule_", "._", "typ_", "==_", "\"", "rule", ".", "Seq", "Rule", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "int_", "(_", "fields_", "[_", "src", "\\u", "id_", "]_", "[_", "src_", "]_", ")_", "+_", "int_", "(_", "rule_", "._", "data_", "[_", "5_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dst", "\\u", "fields_", "[_", "dst_", "]_", "=_", "fuzzer", "_", "._", "fuzz", "_", "(_", "rule_", ",_", "data_", ",_", "fuzz", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "save", " ", "original", " ", "not", " ", "fuzz", "ed", " ", "values", " ", "for", " ", "the", " ", "log", " ", "trace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dst", "\\u", "fields_", "[_", "dst_", "]_", "==_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "non", "\\u", "fuzz", "ed", "\\u", "values_", "+=_", "[_", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fil", "l", " ", "new", " ", "template", " ", "fields", " ", "with", " ", "new", " ", "content_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "next", "\\u", "template_", "._", "fill", "Fields_", "(_", "dst", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "dst", "\\u", "fields_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "._", "sort_", "(_", "key_", "=_", "operator_", "._", "itemgetter_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "update", " ", "tracker_", "\\u\\u\\uNL\\u\\u\\u_", "fuzzer", "_", "._", "update", "\\u", "tracker_", "(_", "next", "\\u", "template_", "._", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fuzzer", "_", "._", "trace_", "=_", "list_", "(_", "fuzz", "\\u", "fields_", ")_", ",_", "non", "\\u", "fuzz", "ed", "\\u", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "fields", "\\u", "to", "\\u", "fuzz", ":", " ", "\"_", ",_", "fuzz", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\">>>", " ", "FU", "ZZ", "ING", " ", "msg", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "urllib_", "._", "unquote_", "(_", "''_", "._", "join_", "(_", "str_", "(_", "n_", ")_", "for_", "n_", "in_", "message_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "f_", "[_", "1_", "]_", "for_", "f_", "in_", "fields_", "]_", ",_", "transition_", ")_", "\\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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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 ]
Imprecise assert
caktus/django-timepiece/timepiece/reports/tests/test_payroll.py
[ { "content": " def testMonthlyPayrollLabels(self):\n \"\"\"\n Labels should contain all billable & nonbillable project type labels\n as well as all leave project names.\n \"\"\"\n self._setupMonthlyTotals()\n self.assertEquals(\n self.labels['billable'], [self.billable_project.type.label])\n self.assertEquals(\n self.labels['nonbillable'], [self.nonbillable_project.type.label])\n self.assertEquals(len(self.labels['leave']), 2)\n self.assertTrue(self.sick.name in self.labels['leave'])\n self.assertTrue(self.vacation.name in self.labels['leave'])", "metadata": "root.PayrollTest.testMonthlyPayrollLabels", "header": "['class', 'PayrollTest', '(', 'ViewTestMixin', ',', 'LogTimeMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 191 } ]
[ { "span": "self.assertTrue(self.sick.name in self.labels['leave'])", "start_line": 202, "start_column": 8, "end_line": 202, "end_column": 63 }, { "span": "self.assertTrue(self.vacation.name in self.labels['leave'])", "start_line": 203, "start_column": 8, "end_line": 203, "end_column": 67 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Pay", "roll", "Test_", "(_", "View", "Test", "Mixin_", ",_", "Log", "Time", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mont", "hl", "y", "Pay", "roll", "Labels_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Label", "s", " ", "shou", "ld", " ", "contain", " ", "all", " ", "bill", "able", " ", "&", " ", "nonb", "illa", "ble", " ", "project", " ", "type", " ", "labels", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "well", " ", "as", " ", "all", " ", "lea", "ve", " ", "project", " ", "names", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "setup", "Mont", "hl", "y", "Total", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "labels_", "[_", "'", "bill", "able", "'_", "]_", ",_", "[_", "self_", "._", "bill", "able", "\\u", "project_", "._", "type_", "._", "label_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "labels_", "[_", "'", "nonb", "illa", "ble", "'_", "]_", ",_", "[_", "self_", "._", "nonb", "illa", "ble", "\\u", "project_", "._", "type_", "._", "label_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "self_", "._", "labels_", "[_", "'", "lea", "ve", "'_", "]_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "sick", "_", "._", "name_", "in_", "self_", "._", "labels_", "[_", "'", "lea", "ve", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "vaca", "tion_", "._", "name_", "in_", "self_", "._", "labels_", "[_", "'", "lea", "ve", "'_", "]_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unreachable code
automl/RoBO/robo/models/gaussian_process.py
[ { "content": " def get_noise(self):\n # Assumes a kernel of the form amp * (kernel1 + noise_kernel)\n # FIXME: How to determine the noise of george gp in general?\n return self.yerr\n assert self.kernel.k2.k2.kernel_type == 1\n return self.kernel.k2.k2.pars[0]", "metadata": "root.GaussianProcess.get_noise", "header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']", "index": 104 } ]
[ { "span": "assert self.kernel.k2.k2.kernel_type == 1", "start_line": 108, "start_column": 8, "end_line": 108, "end_column": 49 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Gaussian", "Process_", "(_", "Base", "Model_", ")_", ":_", "\\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", "noise_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", "s", " ", "a", " ", "kernel", " ", "of", " ", "the", " ", "form", " ", "amp", " ", "*", " ", "(", "kernel", "1", " ", "+", " ", "noise", "\\u", "kernel", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "Ho", "w", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "noise", " ", "of", " ", "geor", "ge", " ", "gp", " ", "in", " ", "genera", "l", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "yerr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "kernel_", "._", "k2_", "._", "k2_", "._", "kernel", "\\u", "type_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "kernel_", "._", "k2_", "._", "k2_", "._", "pars_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]